[clang] [Sema] Fix handling of fields with initializers in nested anonymous unions. (PR #91692)

via cfe-commits cfe-commits at lists.llvm.org
Thu May 9 19:50:47 PDT 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 7115ed0fff027b65fa76fdfae215ed1382ed1473 44c9e4b9920ab23db93a8a716695a6e712edcf01 -- clang/lib/Sema/SemaInit.cpp clang/test/AST/ast-dump-APValue-anon-union.cpp clang/test/SemaCXX/cxx1y-initializer-aggregates.cpp
``````````

</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 0a3d3ea019..331f4cdc5e 100644
--- a/clang/lib/Sema/SemaInit.cpp
+++ b/clang/lib/Sema/SemaInit.cpp
@@ -814,8 +814,8 @@ InitListChecker::FillInEmptyInitializations(const InitializedEntity &Entity,
   if (const RecordType *RType = ILE->getType()->getAs<RecordType>()) {
     const RecordDecl *RDecl = RType->getDecl();
     if (RDecl->isUnion() && ILE->getInitializedFieldInUnion()) {
-      FillInEmptyInitForField(0, ILE->getInitializedFieldInUnion(),
-                              Entity, ILE, RequiresSecondPass, FillWithNoInit);
+      FillInEmptyInitForField(0, ILE->getInitializedFieldInUnion(), Entity, ILE,
+                              RequiresSecondPass, FillWithNoInit);
     } else {
       assert((!RDecl->isUnion() || !isa<CXXRecordDecl>(RDecl) ||
               !cast<CXXRecordDecl>(RDecl)->hasInClassInitializer()) &&

``````````

</details>


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


More information about the cfe-commits mailing list