[clang] [CIR] Handle operator delete with virtual destructors (PR #165010)
Erich Keane via cfe-commits
cfe-commits at lists.llvm.org
Fri Oct 24 09:49:18 PDT 2025
================
@@ -2175,6 +2178,22 @@ mlir::Value CIRGenItaniumCXXABI::emitDynamicCast(CIRGenFunction &cgf,
isRefCast, castInfo);
}
+/// The Itanium ABI always places an offset to the complete object
+/// at entry -2 in the vtable.
+void CIRGenItaniumCXXABI::emitVirtualObjectDelete(
+ CIRGenFunction &cgf, const CXXDeleteExpr *delExpr, Address ptr,
+ QualType elementType, const CXXDestructorDecl *dtor) {
+ bool useGlobalDelete = delExpr->isGlobalDelete();
+ if (useGlobalDelete) {
+ cgf.cgm.errorNYI(delExpr->getSourceRange(),
+ "emitVirtualObjectDelete: global delete");
+ return;
+ }
+
+ CXXDtorType dtorType = useGlobalDelete ? Dtor_Complete : Dtor_Deleting;
----------------
erichkeane wrote:
Hmm, I get that we want this here for future direction, but this is dead with the 'return' above. Is it problematic here to have it just drop-through? Classic-compiler seems to just be diving into the vtable pointer, then doing a cleanup block before/after.
So fall-through would just miss this cleanup, so it would still be valid. So... remove the return above I guess is my suggestion.
https://github.com/llvm/llvm-project/pull/165010
More information about the cfe-commits
mailing list