astyle formatting

[ci skip]
This commit is contained in:
Daniel Marjamäki 2018-07-25 23:02:16 +02:00
parent f093692551
commit c666f74755
2 changed files with 14 additions and 14 deletions

View File

@ -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 {

View File

@ -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