[clang] [clang][constexpr] Evaluate parenthesized array new with the allocated bound (PR #228675)

via cfe-commits cfe-commits at lists.llvm.org
Sat Oct 3 00:44:22 PDT 2026


github-actions[bot] wrote:

<!--LLVM CODE FORMAT COMMENT: {clang-format}-->


:warning: C/C++ code formatter, clang-format found issues in your code. :warning:

<details>
<summary>
You can test this locally with the following command:
</summary>

``````````bash
git-clang-format --diff origin/main HEAD --extensions cpp -- clang/test/SemaCXX/constexpr-array-new-paren-init.cpp clang/lib/AST/ExprConstant.cpp --diff_from_common_commit
``````````

:warning:
The reproduction instructions above might return results for more than one PR
in a stack if you are using a stacked PR workflow. You can limit the results by
changing `origin/main` to the base branch/commit you want to compare against.
:warning:

</details>

<details>
<summary>
View the diff from clang-format here.
</summary>

``````````diff
diff --git a/clang/lib/AST/ExprConstant.cpp b/clang/lib/AST/ExprConstant.cpp
index 30116acfe..d7a162205 100644
--- a/clang/lib/AST/ExprConstant.cpp
+++ b/clang/lib/AST/ExprConstant.cpp
@@ -10963,9 +10963,8 @@ bool PointerExprEvaluator::VisitBuiltinCallExpr(const CallExpr *E,
   }
 }
 
-static bool EvaluateArrayNewInit(EvalInfo &Info, LValue &This,
-                                 APValue &Result, const Expr *Init,
-                                 QualType AllocType);
+static bool EvaluateArrayNewInit(EvalInfo &Info, LValue &This, APValue &Result,
+                                 const Expr *Init, QualType AllocType);
 static bool EvaluateArrayNewConstructExpr(EvalInfo &Info, LValue &This,
                                           APValue &Result,
                                           const CXXConstructExpr *CCE,
@@ -15636,9 +15635,8 @@ static bool EvaluateArray(const Expr *E, const LValue &This,
   return ArrayExprEvaluator(Info, This, Result).Visit(E);
 }
 
-static bool EvaluateArrayNewInit(EvalInfo &Info, LValue &This,
-                                 APValue &Result, const Expr *Init,
-                                 QualType AllocType) {
+static bool EvaluateArrayNewInit(EvalInfo &Info, LValue &This, APValue &Result,
+                                 const Expr *Init, QualType AllocType) {
   assert(!Init->isValueDependent());
   assert(Init->isPRValue() && Init->getType()->isArrayType() &&
          "not an array prvalue");

``````````

</details>


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


More information about the cfe-commits mailing list