1651f13cea278ec967336033dd032faef0e9fc2ecStephen Hines// RUN: %clang_cc1 -emit-llvm-only -triple i686-pc-win32 -fdump-record-layouts %s 2>/dev/null \
22fe363622c32c471e8a68c68ba5cc372644f24fbEli Friedman// RUN:            | FileCheck %s
32fe363622c32c471e8a68c68ba5cc372644f24fbEli Friedman
42fe363622c32c471e8a68c68ba5cc372644f24fbEli Friedman#pragma pack(push, 8)
52fe363622c32c471e8a68c68ba5cc372644f24fbEli Friedman
62fe363622c32c471e8a68c68ba5cc372644f24fbEli Friedmanclass B {
72fe363622c32c471e8a68c68ba5cc372644f24fbEli Friedmanpublic:
82fe363622c32c471e8a68c68ba5cc372644f24fbEli Friedman  virtual void b(){}
92fe363622c32c471e8a68c68ba5cc372644f24fbEli Friedman  int b_field;
102fe363622c32c471e8a68c68ba5cc372644f24fbEli Friedmanprotected:
112fe363622c32c471e8a68c68ba5cc372644f24fbEli Friedmanprivate:
122fe363622c32c471e8a68c68ba5cc372644f24fbEli Friedman};
132fe363622c32c471e8a68c68ba5cc372644f24fbEli Friedman
142fe363622c32c471e8a68c68ba5cc372644f24fbEli Friedmanclass A : public B {
152fe363622c32c471e8a68c68ba5cc372644f24fbEli Friedmanpublic:
162fe363622c32c471e8a68c68ba5cc372644f24fbEli Friedman  int a_field;
172fe363622c32c471e8a68c68ba5cc372644f24fbEli Friedman  virtual void a(){}
182fe363622c32c471e8a68c68ba5cc372644f24fbEli Friedman  char one;
192fe363622c32c471e8a68c68ba5cc372644f24fbEli Friedmanprotected:
202fe363622c32c471e8a68c68ba5cc372644f24fbEli Friedmanprivate:
212fe363622c32c471e8a68c68ba5cc372644f24fbEli Friedman};
222fe363622c32c471e8a68c68ba5cc372644f24fbEli Friedman
232fe363622c32c471e8a68c68ba5cc372644f24fbEli Friedmanclass D {
242fe363622c32c471e8a68c68ba5cc372644f24fbEli Friedmanpublic:
252fe363622c32c471e8a68c68ba5cc372644f24fbEli Friedman  virtual void b(){}
262fe363622c32c471e8a68c68ba5cc372644f24fbEli Friedman  double a;
272fe363622c32c471e8a68c68ba5cc372644f24fbEli Friedman};
282fe363622c32c471e8a68c68ba5cc372644f24fbEli Friedman
292fe363622c32c471e8a68c68ba5cc372644f24fbEli Friedmanclass C : public virtual A,
302fe363622c32c471e8a68c68ba5cc372644f24fbEli Friedman          public D, public B {
312fe363622c32c471e8a68c68ba5cc372644f24fbEli Friedmanpublic:
322fe363622c32c471e8a68c68ba5cc372644f24fbEli Friedman  double c1_field;
332fe363622c32c471e8a68c68ba5cc372644f24fbEli Friedman  int c2_field;
342fe363622c32c471e8a68c68ba5cc372644f24fbEli Friedman  double c3_field;
352fe363622c32c471e8a68c68ba5cc372644f24fbEli Friedman  int c4_field;
362fe363622c32c471e8a68c68ba5cc372644f24fbEli Friedman  virtual void foo(){}
372fe363622c32c471e8a68c68ba5cc372644f24fbEli Friedman  virtual void bar(){}
382fe363622c32c471e8a68c68ba5cc372644f24fbEli Friedmanprotected:
392fe363622c32c471e8a68c68ba5cc372644f24fbEli Friedmanprivate:
402fe363622c32c471e8a68c68ba5cc372644f24fbEli Friedman};
412fe363622c32c471e8a68c68ba5cc372644f24fbEli Friedman
422fe363622c32c471e8a68c68ba5cc372644f24fbEli Friedmanstruct BaseStruct
432fe363622c32c471e8a68c68ba5cc372644f24fbEli Friedman{
442fe363622c32c471e8a68c68ba5cc372644f24fbEli Friedman    BaseStruct(){}
452fe363622c32c471e8a68c68ba5cc372644f24fbEli Friedman    double v0;
462fe363622c32c471e8a68c68ba5cc372644f24fbEli Friedman    float v1;
472fe363622c32c471e8a68c68ba5cc372644f24fbEli Friedman    C fg;
482fe363622c32c471e8a68c68ba5cc372644f24fbEli Friedman};
492fe363622c32c471e8a68c68ba5cc372644f24fbEli Friedman
502fe363622c32c471e8a68c68ba5cc372644f24fbEli Friedmanstruct DerivedStruct : public BaseStruct {
512fe363622c32c471e8a68c68ba5cc372644f24fbEli Friedman  int x;
522fe363622c32c471e8a68c68ba5cc372644f24fbEli Friedman};
532fe363622c32c471e8a68c68ba5cc372644f24fbEli Friedman
542fe363622c32c471e8a68c68ba5cc372644f24fbEli Friedmanstruct G
552fe363622c32c471e8a68c68ba5cc372644f24fbEli Friedman{
5697c0aefe8c0523417ffe8a500a220286e11e7a46Eli Friedman    int g_field;
5797c0aefe8c0523417ffe8a500a220286e11e7a46Eli Friedman};
5897c0aefe8c0523417ffe8a500a220286e11e7a46Eli Friedman
5997c0aefe8c0523417ffe8a500a220286e11e7a46Eli Friedmanstruct H : public G,
6097c0aefe8c0523417ffe8a500a220286e11e7a46Eli Friedman           public virtual D
6197c0aefe8c0523417ffe8a500a220286e11e7a46Eli Friedman{
622fe363622c32c471e8a68c68ba5cc372644f24fbEli Friedman};
632fe363622c32c471e8a68c68ba5cc372644f24fbEli Friedman
64227e483cb1f77ea6dcd38c2ca9fb490894a5f887Eli Friedmanstruct I : public virtual D
65227e483cb1f77ea6dcd38c2ca9fb490894a5f887Eli Friedman{
66227e483cb1f77ea6dcd38c2ca9fb490894a5f887Eli Friedman  virtual ~I(){}
67227e483cb1f77ea6dcd38c2ca9fb490894a5f887Eli Friedman  double q;
68227e483cb1f77ea6dcd38c2ca9fb490894a5f887Eli Friedman};
69227e483cb1f77ea6dcd38c2ca9fb490894a5f887Eli Friedman
709da235244c2de2bcca654b518c66133c30ebde53John McCallstruct K
719da235244c2de2bcca654b518c66133c30ebde53John McCall{
729da235244c2de2bcca654b518c66133c30ebde53John McCall  int k;
739da235244c2de2bcca654b518c66133c30ebde53John McCall};
749da235244c2de2bcca654b518c66133c30ebde53John McCall
759da235244c2de2bcca654b518c66133c30ebde53John McCallstruct L
769da235244c2de2bcca654b518c66133c30ebde53John McCall{
779da235244c2de2bcca654b518c66133c30ebde53John McCall  int l;
789da235244c2de2bcca654b518c66133c30ebde53John McCall};
799da235244c2de2bcca654b518c66133c30ebde53John McCall
809da235244c2de2bcca654b518c66133c30ebde53John McCallstruct M : public virtual K
819da235244c2de2bcca654b518c66133c30ebde53John McCall{
829da235244c2de2bcca654b518c66133c30ebde53John McCall  int m;
839da235244c2de2bcca654b518c66133c30ebde53John McCall};
849da235244c2de2bcca654b518c66133c30ebde53John McCall
859da235244c2de2bcca654b518c66133c30ebde53John McCallstruct N : public L, public M
869da235244c2de2bcca654b518c66133c30ebde53John McCall{
879da235244c2de2bcca654b518c66133c30ebde53John McCall  virtual void f(){}
889da235244c2de2bcca654b518c66133c30ebde53John McCall};
899da235244c2de2bcca654b518c66133c30ebde53John McCall
909da235244c2de2bcca654b518c66133c30ebde53John McCallstruct O : public H, public G {
919da235244c2de2bcca654b518c66133c30ebde53John McCall  virtual void fo(){}
929da235244c2de2bcca654b518c66133c30ebde53John McCall};
939da235244c2de2bcca654b518c66133c30ebde53John McCall
949da235244c2de2bcca654b518c66133c30ebde53John McCallstruct P : public M, public virtual L {
959da235244c2de2bcca654b518c66133c30ebde53John McCall  int p;
969da235244c2de2bcca654b518c66133c30ebde53John McCall};
979da235244c2de2bcca654b518c66133c30ebde53John McCall
98901dd668931a70932ad09092959c42693409a3cdEli Friedmanstruct R {};
999da235244c2de2bcca654b518c66133c30ebde53John McCall
100441c6239c6df8c759bacf6510efbfd434b647066John McCallclass IA {
101441c6239c6df8c759bacf6510efbfd434b647066John McCallpublic:
102441c6239c6df8c759bacf6510efbfd434b647066John McCall  virtual ~IA(){}
103441c6239c6df8c759bacf6510efbfd434b647066John McCall  virtual void ia() = 0;
104441c6239c6df8c759bacf6510efbfd434b647066John McCall};
105441c6239c6df8c759bacf6510efbfd434b647066John McCall
106441c6239c6df8c759bacf6510efbfd434b647066John McCallclass ICh : public virtual IA {
107441c6239c6df8c759bacf6510efbfd434b647066John McCallpublic:
108441c6239c6df8c759bacf6510efbfd434b647066John McCall  virtual ~ICh(){}
109441c6239c6df8c759bacf6510efbfd434b647066John McCall  virtual void ia(){}
110441c6239c6df8c759bacf6510efbfd434b647066John McCall  virtual void iCh(){}
111441c6239c6df8c759bacf6510efbfd434b647066John McCall};
112441c6239c6df8c759bacf6510efbfd434b647066John McCall
113441c6239c6df8c759bacf6510efbfd434b647066John McCallstruct f {
114441c6239c6df8c759bacf6510efbfd434b647066John McCall  virtual int asd() {return -90;}
115441c6239c6df8c759bacf6510efbfd434b647066John McCall};
116441c6239c6df8c759bacf6510efbfd434b647066John McCall
117441c6239c6df8c759bacf6510efbfd434b647066John McCallstruct s : public virtual f {
118441c6239c6df8c759bacf6510efbfd434b647066John McCall  virtual ~s(){}
119441c6239c6df8c759bacf6510efbfd434b647066John McCall  int r;
120441c6239c6df8c759bacf6510efbfd434b647066John McCall  virtual int asd() {return -9;}
121441c6239c6df8c759bacf6510efbfd434b647066John McCall};
122441c6239c6df8c759bacf6510efbfd434b647066John McCall
123441c6239c6df8c759bacf6510efbfd434b647066John McCallstruct sd : virtual s, virtual ICh {
124441c6239c6df8c759bacf6510efbfd434b647066John McCall  virtual ~sd(){}
125441c6239c6df8c759bacf6510efbfd434b647066John McCall  int q;
126441c6239c6df8c759bacf6510efbfd434b647066John McCall  char y;
127441c6239c6df8c759bacf6510efbfd434b647066John McCall  virtual int asd() {return -1;}
128441c6239c6df8c759bacf6510efbfd434b647066John McCall};
129441c6239c6df8c759bacf6510efbfd434b647066John McCallstruct AV {
130441c6239c6df8c759bacf6510efbfd434b647066John McCall  virtual void foo();
131441c6239c6df8c759bacf6510efbfd434b647066John McCall};
132441c6239c6df8c759bacf6510efbfd434b647066John McCallstruct BV : AV {
133441c6239c6df8c759bacf6510efbfd434b647066John McCall};
134441c6239c6df8c759bacf6510efbfd434b647066John McCallstruct CV : virtual BV {
135441c6239c6df8c759bacf6510efbfd434b647066John McCall  CV();
136441c6239c6df8c759bacf6510efbfd434b647066John McCall  virtual void foo();
137441c6239c6df8c759bacf6510efbfd434b647066John McCall};
138441c6239c6df8c759bacf6510efbfd434b647066John McCallstruct DV : BV {
139441c6239c6df8c759bacf6510efbfd434b647066John McCall};
140441c6239c6df8c759bacf6510efbfd434b647066John McCallstruct EV : CV, DV {
141441c6239c6df8c759bacf6510efbfd434b647066John McCall};
1422fe363622c32c471e8a68c68ba5cc372644f24fbEli Friedman#pragma pack(pop)
1432fe363622c32c471e8a68c68ba5cc372644f24fbEli Friedman
1442fe363622c32c471e8a68c68ba5cc372644f24fbEli Friedman// This needs only for building layouts.
1452fe363622c32c471e8a68c68ba5cc372644f24fbEli Friedman// Without this clang doesn`t dump record layouts.
1462fe363622c32c471e8a68c68ba5cc372644f24fbEli Friedmanint main() {
1472fe363622c32c471e8a68c68ba5cc372644f24fbEli Friedman  // This avoid "Can't yet mangle constructors!" for MS ABI.
1482fe363622c32c471e8a68c68ba5cc372644f24fbEli Friedman  C* c;
1492fe363622c32c471e8a68c68ba5cc372644f24fbEli Friedman  c->foo();
1502fe363622c32c471e8a68c68ba5cc372644f24fbEli Friedman  DerivedStruct* v;
15197c0aefe8c0523417ffe8a500a220286e11e7a46Eli Friedman  H* g;
1522fe363622c32c471e8a68c68ba5cc372644f24fbEli Friedman  BaseStruct* u;
153227e483cb1f77ea6dcd38c2ca9fb490894a5f887Eli Friedman  I* i;
1549da235244c2de2bcca654b518c66133c30ebde53John McCall  N* n;
1559da235244c2de2bcca654b518c66133c30ebde53John McCall  O* o;
1569da235244c2de2bcca654b518c66133c30ebde53John McCall  P* p;
157901dd668931a70932ad09092959c42693409a3cdEli Friedman  R* r;
158441c6239c6df8c759bacf6510efbfd434b647066John McCall  sd *h;
159441c6239c6df8c759bacf6510efbfd434b647066John McCall  EV *j;
1602fe363622c32c471e8a68c68ba5cc372644f24fbEli Friedman  return 0;
1612fe363622c32c471e8a68c68ba5cc372644f24fbEli Friedman}
1622fe363622c32c471e8a68c68ba5cc372644f24fbEli Friedman
1632fe363622c32c471e8a68c68ba5cc372644f24fbEli Friedman// CHECK:       0 | class D
164227e483cb1f77ea6dcd38c2ca9fb490894a5f887Eli Friedman// CHECK-NEXT:  0 |   (D vftable pointer)
1652fe363622c32c471e8a68c68ba5cc372644f24fbEli Friedman// CHECK-NEXT:  8 |   double a
1662fe363622c32c471e8a68c68ba5cc372644f24fbEli Friedman
167b2969b1e50580344891a98f5b241f8351fe371cfWarren Hunt// CHECK-NEXT: sizeof=16, align=8
1682fe363622c32c471e8a68c68ba5cc372644f24fbEli Friedman// CHECK-NEXT: nvsize=16, nvalign=8
1692fe363622c32c471e8a68c68ba5cc372644f24fbEli Friedman
1709da235244c2de2bcca654b518c66133c30ebde53John McCall// CHECK: %class.D = type { i32 (...)**, double }
1719bc2c6e3b49523029f54596501cc1f3f2ebcaec2Eli Friedman
1722fe363622c32c471e8a68c68ba5cc372644f24fbEli Friedman// CHECK:       0 | class B
173227e483cb1f77ea6dcd38c2ca9fb490894a5f887Eli Friedman// CHECK-NEXT:  0 |   (B vftable pointer)
1742fe363622c32c471e8a68c68ba5cc372644f24fbEli Friedman// CHECK-NEXT:  4 |   int b_field
1752fe363622c32c471e8a68c68ba5cc372644f24fbEli Friedman
176b2969b1e50580344891a98f5b241f8351fe371cfWarren Hunt// CHECK-NEXT: sizeof=8, align=4
1772fe363622c32c471e8a68c68ba5cc372644f24fbEli Friedman// CHECK-NEXT: nvsize=8, nvalign=4
1782fe363622c32c471e8a68c68ba5cc372644f24fbEli Friedman
1799da235244c2de2bcca654b518c66133c30ebde53John McCall// CHECK: %class.B = type { i32 (...)**, i32 }
1809bc2c6e3b49523029f54596501cc1f3f2ebcaec2Eli Friedman
1812fe363622c32c471e8a68c68ba5cc372644f24fbEli Friedman// CHECK:       0 | class A
1822fe363622c32c471e8a68c68ba5cc372644f24fbEli Friedman// CHECK-NEXT:  0 |   class B (primary base)
183227e483cb1f77ea6dcd38c2ca9fb490894a5f887Eli Friedman// CHECK-NEXT:  0 |     (B vftable pointer)
1842fe363622c32c471e8a68c68ba5cc372644f24fbEli Friedman// CHECK-NEXT:  4 |     int b_field
1852fe363622c32c471e8a68c68ba5cc372644f24fbEli Friedman// CHECK-NEXT:  8 |   int a_field
1862fe363622c32c471e8a68c68ba5cc372644f24fbEli Friedman// CHECK-NEXT: 12 |   char one
1872fe363622c32c471e8a68c68ba5cc372644f24fbEli Friedman
188b2969b1e50580344891a98f5b241f8351fe371cfWarren Hunt// CHECK-NEXT: sizeof=16, align=4
1892fe363622c32c471e8a68c68ba5cc372644f24fbEli Friedman// CHECK-NEXT: nvsize=16, nvalign=4
1902fe363622c32c471e8a68c68ba5cc372644f24fbEli Friedman
1912fe363622c32c471e8a68c68ba5cc372644f24fbEli Friedman// CHECK:       0 | class C
1922fe363622c32c471e8a68c68ba5cc372644f24fbEli Friedman// CHECK-NEXT:  0 |   class D (primary base)
193227e483cb1f77ea6dcd38c2ca9fb490894a5f887Eli Friedman// CHECK-NEXT:  0 |     (D vftable pointer)
1942fe363622c32c471e8a68c68ba5cc372644f24fbEli Friedman// CHECK-NEXT:  8 |     double a
1952fe363622c32c471e8a68c68ba5cc372644f24fbEli Friedman// CHECK-NEXT: 16 |   class B (base)
196227e483cb1f77ea6dcd38c2ca9fb490894a5f887Eli Friedman// CHECK-NEXT: 16 |     (B vftable pointer)
1972fe363622c32c471e8a68c68ba5cc372644f24fbEli Friedman// CHECK-NEXT: 20 |     int b_field
1982fe363622c32c471e8a68c68ba5cc372644f24fbEli Friedman// CHECK-NEXT: 24 |   (C vbtable pointer)
1992fe363622c32c471e8a68c68ba5cc372644f24fbEli Friedman// CHECK-NEXT: 32 |   double c1_field
2002fe363622c32c471e8a68c68ba5cc372644f24fbEli Friedman// CHECK-NEXT: 40 |   int c2_field
2012fe363622c32c471e8a68c68ba5cc372644f24fbEli Friedman// CHECK-NEXT: 48 |   double c3_field
2022fe363622c32c471e8a68c68ba5cc372644f24fbEli Friedman// CHECK-NEXT: 56 |   int c4_field
2032fe363622c32c471e8a68c68ba5cc372644f24fbEli Friedman// CHECK-NEXT: 64 |   class A (virtual base)
2042fe363622c32c471e8a68c68ba5cc372644f24fbEli Friedman// CHECK-NEXT: 64 |     class B (primary base)
205227e483cb1f77ea6dcd38c2ca9fb490894a5f887Eli Friedman// CHECK-NEXT: 64 |       (B vftable pointer)
2062fe363622c32c471e8a68c68ba5cc372644f24fbEli Friedman// CHECK-NEXT: 68 |       int b_field
2072fe363622c32c471e8a68c68ba5cc372644f24fbEli Friedman// CHECK-NEXT: 72 |     int a_field
2082fe363622c32c471e8a68c68ba5cc372644f24fbEli Friedman// CHECK-NEXT: 76 |     char one
2092fe363622c32c471e8a68c68ba5cc372644f24fbEli Friedman
210b2969b1e50580344891a98f5b241f8351fe371cfWarren Hunt// CHECK-NEXT: sizeof=80, align=8
211227e483cb1f77ea6dcd38c2ca9fb490894a5f887Eli Friedman// CHECK-NEXT: nvsize=64, nvalign=8
2129bc2c6e3b49523029f54596501cc1f3f2ebcaec2Eli Friedman
2139bc2c6e3b49523029f54596501cc1f3f2ebcaec2Eli Friedman// CHECK: %class.A = type { %class.B, i32, i8 }
2149bc2c6e3b49523029f54596501cc1f3f2ebcaec2Eli Friedman
2159da235244c2de2bcca654b518c66133c30ebde53John McCall// CHECK: %class.C = type { %class.D, %class.B, i32*, double, i32, double, i32, [4 x i8], %class.A }
2169da235244c2de2bcca654b518c66133c30ebde53John McCall// CHECK: %class.C.base = type { %class.D, %class.B, i32*, double, i32, double, i32 }
2179bc2c6e3b49523029f54596501cc1f3f2ebcaec2Eli Friedman
2182fe363622c32c471e8a68c68ba5cc372644f24fbEli Friedman// CHECK:       0 | struct BaseStruct
2192fe363622c32c471e8a68c68ba5cc372644f24fbEli Friedman// CHECK-NEXT:  0 |   double v0
2202fe363622c32c471e8a68c68ba5cc372644f24fbEli Friedman// CHECK-NEXT:  8 |   float v1
2212fe363622c32c471e8a68c68ba5cc372644f24fbEli Friedman// CHECK-NEXT: 16 |   class C fg
2222fe363622c32c471e8a68c68ba5cc372644f24fbEli Friedman// CHECK-NEXT: 16 |     class D (primary base)
223227e483cb1f77ea6dcd38c2ca9fb490894a5f887Eli Friedman// CHECK-NEXT: 16 |       (D vftable pointer)
2242fe363622c32c471e8a68c68ba5cc372644f24fbEli Friedman// CHECK-NEXT: 24 |       double a
2252fe363622c32c471e8a68c68ba5cc372644f24fbEli Friedman// CHECK-NEXT: 32 |     class B (base)
226227e483cb1f77ea6dcd38c2ca9fb490894a5f887Eli Friedman// CHECK-NEXT: 32 |       (B vftable pointer)
2272fe363622c32c471e8a68c68ba5cc372644f24fbEli Friedman// CHECK-NEXT: 36 |       int b_field
2282fe363622c32c471e8a68c68ba5cc372644f24fbEli Friedman// CHECK-NEXT: 40 |     (C vbtable pointer)
2292fe363622c32c471e8a68c68ba5cc372644f24fbEli Friedman// CHECK-NEXT: 48 |     double c1_field
2302fe363622c32c471e8a68c68ba5cc372644f24fbEli Friedman// CHECK-NEXT: 56 |     int c2_field
2312fe363622c32c471e8a68c68ba5cc372644f24fbEli Friedman// CHECK-NEXT: 64 |     double c3_field
2322fe363622c32c471e8a68c68ba5cc372644f24fbEli Friedman// CHECK-NEXT: 72 |     int c4_field
2332fe363622c32c471e8a68c68ba5cc372644f24fbEli Friedman// CHECK-NEXT: 80 |     class A (virtual base)
2342fe363622c32c471e8a68c68ba5cc372644f24fbEli Friedman// CHECK-NEXT: 80 |       class B (primary base)
235227e483cb1f77ea6dcd38c2ca9fb490894a5f887Eli Friedman// CHECK-NEXT: 80 |         (B vftable pointer)
2362fe363622c32c471e8a68c68ba5cc372644f24fbEli Friedman// CHECK-NEXT: 84 |         int b_field
2372fe363622c32c471e8a68c68ba5cc372644f24fbEli Friedman// CHECK-NEXT: 88 |       int a_field
2382fe363622c32c471e8a68c68ba5cc372644f24fbEli Friedman// CHECK-NEXT: 92 |       char one
2392fe363622c32c471e8a68c68ba5cc372644f24fbEli Friedman
240b2969b1e50580344891a98f5b241f8351fe371cfWarren Hunt// CHECK-NEXT: sizeof=80, align=8
241227e483cb1f77ea6dcd38c2ca9fb490894a5f887Eli Friedman// CHECK-NEXT: nvsize=64, nvalign=8
2422fe363622c32c471e8a68c68ba5cc372644f24fbEli Friedman
243b2969b1e50580344891a98f5b241f8351fe371cfWarren Hunt// CHECK: sizeof=96, align=8
2442fe363622c32c471e8a68c68ba5cc372644f24fbEli Friedman// CHECK-NEXT: nvsize=96, nvalign=8
2452fe363622c32c471e8a68c68ba5cc372644f24fbEli Friedman
2469bc2c6e3b49523029f54596501cc1f3f2ebcaec2Eli Friedman// CHECK: %struct.BaseStruct = type { double, float, %class.C }
2479bc2c6e3b49523029f54596501cc1f3f2ebcaec2Eli Friedman
2482fe363622c32c471e8a68c68ba5cc372644f24fbEli Friedman// CHECK:       0 | struct DerivedStruct
2492fe363622c32c471e8a68c68ba5cc372644f24fbEli Friedman// CHECK-NEXT:  0 |   struct BaseStruct (base)
2502fe363622c32c471e8a68c68ba5cc372644f24fbEli Friedman// CHECK-NEXT:  0 |     double v0
2512fe363622c32c471e8a68c68ba5cc372644f24fbEli Friedman// CHECK-NEXT:  8 |     float v1
2522fe363622c32c471e8a68c68ba5cc372644f24fbEli Friedman// CHECK-NEXT: 16 |     class C fg
2532fe363622c32c471e8a68c68ba5cc372644f24fbEli Friedman// CHECK-NEXT: 16 |       class D (primary base)
254227e483cb1f77ea6dcd38c2ca9fb490894a5f887Eli Friedman// CHECK-NEXT: 16 |         (D vftable pointer)
2552fe363622c32c471e8a68c68ba5cc372644f24fbEli Friedman// CHECK-NEXT: 24 |         double a
2562fe363622c32c471e8a68c68ba5cc372644f24fbEli Friedman// CHECK-NEXT: 32 |       class B (base)
257227e483cb1f77ea6dcd38c2ca9fb490894a5f887Eli Friedman// CHECK-NEXT: 32 |         (B vftable pointer)
2582fe363622c32c471e8a68c68ba5cc372644f24fbEli Friedman// CHECK-NEXT: 36 |         int b_field
2592fe363622c32c471e8a68c68ba5cc372644f24fbEli Friedman// CHECK-NEXT: 40 |       (C vbtable pointer)
2602fe363622c32c471e8a68c68ba5cc372644f24fbEli Friedman// CHECK-NEXT: 48 |       double c1_field
2612fe363622c32c471e8a68c68ba5cc372644f24fbEli Friedman// CHECK-NEXT: 56 |       int c2_field
2622fe363622c32c471e8a68c68ba5cc372644f24fbEli Friedman// CHECK-NEXT: 64 |       double c3_field
2632fe363622c32c471e8a68c68ba5cc372644f24fbEli Friedman// CHECK-NEXT: 72 |       int c4_field
2642fe363622c32c471e8a68c68ba5cc372644f24fbEli Friedman// CHECK-NEXT: 80 |       class A (virtual base)
2652fe363622c32c471e8a68c68ba5cc372644f24fbEli Friedman// CHECK-NEXT: 80 |         class B (primary base)
266227e483cb1f77ea6dcd38c2ca9fb490894a5f887Eli Friedman// CHECK-NEXT: 80 |           (B vftable pointer)
2672fe363622c32c471e8a68c68ba5cc372644f24fbEli Friedman// CHECK-NEXT: 84 |           int b_field
2682fe363622c32c471e8a68c68ba5cc372644f24fbEli Friedman// CHECK-NEXT: 88 |         int a_field
2692fe363622c32c471e8a68c68ba5cc372644f24fbEli Friedman// CHECK-NEXT: 92 |         char one
270b2969b1e50580344891a98f5b241f8351fe371cfWarren Hunt// CHECK-NEXT: sizeof=80, align=8
271227e483cb1f77ea6dcd38c2ca9fb490894a5f887Eli Friedman// CHECK-NEXT: nvsize=64, nvalign=8
2722fe363622c32c471e8a68c68ba5cc372644f24fbEli Friedman
2732fe363622c32c471e8a68c68ba5cc372644f24fbEli Friedman// CHECK: 96 |   int x
274b2969b1e50580344891a98f5b241f8351fe371cfWarren Hunt// CHECK-NEXT: sizeof=104, align=8
2752fe363622c32c471e8a68c68ba5cc372644f24fbEli Friedman// CHECK-NEXT: nvsize=104, nvalign=8
27697c0aefe8c0523417ffe8a500a220286e11e7a46Eli Friedman
2779bc2c6e3b49523029f54596501cc1f3f2ebcaec2Eli Friedman// CHECK: %struct.DerivedStruct = type { %struct.BaseStruct, i32 }
2789bc2c6e3b49523029f54596501cc1f3f2ebcaec2Eli Friedman
27997c0aefe8c0523417ffe8a500a220286e11e7a46Eli Friedman// CHECK:      0 | struct G
28097c0aefe8c0523417ffe8a500a220286e11e7a46Eli Friedman// CHECK-NEXT: 0 |   int g_field
281b2969b1e50580344891a98f5b241f8351fe371cfWarren Hunt// CHECK-NEXT: sizeof=4, align=4
28297c0aefe8c0523417ffe8a500a220286e11e7a46Eli Friedman// CHECK-NEXT: nvsize=4, nvalign=4
28397c0aefe8c0523417ffe8a500a220286e11e7a46Eli Friedman
28497c0aefe8c0523417ffe8a500a220286e11e7a46Eli Friedman// CHECK:       0 | struct H
28597c0aefe8c0523417ffe8a500a220286e11e7a46Eli Friedman// CHECK-NEXT:  0 |   struct G (base)
28697c0aefe8c0523417ffe8a500a220286e11e7a46Eli Friedman// CHECK-NEXT:  0 |     int g_field
287227e483cb1f77ea6dcd38c2ca9fb490894a5f887Eli Friedman// CHECK-NEXT:  4 |   (H vbtable pointer)
28897c0aefe8c0523417ffe8a500a220286e11e7a46Eli Friedman// CHECK-NEXT:  8 |   class D (virtual base)
289227e483cb1f77ea6dcd38c2ca9fb490894a5f887Eli Friedman// CHECK-NEXT:  8 |     (D vftable pointer)
29097c0aefe8c0523417ffe8a500a220286e11e7a46Eli Friedman// CHECK-NEXT: 16 |     double a
291b2969b1e50580344891a98f5b241f8351fe371cfWarren Hunt// CHECK-NEXT: sizeof=24, align=8
292651f13cea278ec967336033dd032faef0e9fc2ecStephen Hines// CHECK-NEXT: nvsize=8, nvalign=8
293227e483cb1f77ea6dcd38c2ca9fb490894a5f887Eli Friedman
2949da235244c2de2bcca654b518c66133c30ebde53John McCall// CHECK: %struct.H = type { %struct.G, i32*, %class.D }
2959bc2c6e3b49523029f54596501cc1f3f2ebcaec2Eli Friedman
296227e483cb1f77ea6dcd38c2ca9fb490894a5f887Eli Friedman// CHECK:       0 | struct I
297227e483cb1f77ea6dcd38c2ca9fb490894a5f887Eli Friedman// CHECK-NEXT:  0 |   (I vftable pointer)
298227e483cb1f77ea6dcd38c2ca9fb490894a5f887Eli Friedman// CHECK-NEXT:  8 |   (I vbtable pointer)
299227e483cb1f77ea6dcd38c2ca9fb490894a5f887Eli Friedman// CHECK-NEXT: 16 |   double q
300227e483cb1f77ea6dcd38c2ca9fb490894a5f887Eli Friedman// CHECK-NEXT: 24 |   class D (virtual base)
301227e483cb1f77ea6dcd38c2ca9fb490894a5f887Eli Friedman// CHECK-NEXT: 24 |     (D vftable pointer)
302227e483cb1f77ea6dcd38c2ca9fb490894a5f887Eli Friedman// CHECK-NEXT: 32 |     double a
303b2969b1e50580344891a98f5b241f8351fe371cfWarren Hunt// CHECK-NEXT: sizeof=40, align=8
30497c0aefe8c0523417ffe8a500a220286e11e7a46Eli Friedman// CHECK-NEXT: nvsize=24, nvalign=8
3059bc2c6e3b49523029f54596501cc1f3f2ebcaec2Eli Friedman
3069da235244c2de2bcca654b518c66133c30ebde53John McCall// CHECK: %struct.I = type { i32 (...)**, [4 x i8], i32*, double, %class.D }
3079da235244c2de2bcca654b518c66133c30ebde53John McCall// CHECK: %struct.I.base = type { i32 (...)**, [4 x i8], i32*, double }
3089da235244c2de2bcca654b518c66133c30ebde53John McCall
3099da235244c2de2bcca654b518c66133c30ebde53John McCall// CHECK:       0 | struct L
3109da235244c2de2bcca654b518c66133c30ebde53John McCall// CHECK-NEXT:  0 |   int l
311b2969b1e50580344891a98f5b241f8351fe371cfWarren Hunt// CHECK-NEXT: sizeof=4, align=4
3129da235244c2de2bcca654b518c66133c30ebde53John McCall// CHECK-NEXT: nvsize=4, nvalign=4
3139da235244c2de2bcca654b518c66133c30ebde53John McCall
3149da235244c2de2bcca654b518c66133c30ebde53John McCall// CHECK:       0 | struct K
3159da235244c2de2bcca654b518c66133c30ebde53John McCall// CHECK-NEXT:  0 |   int k
316b2969b1e50580344891a98f5b241f8351fe371cfWarren Hunt// CHECK-NEXT: sizeof=4, align=4
3179da235244c2de2bcca654b518c66133c30ebde53John McCall// CHECK-NEXT: nvsize=4, nvalign=4
3189da235244c2de2bcca654b518c66133c30ebde53John McCall
3199da235244c2de2bcca654b518c66133c30ebde53John McCall// CHECK:       0 | struct M
3209da235244c2de2bcca654b518c66133c30ebde53John McCall// CHECK-NEXT:  0 |   (M vbtable pointer)
3219da235244c2de2bcca654b518c66133c30ebde53John McCall// CHECK-NEXT:  4 |   int m
3229da235244c2de2bcca654b518c66133c30ebde53John McCall// CHECK-NEXT:  8 |   struct K (virtual base)
3239da235244c2de2bcca654b518c66133c30ebde53John McCall// CHECK-NEXT:  8 |     int k
324b2969b1e50580344891a98f5b241f8351fe371cfWarren Hunt// CHECK-NEXT: sizeof=12, align=4
3259da235244c2de2bcca654b518c66133c30ebde53John McCall
3269da235244c2de2bcca654b518c66133c30ebde53John McCall//CHECK: %struct.M = type { i32*, i32, %struct.K }
3279da235244c2de2bcca654b518c66133c30ebde53John McCall//CHECK: %struct.M.base = type { i32*, i32 }
3289da235244c2de2bcca654b518c66133c30ebde53John McCall
3299da235244c2de2bcca654b518c66133c30ebde53John McCall// CHECK:       0 | struct N
330b2969b1e50580344891a98f5b241f8351fe371cfWarren Hunt// CHECK-NEXT:  0 |   (N vftable pointer)
3319da235244c2de2bcca654b518c66133c30ebde53John McCall// CHECK-NEXT:  4 |   struct L (base)
3329da235244c2de2bcca654b518c66133c30ebde53John McCall// CHECK-NEXT:  4 |     int l
3339da235244c2de2bcca654b518c66133c30ebde53John McCall// CHECK-NEXT:  8 |   struct M (base)
3349da235244c2de2bcca654b518c66133c30ebde53John McCall// CHECK-NEXT:  8 |     (M vbtable pointer)
3359da235244c2de2bcca654b518c66133c30ebde53John McCall// CHECK-NEXT: 12 |     int m
3369da235244c2de2bcca654b518c66133c30ebde53John McCall// CHECK-NEXT: 16 |   struct K (virtual base)
3379da235244c2de2bcca654b518c66133c30ebde53John McCall// CHECK-NEXT: 16 |     int k
338b2969b1e50580344891a98f5b241f8351fe371cfWarren Hunt// CHECK-NEXT: sizeof=20, align=4
3399da235244c2de2bcca654b518c66133c30ebde53John McCall// CHECK-NEXT: nvsize=16, nvalign=4
3409da235244c2de2bcca654b518c66133c30ebde53John McCall
3419da235244c2de2bcca654b518c66133c30ebde53John McCall//CHECK: %struct.N = type { i32 (...)**, %struct.L, %struct.M.base, %struct.K }
3429da235244c2de2bcca654b518c66133c30ebde53John McCall
3439da235244c2de2bcca654b518c66133c30ebde53John McCall// CHECK:       0 | struct O
3449da235244c2de2bcca654b518c66133c30ebde53John McCall// CHECK-NEXT:  0 |   (O vftable pointer)
345b2969b1e50580344891a98f5b241f8351fe371cfWarren Hunt// CHECK-NEXT:  8 |   struct H (base)
346b2969b1e50580344891a98f5b241f8351fe371cfWarren Hunt// CHECK-NEXT:  8 |     struct G (base)
347b2969b1e50580344891a98f5b241f8351fe371cfWarren Hunt// CHECK-NEXT:  8 |       int g_field
348b2969b1e50580344891a98f5b241f8351fe371cfWarren Hunt// CHECK-NEXT: 12 |     (H vbtable pointer)
349b2969b1e50580344891a98f5b241f8351fe371cfWarren Hunt// CHECK-NEXT: 16 |   struct G (base)
350b2969b1e50580344891a98f5b241f8351fe371cfWarren Hunt// CHECK-NEXT: 16 |     int g_field
351b2969b1e50580344891a98f5b241f8351fe371cfWarren Hunt// CHECK-NEXT: 24 |   class D (virtual base)
352b2969b1e50580344891a98f5b241f8351fe371cfWarren Hunt// CHECK-NEXT: 24 |     (D vftable pointer)
353b2969b1e50580344891a98f5b241f8351fe371cfWarren Hunt// CHECK-NEXT: 32 |     double a
354b2969b1e50580344891a98f5b241f8351fe371cfWarren Hunt// CHECK-NEXT:    | [sizeof=40, align=8
355b2969b1e50580344891a98f5b241f8351fe371cfWarren Hunt// CHECK-NEXT:    |  nvsize=24, nvalign=8]
356b2969b1e50580344891a98f5b241f8351fe371cfWarren Hunt
357651f13cea278ec967336033dd032faef0e9fc2ecStephen Hines// CHECK: struct.O = type { i32 (...)**, [4 x i8], %struct.H.base, %struct.G, %class.D }
358b2969b1e50580344891a98f5b241f8351fe371cfWarren Hunt// CHECK: struct.O.base = type { i32 (...)**, [4 x i8], %struct.H.base, %struct.G, [4 x i8] }
3599da235244c2de2bcca654b518c66133c30ebde53John McCall
3609da235244c2de2bcca654b518c66133c30ebde53John McCall
3619da235244c2de2bcca654b518c66133c30ebde53John McCall// CHECK:       0 | struct P
3629da235244c2de2bcca654b518c66133c30ebde53John McCall// CHECK-NEXT:  0 |   struct M (base)
3639da235244c2de2bcca654b518c66133c30ebde53John McCall// CHECK-NEXT:  0 |     (M vbtable pointer)
3649da235244c2de2bcca654b518c66133c30ebde53John McCall// CHECK-NEXT:  4 |     int m
3659da235244c2de2bcca654b518c66133c30ebde53John McCall// CHECK-NEXT:  8 |   int p
3669da235244c2de2bcca654b518c66133c30ebde53John McCall// CHECK-NEXT: 12 |   struct K (virtual base)
3679da235244c2de2bcca654b518c66133c30ebde53John McCall// CHECK-NEXT: 12 |     int k
3689da235244c2de2bcca654b518c66133c30ebde53John McCall// CHECK-NEXT: 16 |   struct L (virtual base)
3699da235244c2de2bcca654b518c66133c30ebde53John McCall// CHECK-NEXT: 16 |     int l
370b2969b1e50580344891a98f5b241f8351fe371cfWarren Hunt// CHECK-NEXT: sizeof=20, align=4
3719da235244c2de2bcca654b518c66133c30ebde53John McCall// CHECK-NEXT: nvsize=12, nvalign=4
3729da235244c2de2bcca654b518c66133c30ebde53John McCall
3739da235244c2de2bcca654b518c66133c30ebde53John McCall//CHECK: %struct.P = type { %struct.M.base, i32, %struct.K, %struct.L }
374901dd668931a70932ad09092959c42693409a3cdEli Friedman
375901dd668931a70932ad09092959c42693409a3cdEli Friedman// CHECK:       0 | struct R (empty)
376b2969b1e50580344891a98f5b241f8351fe371cfWarren Hunt// CHECK-NEXT:  sizeof=1, align=1
377901dd668931a70932ad09092959c42693409a3cdEli Friedman// CHECK-NEXT:  nvsize=0, nvalign=1
378901dd668931a70932ad09092959c42693409a3cdEli Friedman
379901dd668931a70932ad09092959c42693409a3cdEli Friedman//CHECK: %struct.R = type { i8 }
380441c6239c6df8c759bacf6510efbfd434b647066John McCall
381441c6239c6df8c759bacf6510efbfd434b647066John McCall// CHECK:       0 | struct f
382441c6239c6df8c759bacf6510efbfd434b647066John McCall// CHECK-NEXT:  0 |   (f vftable pointer)
383b2969b1e50580344891a98f5b241f8351fe371cfWarren Hunt// CHECK-NEXT: sizeof=4, align=4
384441c6239c6df8c759bacf6510efbfd434b647066John McCall// CHECK-NEXT: nvsize=4, nvalign=4
385441c6239c6df8c759bacf6510efbfd434b647066John McCall
386441c6239c6df8c759bacf6510efbfd434b647066John McCall// CHECK:       0 | struct s
387441c6239c6df8c759bacf6510efbfd434b647066John McCall// CHECK-NEXT:  0 |   (s vftable pointer)
388441c6239c6df8c759bacf6510efbfd434b647066John McCall// CHECK-NEXT:  4 |   (s vbtable pointer)
389441c6239c6df8c759bacf6510efbfd434b647066John McCall// CHECK-NEXT:  8 |   int r
390441c6239c6df8c759bacf6510efbfd434b647066John McCall// CHECK-NEXT: 12 |   (vtordisp for vbase f)
391441c6239c6df8c759bacf6510efbfd434b647066John McCall// CHECK-NEXT: 16 |   struct f (virtual base)
392441c6239c6df8c759bacf6510efbfd434b647066John McCall// CHECK-NEXT: 16 |     (f vftable pointer)
393b2969b1e50580344891a98f5b241f8351fe371cfWarren Hunt// CHECK-NEXT: sizeof=20, align=4
394441c6239c6df8c759bacf6510efbfd434b647066John McCall// CHECK-NEXT: nvsize=12, nvalign=4
395441c6239c6df8c759bacf6510efbfd434b647066John McCall
396441c6239c6df8c759bacf6510efbfd434b647066John McCall// CHECK:       0 | class IA
397441c6239c6df8c759bacf6510efbfd434b647066John McCall// CHECK-NEXT:  0 |   (IA vftable pointer)
398b2969b1e50580344891a98f5b241f8351fe371cfWarren Hunt// CHECK-NEXT:  sizeof=4, align=4
399441c6239c6df8c759bacf6510efbfd434b647066John McCall// CHECK-NEXT:  nvsize=4, nvalign=4
400441c6239c6df8c759bacf6510efbfd434b647066John McCall
401441c6239c6df8c759bacf6510efbfd434b647066John McCall// CHECK:       0 | class ICh
402441c6239c6df8c759bacf6510efbfd434b647066John McCall// CHECK-NEXT:  0 |   (ICh vftable pointer)
403441c6239c6df8c759bacf6510efbfd434b647066John McCall// CHECK-NEXT:  4 |   (ICh vbtable pointer)
404441c6239c6df8c759bacf6510efbfd434b647066John McCall// CHECK-NEXT:  8 |   (vtordisp for vbase IA)
405441c6239c6df8c759bacf6510efbfd434b647066John McCall// CHECK-NEXT: 12 |   class IA (virtual base)
406441c6239c6df8c759bacf6510efbfd434b647066John McCall// CHECK-NEXT: 12 |     (IA vftable pointer)
407b2969b1e50580344891a98f5b241f8351fe371cfWarren Hunt// CHECK-NEXT: sizeof=16, align=4
408441c6239c6df8c759bacf6510efbfd434b647066John McCall// CHECK-NEXT: nvsize=8, nvalign=4
409441c6239c6df8c759bacf6510efbfd434b647066John McCall
410441c6239c6df8c759bacf6510efbfd434b647066John McCall// CHECK:       0 | struct sd
411441c6239c6df8c759bacf6510efbfd434b647066John McCall// CHECK-NEXT:  0 |   (sd vbtable pointer)
412441c6239c6df8c759bacf6510efbfd434b647066John McCall// CHECK-NEXT:  4 |   int q
413441c6239c6df8c759bacf6510efbfd434b647066John McCall// CHECK-NEXT:  8 |   char y
414441c6239c6df8c759bacf6510efbfd434b647066John McCall// CHECK-NEXT: 12 |   (vtordisp for vbase f)
415441c6239c6df8c759bacf6510efbfd434b647066John McCall// CHECK-NEXT: 16 |   struct f (virtual base)
416441c6239c6df8c759bacf6510efbfd434b647066John McCall// CHECK-NEXT: 16 |     (f vftable pointer)
417441c6239c6df8c759bacf6510efbfd434b647066John McCall// CHECK-NEXT: 20 |   struct s (virtual base)
418441c6239c6df8c759bacf6510efbfd434b647066John McCall// CHECK-NEXT: 20 |     (s vftable pointer)
419441c6239c6df8c759bacf6510efbfd434b647066John McCall// CHECK-NEXT: 24 |     (s vbtable pointer)
420441c6239c6df8c759bacf6510efbfd434b647066John McCall// CHECK-NEXT: 28 |     int r
421441c6239c6df8c759bacf6510efbfd434b647066John McCall// CHECK-NEXT: 32 |   (vtordisp for vbase IA)
422441c6239c6df8c759bacf6510efbfd434b647066John McCall// CHECK-NEXT: 36 |   class IA (virtual base)
423441c6239c6df8c759bacf6510efbfd434b647066John McCall// CHECK-NEXT: 36 |     (IA vftable pointer)
424441c6239c6df8c759bacf6510efbfd434b647066John McCall// CHECK-NEXT: 40 |   class ICh (virtual base)
425441c6239c6df8c759bacf6510efbfd434b647066John McCall// CHECK-NEXT: 40 |     (ICh vftable pointer)
426441c6239c6df8c759bacf6510efbfd434b647066John McCall// CHECK-NEXT: 44 |     (ICh vbtable pointer)
427b2969b1e50580344891a98f5b241f8351fe371cfWarren Hunt// CHECK-NEXT: sizeof=48, align=4
428441c6239c6df8c759bacf6510efbfd434b647066John McCall// CHECK-NEXT: nvsize=12, nvalign=4
429441c6239c6df8c759bacf6510efbfd434b647066John McCall
430441c6239c6df8c759bacf6510efbfd434b647066John McCall// CHECK: %struct.f = type { i32 (...)** }
431651f13cea278ec967336033dd032faef0e9fc2ecStephen Hines// CHECK: %struct.s = type { i32 (...)**, i32*, i32, i32, %struct.f }
432441c6239c6df8c759bacf6510efbfd434b647066John McCall// CHECK: %class.IA = type { i32 (...)** }
433651f13cea278ec967336033dd032faef0e9fc2ecStephen Hines// CHECK: %class.ICh = type { i32 (...)**, i32*, i32, %class.IA }
434651f13cea278ec967336033dd032faef0e9fc2ecStephen Hines// CHECK: %struct.sd = type { i32*, i32, i8, i32, %struct.f, %struct.s.base, i32, %class.IA, %class.ICh.base }
435441c6239c6df8c759bacf6510efbfd434b647066John McCall
436441c6239c6df8c759bacf6510efbfd434b647066John McCall// CHECK:       0 | struct AV
437441c6239c6df8c759bacf6510efbfd434b647066John McCall// CHECK-NEXT:  0 |   (AV vftable pointer)
438b2969b1e50580344891a98f5b241f8351fe371cfWarren Hunt// CHECK-NEXT: sizeof=4, align=4
439441c6239c6df8c759bacf6510efbfd434b647066John McCall// CHECK-NEXT: nvsize=4, nvalign=4
440441c6239c6df8c759bacf6510efbfd434b647066John McCall
441441c6239c6df8c759bacf6510efbfd434b647066John McCall
442441c6239c6df8c759bacf6510efbfd434b647066John McCall// CHECK:       0 | struct BV
443441c6239c6df8c759bacf6510efbfd434b647066John McCall// CHECK-NEXT:  0 |   struct AV (primary base)
444441c6239c6df8c759bacf6510efbfd434b647066John McCall// CHECK-NEXT:  0 |     (AV vftable pointer)
445b2969b1e50580344891a98f5b241f8351fe371cfWarren Hunt// CHECK-NEXT: sizeof=4, align=4
446441c6239c6df8c759bacf6510efbfd434b647066John McCall// CHECK-NEXT: nvsize=4, nvalign=4
447441c6239c6df8c759bacf6510efbfd434b647066John McCall
448441c6239c6df8c759bacf6510efbfd434b647066John McCall
449441c6239c6df8c759bacf6510efbfd434b647066John McCall// CHECK:       0 | struct CV
450441c6239c6df8c759bacf6510efbfd434b647066John McCall// CHECK-NEXT:  0 |   (CV vbtable pointer)
451441c6239c6df8c759bacf6510efbfd434b647066John McCall// CHECK-NEXT:  4 |   (vtordisp for vbase BV)
452441c6239c6df8c759bacf6510efbfd434b647066John McCall// CHECK-NEXT:  8 |   struct BV (virtual base)
453441c6239c6df8c759bacf6510efbfd434b647066John McCall// CHECK-NEXT:  8 |     struct AV (primary base)
454441c6239c6df8c759bacf6510efbfd434b647066John McCall// CHECK-NEXT:  8 |       (AV vftable pointer)
455b2969b1e50580344891a98f5b241f8351fe371cfWarren Hunt// CHECK-NEXT: sizeof=12, align=4
456441c6239c6df8c759bacf6510efbfd434b647066John McCall// CHECK-NEXT: nvsize=4, nvalign=4
457441c6239c6df8c759bacf6510efbfd434b647066John McCall
458441c6239c6df8c759bacf6510efbfd434b647066John McCall// CHECK: %struct.AV = type { i32 (...)** }
459441c6239c6df8c759bacf6510efbfd434b647066John McCall// CHECK: %struct.BV = type { %struct.AV }
460651f13cea278ec967336033dd032faef0e9fc2ecStephen Hines// CHECK: %struct.CV = type { i32*, i32, %struct.BV }
461441c6239c6df8c759bacf6510efbfd434b647066John McCall// CHECK: %struct.CV.base = type { i32* }
462441c6239c6df8c759bacf6510efbfd434b647066John McCall
463441c6239c6df8c759bacf6510efbfd434b647066John McCall// CHECK:       0 | struct DV
464441c6239c6df8c759bacf6510efbfd434b647066John McCall// CHECK-NEXT:  0 |   struct BV (primary base)
465441c6239c6df8c759bacf6510efbfd434b647066John McCall// CHECK-NEXT:  0 |     struct AV (primary base)
466441c6239c6df8c759bacf6510efbfd434b647066John McCall// CHECK-NEXT:  0 |       (AV vftable pointer)
467b2969b1e50580344891a98f5b241f8351fe371cfWarren Hunt// CHECK-NEXT: sizeof=4, align=4
468441c6239c6df8c759bacf6510efbfd434b647066John McCall// CHECK-NEXT: nvsize=4, nvalign=4
469441c6239c6df8c759bacf6510efbfd434b647066John McCall
470441c6239c6df8c759bacf6510efbfd434b647066John McCall// CHECK: %struct.DV = type { %struct.BV }
471441c6239c6df8c759bacf6510efbfd434b647066John McCall
472441c6239c6df8c759bacf6510efbfd434b647066John McCall// CHECK:       0 | struct EV
473441c6239c6df8c759bacf6510efbfd434b647066John McCall// CHECK-NEXT:  0 |   struct DV (primary base)
474441c6239c6df8c759bacf6510efbfd434b647066John McCall// CHECK-NEXT:  0 |     struct BV (primary base)
475441c6239c6df8c759bacf6510efbfd434b647066John McCall// CHECK-NEXT:  0 |       struct AV (primary base)
476441c6239c6df8c759bacf6510efbfd434b647066John McCall// CHECK-NEXT:  0 |         (AV vftable pointer)
477651f13cea278ec967336033dd032faef0e9fc2ecStephen Hines// CHECK-NEXT:  4 |   struct CV (base)
478651f13cea278ec967336033dd032faef0e9fc2ecStephen Hines// CHECK-NEXT:  4 |     (CV vbtable pointer)
479441c6239c6df8c759bacf6510efbfd434b647066John McCall// CHECK-NEXT:  8 |   (vtordisp for vbase BV)
480441c6239c6df8c759bacf6510efbfd434b647066John McCall// CHECK-NEXT: 12 |   struct BV (virtual base)
481441c6239c6df8c759bacf6510efbfd434b647066John McCall// CHECK-NEXT: 12 |     struct AV (primary base)
482441c6239c6df8c759bacf6510efbfd434b647066John McCall// CHECK-NEXT: 12 |       (AV vftable pointer)
483b2969b1e50580344891a98f5b241f8351fe371cfWarren Hunt// CHECK-NEXT: sizeof=16, align=4
484441c6239c6df8c759bacf6510efbfd434b647066John McCall// CHECK-NEXT: nvsize=8, nvalign=4
485441c6239c6df8c759bacf6510efbfd434b647066John McCall
486651f13cea278ec967336033dd032faef0e9fc2ecStephen Hines// CHECK: %struct.EV = type { %struct.DV, %struct.CV.base, i32, %struct.BV }
487441c6239c6df8c759bacf6510efbfd434b647066John McCall// CHECK: %struct.EV.base = type { %struct.DV, %struct.CV.base }
488441c6239c6df8c759bacf6510efbfd434b647066John McCall
489441c6239c6df8c759bacf6510efbfd434b647066John McCall// Overriding a method means that all the vbases containing that
490b2969b1e50580344891a98f5b241f8351fe371cfWarren Hunt// method need a vtordisp.  Note: this code will cause an error in cl.exe.
491441c6239c6df8c759bacf6510efbfd434b647066John McCallnamespace test1 {
492441c6239c6df8c759bacf6510efbfd434b647066John McCall  struct A { virtual void foo(); };
493441c6239c6df8c759bacf6510efbfd434b647066John McCall  struct B : A {};
494c2244f6aa1c378657b96f7e076a705845466a93eJohn McCall  struct C : virtual A, virtual B { C(); virtual void foo(); };
495441c6239c6df8c759bacf6510efbfd434b647066John McCall  void test() { C *c; }
496441c6239c6df8c759bacf6510efbfd434b647066John McCall
497441c6239c6df8c759bacf6510efbfd434b647066John McCall// CHECK:        0 | struct test1::C
498441c6239c6df8c759bacf6510efbfd434b647066John McCall// CHECK-NEXT:   0 |   (C vbtable pointer)
499441c6239c6df8c759bacf6510efbfd434b647066John McCall// CHECK-NEXT:   4 |   (vtordisp for vbase A)
500441c6239c6df8c759bacf6510efbfd434b647066John McCall// CHECK-NEXT:   8 |   struct test1::A (virtual base)
501441c6239c6df8c759bacf6510efbfd434b647066John McCall// CHECK-NEXT:   8 |     (A vftable pointer)
502441c6239c6df8c759bacf6510efbfd434b647066John McCall// CHECK-NEXT:  12 |   (vtordisp for vbase B)
503441c6239c6df8c759bacf6510efbfd434b647066John McCall// CHECK-NEXT:  16 |   struct test1::B (virtual base)
504441c6239c6df8c759bacf6510efbfd434b647066John McCall// CHECK-NEXT:  16 |     struct test1::A (primary base)
505441c6239c6df8c759bacf6510efbfd434b647066John McCall// CHECK-NEXT:  16 |       (A vftable pointer)
506b2969b1e50580344891a98f5b241f8351fe371cfWarren Hunt// CHECK-NEXT:  sizeof=20, align=4
507441c6239c6df8c759bacf6510efbfd434b647066John McCall// CHECK-NEXT:  nvsize=4, nvalign=4
508441c6239c6df8c759bacf6510efbfd434b647066John McCall}
509