[PATCH] D58544: [AST] Improve support of external layouts in `MicrosoftRecordLayoutBuilder`

Reid Kleckner via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Mar 12 14:09:27 PDT 2019


rnk accepted this revision.
rnk added a comment.
This revision is now accepted and ready to land.

lgtm



================
Comment at: lib/AST/RecordLayoutBuilder.cpp:2750-2753
+    // It is possible that there were no fields or bases located after vbptr,
+    // so the size was not adjusted before.
+    if (Size < FieldStart)
+      Size = FieldStart;
----------------
I think this may be an interesting test case:
  struct __declspec(align(16)) NVBase {
    int x, y;
    virtual ~NVBase();
  };
  struct VBase { int z; };
  struct Foo : NVBase, virtual VBase {
  };

On reading the code more, I don't think this test uncovers any bugs, but it seems worth including to make sure we do the right thing w.r.t. alignment.


Repository:
  rC Clang

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

https://reviews.llvm.org/D58544





More information about the cfe-commits mailing list