[PATCH] D119051: Fix pod-packed functionality to use the C++11 definition of pod-ness
David Blaikie via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Mon Feb 7 15:09:57 PST 2022
dblaikie updated this revision to Diff 406628.
dblaikie added a comment.
Remove FieldClass check
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D119051/new/
https://reviews.llvm.org/D119051
Files:
clang/lib/AST/RecordLayoutBuilder.cpp
clang/test/SemaCXX/class-layout.cpp
Index: clang/test/SemaCXX/class-layout.cpp
===================================================================
--- clang/test/SemaCXX/class-layout.cpp
+++ clang/test/SemaCXX/class-layout.cpp
@@ -641,3 +641,14 @@
_Static_assert(_Alignof(t1) == 1, "");
_Static_assert(_Alignof(t2) == 1, "");
} // namespace non_pod_packed
+
+namespace cxx11_pod {
+struct t1 {
+ t1() = default;
+ int a;
+};
+struct t2 {
+ t1 v1;
+} __attribute__((packed));
+_Static_assert(_Alignof(t2) == 1, "");
+}
Index: clang/lib/AST/RecordLayoutBuilder.cpp
===================================================================
--- clang/lib/AST/RecordLayoutBuilder.cpp
+++ clang/lib/AST/RecordLayoutBuilder.cpp
@@ -1888,7 +1888,7 @@
LastBitfieldStorageUnitSize = 0;
llvm::Triple Target = Context.getTargetInfo().getTriple();
- bool FieldPacked = (Packed && (!FieldClass || FieldClass->isPOD() ||
+ bool FieldPacked = (Packed && (D->getType().isCXX11PODType(Context) ||
Context.getLangOpts().getClangABICompat() <=
LangOptions::ClangABI::Ver13 ||
Target.isPS4() || Target.isOSDarwin())) ||
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D119051.406628.patch
Type: text/x-patch
Size: 1179 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20220207/e4282fff/attachment.bin>
More information about the cfe-commits
mailing list