astyle formatting

[ci skip]
This commit is contained in:
Daniel Marjamäki 2019-09-20 15:07:27 +02:00
parent ad8abdb0c3
commit 049f6475ee
3 changed files with 25 additions and 30 deletions

View File

@ -37,20 +37,18 @@ class TokenList;
class Variable; class Variable;
namespace ValueFlow { namespace ValueFlow {
struct increment { struct increment {
template <class T> template <class T>
void operator()(T& x) const void operator()(T& x) const {
{ x++;
x++; }
} };
}; struct decrement {
struct decrement { template <class T>
template <class T> void operator()(T& x) const {
void operator()(T& x) const x--;
{ }
x--; };
}
};
class CPPCHECKLIB Value { class CPPCHECKLIB Value {
public: public:
typedef std::pair<const Token *, std::string> ErrorPathItem; typedef std::pair<const Token *, std::string> ErrorPathItem;
@ -115,8 +113,7 @@ struct decrement {
} }
template <class F> template <class F>
void visitValue(F f) void visitValue(F f) {
{
switch (valueType) { switch (valueType) {
case ValueType::INT: case ValueType::INT:
case ValueType::BUFFER_SIZE: case ValueType::BUFFER_SIZE:
@ -153,16 +150,14 @@ struct decrement {
return !(*this == rhs); return !(*this == rhs);
} }
void decreaseRange() void decreaseRange() {
{
if (bound == Bound::Lower) if (bound == Bound::Lower)
visitValue(increment{}); visitValue(increment{});
else if (bound == Bound::Upper) else if (bound == Bound::Upper)
visitValue(decrement{}); visitValue(decrement{});
} }
void invertRange() void invertRange() {
{
if (bound == Bound::Lower) if (bound == Bound::Lower)
bound = Bound::Upper; bound = Bound::Upper;
else if (bound == Bound::Upper) else if (bound == Bound::Upper)
@ -291,9 +286,13 @@ struct decrement {
return valueKind == ValueKind::Possible; return valueKind == ValueKind::Possible;
} }
bool isImpossible() const { return valueKind == ValueKind::Impossible; } bool isImpossible() const {
return valueKind == ValueKind::Impossible;
}
void setImpossible() { valueKind = ValueKind::Impossible; } void setImpossible() {
valueKind = ValueKind::Impossible;
}
void setInconclusive(bool inconclusive = true) { void setInconclusive(bool inconclusive = true) {
if (inconclusive) if (inconclusive)

View File

@ -1443,8 +1443,7 @@ private:
ASSERT_EQUALS("", errout.str()); ASSERT_EQUALS("", errout.str());
} }
void nullpointer37() void nullpointer37() {
{
check("void f(int value, char *string) {\n" check("void f(int value, char *string) {\n"
" char *ptr1 = NULL, *ptr2 = NULL;\n" " char *ptr1 = NULL, *ptr2 = NULL;\n"
" unsigned long count = 0;\n" " unsigned long count = 0;\n"
@ -1463,8 +1462,7 @@ private:
ASSERT_EQUALS("", errout.str()); ASSERT_EQUALS("", errout.str());
} }
void nullpointer38() void nullpointer38() {
{
check("void f(int * x) {\n" check("void f(int * x) {\n"
" std::vector<int*> v;\n" " std::vector<int*> v;\n"
" if (x) {\n" " if (x) {\n"
@ -2143,8 +2141,7 @@ private:
ASSERT_EQUALS("", errout.str()); ASSERT_EQUALS("", errout.str());
} }
void nullpointerSubFunction() void nullpointerSubFunction() {
{
check("void g(int* x) { *x; }\n" check("void g(int* x) { *x; }\n"
"void f(int* x) {\n" "void f(int* x) {\n"
" if (x)\n" " if (x)\n"

View File

@ -3716,8 +3716,7 @@ private:
return ""; return "";
} }
static std::string isImpossibleContainerSizeValue(const std::list<ValueFlow::Value>& values, MathLib::bigint i) static std::string isImpossibleContainerSizeValue(const std::list<ValueFlow::Value>& values, MathLib::bigint i) {
{
if (values.size() != 1) if (values.size() != 1)
return "values.size():" + std::to_string(values.size()); return "values.size():" + std::to_string(values.size());
if (!values.front().isContainerSizeValue()) if (!values.front().isContainerSizeValue())