[clang] [clang] Fix parenthesized list initialization of arrays not working with `new` (PR #76976)

via cfe-commits cfe-commits at lists.llvm.org
Thu Jan 4 09:06:58 PST 2024


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 a7a78fd427569a7ad8a27e682a66fe414f004a35 ee4e3c8634bb876166ee753a4ebcbf3c1699a175 -- clang/lib/CodeGen/CGExprCXX.cpp clang/lib/Sema/SemaExprCXX.cpp clang/test/CodeGen/paren-list-agg-init.cpp clang/test/SemaCXX/new-delete.cpp
``````````

</details>

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

``````````diff
diff --git a/clang/lib/Sema/SemaExprCXX.cpp b/clang/lib/Sema/SemaExprCXX.cpp
index 71e420648c..90e0dcb35a 100644
--- a/clang/lib/Sema/SemaExprCXX.cpp
+++ b/clang/lib/Sema/SemaExprCXX.cpp
@@ -2403,7 +2403,8 @@ ExprResult Sema::BuildCXXNew(SourceRange Range, bool UseGlobal,
   // Array 'new' can't have any initializers except empty parentheses.
   // Initializer lists are also allowed, in C++11. Rely on the parser for the
   // dialect distinction.
-  if (ArraySize && !isLegalArrayNewInitializer(InitStyle, Initializer, getLangOpts().CPlusPlus20)) {
+  if (ArraySize && !isLegalArrayNewInitializer(InitStyle, Initializer,
+                                               getLangOpts().CPlusPlus20)) {
     SourceRange InitRange(Exprs.front()->getBeginLoc(),
                           Exprs.back()->getEndLoc());
     Diag(StartLoc, diag::err_new_array_init_args) << InitRange;

``````````

</details>


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


More information about the cfe-commits mailing list