[clang] [CIR] Add builtin operator new/delete (PR #168578)

Andy Kaylor via cfe-commits cfe-commits at lists.llvm.org
Tue Nov 18 11:55:02 PST 2025


================
@@ -520,6 +521,13 @@ RValue CIRGenFunction::emitBuiltinExpr(const GlobalDecl &gd, unsigned builtinID,
     cir::PrefetchOp::create(builder, loc, address, locality, isWrite);
     return RValue::get(nullptr);
   }
+  case Builtin::BI__builtin_operator_new:
+    return emitNewOrDeleteBuiltinCall(
+        e->getCallee()->getType()->castAs<FunctionProtoType>(), e, false);
----------------
andykaylor wrote:

Better still, you could replace the boolean parameter with `OverloadedOperatorKind` and pass `OO_New` or `OO_Delete` since the only thing the parameter is used for is to select between these two.

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


More information about the cfe-commits mailing list