Skip to content

Commit

Permalink
Update checkother.cpp
Browse files Browse the repository at this point in the history
  • Loading branch information
chrchr-github authored Apr 15, 2024
1 parent 068b0b8 commit bbe8667
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions lib/checkother.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -915,6 +915,10 @@ static bool isSimpleExpr(const Token* tok, const Variable* var, const Settings*
if (Token::Match(ftok, "%name% (") &&
((ftok->function() && ftok->function()->isConst()) || settings->library.isFunctionConst(ftok->str(), /*pure*/ true)))
needsCheck = true;
if (tok->isArithmeticalOp() &&
(!tok->astOperand1() || isSimpleExpr(tok->astOperand1(), var, settings)) &&
(!tok->astOperand2() || isSimpleExpr(tok->astOperand2(), var, settings)))
return true;
}
return (needsCheck && !findExpressionChanged(tok, tok->astParent(), var->scope()->bodyEnd, settings));
}
Expand Down

0 comments on commit bbe8667

Please sign in to comment.