Tokenizer: Fixed bug. When varid is 0 then %varid% doesn't work. Ticket: #2723
This commit is contained in:
parent
877a233145
commit
05f59a1567
|
@ -6234,9 +6234,10 @@ void Tokenizer::simplifyIfNotNull()
|
||||||
{
|
{
|
||||||
if (Token::Match(tok->tokAt(-2), "[;{}] %var%"))
|
if (Token::Match(tok->tokAt(-2), "[;{}] %var%"))
|
||||||
{
|
{
|
||||||
const unsigned int varid = tok->previous()->varId();
|
const std::string varname(tok->previous()->str());
|
||||||
if (Token::Match(tok, "= ( %varid% != 0 ) ;", varid) ||
|
|
||||||
Token::Match(tok, "= ( 0 != %varid% ) ;", varid))
|
if (Token::Match(tok->tokAt(2), (varname + " != 0 ) ;").c_str()) ||
|
||||||
|
Token::Match(tok->tokAt(2), ("0 != " + varname + " ) ;").c_str()))
|
||||||
{
|
{
|
||||||
tok = tok->tokAt(-2);
|
tok = tok->tokAt(-2);
|
||||||
Token::eraseTokens(tok, tok->tokAt(9));
|
Token::eraseTokens(tok, tok->tokAt(9));
|
||||||
|
|
Loading…
Reference in New Issue