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

Andy Kaylor via cfe-commits cfe-commits at lists.llvm.org
Thu Apr 23 17:57:36 PDT 2026


================
@@ -1617,85 +1652,102 @@ 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");
-
-  // If there's an operator delete, enter a cleanup to call it if an
----------------
andykaylor wrote:

You've dropped a number of comments in this refactoring. Please try to preserve them wherever they are still applicable.

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


More information about the cfe-commits mailing list