[clang] [Sema] Instantiate destructors for initialized members (PR #128866)
Erich Keane via cfe-commits
cfe-commits at lists.llvm.org
Wed Mar 5 06:29:51 PST 2025
================
@@ -5283,6 +5283,102 @@ Sema::SetDelegatingInitializer(CXXConstructorDecl *Constructor,
return false;
}
+static void MarkFieldDestructorReferenced(Sema &S, SourceLocation Location,
+ FieldDecl *Field) {
+ if (Field->isInvalidDecl())
+ return;
+
+ // Don't destroy incomplete or zero-length arrays.
+ if (isIncompleteOrZeroLengthArrayType(S.Context, Field->getType()))
+ return;
+
+ QualType FieldType = S.Context.getBaseElementType(Field->getType());
+
+ const RecordType *RT = FieldType->getAs<RecordType>();
+ if (!RT)
+ return;
+
+ CXXRecordDecl *FieldClassDecl = cast<CXXRecordDecl>(RT->getDecl());
----------------
erichkeane wrote:
Instead of the `getAsRecordType` and down, we have a function for all of that. `auto *FieldType->getAsCXXRecordDecl();`
https://github.com/llvm/llvm-project/pull/128866
More information about the cfe-commits
mailing list