[clang] [CIR] Add Minimal Destructor Definition Support (PR #144719)
Andy Kaylor via cfe-commits
cfe-commits at lists.llvm.org
Wed Jun 18 11:29:24 PDT 2025
================
@@ -538,6 +538,104 @@ void CIRGenFunction::emitConstructorBody(FunctionArgList &args) {
}
}
+/// Emits the body of the current destructor.
+void CIRGenFunction::emitDestructorBody(FunctionArgList &args) {
+ const CXXDestructorDecl *dtor = cast<CXXDestructorDecl>(curGD.getDecl());
+ CXXDtorType dtorType = curGD.getDtorType();
+
+ // For an abstract class, non-base destructors are never used (and can't
+ // be emitted in general, because vbase dtors may not have been validated
+ // by Sema), but the Itanium ABI doesn't make them optional and Clang may
+ // in fact emit references to them from other compilations, so emit them
+ // as functions containing a trap instruction.
+ if (dtorType != Dtor_Base && dtor->getParent()->isAbstract()) {
+ SourceLocation loc =
----------------
andykaylor wrote:
It's probably not possible to write a test that hits this code yet. If that's so, can you make it NYI until we can?
https://github.com/llvm/llvm-project/pull/144719
More information about the cfe-commits
mailing list