[PATCH] D26582: [clang-tidy] Handle template instantiations in modenize-use-default check
Malcolm Parsons via cfe-commits
cfe-commits at lists.llvm.org
Wed Nov 16 02:01:30 PST 2016
This revision was automatically updated to reflect the committed changes.
Closed by commit rL287091: [clang-tidy] Handle template instantiations in modenize-use-default check (authored by malcolm.parsons).
Changed prior to commit:
https://reviews.llvm.org/D26582?vs=77728&id=78151#toc
Repository:
rL LLVM
https://reviews.llvm.org/D26582
Files:
clang-tools-extra/trunk/clang-tidy/modernize/UseDefaultCheck.cpp
clang-tools-extra/trunk/test/clang-tidy/modernize-use-default.cpp
Index: clang-tools-extra/trunk/test/clang-tidy/modernize-use-default.cpp
===================================================================
--- clang-tools-extra/trunk/test/clang-tidy/modernize-use-default.cpp
+++ clang-tools-extra/trunk/test/clang-tidy/modernize-use-default.cpp
@@ -124,6 +124,26 @@
// CHECK-FIXES: ~Temp() = default;
};
+// Class template out of line with explicit instantiation.
+template <class T>
+class TempODef {
+public:
+ TempODef();
+ ~TempODef();
+};
+
+template <class T>
+TempODef<T>::TempODef() {}
+// CHECK-MESSAGES: :[[@LINE-2]]:1: warning: use '= default'
+// CHECK-FIXES: TempODef<T>::TempODef() = default;
+template <class T>
+TempODef<T>::~TempODef() {}
+// CHECK-MESSAGES: :[[@LINE-2]]:1: warning: use '= default'
+// CHECK-FIXES: TempODef<T>::~TempODef() = default;
+
+template class TempODef<int>;
+template class TempODef<double>;
+
// Non user-provided constructor/destructor.
struct Imp {
int Int;
Index: clang-tools-extra/trunk/clang-tidy/modernize/UseDefaultCheck.cpp
===================================================================
--- clang-tools-extra/trunk/clang-tidy/modernize/UseDefaultCheck.cpp
+++ clang-tools-extra/trunk/clang-tidy/modernize/UseDefaultCheck.cpp
@@ -241,6 +241,7 @@
if (SpecialFunctionDecl->isDeleted() ||
SpecialFunctionDecl->isExplicitlyDefaulted() ||
SpecialFunctionDecl->isLateTemplateParsed() ||
+ SpecialFunctionDecl->isTemplateInstantiation() ||
!SpecialFunctionDecl->isUserProvided() || !SpecialFunctionDecl->hasBody())
return;
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D26582.78151.patch
Type: text/x-patch
Size: 1559 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20161116/71e15cef/attachment.bin>
More information about the cfe-commits
mailing list