[clang][modules] Don't prevent translation of FW_Private includes when explicitly...
[llvm-project.git] / clang / test / Layout / ms-x86-empty-virtual-base.cpp
blob8c350a2a56e1855f31abb18efd9374d60b6b3395
1 // RUN: %clang_cc1 -fno-rtti -emit-llvm-only -triple i686-pc-win32 -fms-extensions -fdump-record-layouts -fsyntax-only %s 2>/dev/null \
2 // RUN: | FileCheck %s --strict-whitespace
3 // RUN: %clang_cc1 -fno-rtti -emit-llvm-only -triple x86_64-pc-win32 -fms-extensions -fdump-record-layouts -fsyntax-only %s 2>/dev/null \
4 // RUN: | FileCheck %s -check-prefix CHECK-X64 --strict-whitespace
6 extern "C" int printf(const char *fmt, ...);
8 struct __declspec(align(8)) B0 { B0() {printf("B0 : %3d\n", ((int)(__SIZE_TYPE__)this)&0xfff);} };
9 struct __declspec(align(8)) B1 { B1() {printf("B1 : %3d\n", ((int)(__SIZE_TYPE__)this)&0xfff);} };
10 struct __declspec(align(8)) B2 { B2() {printf("B2 : %3d\n", ((int)(__SIZE_TYPE__)this)&0xfff);} };
11 struct __declspec(align(8)) B3 { B3() {printf("B3 : %3d\n", ((int)(__SIZE_TYPE__)this)&0xfff);} };
12 struct __declspec(align(8)) B4 { B4() {printf("B4 : %3d\n", ((int)(__SIZE_TYPE__)this)&0xfff);} };
14 struct C0 { int a; C0() : a(0xf00000C0) {printf("C0 : %3d\n", ((int)(__SIZE_TYPE__)this)&0xfff);} };
15 struct C1 { int a; C1() : a(0xf00000C1) {printf("C1 : %3d\n", ((int)(__SIZE_TYPE__)this)&0xfff);} };
16 struct C2 { int a; C2() : a(0xf00000C2) {printf("C2 : %3d\n", ((int)(__SIZE_TYPE__)this)&0xfff);} };
17 struct C3 { int a; C3() : a(0xf00000C3) {printf("C3 : %3d\n", ((int)(__SIZE_TYPE__)this)&0xfff);} };
18 struct C4 { int a; C4() : a(0xf00000C4) {printf("C4 : %3d\n", ((int)(__SIZE_TYPE__)this)&0xfff);} };
20 struct __declspec(align(16)) D0 { D0() {printf("D0 : %3d\n", ((int)(__SIZE_TYPE__)this)&0xfff);} virtual void f() {} };
21 struct D1 { D1() {printf("D1 : %3d\n", ((int)(__SIZE_TYPE__)this)&0xfff);} };
22 struct D2 { int a[8]; D2() {printf("D2 : %3d\n", ((int)(__SIZE_TYPE__)this)&0xfff);} };
24 struct A : virtual B0 {
25 int a;
26 A() : a(0xf000000A) {printf("X : %3d\n", ((int)(__SIZE_TYPE__)this)&0xfff);}
29 // CHECK-LABEL: 0 | struct A{{$}}
30 // CHECK-NEXT: 0 | (A vbtable pointer)
31 // CHECK-NEXT: 4 | int a
32 // CHECK-NEXT: 8 | struct B0 (virtual base) (empty)
33 // CHECK-NEXT: | [sizeof=8, align=8
34 // CHECK-NEXT: | nvsize=8, nvalign=8]
35 // CHECK-X64-LABEL: 0 | struct A{{$}}
36 // CHECK-X64-NEXT: 0 | (A vbtable pointer)
37 // CHECK-X64-NEXT: 8 | int a
38 // CHECK-X64-NEXT: 16 | struct B0 (virtual base) (empty)
39 // CHECK-X64-NEXT: | [sizeof=16, align=8
40 // CHECK-X64-NEXT: | nvsize=16, nvalign=8]
42 struct B : virtual B0 {
43 B0 b0;
44 int a;
45 B() : a(0xf000000B) {printf("X : %3d\n", ((int)(__SIZE_TYPE__)this)&0xfff);}
48 // CHECK-LABEL: 0 | struct B{{$}}
49 // CHECK-NEXT: 0 | (B vbtable pointer)
50 // CHECK-NEXT: 8 | struct B0 b0 (empty)
51 // CHECK: 16 | int a
52 // CHECK-NEXT: 24 | struct B0 (virtual base) (empty)
53 // CHECK-NEXT: | [sizeof=24, align=8
54 // CHECK-NEXT: | nvsize=24, nvalign=8]
55 // CHECK-X64-LABEL: 0 | struct B{{$}}
56 // CHECK-X64-NEXT: 0 | (B vbtable pointer)
57 // CHECK-X64-NEXT: 8 | struct B0 b0 (empty)
58 // CHECK-X64: 16 | int a
59 // CHECK-X64-NEXT: 24 | struct B0 (virtual base) (empty)
60 // CHECK-X64-NEXT: | [sizeof=24, align=8
61 // CHECK-X64-NEXT: | nvsize=24, nvalign=8]
63 struct C : virtual B0, virtual B1, virtual B2, virtual B3, virtual B4 {
64 int a;
65 C() : a(0xf000000C) {printf("X : %3d\n", ((int)(__SIZE_TYPE__)this)&0xfff);}
68 // CHECK-LABEL: 0 | struct C{{$}}
69 // CHECK-NEXT: 0 | (C vbtable pointer)
70 // CHECK-NEXT: 4 | int a
71 // CHECK-NEXT: 8 | struct B0 (virtual base) (empty)
72 // CHECK-NEXT: 16 | struct B1 (virtual base) (empty)
73 // CHECK-NEXT: 24 | struct B2 (virtual base) (empty)
74 // CHECK-NEXT: 32 | struct B3 (virtual base) (empty)
75 // CHECK-NEXT: 40 | struct B4 (virtual base) (empty)
76 // CHECK-NEXT: | [sizeof=40, align=8
77 // CHECK-NEXT: | nvsize=8, nvalign=8]
78 // CHECK-X64-LABEL: 0 | struct C{{$}}
79 // CHECK-X64-NEXT: 0 | (C vbtable pointer)
80 // CHECK-X64-NEXT: 8 | int a
81 // CHECK-X64-NEXT: 16 | struct B0 (virtual base) (empty)
82 // CHECK-X64-NEXT: 24 | struct B1 (virtual base) (empty)
83 // CHECK-X64-NEXT: 32 | struct B2 (virtual base) (empty)
84 // CHECK-X64-NEXT: 40 | struct B3 (virtual base) (empty)
85 // CHECK-X64-NEXT: 48 | struct B4 (virtual base) (empty)
86 // CHECK-X64-NEXT: | [sizeof=48, align=8
87 // CHECK-X64-NEXT: | nvsize=16, nvalign=8]
89 struct D {
90 B0 b0;
91 C0 c0;
92 C1 c1;
93 C2 c2;
94 B1 b1;
95 int a;
96 D() : a(0xf000000D) {printf("X : %3d\n", ((int)(__SIZE_TYPE__)this)&0xfff);}
99 // CHECK-LABEL: 0 | struct D{{$}}
100 // CHECK-NEXT: 0 | struct B0 b0 (empty)
101 // CHECK: 8 | struct C0 c0
102 // CHECK-NEXT: 8 | int a
103 // CHECK: 12 | struct C1 c1
104 // CHECK-NEXT: 12 | int a
105 // CHECK: 16 | struct C2 c2
106 // CHECK-NEXT: 16 | int a
107 // CHECK: 24 | struct B1 b1 (empty)
108 // CHECK: 32 | int a
109 // CHECK-NEXT: | [sizeof=40, align=8
110 // CHECK-NEXT: | nvsize=40, nvalign=8]
111 // CHECK-X64-LABEL: 0 | struct D{{$}}
112 // CHECK-X64-NEXT: 0 | struct B0 b0 (empty)
113 // CHECK-X64: 8 | struct C0 c0
114 // CHECK-X64-NEXT: 8 | int a
115 // CHECK-X64: 12 | struct C1 c1
116 // CHECK-X64-NEXT: 12 | int a
117 // CHECK-X64: 16 | struct C2 c2
118 // CHECK-X64-NEXT: 16 | int a
119 // CHECK-X64: 24 | struct B1 b1 (empty)
120 // CHECK-X64: 32 | int a
121 // CHECK-X64-NEXT: | [sizeof=40, align=8
122 // CHECK-X64-NEXT: | nvsize=40, nvalign=8]
124 struct E : virtual B0, virtual C0, virtual C1, virtual C2, virtual B1 {
125 int a;
126 E() : a(0xf000000E) {printf("X : %3d\n", ((int)(__SIZE_TYPE__)this)&0xfff);}
129 // CHECK-LABEL: 0 | struct E{{$}}
130 // CHECK-NEXT: 0 | (E vbtable pointer)
131 // CHECK-NEXT: 4 | int a
132 // CHECK-NEXT: 8 | struct B0 (virtual base) (empty)
133 // CHECK-NEXT: 8 | struct C0 (virtual base)
134 // CHECK-NEXT: 8 | int a
135 // CHECK-NEXT: 12 | struct C1 (virtual base)
136 // CHECK-NEXT: 12 | int a
137 // CHECK-NEXT: 16 | struct C2 (virtual base)
138 // CHECK-NEXT: 16 | int a
139 // CHECK-NEXT: 24 | struct B1 (virtual base) (empty)
140 // CHECK-NEXT: | [sizeof=24, align=8
141 // CHECK-NEXT: | nvsize=8, nvalign=8]
142 // CHECK-X64-LABEL: 0 | struct E{{$}}
143 // CHECK-X64-NEXT: 0 | (E vbtable pointer)
144 // CHECK-X64-NEXT: 8 | int a
145 // CHECK-X64-NEXT: 16 | struct B0 (virtual base) (empty)
146 // CHECK-X64-NEXT: 16 | struct C0 (virtual base)
147 // CHECK-X64-NEXT: 16 | int a
148 // CHECK-X64-NEXT: 20 | struct C1 (virtual base)
149 // CHECK-X64-NEXT: 20 | int a
150 // CHECK-X64-NEXT: 24 | struct C2 (virtual base)
151 // CHECK-X64-NEXT: 24 | int a
152 // CHECK-X64-NEXT: 32 | struct B1 (virtual base) (empty)
153 // CHECK-X64-NEXT: | [sizeof=32, align=8
154 // CHECK-X64-NEXT: | nvsize=16, nvalign=8]
156 struct F : virtual C0, virtual B0, virtual B1, virtual C1 {
157 int a;
158 F() : a(0xf000000F) {printf("X : %3d\n", ((int)(__SIZE_TYPE__)this)&0xfff);}
161 // CHECK-LABEL: 0 | struct F{{$}}
162 // CHECK-NEXT: 0 | (F vbtable pointer)
163 // CHECK-NEXT: 4 | int a
164 // CHECK-NEXT: 8 | struct C0 (virtual base)
165 // CHECK-NEXT: 8 | int a
166 // CHECK-NEXT: 16 | struct B0 (virtual base) (empty)
167 // CHECK-NEXT: 24 | struct B1 (virtual base) (empty)
168 // CHECK-NEXT: 24 | struct C1 (virtual base)
169 // CHECK-NEXT: 24 | int a
170 // CHECK-NEXT: | [sizeof=32, align=8
171 // CHECK-NEXT: | nvsize=8, nvalign=8]
172 // CHECK-X64-LABEL: 0 | struct F{{$}}
173 // CHECK-X64-NEXT: 0 | (F vbtable pointer)
174 // CHECK-X64-NEXT: 8 | int a
175 // CHECK-X64-NEXT: 16 | struct C0 (virtual base)
176 // CHECK-X64-NEXT: 16 | int a
177 // CHECK-X64-NEXT: 24 | struct B0 (virtual base) (empty)
178 // CHECK-X64-NEXT: 32 | struct B1 (virtual base) (empty)
179 // CHECK-X64-NEXT: 32 | struct C1 (virtual base)
180 // CHECK-X64-NEXT: 32 | int a
181 // CHECK-X64-NEXT: | [sizeof=40, align=8
182 // CHECK-X64-NEXT: | nvsize=16, nvalign=8]
184 struct G : virtual C0, virtual B0, virtual B1, D0, virtual C1 {
185 int a;
186 G() : a(0xf0000010) {printf("X : %3d\n", ((int)(__SIZE_TYPE__)this)&0xfff);}
187 virtual void f() {}
190 // CHECK-LABEL: 0 | struct G{{$}}
191 // CHECK-NEXT: 0 | struct D0 (primary base)
192 // CHECK-NEXT: 0 | (D0 vftable pointer)
193 // CHECK-NEXT: 4 | (G vbtable pointer)
194 // CHECK-NEXT: 20 | int a
195 // CHECK-NEXT: 32 | struct C0 (virtual base)
196 // CHECK-NEXT: 32 | int a
197 // CHECK-NEXT: 40 | struct B0 (virtual base) (empty)
198 // CHECK-NEXT: 56 | struct B1 (virtual base) (empty)
199 // CHECK-NEXT: 56 | struct C1 (virtual base)
200 // CHECK-NEXT: 56 | int a
201 // CHECK-NEXT: | [sizeof=64, align=16
202 // CHECK-NEXT: | nvsize=32, nvalign=16]
203 // CHECK-X64-LABEL: 0 | struct G{{$}}
204 // CHECK-X64-NEXT: 0 | struct D0 (primary base)
205 // CHECK-X64-NEXT: 0 | (D0 vftable pointer)
206 // CHECK-X64-NEXT: 8 | (G vbtable pointer)
207 // CHECK-X64-NEXT: 24 | int a
208 // CHECK-X64-NEXT: 32 | struct C0 (virtual base)
209 // CHECK-X64-NEXT: 32 | int a
210 // CHECK-X64-NEXT: 40 | struct B0 (virtual base) (empty)
211 // CHECK-X64-NEXT: 56 | struct B1 (virtual base) (empty)
212 // CHECK-X64-NEXT: 56 | struct C1 (virtual base)
213 // CHECK-X64-NEXT: 56 | int a
214 // CHECK-X64-NEXT: | [sizeof=64, align=16
215 // CHECK-X64-NEXT: | nvsize=32, nvalign=16]
217 struct H : virtual C0, virtual B0, virtual B1, virtual D0, virtual C1 {
218 int a;
219 H() : a(0xf0000011) {printf("X : %3d\n", ((int)(__SIZE_TYPE__)this)&0xfff);}
220 virtual void f() {}
223 // CHECK-LABEL: 0 | struct H{{$}}
224 // CHECK-NEXT: 0 | (H vbtable pointer)
225 // CHECK-NEXT: 4 | int a
226 // CHECK-NEXT: 8 | struct C0 (virtual base)
227 // CHECK-NEXT: 8 | int a
228 // CHECK-NEXT: 16 | struct B0 (virtual base) (empty)
229 // CHECK-NEXT: 24 | struct B1 (virtual base) (empty)
230 // CHECK-NEXT: 44 | (vtordisp for vbase D0)
231 // CHECK-NEXT: 48 | struct D0 (virtual base)
232 // CHECK-NEXT: 48 | (D0 vftable pointer)
233 // CHECK-NEXT: 52 | struct C1 (virtual base)
234 // CHECK-NEXT: 52 | int a
235 // CHECK-NEXT: | [sizeof=64, align=16
236 // CHECK-NEXT: | nvsize=8, nvalign=16]
237 // CHECK-X64-LABEL: 0 | struct H{{$}}
238 // CHECK-X64-NEXT: 0 | (H vbtable pointer)
239 // CHECK-X64-NEXT: 8 | int a
240 // CHECK-X64-NEXT: 16 | struct C0 (virtual base)
241 // CHECK-X64-NEXT: 16 | int a
242 // CHECK-X64-NEXT: 24 | struct B0 (virtual base) (empty)
243 // CHECK-X64-NEXT: 40 | struct B1 (virtual base) (empty)
244 // CHECK-X64-NEXT: 60 | (vtordisp for vbase D0)
245 // CHECK-X64-NEXT: 64 | struct D0 (virtual base)
246 // CHECK-X64-NEXT: 64 | (D0 vftable pointer)
247 // CHECK-X64-NEXT: 72 | struct C1 (virtual base)
248 // CHECK-X64-NEXT: 72 | int a
249 // CHECK-X64-NEXT: | [sizeof=80, align=16
250 // CHECK-X64-NEXT: | nvsize=16, nvalign=16]
252 struct I : virtual B0, virtual B1, virtual B2, virtual B3, virtual B4 {
253 __declspec(align(32)) int a;
254 I() : a(0xf0000012) {printf("X : %3d\n", ((int)(__SIZE_TYPE__)this)&0xfff);}
257 // CHECK-LABEL: 0 | struct I{{$}}
258 // CHECK-NEXT: 0 | (I vbtable pointer)
259 // CHECK-NEXT: 32 | int a
260 // CHECK-NEXT: 64 | struct B0 (virtual base) (empty)
261 // CHECK-NEXT: 72 | struct B1 (virtual base) (empty)
262 // CHECK-NEXT: 104 | struct B2 (virtual base) (empty)
263 // CHECK-NEXT: 136 | struct B3 (virtual base) (empty)
264 // CHECK-NEXT: 168 | struct B4 (virtual base) (empty)
265 // CHECK-NEXT: | [sizeof=192, align=32
266 // CHECK-NEXT: | nvsize=64, nvalign=32]
267 // CHECK-X64-LABEL: 0 | struct I{{$}}
268 // CHECK-X64-NEXT: 0 | (I vbtable pointer)
269 // CHECK-X64-NEXT: 32 | int a
270 // CHECK-X64-NEXT: 64 | struct B0 (virtual base) (empty)
271 // CHECK-X64-NEXT: 72 | struct B1 (virtual base) (empty)
272 // CHECK-X64-NEXT: 104 | struct B2 (virtual base) (empty)
273 // CHECK-X64-NEXT: 136 | struct B3 (virtual base) (empty)
274 // CHECK-X64-NEXT: 168 | struct B4 (virtual base) (empty)
275 // CHECK-X64-NEXT: | [sizeof=192, align=32
276 // CHECK-X64-NEXT: | nvsize=64, nvalign=32]
278 struct __declspec(align(32)) J : virtual B0, virtual B1, virtual B2, virtual B3, virtual B4 {
279 int a;
280 J() : a(0xf0000012) {printf("X : %3d\n", ((int)(__SIZE_TYPE__)this)&0xfff);}
283 // CHECK-LABEL: 0 | struct J{{$}}
284 // CHECK-NEXT: 0 | (J vbtable pointer)
285 // CHECK-NEXT: 4 | int a
286 // CHECK-NEXT: 8 | struct B0 (virtual base) (empty)
287 // CHECK-NEXT: 40 | struct B1 (virtual base) (empty)
288 // CHECK-NEXT: 72 | struct B2 (virtual base) (empty)
289 // CHECK-NEXT: 104 | struct B3 (virtual base) (empty)
290 // CHECK-NEXT: 136 | struct B4 (virtual base) (empty)
291 // CHECK-NEXT: | [sizeof=160, align=32
292 // CHECK-NEXT: | nvsize=8, nvalign=32]
293 // CHECK-X64-LABEL: 0 | struct J{{$}}
294 // CHECK-X64-NEXT: 0 | (J vbtable pointer)
295 // CHECK-X64-NEXT: 8 | int a
296 // CHECK-X64-NEXT: 16 | struct B0 (virtual base) (empty)
297 // CHECK-X64-NEXT: 40 | struct B1 (virtual base) (empty)
298 // CHECK-X64-NEXT: 72 | struct B2 (virtual base) (empty)
299 // CHECK-X64-NEXT: 104 | struct B3 (virtual base) (empty)
300 // CHECK-X64-NEXT: 136 | struct B4 (virtual base) (empty)
301 // CHECK-X64-NEXT: | [sizeof=160, align=32
302 // CHECK-X64-NEXT: | nvsize=16, nvalign=32]
304 struct K : virtual D1, virtual B1, virtual B2, virtual B3, virtual B4 {
305 __declspec(align(32)) int a;
306 K() : a(0xf0000013) {printf("X : %3d\n", ((int)(__SIZE_TYPE__)this)&0xfff);}
309 // CHECK-LABEL: 0 | struct K{{$}}
310 // CHECK-NEXT: 0 | (K vbtable pointer)
311 // CHECK-NEXT: 32 | int a
312 // CHECK-NEXT: 64 | struct D1 (virtual base) (empty)
313 // CHECK-NEXT: 72 | struct B1 (virtual base) (empty)
314 // CHECK-NEXT: 104 | struct B2 (virtual base) (empty)
315 // CHECK-NEXT: 136 | struct B3 (virtual base) (empty)
316 // CHECK-NEXT: 168 | struct B4 (virtual base) (empty)
317 // CHECK-NEXT: | [sizeof=192, align=32
318 // CHECK-NEXT: | nvsize=64, nvalign=32]
319 // CHECK-X64-LABEL: 0 | struct K{{$}}
320 // CHECK-X64-NEXT: 0 | (K vbtable pointer)
321 // CHECK-X64-NEXT: 32 | int a
322 // CHECK-X64-NEXT: 64 | struct D1 (virtual base) (empty)
323 // CHECK-X64-NEXT: 72 | struct B1 (virtual base) (empty)
324 // CHECK-X64-NEXT: 104 | struct B2 (virtual base) (empty)
325 // CHECK-X64-NEXT: 136 | struct B3 (virtual base) (empty)
326 // CHECK-X64-NEXT: 168 | struct B4 (virtual base) (empty)
327 // CHECK-X64-NEXT: | [sizeof=192, align=32
328 // CHECK-X64-NEXT: | nvsize=64, nvalign=32]
330 struct L : virtual B1, virtual D1, virtual B2, virtual B3, virtual B4 {
331 __declspec(align(32)) int a;
332 L() : a(0xf0000014) {printf("X : %3d\n", ((int)(__SIZE_TYPE__)this)&0xfff);}
335 // CHECK-LABEL: 0 | struct L{{$}}
336 // CHECK-NEXT: 0 | (L vbtable pointer)
337 // CHECK-NEXT: 32 | int a
338 // CHECK-NEXT: 64 | struct B1 (virtual base) (empty)
339 // CHECK-NEXT: 68 | struct D1 (virtual base) (empty)
340 // CHECK-NEXT: 104 | struct B2 (virtual base) (empty)
341 // CHECK-NEXT: 136 | struct B3 (virtual base) (empty)
342 // CHECK-NEXT: 168 | struct B4 (virtual base) (empty)
343 // CHECK-NEXT: | [sizeof=192, align=32
344 // CHECK-NEXT: | nvsize=64, nvalign=32]
345 // CHECK-X64-LABEL: 0 | struct L{{$}}
346 // CHECK-X64-NEXT: 0 | (L vbtable pointer)
347 // CHECK-X64-NEXT: 32 | int a
348 // CHECK-X64-NEXT: 64 | struct B1 (virtual base) (empty)
349 // CHECK-X64-NEXT: 68 | struct D1 (virtual base) (empty)
350 // CHECK-X64-NEXT: 104 | struct B2 (virtual base) (empty)
351 // CHECK-X64-NEXT: 136 | struct B3 (virtual base) (empty)
352 // CHECK-X64-NEXT: 168 | struct B4 (virtual base) (empty)
353 // CHECK-X64-NEXT: | [sizeof=192, align=32
354 // CHECK-X64-NEXT: | nvsize=64, nvalign=32]
356 struct M : virtual B1, virtual B2, virtual D1, virtual B3, virtual B4 {
357 __declspec(align(32)) int a;
358 M() : a(0xf0000015) {printf("X : %3d\n", ((int)(__SIZE_TYPE__)this)&0xfff);}
361 // CHECK-LABEL: 0 | struct M{{$}}
362 // CHECK-NEXT: 0 | (M vbtable pointer)
363 // CHECK-NEXT: 32 | int a
364 // CHECK-NEXT: 64 | struct B1 (virtual base) (empty)
365 // CHECK-NEXT: 72 | struct B2 (virtual base) (empty)
366 // CHECK-NEXT: 100 | struct D1 (virtual base) (empty)
367 // CHECK-NEXT: 136 | struct B3 (virtual base) (empty)
368 // CHECK-NEXT: 168 | struct B4 (virtual base) (empty)
369 // CHECK-NEXT: | [sizeof=192, align=32
370 // CHECK-NEXT: | nvsize=64, nvalign=32]
371 // CHECK-X64-LABEL: 0 | struct M{{$}}
372 // CHECK-X64-NEXT: 0 | (M vbtable pointer)
373 // CHECK-X64-NEXT: 32 | int a
374 // CHECK-X64-NEXT: 64 | struct B1 (virtual base) (empty)
375 // CHECK-X64-NEXT: 72 | struct B2 (virtual base) (empty)
376 // CHECK-X64-NEXT: 100 | struct D1 (virtual base) (empty)
377 // CHECK-X64-NEXT: 136 | struct B3 (virtual base) (empty)
378 // CHECK-X64-NEXT: 168 | struct B4 (virtual base) (empty)
379 // CHECK-X64-NEXT: | [sizeof=192, align=32
380 // CHECK-X64-NEXT: | nvsize=64, nvalign=32]
382 struct N : virtual C0, virtual B1, virtual D1, virtual B2, virtual B3, virtual B4 {
383 __declspec(align(32)) int a;
384 N() : a(0xf0000016) {printf("X : %3d\n", ((int)(__SIZE_TYPE__)this)&0xfff);}
387 // CHECK-LABEL: 0 | struct N{{$}}
388 // CHECK-NEXT: 0 | (N vbtable pointer)
389 // CHECK-NEXT: 32 | int a
390 // CHECK-NEXT: 64 | struct C0 (virtual base)
391 // CHECK-NEXT: 64 | int a
392 // CHECK-NEXT: 72 | struct B1 (virtual base) (empty)
393 // CHECK-NEXT: 100 | struct D1 (virtual base) (empty)
394 // CHECK-NEXT: 136 | struct B2 (virtual base) (empty)
395 // CHECK-NEXT: 168 | struct B3 (virtual base) (empty)
396 // CHECK-NEXT: 200 | struct B4 (virtual base) (empty)
397 // CHECK-NEXT: | [sizeof=224, align=32
398 // CHECK-NEXT: | nvsize=64, nvalign=32]
399 // CHECK-X64-LABEL: 0 | struct N{{$}}
400 // CHECK-X64-NEXT: 0 | (N vbtable pointer)
401 // CHECK-X64-NEXT: 32 | int a
402 // CHECK-X64-NEXT: 64 | struct C0 (virtual base)
403 // CHECK-X64-NEXT: 64 | int a
404 // CHECK-X64-NEXT: 72 | struct B1 (virtual base) (empty)
405 // CHECK-X64-NEXT: 100 | struct D1 (virtual base) (empty)
406 // CHECK-X64-NEXT: 136 | struct B2 (virtual base) (empty)
407 // CHECK-X64-NEXT: 168 | struct B3 (virtual base) (empty)
408 // CHECK-X64-NEXT: 200 | struct B4 (virtual base) (empty)
409 // CHECK-X64-NEXT: | [sizeof=224, align=32
410 // CHECK-X64-NEXT: | nvsize=64, nvalign=32]
412 struct O : virtual C0, virtual B1, virtual B2, virtual D1, virtual B3, virtual B4 {
413 __declspec(align(32)) int a;
414 O() : a(0xf0000017) {printf("X : %3d\n", ((int)(__SIZE_TYPE__)this)&0xfff);}
417 // CHECK-LABEL: 0 | struct O{{$}}
418 // CHECK-NEXT: 0 | (O vbtable pointer)
419 // CHECK-NEXT: 32 | int a
420 // CHECK-NEXT: 64 | struct C0 (virtual base)
421 // CHECK-NEXT: 64 | int a
422 // CHECK-NEXT: 72 | struct B1 (virtual base) (empty)
423 // CHECK-NEXT: 104 | struct B2 (virtual base) (empty)
424 // CHECK-NEXT: 132 | struct D1 (virtual base) (empty)
425 // CHECK-NEXT: 168 | struct B3 (virtual base) (empty)
426 // CHECK-NEXT: 200 | struct B4 (virtual base) (empty)
427 // CHECK-NEXT: | [sizeof=224, align=32
428 // CHECK-NEXT: | nvsize=64, nvalign=32]
429 // CHECK-X64-LABEL: 0 | struct O{{$}}
430 // CHECK-X64-NEXT: 0 | (O vbtable pointer)
431 // CHECK-X64-NEXT: 32 | int a
432 // CHECK-X64-NEXT: 64 | struct C0 (virtual base)
433 // CHECK-X64-NEXT: 64 | int a
434 // CHECK-X64-NEXT: 72 | struct B1 (virtual base) (empty)
435 // CHECK-X64-NEXT: 104 | struct B2 (virtual base) (empty)
436 // CHECK-X64-NEXT: 132 | struct D1 (virtual base) (empty)
437 // CHECK-X64-NEXT: 168 | struct B3 (virtual base) (empty)
438 // CHECK-X64-NEXT: 200 | struct B4 (virtual base) (empty)
439 // CHECK-X64-NEXT: | [sizeof=224, align=32
440 // CHECK-X64-NEXT: | nvsize=64, nvalign=32]
442 struct P : virtual B1, virtual C0, virtual D1, virtual B2, virtual B3, virtual B4 {
443 __declspec(align(32)) int a;
444 P() : a(0xf0000018) {printf("X : %3d\n", ((int)(__SIZE_TYPE__)this)&0xfff);}
447 // CHECK-LABEL: 0 | struct P{{$}}
448 // CHECK-NEXT: 0 | (P vbtable pointer)
449 // CHECK-NEXT: 32 | int a
450 // CHECK-NEXT: 64 | struct B1 (virtual base) (empty)
451 // CHECK-NEXT: 64 | struct C0 (virtual base)
452 // CHECK-NEXT: 64 | int a
453 // CHECK-NEXT: 68 | struct D1 (virtual base) (empty)
454 // CHECK-NEXT: 104 | struct B2 (virtual base) (empty)
455 // CHECK-NEXT: 136 | struct B3 (virtual base) (empty)
456 // CHECK-NEXT: 168 | struct B4 (virtual base) (empty)
457 // CHECK-NEXT: | [sizeof=192, align=32
458 // CHECK-NEXT: | nvsize=64, nvalign=32]
459 // CHECK-X64-LABEL: 0 | struct P{{$}}
460 // CHECK-X64-NEXT: 0 | (P vbtable pointer)
461 // CHECK-X64-NEXT: 32 | int a
462 // CHECK-X64-NEXT: 64 | struct B1 (virtual base) (empty)
463 // CHECK-X64-NEXT: 64 | struct C0 (virtual base)
464 // CHECK-X64-NEXT: 64 | int a
465 // CHECK-X64-NEXT: 68 | struct D1 (virtual base) (empty)
466 // CHECK-X64-NEXT: 104 | struct B2 (virtual base) (empty)
467 // CHECK-X64-NEXT: 136 | struct B3 (virtual base) (empty)
468 // CHECK-X64-NEXT: 168 | struct B4 (virtual base) (empty)
469 // CHECK-X64-NEXT: | [sizeof=192, align=32
470 // CHECK-X64-NEXT: | nvsize=64, nvalign=32]
472 struct Q : virtual B1, virtual C0, virtual B2, virtual D1, virtual B3, virtual B4 {
473 __declspec(align(32)) int a;
474 Q() : a(0xf0000019) {printf("X : %3d\n", ((int)(__SIZE_TYPE__)this)&0xfff);}
477 // CHECK-LABEL: 0 | struct Q{{$}}
478 // CHECK-NEXT: 0 | (Q vbtable pointer)
479 // CHECK-NEXT: 32 | int a
480 // CHECK-NEXT: 64 | struct B1 (virtual base) (empty)
481 // CHECK-NEXT: 64 | struct C0 (virtual base)
482 // CHECK-NEXT: 64 | int a
483 // CHECK-NEXT: 72 | struct B2 (virtual base) (empty)
484 // CHECK-NEXT: 100 | struct D1 (virtual base) (empty)
485 // CHECK-NEXT: 136 | struct B3 (virtual base) (empty)
486 // CHECK-NEXT: 168 | struct B4 (virtual base) (empty)
487 // CHECK-NEXT: | [sizeof=192, align=32
488 // CHECK-NEXT: | nvsize=64, nvalign=32]
489 // CHECK-X64-LABEL: 0 | struct Q{{$}}
490 // CHECK-X64-NEXT: 0 | (Q vbtable pointer)
491 // CHECK-X64-NEXT: 32 | int a
492 // CHECK-X64-NEXT: 64 | struct B1 (virtual base) (empty)
493 // CHECK-X64-NEXT: 64 | struct C0 (virtual base)
494 // CHECK-X64-NEXT: 64 | int a
495 // CHECK-X64-NEXT: 72 | struct B2 (virtual base) (empty)
496 // CHECK-X64-NEXT: 100 | struct D1 (virtual base) (empty)
497 // CHECK-X64-NEXT: 136 | struct B3 (virtual base) (empty)
498 // CHECK-X64-NEXT: 168 | struct B4 (virtual base) (empty)
499 // CHECK-X64-NEXT: | [sizeof=192, align=32
500 // CHECK-X64-NEXT: | nvsize=64, nvalign=32]
502 struct R : virtual B0, virtual B1, virtual B2, virtual C0, virtual B3, virtual B4 {
503 __declspec(align(32)) int a;
504 R() : a(0xf0000020) {printf("X : %3d\n", ((int)(__SIZE_TYPE__)this)&0xfff);}
507 // CHECK-LABEL: 0 | struct R{{$}}
508 // CHECK-NEXT: 0 | (R vbtable pointer)
509 // CHECK-NEXT: 32 | int a
510 // CHECK-NEXT: 64 | struct B0 (virtual base) (empty)
511 // CHECK-NEXT: 72 | struct B1 (virtual base) (empty)
512 // CHECK-NEXT: 104 | struct B2 (virtual base) (empty)
513 // CHECK-NEXT: 104 | struct C0 (virtual base)
514 // CHECK-NEXT: 104 | int a
515 // CHECK-NEXT: 112 | struct B3 (virtual base) (empty)
516 // CHECK-NEXT: 136 | struct B4 (virtual base) (empty)
517 // CHECK-NEXT: | [sizeof=160, align=32
518 // CHECK-NEXT: | nvsize=64, nvalign=32]
519 // CHECK-X64-LABEL: 0 | struct R{{$}}
520 // CHECK-X64-NEXT: 0 | (R vbtable pointer)
521 // CHECK-X64-NEXT: 32 | int a
522 // CHECK-X64-NEXT: 64 | struct B0 (virtual base) (empty)
523 // CHECK-X64-NEXT: 72 | struct B1 (virtual base) (empty)
524 // CHECK-X64-NEXT: 104 | struct B2 (virtual base) (empty)
525 // CHECK-X64-NEXT: 104 | struct C0 (virtual base)
526 // CHECK-X64-NEXT: 104 | int a
527 // CHECK-X64-NEXT: 112 | struct B3 (virtual base) (empty)
528 // CHECK-X64-NEXT: 136 | struct B4 (virtual base) (empty)
529 // CHECK-X64-NEXT: | [sizeof=160, align=32
530 // CHECK-X64-NEXT: | nvsize=64, nvalign=32]
532 struct S : virtual B0, virtual B1, virtual C0, virtual B2, virtual B3, virtual B4 {
533 __declspec(align(32)) int a;
534 S() : a(0xf0000021) {printf("X : %3d\n", ((int)(__SIZE_TYPE__)this)&0xfff);}
537 // CHECK-LABEL: 0 | struct S{{$}}
538 // CHECK-NEXT: 0 | (S vbtable pointer)
539 // CHECK-NEXT: 32 | int a
540 // CHECK-NEXT: 64 | struct B0 (virtual base) (empty)
541 // CHECK-NEXT: 72 | struct B1 (virtual base) (empty)
542 // CHECK-NEXT: 72 | struct C0 (virtual base)
543 // CHECK-NEXT: 72 | int a
544 // CHECK-NEXT: 80 | struct B2 (virtual base) (empty)
545 // CHECK-NEXT: 104 | struct B3 (virtual base) (empty)
546 // CHECK-NEXT: 136 | struct B4 (virtual base) (empty)
547 // CHECK-NEXT: | [sizeof=160, align=32
548 // CHECK-NEXT: | nvsize=64, nvalign=32]
549 // CHECK-X64-LABEL: 0 | struct S{{$}}
550 // CHECK-X64-NEXT: 0 | (S vbtable pointer)
551 // CHECK-X64-NEXT: 32 | int a
552 // CHECK-X64-NEXT: 64 | struct B0 (virtual base) (empty)
553 // CHECK-X64-NEXT: 72 | struct B1 (virtual base) (empty)
554 // CHECK-X64-NEXT: 72 | struct C0 (virtual base)
555 // CHECK-X64-NEXT: 72 | int a
556 // CHECK-X64-NEXT: 80 | struct B2 (virtual base) (empty)
557 // CHECK-X64-NEXT: 104 | struct B3 (virtual base) (empty)
558 // CHECK-X64-NEXT: 136 | struct B4 (virtual base) (empty)
559 // CHECK-X64-NEXT: | [sizeof=160, align=32
560 // CHECK-X64-NEXT: | nvsize=64, nvalign=32]
562 struct T : virtual B0, virtual B1, virtual C0, virtual D2, virtual B2, virtual B3, virtual B4 {
563 __declspec(align(16)) int a;
564 T() : a(0xf0000022) {printf("X : %3d\n", ((int)(__SIZE_TYPE__)this)&0xfff);}
567 // CHECK-LABEL: 0 | struct T{{$}}
568 // CHECK-NEXT: 0 | (T vbtable pointer)
569 // CHECK-NEXT: 16 | int a
570 // CHECK-NEXT: 32 | struct B0 (virtual base) (empty)
571 // CHECK-NEXT: 40 | struct B1 (virtual base) (empty)
572 // CHECK-NEXT: 40 | struct C0 (virtual base)
573 // CHECK-NEXT: 40 | int a
574 // CHECK-NEXT: 44 | struct D2 (virtual base)
575 // CHECK-NEXT: 44 | int[8] a
576 // CHECK-NEXT: 80 | struct B2 (virtual base) (empty)
577 // CHECK-NEXT: 88 | struct B3 (virtual base) (empty)
578 // CHECK-NEXT: 104 | struct B4 (virtual base) (empty)
579 // CHECK-NEXT: | [sizeof=112, align=16
580 // CHECK-NEXT: | nvsize=32, nvalign=16]
581 // CHECK-X64-LABEL: 0 | struct T{{$}}
582 // CHECK-X64-NEXT: 0 | (T vbtable pointer)
583 // CHECK-X64-NEXT: 16 | int a
584 // CHECK-X64-NEXT: 32 | struct B0 (virtual base) (empty)
585 // CHECK-X64-NEXT: 40 | struct B1 (virtual base) (empty)
586 // CHECK-X64-NEXT: 40 | struct C0 (virtual base)
587 // CHECK-X64-NEXT: 40 | int a
588 // CHECK-X64-NEXT: 44 | struct D2 (virtual base)
589 // CHECK-X64-NEXT: 44 | int[8] a
590 // CHECK-X64-NEXT: 80 | struct B2 (virtual base) (empty)
591 // CHECK-X64-NEXT: 88 | struct B3 (virtual base) (empty)
592 // CHECK-X64-NEXT: 104 | struct B4 (virtual base) (empty)
593 // CHECK-X64-NEXT: | [sizeof=112, align=16
594 // CHECK-X64-NEXT: | nvsize=32, nvalign=16]
596 struct __declspec(align(32)) U : virtual B0, virtual B1 {
597 int a;
598 U() : a(0xf0000023) {printf("X : %3d\n", ((int)(__SIZE_TYPE__)this)&0xfff);}
601 // CHECK-LABEL: 0 | struct U{{$}}
602 // CHECK-NEXT: 0 | (U vbtable pointer)
603 // CHECK-NEXT: 4 | int a
604 // CHECK-NEXT: 8 | struct B0 (virtual base) (empty)
605 // CHECK-NEXT: 40 | struct B1 (virtual base) (empty)
606 // CHECK-NEXT: | [sizeof=64, align=32
607 // CHECK-NEXT: | nvsize=8, nvalign=32]
608 // CHECK-X64-LABEL: 0 | struct U{{$}}
609 // CHECK-X64-NEXT: 0 | (U vbtable pointer)
610 // CHECK-X64-NEXT: 8 | int a
611 // CHECK-X64-NEXT: 16 | struct B0 (virtual base) (empty)
612 // CHECK-X64-NEXT: 40 | struct B1 (virtual base) (empty)
613 // CHECK-X64-NEXT: | [sizeof=64, align=32
614 // CHECK-X64-NEXT: | nvsize=16, nvalign=32]
616 struct __declspec(align(32)) V : virtual D1 {
617 int a;
618 V() : a(0xf0000024) {printf("X : %3d\n", ((int)(__SIZE_TYPE__)this)&0xfff);}
621 // CHECK-LABEL: 0 | struct V{{$}}
622 // CHECK-NEXT: 0 | (V vbtable pointer)
623 // CHECK-NEXT: 4 | int a
624 // CHECK-NEXT: 8 | struct D1 (virtual base) (empty)
625 // CHECK-NEXT: | [sizeof=32, align=32
626 // CHECK-NEXT: | nvsize=8, nvalign=32]
627 // CHECK-X64-LABEL: 0 | struct V{{$}}
628 // CHECK-X64-NEXT: 0 | (V vbtable pointer)
629 // CHECK-X64-NEXT: 8 | int a
630 // CHECK-X64-NEXT: 16 | struct D1 (virtual base) (empty)
631 // CHECK-X64-NEXT: | [sizeof=32, align=32
632 // CHECK-X64-NEXT: | nvsize=16, nvalign=32]
634 struct T0 {};
635 struct T1 : T0 { char a; };
636 struct T3 : virtual T1, virtual T0 { long long a; };
638 // CHECK-LABEL: 0 | struct T3{{$}}
639 // CHECK-NEXT: 0 | (T3 vbtable pointer)
640 // CHECK-NEXT: 8 | long long a
641 // CHECK-NEXT: 16 | struct T1 (virtual base)
642 // CHECK-NEXT: 16 | struct T0 (base) (empty)
643 // CHECK-NEXT: 16 | char a
644 // CHECK-NEXT: 24 | struct T0 (virtual base) (empty)
645 // CHECK-NEXT: | [sizeof=24, align=8
646 // CHECK-NEXT: | nvsize=16, nvalign=8]
647 // CHECK-X64-LABEL: 0 | struct T3{{$}}
648 // CHECK-X64-NEXT: 0 | (T3 vbtable pointer)
649 // CHECK-X64-NEXT: 8 | long long a
650 // CHECK-X64-NEXT: 16 | struct T1 (virtual base)
651 // CHECK-X64-NEXT: 16 | struct T0 (base) (empty)
652 // CHECK-X64-NEXT: 16 | char a
653 // CHECK-X64-NEXT: 24 | struct T0 (virtual base) (empty)
654 // CHECK-X64-NEXT: | [sizeof=24, align=8
655 // CHECK-X64-NEXT: | nvsize=16, nvalign=8]
657 struct Q0A {};
658 struct Q0B { char Q0BField; };
659 struct Q0C : virtual Q0A, virtual Q0B { char Q0CField; };
660 struct Q0D : Q0C, Q0A {};
662 // CHECK-LABEL: 0 | struct Q0D{{$}}
663 // CHECK-NEXT: 0 | struct Q0C (base)
664 // CHECK-NEXT: 0 | (Q0C vbtable pointer)
665 // CHECK-NEXT: 4 | char Q0CField
666 // CHECK-NEXT: 8 | struct Q0A (base) (empty)
667 // CHECK-NEXT: 8 | struct Q0A (virtual base) (empty)
668 // CHECK-NEXT: 8 | struct Q0B (virtual base)
669 // CHECK-NEXT: 8 | char Q0BField
670 // CHECK-NEXT: | [sizeof=9, align=4
671 // CHECK-NEXT: | nvsize=8, nvalign=4]
672 // CHECK-X64-LABEL: 0 | struct Q0D{{$}}
673 // CHECK-X64-NEXT: 0 | struct Q0C (base)
674 // CHECK-X64-NEXT: 0 | (Q0C vbtable pointer)
675 // CHECK-X64-NEXT: 8 | char Q0CField
676 // CHECK-X64-NEXT: 16 | struct Q0A (base) (empty)
677 // CHECK-X64-NEXT: 16 | struct Q0A (virtual base) (empty)
678 // CHECK-X64-NEXT: 16 | struct Q0B (virtual base)
679 // CHECK-X64-NEXT: 16 | char Q0BField
680 // CHECK-X64-NEXT: | [sizeof=24, align=8
681 // CHECK-X64-NEXT: | nvsize=16, nvalign=8]
683 int a[
684 sizeof(A)+
685 sizeof(B)+
686 sizeof(C)+
687 sizeof(D)+
688 sizeof(E)+
689 sizeof(F)+
690 sizeof(G)+
691 sizeof(H)+
692 sizeof(I)+
693 sizeof(J)+
694 sizeof(K)+
695 sizeof(L)+
696 sizeof(M)+
697 sizeof(N)+
698 sizeof(O)+
699 sizeof(P)+
700 sizeof(Q)+
701 sizeof(R)+
702 sizeof(S)+
703 sizeof(T)+
704 sizeof(U)+
705 sizeof(V)+
706 sizeof(T3)+
707 sizeof(Q0D)];