[PATCH] D26751: [clang-tidy] Ignore template instantiations in modernize-use-equals-delete check

2016-11-17 Thread Malcolm Parsons via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL287221: [clang-tidy] Ignore template instantiations in 
modernize-use-equals-delete check (authored by malcolm.parsons).

Changed prior to commit:
  https://reviews.llvm.org/D26751?vs=78202=78344#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D26751

Files:
  clang-tools-extra/trunk/clang-tidy/modernize/UseEqualsDeleteCheck.cpp
  clang-tools-extra/trunk/test/clang-tidy/modernize-use-equals-delete.cpp


Index: clang-tools-extra/trunk/test/clang-tidy/modernize-use-equals-delete.cpp
===
--- clang-tools-extra/trunk/test/clang-tidy/modernize-use-equals-delete.cpp
+++ clang-tools-extra/trunk/test/clang-tidy/modernize-use-equals-delete.cpp
@@ -22,6 +22,32 @@
   // CHECK-FIXES: ~PositivePrivate() = delete;
 };
 
+template
+struct PositivePrivateTemplate {
+private:
+  PositivePrivateTemplate();
+  // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: use '= delete' to prohibit 
calling of a special member function [modernize-use-equals-delete]
+  // CHECK-FIXES: PositivePrivateTemplate() = delete;
+  PositivePrivateTemplate(const PositivePrivateTemplate &);
+  // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: use '= delete' to prohibit 
calling of a special member function [modernize-use-equals-delete]
+  // CHECK-FIXES: PositivePrivateTemplate(const PositivePrivateTemplate &) = 
delete;
+  PositivePrivateTemplate =(const PositivePrivateTemplate &);
+  // CHECK-MESSAGES: :[[@LINE-1]]:28: warning: use '= delete' to prohibit 
calling of a special member function [modernize-use-equals-delete]
+  // CHECK-FIXES: PositivePrivateTemplate =(const 
PositivePrivateTemplate &) = delete;
+  PositivePrivateTemplate(PositivePrivateTemplate &&);
+  // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: use '= delete' to prohibit 
calling of a special member function [modernize-use-equals-delete]
+  // CHECK-FIXES: PositivePrivateTemplate(PositivePrivateTemplate &&) = delete;
+  PositivePrivateTemplate =(PositivePrivateTemplate &&);
+  // CHECK-MESSAGES: :[[@LINE-1]]:28: warning: use '= delete' to prohibit 
calling of a special member function [modernize-use-equals-delete]
+  // CHECK-FIXES: PositivePrivateTemplate =(PositivePrivateTemplate 
&&) = delete;
+  ~PositivePrivateTemplate();
+  // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: use '= delete' to prohibit 
calling of a special member function [modernize-use-equals-delete]
+  // CHECK-FIXES: ~PositivePrivateTemplate() = delete;
+};
+
+template struct PositivePrivateTemplate;
+template struct PositivePrivateTemplate;
+
 struct NegativePublic {
   NegativePublic(const NegativePublic &);
 };
Index: clang-tools-extra/trunk/clang-tidy/modernize/UseEqualsDeleteCheck.cpp
===
--- clang-tools-extra/trunk/clang-tidy/modernize/UseEqualsDeleteCheck.cpp
+++ clang-tools-extra/trunk/clang-tidy/modernize/UseEqualsDeleteCheck.cpp
@@ -34,6 +34,7 @@
   cxxMethodDecl(
   PrivateSpecialFn,
   unless(anyOf(hasBody(stmt()), isDefaulted(), isDeleted(),
+   ast_matchers::isTemplateInstantiation(),
// Ensure that all methods except private special member
// functions are defined.
hasParent(cxxRecordDecl(hasMethod(unless(


Index: clang-tools-extra/trunk/test/clang-tidy/modernize-use-equals-delete.cpp
===
--- clang-tools-extra/trunk/test/clang-tidy/modernize-use-equals-delete.cpp
+++ clang-tools-extra/trunk/test/clang-tidy/modernize-use-equals-delete.cpp
@@ -22,6 +22,32 @@
   // CHECK-FIXES: ~PositivePrivate() = delete;
 };
 
+template
+struct PositivePrivateTemplate {
+private:
+  PositivePrivateTemplate();
+  // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: use '= delete' to prohibit calling of a special member function [modernize-use-equals-delete]
+  // CHECK-FIXES: PositivePrivateTemplate() = delete;
+  PositivePrivateTemplate(const PositivePrivateTemplate &);
+  // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: use '= delete' to prohibit calling of a special member function [modernize-use-equals-delete]
+  // CHECK-FIXES: PositivePrivateTemplate(const PositivePrivateTemplate &) = delete;
+  PositivePrivateTemplate =(const PositivePrivateTemplate &);
+  // CHECK-MESSAGES: :[[@LINE-1]]:28: warning: use '= delete' to prohibit calling of a special member function [modernize-use-equals-delete]
+  // CHECK-FIXES: PositivePrivateTemplate =(const PositivePrivateTemplate &) = delete;
+  PositivePrivateTemplate(PositivePrivateTemplate &&);
+  // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: use '= delete' to prohibit calling of a special member function [modernize-use-equals-delete]
+  // CHECK-FIXES: PositivePrivateTemplate(PositivePrivateTemplate &&) = delete;
+  PositivePrivateTemplate =(PositivePrivateTemplate &&);
+  // CHECK-MESSAGES: 

[PATCH] D26751: [clang-tidy] Ignore template instantiations in modernize-use-equals-delete check

2016-11-17 Thread Malcolm Parsons via cfe-commits
malcolm.parsons added inline comments.



Comment at: clang-tidy/modernize/UseEqualsDeleteCheck.cpp:37
   unless(anyOf(hasBody(stmt()), isDefaulted(), isDeleted(),
+   ast_matchers::isTemplateInstantiation(),
// Ensure that all methods except private special member

hokein wrote:
> Can we remove `ast_matchers::`?
No, there's a collision with 
`isTemplateInstantiation(TemplateSpecializationKind Kind)`.


https://reviews.llvm.org/D26751



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D26751: [clang-tidy] Ignore template instantiations in modernize-use-equals-delete check

2016-11-17 Thread Haojian Wu via cfe-commits
hokein accepted this revision.
hokein added a reviewer: hokein.
hokein added a comment.
This revision is now accepted and ready to land.

LGTM, thanks.




Comment at: clang-tidy/modernize/UseEqualsDeleteCheck.cpp:37
   unless(anyOf(hasBody(stmt()), isDefaulted(), isDeleted(),
+   ast_matchers::isTemplateInstantiation(),
// Ensure that all methods except private special member

Can we remove `ast_matchers::`?


https://reviews.llvm.org/D26751



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits