change some Token::Match patterns used in code:

replace '||' with '%oror%', where possible.
This commit is contained in:
Edoardo Prezioso 2012-11-07 02:17:48 +01:00
parent aa2ad41629
commit 1c0617c504
2 changed files with 2 additions and 2 deletions

View File

@ -816,7 +816,7 @@ bool TemplateSimplifier::simplifyCalculations(Token *_tokens)
if (tok->isNumber()) {
// Remove redundant conditions (0&&x) (1||x)
if (Token::Match(tok->previous(), "[(=,] 0 &&") ||
Token::Match(tok->previous(), "[(=,] 1 ||")) {
Token::Match(tok->previous(), "[(=,] 1 %oror%")) {
unsigned int par = 0;
const Token *tok2 = tok;
for (; tok2; tok2 = tok2->next()) {

View File

@ -5653,7 +5653,7 @@ bool Tokenizer::simplifyLogicalOperators()
} else if (Token::Match(tok, "&& not|compl %var%")) {
tok->next()->str(tok->next()->str() == "not" ? "!" : "~");
ret = true;
} else if (Token::Match(tok, "|| not|compl %var%")) {
} else if (Token::Match(tok, "%oror% not|compl %var%")) {
tok->next()->str(tok->next()->str() == "not" ? "!" : "~");
ret = true;
}