Tokenizer(simplifyNot): replace "if" by "else if" and added braces.

No functional change.
This commit is contained in:
Slava Semushin 2009-08-29 20:11:47 +07:00
parent b5c6d7ba49
commit 0582572867
1 changed files with 8 additions and 2 deletions

View File

@ -2833,11 +2833,17 @@ bool Tokenizer::simplifyNot()
for (Token *tok = _tokens; tok; tok = tok->next()) for (Token *tok = _tokens; tok; tok = tok->next())
{ {
if (Token::Match(tok, "if|while ( not %var%")) if (Token::Match(tok, "if|while ( not %var%"))
{
tok->tokAt(2)->str("!"); tok->tokAt(2)->str("!");
if (Token::Match(tok, "&& not %var%")) }
else if (Token::Match(tok, "&& not %var%"))
{
tok->next()->str("!"); tok->next()->str("!");
if (Token::Match(tok, "|| not %var%")) }
else if (Token::Match(tok, "|| not %var%"))
{
tok->next()->str("!"); tok->next()->str("!");
}
} }
return ret; return ret;
} }