Skip to content

Commit 0890a09

Browse files
committed
valueflow.cpp: avoid unnecessary copies in valueFlowInferCondition()
1 parent 234e25f commit 0890a09

1 file changed

Lines changed: 2 additions & 3 deletions

File tree

lib/valueflow.cpp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5148,7 +5148,7 @@ static void valueFlowInferCondition(TokenList& tokenlist, const Settings& settin
51485148
for (const ValuePtr<InferModel>& model : iteratorModels) {
51495149
std::vector<ValueFlow::Value> result =
51505150
infer(model, tok->str(), tok->astOperand1()->values(), tok->astOperand2()->values());
5151-
for (ValueFlow::Value value : result) {
5151+
for (ValueFlow::Value& value : result) {
51525152
value.valueType = ValueFlow::Value::ValueType::INT;
51535153
setTokenValue(tok, std::move(value), settings);
51545154
}
@@ -5166,8 +5166,7 @@ static void valueFlowInferCondition(TokenList& tokenlist, const Settings& settin
51665166
std::vector<ValueFlow::Value> result = infer(makeIntegralInferModel(), "!=", tok->values(), 0);
51675167
if (result.size() != 1)
51685168
continue;
5169-
ValueFlow::Value value = result.front();
5170-
setTokenValue(tok, std::move(value), settings);
5169+
setTokenValue(tok, std::move(result.front()), settings);
51715170
}
51725171
}
51735172
}

0 commit comments

Comments
 (0)