diff --git a/lib/checkother.cpp b/lib/checkother.cpp index 8f0d7b1f52b..af2ca4ea432 100644 --- a/lib/checkother.cpp +++ b/lib/checkother.cpp @@ -2535,7 +2535,7 @@ void CheckOther::checkDuplicateExpression() &errorPath) && !Token::Match(tok, "=|-|-=|/|/=") && isWithoutSideEffects(cpp, tok->astOperand1())) { - oppositeExpressionError(tok, errorPath); + oppositeExpressionError(tok, std::move(errorPath)); } else if (!Token::Match(tok, "[-/%]")) { // These operators are not associative if (styleEnabled && tok->astOperand2() && tok->str() == tok->astOperand1()->str() && isSameExpression(cpp, diff --git a/lib/settings.cpp b/lib/settings.cpp index dd3f057c7ad..0488785edf3 100644 --- a/lib/settings.cpp +++ b/lib/settings.cpp @@ -560,7 +560,7 @@ void Settings::setMisraRuleTexts(const ExecuteCmdFn& executeCommand) else arg = "--misra-c-2012-rule-texts"; std::string output; - executeCommand(it->executable, {arg}, "2>&1", output); + executeCommand(it->executable, {std::move(arg)}, "2>&1", output); setMisraRuleTexts(output); } } @@ -579,7 +579,7 @@ void Settings::setMisraRuleTexts(const std::string& data) std::string text = line.substr(pos + 1); if (id.empty() || text.empty()) continue; - mMisraRuleTexts[id] = text; + mMisraRuleTexts[id] = std::move(text); } } diff --git a/lib/valueflow.cpp b/lib/valueflow.cpp index d50201662f6..8f9f89741c9 100644 --- a/lib/valueflow.cpp +++ b/lib/valueflow.cpp @@ -771,7 +771,7 @@ static void setTokenValue(Token* tok, } else if (parent->str() == ":") { - setTokenValue(parent,value,settings); + setTokenValue(parent,std::move(value),settings); } else if (parent->str() == "?" && tok->str() == ":" && tok == parent->astOperand2() && parent->astOperand1()) { @@ -1619,7 +1619,7 @@ static void valueFlowArrayElement(TokenList& tokenlist, const Settings& settings const std::string s = arrayValue.tokvalue->strValue(); if (index == s.size()) { result.intvalue = 0; - setTokenValue(tok, result, settings); + setTokenValue(tok, std::move(result), settings); } else if (index >= 0 && index < s.size()) { result.intvalue = s[index]; setTokenValue(tok, std::move(result), settings); @@ -4009,7 +4009,7 @@ static void valueFlowForwardLifetime(Token * tok, TokenList &tokenlist, ErrorLog const Token* parentLifetime = getParentLifetime(tokenlist.isCPP(), parent->astOperand1()->astOperand2(), &settings.library); if (parentLifetime && parentLifetime->exprId() > 0) { - valueFlowForward(nextExpression, endOfVarScope, parentLifetime, values, tokenlist, errorLogger, settings); + valueFlowForward(nextExpression, endOfVarScope, parentLifetime, std::move(values), tokenlist, errorLogger, settings); } } } @@ -8462,7 +8462,7 @@ static void valueFlowSmartPointer(TokenList &tokenlist, ErrorLogger * errorLogge if (Token::simpleMatch(ftok, "( )")) { ValueFlow::Value v(0); v.setKnown(); - valueFlowForwardAssign(ftok, tok, vars, {std::move(v)}, false, tokenlist, errorLogger, settings); + valueFlowForwardAssign(ftok, tok, std::move(vars), {std::move(v)}, false, tokenlist, errorLogger, settings); } else { tok->removeValues(std::mem_fn(&ValueFlow::Value::isIntValue)); Token* inTok = ftok->astOperand2(); @@ -8917,7 +8917,7 @@ static void valueFlowContainerSize(TokenList& tokenlist, ValueFlow::Value value(0); value.valueType = ValueFlow::Value::ValueType::CONTAINER_SIZE; value.setImpossible(); - valueFlowForward(tok->linkAt(2), containerTok, value, tokenlist, errorLogger, settings); + valueFlowForward(tok->linkAt(2), containerTok, std::move(value), tokenlist, errorLogger, settings); } } else if (Token::simpleMatch(tok, "+=") && astIsContainer(tok->astOperand1())) { const Token* containerTok = tok->astOperand1();