[PATCH] D19849: [clang-tidy] MoveConstructorInitCheck - Add parameter name to check message.
Felix Berger via cfe-commits
cfe-commits at lists.llvm.org
Mon May 2 18:57:48 PDT 2016
flx created this revision.
flx added a reviewer: alexfh.
flx added a subscriber: cfe-commits.
flx set the repository for this revision to rL LLVM.
Repository:
rL LLVM
http://reviews.llvm.org/D19849
Files:
clang-tidy/misc/MoveConstructorInitCheck.cpp
test/clang-tidy/misc-move-constructor-init.cpp
Index: test/clang-tidy/misc-move-constructor-init.cpp
===================================================================
--- test/clang-tidy/misc-move-constructor-init.cpp
+++ test/clang-tidy/misc-move-constructor-init.cpp
@@ -96,7 +96,7 @@
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_;
};
Index: clang-tidy/misc/MoveConstructorInitCheck.cpp
===================================================================
--- clang-tidy/misc/MoveConstructorInitCheck.cpp
+++ clang-tidy/misc/MoveConstructorInitCheck.cpp
@@ -109,8 +109,9 @@
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->getName();
DiagOut << FixItHint::CreateReplacement(
InitArg->getSourceRange(),
(Twine("std::move(") + MovableParam->getName() + ")").str());
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D19849.55935.patch
Type: text/x-patch
Size: 1404 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20160503/02654b1b/attachment.bin>
More information about the cfe-commits
mailing list