[clang] [CIR] Add support for delete cleanup after new operators (PR #184707)

Erich Keane via cfe-commits cfe-commits at lists.llvm.org
Thu Mar 5 06:50:20 PST 2026


================
@@ -1190,10 +1329,28 @@ mlir::Value CIRGenFunction::emitCXXNewExpr(const CXXNewExpr *e) {
     cgm.errorNYI(e->getSourceRange(), "emitCXXNewExpr: null check");
 
   // If there's an operator delete, enter a cleanup to call it if an
-  // exception is thrown.
-  if (e->getOperatorDelete() &&
-      !e->getOperatorDelete()->isReservedGlobalPlacementOperator())
-    cgm.errorNYI(e->getSourceRange(), "emitCXXNewExpr: operator delete");
+  // exception is thrown. If we do this, we'l be creating the result pointer
----------------
erichkeane wrote:

```suggestion
  // exception is thrown. If we do this, we'll be creating the result pointer
```

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


More information about the cfe-commits mailing list