Skip to content

Commit

Permalink
[clang-tidy] MoveConstructorInitCheck - Add parameter name to check m…
Browse files Browse the repository at this point in the history
…essage.

Reviewers: alexfh

Subscribers: aaron.ballman, cfe-commits

Differential Revision: http://reviews.llvm.org/D19849

llvm-svn: 268461
  • Loading branch information
Felix Berger committed May 3, 2016
1 parent af09f4a commit 99a0ddd
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
Expand Up @@ -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());
Expand Down
Expand Up @@ -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_;
};
Expand Down

0 comments on commit 99a0ddd

Please sign in to comment.