[PATCH] D87540: [clang-tidy] Fix false positive issue in performance-unnecessary-value-param for arguments being moved in the function body.

Sukraat Ahluwalia via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Sep 11 13:19:30 PDT 2020


sukraat91 updated this revision to Diff 291322.
sukraat91 added a comment.

Changed the case for the first character in variable `paramName` from lowercase to uppercase, to pass pre-merge checks.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D87540/new/

https://reviews.llvm.org/D87540

Files:
  clang-tools-extra/clang-tidy/performance/UnnecessaryValueParamCheck.cpp


Index: clang-tools-extra/clang-tidy/performance/UnnecessaryValueParamCheck.cpp
===================================================================
--- clang-tools-extra/clang-tidy/performance/UnnecessaryValueParamCheck.cpp
+++ clang-tools-extra/clang-tidy/performance/UnnecessaryValueParamCheck.cpp
@@ -74,15 +74,15 @@
   // lead to an assertion failure when using hasName(std::string) being used
   // in the matcher below. If empty then exit indicating no move calls present
   // for the function argument being examined.
-  const auto paramName = Param.getName();
+  const auto ParamName = Param.getName();
 
-  if (paramName.empty()) {
+  if (ParamName.empty()) {
     return false;
   }
   auto Matches = match(
       callExpr(
           callee(functionDecl(hasName("::std::move"))), argumentCountIs(1),
-          hasArgument(0, declRefExpr(to(parmVarDecl(hasName(paramName)))))),
+          hasArgument(0, declRefExpr(to(parmVarDecl(hasName(ParamName)))))),
       Context);
 
   return !Matches.empty();


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D87540.291322.patch
Type: text/x-patch
Size: 1015 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20200911/42b7c0f8/attachment.bin>


More information about the cfe-commits mailing list