[PATCH] D26751: [clang-tidy] Ignore template instantiations in modernize-use-equals-delete check
Malcolm Parsons via cfe-commits
cfe-commits at lists.llvm.org
Thu Nov 17 03:49:53 PST 2016
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&id=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<typename T>
+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 &operator=(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 &operator=(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 &operator=(PositivePrivateTemplate &&);
+ // CHECK-MESSAGES: :[[@LINE-1]]:28: warning: use '= delete' to prohibit calling of a special member function [modernize-use-equals-delete]
+ // CHECK-FIXES: PositivePrivateTemplate &operator=(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<int>;
+template struct PositivePrivateTemplate<char>;
+
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(
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D26751.78344.patch
Type: text/x-patch
Size: 2938 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20161117/b0e17cee/attachment.bin>
More information about the cfe-commits
mailing list