[clang] Fix GH112189 (PR #156846)
via cfe-commits
cfe-commits at lists.llvm.org
Thu Sep 4 03:27:55 PDT 2025
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/GH112189.cpp clang/lib/Sema/SemaInit.cpp
``````````
: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/Sema/SemaInit.cpp b/clang/lib/Sema/SemaInit.cpp
index b1cffe062..c437ae1bd 100644
--- a/clang/lib/Sema/SemaInit.cpp
+++ b/clang/lib/Sema/SemaInit.cpp
@@ -287,8 +287,8 @@ static void CheckC23ConstexprInitStringLiteral(const StringLiteral *SE,
Sema &SemaRef, QualType &TT);
static Expr *CheckStringInit(Expr *Str, QualType &DeclT, const ArrayType *AT,
- Sema &S, const InitializedEntity &Entity,
- bool CheckC23ConstexprInit = false) {
+ Sema &S, const InitializedEntity &Entity,
+ bool CheckC23ConstexprInit = false) {
// Get the length of the string as parsed.
auto *ConstantArrayTy =
cast<ConstantArrayType>(Str->getType()->getAsArrayTypeUnsafe());
@@ -1685,8 +1685,7 @@ void InitListChecker::CheckSubElementType(const InitializedEntity &Entity,
if (IsStringInit(expr, arrayType, SemaRef.Context) == SIF_None) {
// FIXME: Should we do this checking in verify-only mode?
if (!VerifyOnly) {
- expr = CheckStringInit(
- expr, ElemType, arrayType, SemaRef, Entity,
+ expr = CheckStringInit(expr, ElemType, arrayType, SemaRef, Entity,
SemaRef.getLangOpts().C23 &&
initializingConstexprVariable(Entity));
IList->setInit(Index, expr);
@@ -8503,11 +8502,10 @@ ExprResult InitializationSequence::Perform(Sema &S,
case SK_StringInit: {
QualType Ty = Step->Type;
bool UpdateType = ResultType && Entity.getType()->isIncompleteArrayType();
- CurInit = CheckStringInit(
- CurInit.get(), UpdateType ? *ResultType : Ty,
- S.Context.getAsArrayType(Ty), S, Entity,
- S.getLangOpts().C23 &&
- initializingConstexprVariable(Entity));
+ CurInit = CheckStringInit(CurInit.get(), UpdateType ? *ResultType : Ty,
+ S.Context.getAsArrayType(Ty), S, Entity,
+ S.getLangOpts().C23 &&
+ initializingConstexprVariable(Entity));
break;
}
``````````
</details>
https://github.com/llvm/llvm-project/pull/156846
More information about the cfe-commits
mailing list