diff --git a/lib/checkautovariables.cpp b/lib/checkautovariables.cpp index 649a17835..529debfcc 100644 --- a/lib/checkautovariables.cpp +++ b/lib/checkautovariables.cpp @@ -484,7 +484,7 @@ static bool isDanglingSubFunction(const Token* tokvalue, const Token* tok) if (!f) return false; const Token* parent = tokvalue->astParent(); - while(parent && !Token::Match(parent->previous(), "%name% (")) { + while (parent && !Token::Match(parent->previous(), "%name% (")) { parent = parent->astParent(); } if (!Token::simpleMatch(parent, "(")) diff --git a/lib/symboldatabase.h b/lib/symboldatabase.h index 39658f51e..7485883ac 100644 --- a/lib/symboldatabase.h +++ b/lib/symboldatabase.h @@ -1040,8 +1040,9 @@ public: return false; } - static Function* nestedInFunction(const Scope* scope) { - while(scope) { + static Function* nestedInFunction(const Scope* scope) + { + while (scope) { if (scope->type == Scope::eFunction) break; scope = scope->nestedIn; diff --git a/test/testautovariables.cpp b/test/testautovariables.cpp index 7d2bcf09b..14a641b3d 100644 --- a/test/testautovariables.cpp +++ b/test/testautovariables.cpp @@ -2170,7 +2170,7 @@ private: ASSERT_EQUALS( "[test.cpp:8] -> [test.cpp:8] -> [test.cpp:4] -> [test.cpp:7] -> [test.cpp:4]: (error) Non-local variable 'v' will use object that points to local variable 'i'.\n", errout.str()); - + check("struct A {\n" " std::vector v;\n" " void add(int* i) {\n"