This is an archive of the discontinued LLVM Phabricator instance.

[AST] Fix class layout when using external layout under MS ABI.
ClosedPublic

Authored by zequanwu on Nov 10 2022, 3:37 PM.

Diff Detail

Event Timeline

zequanwu created this revision.Nov 10 2022, 3:37 PM
Herald added a project: Restricted Project. · View Herald TranscriptNov 10 2022, 3:37 PM
zequanwu requested review of this revision.Nov 10 2022, 3:37 PM
Herald added a project: Restricted Project. · View Herald TranscriptNov 10 2022, 3:37 PM
Herald added a subscriber: cfe-commits. · View Herald Transcript
zequanwu added inline comments.Nov 10 2022, 3:40 PM
clang/test/CodeGenCXX/override-layout-virtual-base.cpp
25–43

Pasted -fdump-record-layout result below before this change as reference:

*** Dumping AST Record Layout
         0 | struct S1
         0 |   int a
           | [sizeof=4, align=4,
           |  nvsize=4, nvalign=4]

*** Dumping AST Record Layout
         0 | struct S2
         0 |   (S2 vftable pointer)
         8 |   (S2 vbtable pointer)
        16 |   struct S1 (virtual base)
        16 |     int a
           | [sizeof=8, align=8,
           |  nvsize=16, nvalign=8]

*** Dumping AST Record Layout
         0 | struct S3
         0 |   struct S2 (primary base)
         0 |     (S2 vftable pointer)
         8 |     (S2 vbtable pointer)
        16 |   char b
        24 |   struct S1 (virtual base)
        24 |     int a
           | [sizeof=32, align=8,
           |  nvsize=24, nvalign=8]

*** Dumping AST Record Layout
         0 | struct S4 (empty)
           | [sizeof=1, align=1,
           |  nvsize=0, nvalign=1]

*** Dumping AST Record Layout
         0 | struct S5
         0 |   (S5 vftable pointer)
         0 |   struct S4 (base) (empty)
           | [sizeof=8, align=8,
           |  nvsize=0, nvalign=8]
rnk accepted this revision.Nov 14 2022, 4:17 PM

lgtm

This revision is now accepted and ready to land.Nov 14 2022, 4:17 PM
This revision was landed with ongoing or failed builds.Nov 16 2022, 11:17 AM
This revision was automatically updated to reflect the committed changes.