[clang] [clang][Sema] Expand `#embed` in braced lists that initialize non-aggregates (PR #231938)
via cfe-commits
cfe-commits at lists.llvm.org
Sun Oct 18 22:12:20 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 h,c,cpp -- clang/include/clang/AST/Expr.h clang/include/clang/Sema/Sema.h clang/lib/Sema/SemaInit.cpp clang/lib/Sema/SemaOverload.cpp clang/test/Preprocessor/embed_codegen.cpp clang/test/Preprocessor/embed_constexpr.cpp clang/test/Sema/excess-embed-data.c clang/test/SemaCXX/embed-init-list.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/include/clang/AST/Expr.h b/clang/include/clang/AST/Expr.h
index ef442213a..ab98fe216 100644
--- a/clang/include/clang/AST/Expr.h
+++ b/clang/include/clang/AST/Expr.h
@@ -5404,8 +5404,8 @@ public:
bool hasOneInit() const {
if (InitExprs.size() != 1)
return false;
- auto *EE = dyn_cast<EmbedExpr>(
- cast<Expr>(InitExprs[0])->IgnoreParenImpCasts());
+ auto *EE =
+ dyn_cast<EmbedExpr>(cast<Expr>(InitExprs[0])->IgnoreParenImpCasts());
return !EE || EE->getDataElementCount() == 1;
}
diff --git a/clang/lib/Sema/SemaInit.cpp b/clang/lib/Sema/SemaInit.cpp
index da4c18ead..a02f39b48 100644
--- a/clang/lib/Sema/SemaInit.cpp
+++ b/clang/lib/Sema/SemaInit.cpp
@@ -3657,8 +3657,8 @@ MultiExprArg Sema::getInitsWithEmbedExpanded(InitListExpr *ILE,
for (unsigned I = Embed->getStartingElementPos(),
E = I + Embed->getDataElementCount();
I != E; ++I)
- Storage.push_back(new (Context) EmbedExpr(
- Context, Embed->getLocation(), Embed->getData(), I, 1));
+ Storage.push_back(new (Context) EmbedExpr(Context, Embed->getLocation(),
+ Embed->getData(), I, 1));
}
return Storage;
}
``````````
</details>
https://github.com/llvm/llvm-project/pull/231938
More information about the cfe-commits
mailing list