[clang-tidy] MoveConstructorInitCheck - Add parameter name to check message.
Reviewers: alexfh Subscribers: aaron.ballman, cfe-commits Differential Revision: http://reviews.llvm.org/D19849 git-svn-id: https://llvm.org/svn/llvm-project/clang-tools-extra/trunk@268461 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Родитель
b9a137a3c4
Коммит
84f5259cbc
|
@ -109,8 +109,9 @@ void MoveConstructorInitCheck::handleParamNotMoved(
|
|||
if (parmVarDeclRefExprOccurences(*MovableParam, *ConstructorDecl,
|
||||
*Result.Context) > 1)
|
||||
return;
|
||||
auto DiagOut =
|
||||
diag(InitArg->getLocStart(), "value argument can be moved to avoid copy");
|
||||
auto DiagOut = diag(InitArg->getLocStart(),
|
||||
"value argument %0 can be moved to avoid copy")
|
||||
<< MovableParam;
|
||||
DiagOut << FixItHint::CreateReplacement(
|
||||
InitArg->getSourceRange(),
|
||||
(Twine("std::move(") + MovableParam->getName() + ")").str());
|
||||
|
|
|
@ -96,7 +96,7 @@ struct TriviallyCopyable {
|
|||
|
||||
struct Positive {
|
||||
Positive(Movable M) : M_(M) {}
|
||||
// CHECK-MESSAGES: [[@LINE-1]]:28: warning: value argument can be moved to avoid copy [misc-move-constructor-init]
|
||||
// CHECK-MESSAGES: [[@LINE-1]]:28: warning: value argument 'M' can be moved to avoid copy [misc-move-constructor-init]
|
||||
// CHECK-FIXES: Positive(Movable M) : M_(std::move(M)) {}
|
||||
Movable M_;
|
||||
};
|
||||
|
|
Загрузка…
Ссылка в новой задаче