Skip to content

Commit

Permalink
astutils.cpp: perform lighter checks first in isMutableExpression()
Browse files Browse the repository at this point in the history
  • Loading branch information
firewave committed Jul 21, 2024
1 parent 9989419 commit 877e75d
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions lib/astutils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2447,11 +2447,11 @@ static bool isMutableExpression(const Token* tok)
return false;
if (Token::simpleMatch(tok, "[ ]"))
return false;
if (Token::Match(tok->previous(), "%name% (") && tok->previous()->isKeyword())
if (tok->previous() && tok->previous()->isKeyword() && Token::Match(tok->previous(), "%name% ("))
return false;
if (Token::Match(tok, "<|>") && tok->link())
if (tok->link() && Token::Match(tok, "<|>"))
return false;
if (Token::simpleMatch(tok, "[") && tok->astOperand1())
if (tok->astOperand1() && Token::simpleMatch(tok, "["))
return isMutableExpression(tok->astOperand1());
if (const Variable* var = tok->variable()) {
if (var->nameToken() == tok)
Expand Down

0 comments on commit 877e75d

Please sign in to comment.