[PATCH] D79719: [AIX] Implement AIX special alignment rule about double/long double

Xiangling Liao via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Jun 8 18:50:29 PDT 2020


Xiangling_L added inline comments.


================
Comment at: clang/lib/AST/RecordLayoutBuilder.cpp:666
+    FirstNonOverlappingEmptyFieldHandled
+  } FirstNonOverlappingEmptyFieldStatus;
+
----------------
efriedma wrote:
> Instead of specifically tracking whether you've found an OverlappingEmpty field, could you just have something like "bool FoundNonOverlappingEmptyField = false;", and set it to true when you handle a field that isn't OverlappingEmpty?  I don't think we need to specifically track whether we've found an OverlappingEmpty field.
I think you are right. We do not need to specifically track whether we've found an OverlappingEmpty field. But I think we do need an enum to track if the first non-OverlappingEmptyField is handled or not.

Or the following case is problematic:


```
struct A {
  int : 0;
  double d;
};

```
The `double d` will mistakenly match `FieldOffset == CharUnits::Zero() && D->getFieldIndex() != 0 && !IsOverlappingEmptyField && FoundNonOverlappingEmptyField `, which we shouldn't because it is not the first member of the struct.





Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D79719/new/

https://reviews.llvm.org/D79719





More information about the cfe-commits mailing list