Skip to content

Commit

Permalink
programmemory.cpp: avoid some unnecessary copies in `Executor::execut…
Browse files Browse the repository at this point in the history
…eImpl()` (#6700)
  • Loading branch information
firewave committed Aug 16, 2024
1 parent 601156b commit f5af7c6
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions lib/programmemory.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1529,13 +1529,13 @@ namespace {
std::vector<ValueFlow::Value> result =
infer(ValueFlow::makeIntegralInferModel(), expr->str(), expr->astOperand1()->values(), {std::move(rhs)});
if (!result.empty() && result.front().isKnown())
return result.front();
return std::move(result.front());
}
if (lhs.isIntValue() && !expr->astOperand2()->values().empty()) {
std::vector<ValueFlow::Value> result =
infer(ValueFlow::makeIntegralInferModel(), expr->str(), {std::move(lhs)}, expr->astOperand2()->values());
if (!result.empty() && result.front().isKnown())
return result.front();
return std::move(result.front());
}
return unknown();
}
Expand Down Expand Up @@ -1613,7 +1613,7 @@ namespace {
ex.fdepth--;
auto r = ex.execute(f->functionScope);
if (!r.empty())
result = r.front();
result = std::move(r.front());
// TODO: Track values changed by reference
}
} else {
Expand Down

0 comments on commit f5af7c6

Please sign in to comment.