forked from OSchip/llvm-project
[clang-tidy] Ignore template instantiations in modernize-use-equals-delete check
Summary: Template instantiations were causing misplaced fixits. Reviewers: aaron.ballman, alexfh, hokein Subscribers: hokein, cfe-commits Differential Revision: https://reviews.llvm.org/D26751 llvm-svn: 287221
This commit is contained in:
parent
10849a81f3
commit
d549e3a23c
|
|
@ -34,6 +34,7 @@ void UseEqualsDeleteCheck::registerMatchers(MatchFinder *Finder) {
|
|||
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(
|
||||
|
|
|
|||
|
|
@ -22,6 +22,32 @@ private:
|
|||
// 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 &);
|
||||
};
|
||||
|
|
|
|||
Loading…
Reference in New Issue