From 277f59e5df3be5f80825bc433b23442029dce80b Mon Sep 17 00:00:00 2001 From: firewave Date: Thu, 1 Aug 2024 00:34:21 +0200 Subject: [PATCH] ProgramMemory: avoid unnecessary copy in `Executor::executeImpl()` --- lib/programmemory.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/programmemory.cpp b/lib/programmemory.cpp index 6cd0c55de30c..aa98ad3dc37c 100644 --- a/lib/programmemory.cpp +++ b/lib/programmemory.cpp @@ -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();