[clang] Clean up array allocation logic in Sema::BuildCXXNew (PR #186617)

Oliver Hunt via cfe-commits cfe-commits at lists.llvm.org
Sun Mar 15 00:52:15 PDT 2026


================
@@ -2297,18 +2297,19 @@ ExprResult Sema::BuildCXXNew(SourceRange Range, bool UseGlobal,
   // C++1y [expr.new]p6: The expression [...] is implicitly converted to
   //   std::size_t.
   std::optional<uint64_t> KnownArraySize;
-  if (ArraySize && *ArraySize && !(*ArraySize)->isTypeDependent()) {
+  if (ArraySize.isExprNotTypeDependent()) {
----------------
ojhunt wrote:

this and the follow on are essentially the only actual code changes in the pr, where we've replaced `(ArraySize && *ArraySize && !(*ArraySize)` with a very large class wrapping a pile of behavior to make it compatible with existing code.

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


More information about the cfe-commits mailing list