Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

astutils.cpp: perform lighter checks first in isMutableExpression() #6623

Merged
merged 1 commit into from
Jul 21, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading