Tokenizer: don't simplify 'a!=(b!=0)' to 'a!=b'. Ticket: #4697
This commit is contained in:
parent
54e7c8f6a2
commit
a49fc57e00
|
@ -5672,6 +5672,9 @@ void Tokenizer::simplifyIfNotNull()
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (Token::Match(tok, "==|!= ("))
|
||||||
|
tok = tok->linkAt(1);
|
||||||
|
|
||||||
if (Token::Match(tok, "(|&&|%oror%")) {
|
if (Token::Match(tok, "(|&&|%oror%")) {
|
||||||
tok = tok->next();
|
tok = tok->next();
|
||||||
|
|
||||||
|
|
|
@ -1042,6 +1042,9 @@ private:
|
||||||
ASSERT_EQUALS("( ! p )", tokenizeAndStringify("( 0UL == p )", true));
|
ASSERT_EQUALS("( ! p )", tokenizeAndStringify("( 0UL == p )", true));
|
||||||
ASSERT_EQUALS("( ! p )", tokenizeAndStringify("( 0ul == p )", true));
|
ASSERT_EQUALS("( ! p )", tokenizeAndStringify("( 0ul == p )", true));
|
||||||
ASSERT_EQUALS("( ! p )", tokenizeAndStringify("( 0l == p )", true));
|
ASSERT_EQUALS("( ! p )", tokenizeAndStringify("( 0l == p )", true));
|
||||||
|
|
||||||
|
// not pointer
|
||||||
|
ASSERT_EQUALS("( x != ( y != 0 ) )", tokenizeAndStringify("( x != ( y != 0 ) )", false));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue