[PATCH] D29018: [clang-tidy] Ignore implicit functions in performance-unnecessary-value-param

Malcolm Parsons via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Jan 23 05:29:21 PST 2017


This revision was automatically updated to reflect the committed changes.
Closed by commit rL292786: [clang-tidy] Ignore implicit functions in performance-unnecessary-value-param (authored by malcolm.parsons).

Changed prior to commit:
  https://reviews.llvm.org/D29018?vs=85358&id=85365#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D29018

Files:
  clang-tools-extra/trunk/clang-tidy/performance/UnnecessaryValueParamCheck.cpp
  clang-tools-extra/trunk/test/clang-tidy/performance-unnecessary-value-param.cpp


Index: clang-tools-extra/trunk/clang-tidy/performance/UnnecessaryValueParamCheck.cpp
===================================================================
--- clang-tools-extra/trunk/clang-tidy/performance/UnnecessaryValueParamCheck.cpp
+++ clang-tools-extra/trunk/clang-tidy/performance/UnnecessaryValueParamCheck.cpp
@@ -74,7 +74,7 @@
   Finder->addMatcher(
       functionDecl(hasBody(stmt()), isDefinition(),
                    unless(cxxMethodDecl(anyOf(isOverride(), isFinal()))),
-                   unless(isInstantiated()),
+                   unless(anyOf(isInstantiated(), isImplicit())),
                    has(typeLoc(forEach(ExpensiveValueParamDecl))),
                    decl().bind("functionDecl")),
       this);
Index: clang-tools-extra/trunk/test/clang-tidy/performance-unnecessary-value-param.cpp
===================================================================
--- clang-tools-extra/trunk/test/clang-tidy/performance-unnecessary-value-param.cpp
+++ clang-tools-extra/trunk/test/clang-tidy/performance-unnecessary-value-param.cpp
@@ -331,3 +331,20 @@
 struct NegativeFinalImpl : public NegativeDependentTypeInterface<T> {
   void Method(ExpensiveToCopyType E) final {}
 };
+
+struct PositiveConstructor {
+  PositiveConstructor(ExpensiveToCopyType E) : E(E) {}
+  // CHECK-MESSAGES: [[@LINE-1]]:43: warning: the parameter 'E' is copied
+  // CHECK-FIXES: PositiveConstructor(const ExpensiveToCopyType& E) : E(E) {}
+
+  ExpensiveToCopyType E;
+};
+
+struct NegativeUsingConstructor : public PositiveConstructor {
+  using PositiveConstructor::PositiveConstructor;
+};
+
+void fun() {
+  ExpensiveToCopyType E;
+  NegativeUsingConstructor S(E);
+}


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D29018.85365.patch
Type: text/x-patch
Size: 1671 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20170123/f5b56199/attachment-0001.bin>


More information about the cfe-commits mailing list