[all-commits] [llvm/llvm-project] ca946f: [CIR] Implement null check for CXXNewExpr (#192848)

AbdallahRashed via All-commits all-commits at lists.llvm.org
Tue Apr 28 13:08:03 PDT 2026


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: ca946f7faea970ebea2a71394d428857d0e05205
      https://github.com/llvm/llvm-project/commit/ca946f7faea970ebea2a71394d428857d0e05205
  Author: AbdallahRashed <63146988+AbdallahRashed at users.noreply.github.com>
  Date:   2026-04-28 (Tue, 28 Apr 2026)

  Changed paths:
    M clang/include/clang/CIR/MissingFeatures.h
    M clang/lib/CIR/CodeGen/CIRGenExprCXX.cpp
    A clang/test/CIR/CodeGen/new-null.cpp

  Log Message:
  -----------
  [CIR] Implement null check for CXXNewExpr (#192848)

When operator new is allowed to return null (e.g. nothrow new), the
initialization needs to be guarded by a null check,Previously this was
an errorNYI.
This wraps the initialization in a cir.if conditioned on the allocation
being non null, then uses cir.select to pick between the allocation
pointer and null as the result. Also removes
MissingFeatures::exprNewNullCheck.
part of https://github.com/llvm/llvm-project/issues/192328



To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications


More information about the All-commits mailing list