[clang] Fix to msvc::no_unique_address causing assert when used with __declspec(empty_bases) (PR #74776)
via cfe-commits
cfe-commits at lists.llvm.org
Thu Dec 7 14:49:23 PST 2023
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 c6805ea44af3bfd57e6b46f2d65ec6b0d0d6c64a c3dedfd535f037fb54a8e04640f9332e655a9a7d -- clang/lib/AST/RecordLayoutBuilder.cpp clang/test/Layout/ms-x86-declspec-empty_bases.cpp
``````````
</details>
<details>
<summary>
View the diff from clang-format here.
</summary>
``````````diff
diff --git a/clang/lib/AST/RecordLayoutBuilder.cpp b/clang/lib/AST/RecordLayoutBuilder.cpp
index 73b248ffe5..4af8770db2 100644
--- a/clang/lib/AST/RecordLayoutBuilder.cpp
+++ b/clang/lib/AST/RecordLayoutBuilder.cpp
@@ -2267,9 +2267,12 @@ ItaniumRecordLayoutBuilder::updateExternalFieldOffset(const FieldDecl *Field,
/// \returns diagnostic %select index.
static unsigned getPaddingDiagFromTagKind(TagTypeKind Tag) {
switch (Tag) {
- case TTK_Struct: return 0;
- case TTK_Interface: return 1;
- case TTK_Class: return 2;
+ case TTK_Struct:
+ return 0;
+ case TTK_Interface:
+ return 1;
+ case TTK_Class:
+ return 2;
default: llvm_unreachable("Invalid tag kind for field padding diagnostic!");
}
}
@@ -2300,15 +2303,13 @@ void ItaniumRecordLayoutBuilder::CheckFieldPadding(
if (D->getIdentifier())
Diag(D->getLocation(), diag::warn_padded_struct_field)
<< getPaddingDiagFromTagKind(D->getParent()->getTagKind())
- << Context.getTypeDeclType(D->getParent())
- << PadSize
+ << Context.getTypeDeclType(D->getParent()) << PadSize
<< (InBits ? 1 : 0) // (byte|bit)
<< D->getIdentifier();
else
Diag(D->getLocation(), diag::warn_padded_struct_anon_field)
<< getPaddingDiagFromTagKind(D->getParent()->getTagKind())
- << Context.getTypeDeclType(D->getParent())
- << PadSize
+ << Context.getTypeDeclType(D->getParent()) << PadSize
<< (InBits ? 1 : 0); // (byte|bit)
}
if (isPacked && Offset != UnpackedOffset) {
``````````
</details>
https://github.com/llvm/llvm-project/pull/74776
More information about the cfe-commits
mailing list