Reverted some changes in commits 4b05c3e19f
and 4b08b13845
.
This commit is contained in:
parent
4b05c3e19f
commit
40739eb3fb
|
@ -4167,9 +4167,8 @@ bool Tokenizer::simplifyIfAddBraces()
|
|||
}
|
||||
|
||||
else if (tok->str() == "else") {
|
||||
const Token *tok2 = tok->next();
|
||||
// An else followed by an if or brace don't need to be processed further
|
||||
if (tok2 && (tok2->str() == "if" || tok2->str() == "{"))
|
||||
if (Token::Match(tok, "else if|{"))
|
||||
continue;
|
||||
}
|
||||
|
||||
|
@ -4214,17 +4213,12 @@ bool Tokenizer::simplifyIfAddBraces()
|
|||
break;
|
||||
}
|
||||
tempToken = tempToken->link();
|
||||
const Token *tempToken1 = tempToken->next();
|
||||
if (!tempToken1)
|
||||
if (!tempToken || !tempToken->next())
|
||||
break;
|
||||
if (tempToken1->isName()) {
|
||||
if (tempToken1->str() == "else") {
|
||||
tempToken1 = tempToken1->next();
|
||||
if (!tempToken1 || (tempToken1->str() != "if" && tempToken1->str() != "{"))
|
||||
if (Token::simpleMatch(tempToken, "} else") && !Token::Match(tempToken->tokAt(2), "if|{"))
|
||||
innerIf = false;
|
||||
} else
|
||||
else if (tempToken->next()->isName() && tempToken->next()->str() != "else")
|
||||
break;
|
||||
}
|
||||
continue;
|
||||
}
|
||||
|
||||
|
@ -4243,12 +4237,11 @@ bool Tokenizer::simplifyIfAddBraces()
|
|||
if (!innerIf)
|
||||
break;
|
||||
|
||||
const Token *tempToken1 = tempToken->next();
|
||||
if (tempToken1 && tempToken1->str() == "else") {
|
||||
tempToken1 = tempToken1->next();
|
||||
if (!tempToken1 || tempToken1->str() != "if")
|
||||
if (Token::simpleMatch(tempToken, "; else if"))
|
||||
;
|
||||
else if (Token::simpleMatch(tempToken, "; else"))
|
||||
innerIf = false;
|
||||
} else
|
||||
else
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue