MarcoFalke updated this revision to Diff 496104.
MarcoFalke edited the summary of this revision.
MarcoFalke added a comment.
Remove both test cases that pass on current `main` on Linux, but fail on
Windows. Seems unrelated to add/fix them here.
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D143375/new/
https://reviews.llvm.org/D143375
Files:
clang-tools-extra/clang-tidy/modernize/UseDefaultMemberInitCheck.cpp
clang-tools-extra/test/clang-tidy/checkers/modernize/use-default-member-init.cpp
Index:
clang-tools-extra/test/clang-tidy/checkers/modernize/use-default-member-init.cpp
===================================================================
---
clang-tools-extra/test/clang-tidy/checkers/modernize/use-default-member-init.cpp
+++
clang-tools-extra/test/clang-tidy/checkers/modernize/use-default-member-init.cpp
@@ -60,6 +60,12 @@
int i;
};
+struct TwoConstructorsTpl {
+ TwoConstructorsTpl() : i{7} {}
+ template <typename T> TwoConstructorsTpl(T, int) : i(8) {}
+ int i;
+};
+
struct PositiveNotDefaultOOLInt {
PositiveNotDefaultOOLInt(int);
int i;
Index: clang-tools-extra/clang-tidy/modernize/UseDefaultMemberInitCheck.cpp
===================================================================
--- clang-tools-extra/clang-tidy/modernize/UseDefaultMemberInitCheck.cpp
+++ clang-tools-extra/clang-tidy/modernize/UseDefaultMemberInitCheck.cpp
@@ -246,8 +246,12 @@
// Check whether we have multiple hand-written constructors and bomb out, as
// it is hard to reconcile their sets of member initializers.
const auto *ClassDecl = cast<CXXRecordDecl>(Field->getParent());
- if (llvm::count_if(ClassDecl->ctors(), [](const CXXConstructorDecl *Ctor) {
- return !Ctor->isCopyOrMoveConstructor();
+ if (llvm::count_if(ClassDecl->decls(), [](const Decl *D) {
+ if (const auto *FTD = dyn_cast<FunctionTemplateDecl>(D))
+ D = FTD->getTemplatedDecl();
+ if (const auto *Ctor = dyn_cast<CXXConstructorDecl>(D))
+ return !Ctor->isCopyOrMoveConstructor();
+ return false;
}) > 1)
return;
Index: clang-tools-extra/test/clang-tidy/checkers/modernize/use-default-member-init.cpp
===================================================================
--- clang-tools-extra/test/clang-tidy/checkers/modernize/use-default-member-init.cpp
+++ clang-tools-extra/test/clang-tidy/checkers/modernize/use-default-member-init.cpp
@@ -60,6 +60,12 @@
int i;
};
+struct TwoConstructorsTpl {
+ TwoConstructorsTpl() : i{7} {}
+ template <typename T> TwoConstructorsTpl(T, int) : i(8) {}
+ int i;
+};
+
struct PositiveNotDefaultOOLInt {
PositiveNotDefaultOOLInt(int);
int i;
Index: clang-tools-extra/clang-tidy/modernize/UseDefaultMemberInitCheck.cpp
===================================================================
--- clang-tools-extra/clang-tidy/modernize/UseDefaultMemberInitCheck.cpp
+++ clang-tools-extra/clang-tidy/modernize/UseDefaultMemberInitCheck.cpp
@@ -246,8 +246,12 @@
// Check whether we have multiple hand-written constructors and bomb out, as
// it is hard to reconcile their sets of member initializers.
const auto *ClassDecl = cast<CXXRecordDecl>(Field->getParent());
- if (llvm::count_if(ClassDecl->ctors(), [](const CXXConstructorDecl *Ctor) {
- return !Ctor->isCopyOrMoveConstructor();
+ if (llvm::count_if(ClassDecl->decls(), [](const Decl *D) {
+ if (const auto *FTD = dyn_cast<FunctionTemplateDecl>(D))
+ D = FTD->getTemplatedDecl();
+ if (const auto *Ctor = dyn_cast<CXXConstructorDecl>(D))
+ return !Ctor->isCopyOrMoveConstructor();
+ return false;
}) > 1)
return;
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits