Skip to content

Commit

Permalink
ProgramMemory: avoid unnecessary copy in Executor::executeImpl()
Browse files Browse the repository at this point in the history
  • Loading branch information
firewave committed Jul 31, 2024
1 parent 53e55be commit 277f59e
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion lib/programmemory.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1577,7 +1577,8 @@ namespace {
return execute(expr->astOperand1());
}
if (expr->exprId() > 0 && pm->hasValue(expr->exprId())) {
ValueFlow::Value result = pm->at(expr->exprId());
const ProgramMemory& pm2 = *pm;
ValueFlow::Value result = pm2.at(expr->exprId());
if (result.isImpossible() && result.isIntValue() && result.intvalue == 0 && isUsedAsBool(expr, *settings)) {
result.intvalue = !result.intvalue;
result.setKnown();
Expand Down

0 comments on commit 277f59e

Please sign in to comment.