[clang] [CIR] Add abstract array delete operation with expansion during CXXABILowering (PR #185134)

Andy Kaylor via cfe-commits cfe-commits at lists.llvm.org
Mon Mar 9 11:58:52 PDT 2026


================
@@ -3589,6 +3589,45 @@ def CIR_LLVMIntrinsicCallOp : CIR_Op<"call_llvm_intrinsic"> {
   ];
 }
 
+//===----------------------------------------------------------------------===//
+// DeleteArrayOp
+//===----------------------------------------------------------------------===//
+
+def CIR_DeleteArrayOp : CIR_Op<"delete_array"> {
+  let summary = "Delete address representing an array";
+  let description = [{
+    `cir.delete_array` operation deletes an array. For example, `delete[] ptr;`
+    will be translated to `cir.delete_array %ptr`.
+
+    When present, the AST attribute provides the CXXDeleteExpr for generating
----------------
andykaylor wrote:

We need the CXXDeleteExpr to get the usual delete parameters, to check if this is a replaceable global allocation function, and to get the element destructor name. In this case, we could store all of that in attributes when creating the operation, but I think there are going to be other operations where we'll need the AST node to effectively defer lowering of target-specific CXXABI details.

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


More information about the cfe-commits mailing list