[clang] [CUDA][HIP] check dtor in deferred diag (PR #129117)
Yaxun Liu via cfe-commits
cfe-commits at lists.llvm.org
Fri Feb 28 05:16:00 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);
+ }
+ }
+ }
+ }
----------------
yxsamliu wrote:
will do
https://github.com/llvm/llvm-project/pull/129117
More information about the cfe-commits
mailing list