[clang] [CUDA][HIP] check dtor in deferred diag (PR #129117)
Artem Belevich via cfe-commits
cfe-commits at lists.llvm.org
Thu Feb 27 14:08:58 PST 2025
================
@@ -1798,6 +1798,62 @@ class DeferredDiagnosticsEmitter
Inherited::visitUsedDecl(Loc, D);
}
+ // Visitor member and parent dtors called by this dtor.
+ void VisitCalledDestructors(CXXDestructorDecl *DD) {
+ const CXXRecordDecl *RD = DD->getParent();
+
+ // Visit the dtors of all members
+ for (const FieldDecl *FD : RD->fields()) {
+ QualType FT = FD->getType();
+ if (const auto *RT = FT->getAs<RecordType>()) {
+ if (const auto *ClassDecl = dyn_cast<CXXRecordDecl>(RT->getDecl())) {
+ if (ClassDecl->hasDefinition()) {
+ if (CXXDestructorDecl *MemberDtor = ClassDecl->getDestructor()) {
+ asImpl().visitUsedDecl(MemberDtor->getLocation(), MemberDtor);
+ }
+ }
+ }
+ }
----------------
Artem-B wrote:
These do not need `{}`. We do not have any else clauses here, so even with deep nesting it would work fine.
https://github.com/llvm/llvm-project/pull/129117
More information about the cfe-commits
mailing list