Skip to content

Commit

Permalink
fixed some COPY_INSTEAD_OF_MOVE Coverity warnings (#6532)
Browse files Browse the repository at this point in the history
  • Loading branch information
firewave authored Jun 17, 2024
1 parent 750b914 commit f4d3a44
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion lib/checkother.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2589,7 +2589,7 @@ void CheckOther::checkDuplicateExpression()
followVar,
&errorPath) &&
isWithoutSideEffects(tok->astOperand2()))
duplicateExpressionError(tok->astOperand2(), tok->astOperand1()->astOperand2(), tok, errorPath);
duplicateExpressionError(tok->astOperand2(), tok->astOperand1()->astOperand2(), tok, std::move(errorPath));
else if (tok->astOperand2() && isConstExpression(tok->astOperand1(), mSettings->library)) {
auto checkDuplicate = [&](const Token* exp1, const Token* exp2, const Token* ast1) {
if (isSameExpression(true, exp1, exp2, *mSettings, true, true, &errorPath) &&
Expand Down
2 changes: 1 addition & 1 deletion lib/cppcheck.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1629,7 +1629,7 @@ void CppCheck::reportErr(const ErrorMessage &msg)

if (!remark.empty()) {
ErrorMessage msg2(msg);
msg2.remark = remark;
msg2.remark = std::move(remark);
mErrorLogger.reportErr(msg2);
} else {
mErrorLogger.reportErr(msg);
Expand Down
2 changes: 1 addition & 1 deletion lib/preprocessor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ static std::string getRelativeFilename(const simplecpp::Token* tok, const Settin
}
}
}
return Path::simplifyPath(relativeFilename);
return Path::simplifyPath(std::move(relativeFilename));
}

static void addInlineSuppressions(const simplecpp::TokenList &tokens, const Settings &settings, SuppressionList &suppressions, std::list<BadInlineSuppression> &bad)
Expand Down
4 changes: 2 additions & 2 deletions lib/valueflow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8020,7 +8020,7 @@ static void valueFlowContainerSize(const TokenList& tokenlist,
ValueFlow::Value value(Token::getStrLength(containerTok->tokAt(2)));
value.valueType = ValueFlow::Value::ValueType::CONTAINER_SIZE;
value.setKnown();
valueFlowForward(containerTok->next(), containerTok, value, tokenlist, errorLogger, settings);
valueFlowForward(containerTok->next(), containerTok, std::move(value), tokenlist, errorLogger, settings);
}
} else if (Token::Match(tok->previous(), ">|return (|{") && astIsContainer(tok) && getLibraryContainer(tok)->size_templateArgNo < 0) {
std::vector<ValueFlow::Value> values;
Expand Down Expand Up @@ -8084,7 +8084,7 @@ static void valueFlowContainerSize(const TokenList& tokenlist,
Token* next = nextAfterAstRightmostLeaf(tok);
if (!next)
next = tok->next();
valueFlowForward(next, containerTok, value, tokenlist, errorLogger, settings);
valueFlowForward(next, containerTok, std::move(value), tokenlist, errorLogger, settings);
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion lib/vf_settokenvalue.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -445,7 +445,7 @@ namespace ValueFlow
else if (astIsPointer(tok) && Token::Match(parent, "+|-") &&
(parent->astOperand2() == nullptr || !astIsPointer(parent->astOperand2())) &&
value.isIntValue() && value.isImpossible() && value.intvalue == 0) {
setTokenValue(parent, value, settings);
setTokenValue(parent, std::move(value), settings);
}

// Calculations..
Expand Down

0 comments on commit f4d3a44

Please sign in to comment.