[PATCH] D79719: [AIX] Implement AIX special alignment rule about double/long double
Jason Liu via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Wed Jun 24 08:36:50 PDT 2020
jasonliu added inline comments.
================
Comment at: clang/lib/AST/RecordLayoutBuilder.cpp:1881
+ if (isAIXLayout(Context) && FieldOffset == CharUnits::Zero() &&
+ (IsUnion || NonOverlappingEmptyFieldFound)) {
+ FirstNonOverlappingEmptyFieldHandled = true;
----------------
Xiangling_L wrote:
> jasonliu wrote:
> > Xiangling_L wrote:
> > > jasonliu wrote:
> > > > Maybe it's a naive thought, but is it possible to replace `NonOverlappingEmptyFieldFound` with `IsOverlappingEmptyField && FieldOffsets.size() == 0`?
> > > I don't think these two work the same. `NonOverlappingEmptyFieldFound` represents the 1st non-empty and non-overlapping field in the record. `IsOverlappingEmptyField && FieldOffsets.size() == 0` represents something opposite.
> > You are right. I meant could we replace it with `!(IsOverlappingEmptyField && FieldOffsets.size() == 0)`?
> I don't think so. The replacement does not work for the case:
>
>
> ```
> struct A {
> int : 0;
> double d;
> };
> ```
>
> where __alignof(A) should be 4;
Got it. Thanks!
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D79719/new/
https://reviews.llvm.org/D79719
More information about the cfe-commits
mailing list