From ab1bbda53a37e95035a501439d84c0a1025a39b9 Mon Sep 17 00:00:00 2001 From: firewave Date: Thu, 15 Aug 2024 12:09:08 +0200 Subject: [PATCH] programmemory.cpp: avoid some unnecessary copies in `Executor::executeImpl()` --- lib/programmemory.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/programmemory.cpp b/lib/programmemory.cpp index af86ef98318..ee52f003b5d 100644 --- a/lib/programmemory.cpp +++ b/lib/programmemory.cpp @@ -1529,13 +1529,13 @@ namespace { std::vector 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 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(); } @@ -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 {