Skip to content

Commit d8f8fa4

Browse files
authored
fixed even more COPY_INSTEAD_OF_MOVE Coverity warnings (#5977)
1 parent 554dccd commit d8f8fa4

3 files changed

Lines changed: 8 additions & 8 deletions

File tree

lib/checkother.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2535,7 +2535,7 @@ void CheckOther::checkDuplicateExpression()
25352535
&errorPath) &&
25362536
!Token::Match(tok, "=|-|-=|/|/=") &&
25372537
isWithoutSideEffects(cpp, tok->astOperand1())) {
2538-
oppositeExpressionError(tok, errorPath);
2538+
oppositeExpressionError(tok, std::move(errorPath));
25392539
} else if (!Token::Match(tok, "[-/%]")) { // These operators are not associative
25402540
if (styleEnabled && tok->astOperand2() && tok->str() == tok->astOperand1()->str() &&
25412541
isSameExpression(cpp,

lib/settings.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -560,7 +560,7 @@ void Settings::setMisraRuleTexts(const ExecuteCmdFn& executeCommand)
560560
else
561561
arg = "--misra-c-2012-rule-texts";
562562
std::string output;
563-
executeCommand(it->executable, {arg}, "2>&1", output);
563+
executeCommand(it->executable, {std::move(arg)}, "2>&1", output);
564564
setMisraRuleTexts(output);
565565
}
566566
}
@@ -579,7 +579,7 @@ void Settings::setMisraRuleTexts(const std::string& data)
579579
std::string text = line.substr(pos + 1);
580580
if (id.empty() || text.empty())
581581
continue;
582-
mMisraRuleTexts[id] = text;
582+
mMisraRuleTexts[id] = std::move(text);
583583
}
584584
}
585585

lib/valueflow.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -771,7 +771,7 @@ static void setTokenValue(Token* tok,
771771
}
772772

773773
else if (parent->str() == ":") {
774-
setTokenValue(parent,value,settings);
774+
setTokenValue(parent,std::move(value),settings);
775775
}
776776

777777
else if (parent->str() == "?" && tok->str() == ":" && tok == parent->astOperand2() && parent->astOperand1()) {
@@ -1619,7 +1619,7 @@ static void valueFlowArrayElement(TokenList& tokenlist, const Settings& settings
16191619
const std::string s = arrayValue.tokvalue->strValue();
16201620
if (index == s.size()) {
16211621
result.intvalue = 0;
1622-
setTokenValue(tok, result, settings);
1622+
setTokenValue(tok, std::move(result), settings);
16231623
} else if (index >= 0 && index < s.size()) {
16241624
result.intvalue = s[index];
16251625
setTokenValue(tok, std::move(result), settings);
@@ -4009,7 +4009,7 @@ static void valueFlowForwardLifetime(Token * tok, TokenList &tokenlist, ErrorLog
40094009
const Token* parentLifetime =
40104010
getParentLifetime(tokenlist.isCPP(), parent->astOperand1()->astOperand2(), &settings.library);
40114011
if (parentLifetime && parentLifetime->exprId() > 0) {
4012-
valueFlowForward(nextExpression, endOfVarScope, parentLifetime, values, tokenlist, errorLogger, settings);
4012+
valueFlowForward(nextExpression, endOfVarScope, parentLifetime, std::move(values), tokenlist, errorLogger, settings);
40134013
}
40144014
}
40154015
}
@@ -8472,7 +8472,7 @@ static void valueFlowSmartPointer(TokenList &tokenlist, ErrorLogger * errorLogge
84728472
if (Token::simpleMatch(ftok, "( )")) {
84738473
ValueFlow::Value v(0);
84748474
v.setKnown();
8475-
valueFlowForwardAssign(ftok, tok, vars, {std::move(v)}, false, tokenlist, errorLogger, settings);
8475+
valueFlowForwardAssign(ftok, tok, std::move(vars), {std::move(v)}, false, tokenlist, errorLogger, settings);
84768476
} else {
84778477
tok->removeValues(std::mem_fn(&ValueFlow::Value::isIntValue));
84788478
Token* inTok = ftok->astOperand2();
@@ -8927,7 +8927,7 @@ static void valueFlowContainerSize(TokenList& tokenlist,
89278927
ValueFlow::Value value(0);
89288928
value.valueType = ValueFlow::Value::ValueType::CONTAINER_SIZE;
89298929
value.setImpossible();
8930-
valueFlowForward(tok->linkAt(2), containerTok, value, tokenlist, errorLogger, settings);
8930+
valueFlowForward(tok->linkAt(2), containerTok, std::move(value), tokenlist, errorLogger, settings);
89318931
}
89328932
} else if (Token::simpleMatch(tok, "+=") && astIsContainer(tok->astOperand1())) {
89338933
const Token* containerTok = tok->astOperand1();

0 commit comments

Comments
 (0)