[PATCH] D137806: [AST] Fix class layout when using external layout under MS ABI.

Zequan Wu via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Nov 10 15:40:40 PST 2022


zequanwu added inline comments.


================
Comment at: clang/test/CodeGenCXX/override-layout-virtual-base.cpp:25-43
+// CHECK:      *** Dumping AST Record Layout
+// CHECK-NEXT:          0 | struct S2
+// CHECK-NEXT:          0 |   (S2 vftable pointer)
+// CHECK-NEXT:          8 |   (S2 vbtable pointer)
+// CHECK-NEXT:          8 |   struct S1 (virtual base)
+// CHECK-NEXT:          8 |     int a
+// CHECK-NEXT:            | [sizeof=8, align=8,
----------------
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]
```




Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D137806



More information about the cfe-commits mailing list