[clang] [CIR] [WIP] Implement null check for CXXNewExpr (PR #192848)

via cfe-commits cfe-commits at lists.llvm.org
Tue Apr 21 07:56:24 PDT 2026


================
@@ -1472,9 +1472,28 @@ mlir::Value CIRGenFunction::emitCXXNewExpr(const CXXNewExpr *e) {
   // interesting initializer will be running sanitizers on the initialization.
   bool nullCheck = e->shouldNullCheckAllocation() &&
                    (!allocType.isPODType(getContext()) || e->hasInitializer());
-  assert(!cir::MissingFeatures::exprNewNullCheck());
-  if (nullCheck)
-    cgm.errorNYI(e->getSourceRange(), "emitCXXNewExpr: null check");
+
+  // The null-check means that the initializer is conditionally
+  // evaluated.
+  ConditionalEvaluation conditional(*this);
----------------
AbdallahRashed wrote:

reverted 

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


More information about the cfe-commits mailing list