Fixed #5827 (Invalid token match patterns)

This commit is contained in:
Mark de Wever 2014-05-19 06:31:38 +02:00 committed by Daniel Marjamäki
parent 20c19b85c2
commit d6db261213
2 changed files with 3 additions and 3 deletions

View File

@ -976,7 +976,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

@ -302,10 +302,10 @@ private:
void matchAny() const {
givenACodeSampleToTokenize varBitOrVar("abc|def", true);
ASSERT_EQUALS(true, Token::Match(varBitOrVar.tokens(), "%var% | %var%"));
ASSERT_EQUALS(true, Token::Match(varBitOrVar.tokens(), "%var% %or% %var%"));
givenACodeSampleToTokenize varLogOrVar("abc||def", true);
ASSERT_EQUALS(true, Token::Match(varLogOrVar.tokens(), "%var% || %var%"));
ASSERT_EQUALS(true, Token::Match(varLogOrVar.tokens(), "%var% %oror% %var%"));
}
void matchSingleChar() const {