[clang] [clang] Fix acceptance of redefinition of a struct with different bit-field width (PR #235265)
via cfe-commits
cfe-commits at lists.llvm.org
Sat Oct 24 01:59:27 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,c -- clang/lib/AST/ASTStructuralEquivalence.cpp clang/test/C/C23/n3037.c --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/ASTStructuralEquivalence.cpp b/clang/lib/AST/ASTStructuralEquivalence.cpp
index f6fa06781..cd0b03c5c 100644
--- a/clang/lib/AST/ASTStructuralEquivalence.cpp
+++ b/clang/lib/AST/ASTStructuralEquivalence.cpp
@@ -1669,8 +1669,9 @@ static bool IsStructurallyEquivalent(StructuralEquivalenceContext &Context,
// the purposes of C where they simply need to have the same values, not
// the same token sequences.
bool Diagnose = false;
- if (!IsStructurallyEquivalent(Context, Field1->getBitWidth(), Field2->getBitWidth()))
- Diagnose = true;
+ if (!IsStructurallyEquivalent(Context, Field1->getBitWidth(),
+ Field2->getBitWidth()))
+ Diagnose = true;
if (Context.LangOpts.C23 && Field1->isBitField() && Field2->isBitField())
Diagnose = Field1->getBitWidthValue() != Field2->getBitWidthValue();
``````````
</details>
https://github.com/llvm/llvm-project/pull/235265
More information about the cfe-commits
mailing list