From 049f6475ee6087a37c28ae64c44246c611d89261 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Marjam=C3=A4ki?= Date: Fri, 20 Sep 2019 15:07:27 +0200 Subject: [PATCH] astyle formatting [ci skip] --- lib/valueflow.h | 43 ++++++++++++++++++++-------------------- test/testnullpointer.cpp | 9 +++------ test/testvalueflow.cpp | 3 +-- 3 files changed, 25 insertions(+), 30 deletions(-) diff --git a/lib/valueflow.h b/lib/valueflow.h index 124215549..3f686bfd5 100644 --- a/lib/valueflow.h +++ b/lib/valueflow.h @@ -37,20 +37,18 @@ class TokenList; class Variable; namespace ValueFlow { -struct increment { - template - void operator()(T& x) const - { - x++; - } -}; -struct decrement { - template - void operator()(T& x) const - { - x--; - } -}; + struct increment { + template + void operator()(T& x) const { + x++; + } + }; + struct decrement { + template + void operator()(T& x) const { + x--; + } + }; class CPPCHECKLIB Value { public: typedef std::pair ErrorPathItem; @@ -115,8 +113,7 @@ struct decrement { } template - void visitValue(F f) - { + void visitValue(F f) { switch (valueType) { case ValueType::INT: case ValueType::BUFFER_SIZE: @@ -153,16 +150,14 @@ struct decrement { return !(*this == rhs); } - void decreaseRange() - { + void decreaseRange() { if (bound == Bound::Lower) visitValue(increment{}); else if (bound == Bound::Upper) visitValue(decrement{}); } - void invertRange() - { + void invertRange() { if (bound == Bound::Lower) bound = Bound::Upper; else if (bound == Bound::Upper) @@ -291,9 +286,13 @@ struct decrement { 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) { if (inconclusive) diff --git a/test/testnullpointer.cpp b/test/testnullpointer.cpp index cfcfc9ed7..7f7ab2a56 100644 --- a/test/testnullpointer.cpp +++ b/test/testnullpointer.cpp @@ -1443,8 +1443,7 @@ private: ASSERT_EQUALS("", errout.str()); } - void nullpointer37() - { + void nullpointer37() { check("void f(int value, char *string) {\n" " char *ptr1 = NULL, *ptr2 = NULL;\n" " unsigned long count = 0;\n" @@ -1463,8 +1462,7 @@ private: ASSERT_EQUALS("", errout.str()); } - void nullpointer38() - { + void nullpointer38() { check("void f(int * x) {\n" " std::vector v;\n" " if (x) {\n" @@ -2143,8 +2141,7 @@ private: ASSERT_EQUALS("", errout.str()); } - void nullpointerSubFunction() - { + void nullpointerSubFunction() { check("void g(int* x) { *x; }\n" "void f(int* x) {\n" " if (x)\n" diff --git a/test/testvalueflow.cpp b/test/testvalueflow.cpp index 8b4eedc32..a73eb1cfc 100644 --- a/test/testvalueflow.cpp +++ b/test/testvalueflow.cpp @@ -3716,8 +3716,7 @@ private: return ""; } - static std::string isImpossibleContainerSizeValue(const std::list& values, MathLib::bigint i) - { + static std::string isImpossibleContainerSizeValue(const std::list& values, MathLib::bigint i) { if (values.size() != 1) return "values.size():" + std::to_string(values.size()); if (!values.front().isContainerSizeValue())