[clang] [CIR] Add support for virtual destructor calls (PR #162725)

Amr Hesham via cfe-commits cfe-commits at lists.llvm.org
Thu Oct 9 13:31:27 PDT 2025


================
@@ -678,7 +678,13 @@ void CIRGenFunction::emitDestructorBody(FunctionArgList &args) {
   // possible to delegate the destructor body to the complete
   // destructor.  Do so.
   if (dtorType == Dtor_Deleting) {
-    cgm.errorNYI(dtor->getSourceRange(), "deleting destructor");
+    RunCleanupsScope dtorEpilogue(*this);
+    enterDtorCleanups(dtor, Dtor_Deleting);
+    if (haveInsertPoint()) {
+      QualType thisTy = dtor->getFunctionObjectParameterType();
+      emitCXXDestructorCall(dtor, Dtor_Complete, /*ForVirtualBase=*/false,
+                            /*Delegating=*/false, loadCXXThisAddress(), thisTy);
----------------
AmrDeveloper wrote:

```suggestion
      emitCXXDestructorCall(dtor, Dtor_Complete, /*forVirtualBase=*/false,
                            /*delegating=*/false, loadCXXThisAddress(), thisTy);
```

https://github.com/llvm/llvm-project/pull/162725


More information about the cfe-commits mailing list