Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fixed some COPY_INSTEAD_OF_MOVE Coverity warnings #6532

Merged
merged 1 commit into from
Jun 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading