[PATCH] D25911: [clang-move] Support moving template class forward declarations.

Haojian Wu via cfe-commits cfe-commits at lists.llvm.org
Mon Oct 24 09:08:44 PDT 2016


hokein updated this revision to Diff 75595.
hokein added a comment.

Don't mess up with other patches.


https://reviews.llvm.org/D25911

Files:
  clang-tidy/performance/UnnecessaryCopyInitialization.cpp
  test/clang-tidy/performance-unnecessary-copy-initialization.cpp


Index: test/clang-tidy/performance-unnecessary-copy-initialization.cpp
===================================================================
--- test/clang-tidy/performance-unnecessary-copy-initialization.cpp
+++ test/clang-tidy/performance-unnecessary-copy-initialization.cpp
@@ -368,3 +368,22 @@
   // CHECK-MESSAGES: [[@LINE-1]]:23: warning: local copy 'copy' of the variable 'orig' is never modified; consider avoiding the copy [performance-unnecessary-copy-initialization]
   // CHECK-FIXES: ExpensiveToCopyType copy = orig, copy2;
 }
+
+class Element {};
+class Container {
+public:
+  class Iterator {
+  public:
+    void operator++();
+    Element operator*();
+    bool operator!=(const Iterator &);
+    WeirdCopyCtorType c;
+  };
+  const Iterator &begin() const;
+  const Iterator &end() const;
+};
+
+void implicitVarFalsePositive() {
+  for (const Element &E : Container()) {
+  }
+}
Index: clang-tidy/performance/UnnecessaryCopyInitialization.cpp
===================================================================
--- clang-tidy/performance/UnnecessaryCopyInitialization.cpp
+++ clang-tidy/performance/UnnecessaryCopyInitialization.cpp
@@ -57,6 +57,7 @@
                    declStmt(
                        has(varDecl(hasLocalStorage(),
                                    hasType(matchers::isExpensiveToCopy()),
+                                   unless(isImplicit()),
                                    hasInitializer(
                                        cxxConstructExpr(
                                            hasDeclaration(cxxConstructorDecl(


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D25911.75595.patch
Type: text/x-patch
Size: 1577 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20161024/372c4599/attachment.bin>


More information about the cfe-commits mailing list