[clang-tools-extra] r268461 - [clang-tidy] MoveConstructorInitCheck - Add parameter name to check message.

Felix Berger via cfe-commits cfe-commits at lists.llvm.org
Tue May 3 16:07:44 PDT 2016


Author: flx
Date: Tue May  3 18:07:44 2016
New Revision: 268461

URL: http://llvm.org/viewvc/llvm-project?rev=268461&view=rev
Log:
[clang-tidy] MoveConstructorInitCheck - Add parameter name to check message.

Reviewers: alexfh

Subscribers: aaron.ballman, cfe-commits

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

Modified:
    clang-tools-extra/trunk/clang-tidy/misc/MoveConstructorInitCheck.cpp
    clang-tools-extra/trunk/test/clang-tidy/misc-move-constructor-init.cpp

Modified: clang-tools-extra/trunk/clang-tidy/misc/MoveConstructorInitCheck.cpp
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/misc/MoveConstructorInitCheck.cpp?rev=268461&r1=268460&r2=268461&view=diff
==============================================================================
--- clang-tools-extra/trunk/clang-tidy/misc/MoveConstructorInitCheck.cpp (original)
+++ clang-tools-extra/trunk/clang-tidy/misc/MoveConstructorInitCheck.cpp Tue May  3 18:07:44 2016
@@ -109,8 +109,9 @@ void MoveConstructorInitCheck::handlePar
   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());

Modified: clang-tools-extra/trunk/test/clang-tidy/misc-move-constructor-init.cpp
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/test/clang-tidy/misc-move-constructor-init.cpp?rev=268461&r1=268460&r2=268461&view=diff
==============================================================================
--- clang-tools-extra/trunk/test/clang-tidy/misc-move-constructor-init.cpp (original)
+++ clang-tools-extra/trunk/test/clang-tidy/misc-move-constructor-init.cpp Tue May  3 18:07:44 2016
@@ -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_;
 };




More information about the cfe-commits mailing list