diff --git a/lib/valueflow.cpp b/lib/valueflow.cpp index 405dc3202..66a77c488 100644 --- a/lib/valueflow.cpp +++ b/lib/valueflow.cpp @@ -1545,10 +1545,10 @@ static bool evalAssignment(ValueFlow::Value &lhsValue, const std::string &assign static bool isEscapeScope(const Token* tok, TokenList * tokenlist) { - if(!Token::simpleMatch(tok, "{")) + if (!Token::simpleMatch(tok, "{")) return false; return Token::findmatch(tok, "return|continue|break|throw|goto", tok->link()) || - (tokenlist && tokenlist->getSettings()->library.isScopeNoReturn(tok->link(), nullptr)); + (tokenlist && tokenlist->getSettings()->library.isScopeNoReturn(tok->link(), nullptr)); } static bool valueFlowForward(Token * const startToken, @@ -1867,7 +1867,7 @@ static bool valueFlowForward(Token * const startToken, if ((!read || number_of_if == 0) && Token::simpleMatch(tok2, "if (") && !(Token::simpleMatch(end, "} else {") && - isEscapeScope(end->tokAt(2), tokenlist))) { + isEscapeScope(end->tokAt(2), tokenlist))) { ++number_of_if; tok2 = end; } else { diff --git a/test/testvalueflow.cpp b/test/testvalueflow.cpp index b6b3d3f66..1532e3942 100644 --- a/test/testvalueflow.cpp +++ b/test/testvalueflow.cpp @@ -1584,20 +1584,20 @@ private: ASSERT_EQUALS(false, testValueOfX(code, 9U, 0)); code = "void f(int i) {\n" - " bool x = false;\n" - " if (i == 0) { x = true; }\n" - " else if (x && i == 1) {}\n" - "}\n"; + " bool x = false;\n" + " if (i == 0) { x = true; }\n" + " else if (x && i == 1) {}\n" + "}\n"; ASSERT_EQUALS(true, testValueOfX(code, 4U, 0)); code = "void f(int i) {\n" - " bool x = false;\n" - " while(i > 0) {\n" - " i++;\n" - " if (i == 0) { x = true; }\n" - " else if (x && i == 1) {}\n" - " }\n" - "}\n"; + " bool x = false;\n" + " while(i > 0) {\n" + " i++;\n" + " if (i == 0) { x = true; }\n" + " else if (x && i == 1) {}\n" + " }\n" + "}\n"; ASSERT_EQUALS(false, testValueOfX(code, 6U, 0)); // multivariables