[clang][modules] Don't prevent translation of FW_Private includes when explicitly...
[llvm-project.git] / clang / test / Layout / ms-x86-basic-layout.cpp
blobf2135496b1ef700128898d6a676b78fcf52dcaa0
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 A4 {
9 int a;
10 A4() : a(0xf00000a4) {}
13 struct B4 {
14 int a;
15 B4() : a(0xf00000b4) {}
18 struct C4 {
19 int a;
20 C4() : a(0xf00000c4) {}
21 virtual void f() {printf("C4");}
24 struct A16 {
25 __declspec(align(16)) int a;
26 A16() : a(0xf0000a16) {}
29 struct C16 {
30 __declspec(align(16)) int a;
31 C16() : a(0xf0000c16) {}
32 virtual void f() {printf("C16");}
35 struct TestF3 : A4, virtual C16 {
36 int a;
37 TestF3() : a(0xf00000f3) {}
40 // CHECK-LABEL: 0 | struct TestF3{{$}}
41 // CHECK-NEXT: 0 | struct A4 (base)
42 // CHECK-NEXT: 0 | int a
43 // CHECK-NEXT: 4 | (TestF3 vbtable pointer)
44 // CHECK-NEXT: 8 | int a
45 // CHECK-NEXT: 16 | struct C16 (virtual base)
46 // CHECK-NEXT: 16 | (C16 vftable pointer)
47 // CHECK-NEXT: 32 | int a
48 // CHECK-NEXT: | [sizeof=48, align=16
49 // CHECK-NEXT: | nvsize=12, nvalign=16]
50 // CHECK-X64-LABEL: 0 | struct TestF3{{$}}
51 // CHECK-X64-NEXT: 0 | struct A4 (base)
52 // CHECK-X64-NEXT: 0 | int a
53 // CHECK-X64-NEXT: 8 | (TestF3 vbtable pointer)
54 // CHECK-X64-NEXT: 16 | int a
55 // CHECK-X64-NEXT: 32 | struct C16 (virtual base)
56 // CHECK-X64-NEXT: 32 | (C16 vftable pointer)
57 // CHECK-X64-NEXT: 48 | int a
58 // CHECK-X64-NEXT: | [sizeof=64, align=16
59 // CHECK-X64-NEXT: | nvsize=24, nvalign=16]
61 struct TestF7 : A4, virtual C16 {
62 int a;
63 TestF7() : a(0xf00000f7) {}
64 virtual void f() { printf("F7"); }
67 // CHECK-LABEL: 0 | struct TestF7{{$}}
68 // CHECK-NEXT: 0 | struct A4 (base)
69 // CHECK-NEXT: 0 | int a
70 // CHECK-NEXT: 4 | (TestF7 vbtable pointer)
71 // CHECK-NEXT: 8 | int a
72 // CHECK-NEXT: 28 | (vtordisp for vbase C16)
73 // CHECK-NEXT: 32 | struct C16 (virtual base)
74 // CHECK-NEXT: 32 | (C16 vftable pointer)
75 // CHECK-NEXT: 48 | int a
76 // CHECK-NEXT: | [sizeof=64, align=16
77 // CHECK-NEXT: | nvsize=12, nvalign=16]
78 // CHECK-X64-LABEL: 0 | struct TestF7{{$}}
79 // CHECK-X64-NEXT: 0 | struct A4 (base)
80 // CHECK-X64-NEXT: 0 | int a
81 // CHECK-X64-NEXT: 8 | (TestF7 vbtable pointer)
82 // CHECK-X64-NEXT: 16 | int a
83 // CHECK-X64-NEXT: 44 | (vtordisp for vbase C16)
84 // CHECK-X64-NEXT: 48 | struct C16 (virtual base)
85 // CHECK-X64-NEXT: 48 | (C16 vftable pointer)
86 // CHECK-X64-NEXT: 64 | int a
87 // CHECK-X64-NEXT: | [sizeof=80, align=16
88 // CHECK-X64-NEXT: | nvsize=24, nvalign=16]
90 struct TestF9 : A4, virtual C16 {
91 int a;
92 TestF9() : a(0xf00000f9) {}
93 virtual void g() { printf("F9"); }
96 // CHECK-LABEL: 0 | struct TestF9{{$}}
97 // CHECK-NEXT: 0 | (TestF9 vftable pointer)
98 // CHECK-NEXT: 4 | struct A4 (base)
99 // CHECK-NEXT: 4 | int a
100 // CHECK-NEXT: 8 | (TestF9 vbtable pointer)
101 // CHECK-NEXT: 12 | int a
102 // CHECK-NEXT: 16 | struct C16 (virtual base)
103 // CHECK-NEXT: 16 | (C16 vftable pointer)
104 // CHECK-NEXT: 32 | int a
105 // CHECK-NEXT: | [sizeof=48, align=16
106 // CHECK-NEXT: | nvsize=16, nvalign=16]
107 // CHECK-X64-LABEL: 0 | struct TestF9{{$}}
108 // CHECK-X64-NEXT: 0 | (TestF9 vftable pointer)
109 // CHECK-X64-NEXT: 8 | struct A4 (base)
110 // CHECK-X64-NEXT: 8 | int a
111 // CHECK-X64-NEXT: 16 | (TestF9 vbtable pointer)
112 // CHECK-X64-NEXT: 24 | int a
113 // CHECK-X64-NEXT: 32 | struct C16 (virtual base)
114 // CHECK-X64-NEXT: 32 | (C16 vftable pointer)
115 // CHECK-X64-NEXT: 48 | int a
116 // CHECK-X64-NEXT: | [sizeof=64, align=16
117 // CHECK-X64-NEXT: | nvsize=32, nvalign=16]
119 struct TestFB : A16, virtual C16 {
120 int a;
121 TestFB() : a(0xf00000fb) {}
122 virtual void g() { printf("Fb"); }
125 // CHECK-LABEL: 0 | struct TestFB{{$}}
126 // CHECK-NEXT: 0 | (TestFB vftable pointer)
127 // CHECK-NEXT: 16 | struct A16 (base)
128 // CHECK-NEXT: 16 | int a
129 // CHECK-NEXT: 32 | (TestFB vbtable pointer)
130 // CHECK-NEXT: 48 | int a
131 // CHECK-NEXT: 64 | struct C16 (virtual base)
132 // CHECK-NEXT: 64 | (C16 vftable pointer)
133 // CHECK-NEXT: 80 | int a
134 // CHECK-NEXT: | [sizeof=96, align=16
135 // CHECK-NEXT: | nvsize=64, nvalign=16]
136 // CHECK-X64-LABEL: 0 | struct TestFB{{$}}
137 // CHECK-X64-NEXT: 0 | (TestFB vftable pointer)
138 // CHECK-X64-NEXT: 16 | struct A16 (base)
139 // CHECK-X64-NEXT: 16 | int a
140 // CHECK-X64-NEXT: 32 | (TestFB vbtable pointer)
141 // CHECK-X64-NEXT: 48 | int a
142 // CHECK-X64-NEXT: 64 | struct C16 (virtual base)
143 // CHECK-X64-NEXT: 64 | (C16 vftable pointer)
144 // CHECK-X64-NEXT: 80 | int a
145 // CHECK-X64-NEXT: | [sizeof=96, align=16
146 // CHECK-X64-NEXT: | nvsize=64, nvalign=16]
148 struct TestF0 : A4, virtual B4 {
149 int a;
150 TestF0() : a(0xf00000F0) {}
153 // CHECK-LABEL: 0 | struct TestF0{{$}}
154 // CHECK-NEXT: 0 | struct A4 (base)
155 // CHECK-NEXT: 0 | int a
156 // CHECK-NEXT: 4 | (TestF0 vbtable pointer)
157 // CHECK-NEXT: 8 | int a
158 // CHECK-NEXT: 12 | struct B4 (virtual base)
159 // CHECK-NEXT: 12 | int a
160 // CHECK-NEXT: | [sizeof=16, align=4
161 // CHECK-NEXT: | nvsize=12, nvalign=4]
162 // CHECK-X64-LABEL: 0 | struct TestF0{{$}}
163 // CHECK-X64-NEXT: 0 | struct A4 (base)
164 // CHECK-X64-NEXT: 0 | int a
165 // CHECK-X64-NEXT: 8 | (TestF0 vbtable pointer)
166 // CHECK-X64-NEXT: 16 | int a
167 // CHECK-X64-NEXT: 24 | struct B4 (virtual base)
168 // CHECK-X64-NEXT: 24 | int a
169 // CHECK-X64-NEXT: | [sizeof=32, align=8
170 // CHECK-X64-NEXT: | nvsize=24, nvalign=8]
172 struct TestF1 : A4, virtual A16 {
173 int a;
174 TestF1() : a(0xf00000f1) {}
177 // CHECK-LABEL: 0 | struct TestF1{{$}}
178 // CHECK-NEXT: 0 | struct A4 (base)
179 // CHECK-NEXT: 0 | int a
180 // CHECK-NEXT: 4 | (TestF1 vbtable pointer)
181 // CHECK-NEXT: 8 | int a
182 // CHECK-NEXT: 16 | struct A16 (virtual base)
183 // CHECK-NEXT: 16 | int a
184 // CHECK-NEXT: | [sizeof=32, align=16
185 // CHECK-NEXT: | nvsize=12, nvalign=16]
186 // CHECK-X64-LABEL: 0 | struct TestF1{{$}}
187 // CHECK-X64-NEXT: 0 | struct A4 (base)
188 // CHECK-X64-NEXT: 0 | int a
189 // CHECK-X64-NEXT: 8 | (TestF1 vbtable pointer)
190 // CHECK-X64-NEXT: 16 | int a
191 // CHECK-X64-NEXT: 32 | struct A16 (virtual base)
192 // CHECK-X64-NEXT: 32 | int a
193 // CHECK-X64-NEXT: | [sizeof=48, align=16
194 // CHECK-X64-NEXT: | nvsize=24, nvalign=16]
196 struct TestF2 : A4, virtual C4 {
197 int a;
198 TestF2() : a(0xf00000f2) {}
201 // CHECK-LABEL: 0 | struct TestF2{{$}}
202 // CHECK-NEXT: 0 | struct A4 (base)
203 // CHECK-NEXT: 0 | int a
204 // CHECK-NEXT: 4 | (TestF2 vbtable pointer)
205 // CHECK-NEXT: 8 | int a
206 // CHECK-NEXT: 12 | struct C4 (virtual base)
207 // CHECK-NEXT: 12 | (C4 vftable pointer)
208 // CHECK-NEXT: 16 | int a
209 // CHECK-NEXT: | [sizeof=20, align=4
210 // CHECK-NEXT: | nvsize=12, nvalign=4]
211 // CHECK-X64-LABEL: 0 | struct TestF2{{$}}
212 // CHECK-X64-NEXT: 0 | struct A4 (base)
213 // CHECK-X64-NEXT: 0 | int a
214 // CHECK-X64-NEXT: 8 | (TestF2 vbtable pointer)
215 // CHECK-X64-NEXT: 16 | int a
216 // CHECK-X64-NEXT: 24 | struct C4 (virtual base)
217 // CHECK-X64-NEXT: 24 | (C4 vftable pointer)
218 // CHECK-X64-NEXT: 32 | int a
219 // CHECK-X64-NEXT: | [sizeof=40, align=8
220 // CHECK-X64-NEXT: | nvsize=24, nvalign=8]
222 struct TestF4 : TestF3, A4 {
223 int a;
224 TestF4() : a(0xf00000f4) {}
227 // CHECK-LABEL: 0 | struct TestF4{{$}}
228 // CHECK-NEXT: 0 | struct TestF3 (base)
229 // CHECK-NEXT: 0 | struct A4 (base)
230 // CHECK-NEXT: 0 | int a
231 // CHECK-NEXT: 4 | (TestF3 vbtable pointer)
232 // CHECK-NEXT: 8 | int a
233 // CHECK-NEXT: 12 | struct A4 (base)
234 // CHECK-NEXT: 12 | int a
235 // CHECK-NEXT: 16 | int a
236 // CHECK-NEXT: 32 | struct C16 (virtual base)
237 // CHECK-NEXT: 32 | (C16 vftable pointer)
238 // CHECK-NEXT: 48 | int a
239 // CHECK-NEXT: | [sizeof=64, align=16
240 // CHECK-NEXT: | nvsize=32, nvalign=16]
241 // CHECK-X64-LABEL: 0 | struct TestF4{{$}}
242 // CHECK-X64-NEXT: 0 | struct TestF3 (base)
243 // CHECK-X64-NEXT: 0 | struct A4 (base)
244 // CHECK-X64-NEXT: 0 | int a
245 // CHECK-X64-NEXT: 8 | (TestF3 vbtable pointer)
246 // CHECK-X64-NEXT: 16 | int a
247 // CHECK-X64-NEXT: 24 | struct A4 (base)
248 // CHECK-X64-NEXT: 24 | int a
249 // CHECK-X64-NEXT: 28 | int a
250 // CHECK-X64-NEXT: 32 | struct C16 (virtual base)
251 // CHECK-X64-NEXT: 32 | (C16 vftable pointer)
252 // CHECK-X64-NEXT: 48 | int a
253 // CHECK-X64-NEXT: | [sizeof=64, align=16
254 // CHECK-X64-NEXT: | nvsize=32, nvalign=16]
256 struct TestF5 : TestF3, A4 {
257 int a;
258 TestF5() : a(0xf00000f5) {}
259 virtual void g() {printf("F5");}
262 // CHECK-LABEL: 0 | struct TestF5{{$}}
263 // CHECK-NEXT: 0 | (TestF5 vftable pointer)
264 // CHECK-NEXT: 16 | struct TestF3 (base)
265 // CHECK-NEXT: 16 | struct A4 (base)
266 // CHECK-NEXT: 16 | int a
267 // CHECK-NEXT: 20 | (TestF3 vbtable pointer)
268 // CHECK-NEXT: 24 | int a
269 // CHECK-NEXT: 28 | struct A4 (base)
270 // CHECK-NEXT: 28 | int a
271 // CHECK-NEXT: 32 | int a
272 // CHECK-NEXT: 48 | struct C16 (virtual base)
273 // CHECK-NEXT: 48 | (C16 vftable pointer)
274 // CHECK-NEXT: 64 | int a
275 // CHECK-NEXT: | [sizeof=80, align=16
276 // CHECK-NEXT: | nvsize=48, nvalign=16]
277 // CHECK-X64-LABEL: 0 | struct TestF5{{$}}
278 // CHECK-X64-NEXT: 0 | (TestF5 vftable pointer)
279 // CHECK-X64-NEXT: 16 | struct TestF3 (base)
280 // CHECK-X64-NEXT: 16 | struct A4 (base)
281 // CHECK-X64-NEXT: 16 | int a
282 // CHECK-X64-NEXT: 24 | (TestF3 vbtable pointer)
283 // CHECK-X64-NEXT: 32 | int a
284 // CHECK-X64-NEXT: 40 | struct A4 (base)
285 // CHECK-X64-NEXT: 40 | int a
286 // CHECK-X64-NEXT: 44 | int a
287 // CHECK-X64-NEXT: 48 | struct C16 (virtual base)
288 // CHECK-X64-NEXT: 48 | (C16 vftable pointer)
289 // CHECK-X64-NEXT: 64 | int a
290 // CHECK-X64-NEXT: | [sizeof=80, align=16
291 // CHECK-X64-NEXT: | nvsize=48, nvalign=16]
293 struct TestF6 : TestF3, A4 {
294 int a;
295 TestF6() : a(0xf00000f6) {}
296 virtual void f() {printf("F6");}
299 // CHECK-LABEL: 0 | struct TestF6{{$}}
300 // CHECK-NEXT: 0 | struct TestF3 (base)
301 // CHECK-NEXT: 0 | struct A4 (base)
302 // CHECK-NEXT: 0 | int a
303 // CHECK-NEXT: 4 | (TestF3 vbtable pointer)
304 // CHECK-NEXT: 8 | int a
305 // CHECK-NEXT: 12 | struct A4 (base)
306 // CHECK-NEXT: 12 | int a
307 // CHECK-NEXT: 16 | int a
308 // CHECK-NEXT: 44 | (vtordisp for vbase C16)
309 // CHECK-NEXT: 48 | struct C16 (virtual base)
310 // CHECK-NEXT: 48 | (C16 vftable pointer)
311 // CHECK-NEXT: 64 | int a
312 // CHECK-NEXT: | [sizeof=80, align=16
313 // CHECK-NEXT: | nvsize=32, nvalign=16]
314 // CHECK-X64-LABEL: 0 | struct TestF6{{$}}
315 // CHECK-X64-NEXT: 0 | struct TestF3 (base)
316 // CHECK-X64-NEXT: 0 | struct A4 (base)
317 // CHECK-X64-NEXT: 0 | int a
318 // CHECK-X64-NEXT: 8 | (TestF3 vbtable pointer)
319 // CHECK-X64-NEXT: 16 | int a
320 // CHECK-X64-NEXT: 24 | struct A4 (base)
321 // CHECK-X64-NEXT: 24 | int a
322 // CHECK-X64-NEXT: 28 | int a
323 // CHECK-X64-NEXT: 44 | (vtordisp for vbase C16)
324 // CHECK-X64-NEXT: 48 | struct C16 (virtual base)
325 // CHECK-X64-NEXT: 48 | (C16 vftable pointer)
326 // CHECK-X64-NEXT: 64 | int a
327 // CHECK-X64-NEXT: | [sizeof=80, align=16
328 // CHECK-X64-NEXT: | nvsize=32, nvalign=16]
330 struct TestF8 : TestF7, A4 {
331 int a;
332 TestF8() : a(0xf00000f8) {}
333 virtual void f() {printf("F8");}
336 // CHECK-LABEL: 0 | struct TestF8{{$}}
337 // CHECK-NEXT: 0 | struct TestF7 (base)
338 // CHECK-NEXT: 0 | struct A4 (base)
339 // CHECK-NEXT: 0 | int a
340 // CHECK-NEXT: 4 | (TestF7 vbtable pointer)
341 // CHECK-NEXT: 8 | int a
342 // CHECK-NEXT: 12 | struct A4 (base)
343 // CHECK-NEXT: 12 | int a
344 // CHECK-NEXT: 16 | int a
345 // CHECK-NEXT: 44 | (vtordisp for vbase C16)
346 // CHECK-NEXT: 48 | struct C16 (virtual base)
347 // CHECK-NEXT: 48 | (C16 vftable pointer)
348 // CHECK-NEXT: 64 | int a
349 // CHECK-NEXT: | [sizeof=80, align=16
350 // CHECK-NEXT: | nvsize=32, nvalign=16]
351 // CHECK-X64-LABEL: 0 | struct TestF8{{$}}
352 // CHECK-X64-NEXT: 0 | struct TestF7 (base)
353 // CHECK-X64-NEXT: 0 | struct A4 (base)
354 // CHECK-X64-NEXT: 0 | int a
355 // CHECK-X64-NEXT: 8 | (TestF7 vbtable pointer)
356 // CHECK-X64-NEXT: 16 | int a
357 // CHECK-X64-NEXT: 24 | struct A4 (base)
358 // CHECK-X64-NEXT: 24 | int a
359 // CHECK-X64-NEXT: 28 | int a
360 // CHECK-X64-NEXT: 44 | (vtordisp for vbase C16)
361 // CHECK-X64-NEXT: 48 | struct C16 (virtual base)
362 // CHECK-X64-NEXT: 48 | (C16 vftable pointer)
363 // CHECK-X64-NEXT: 64 | int a
364 // CHECK-X64-NEXT: | [sizeof=80, align=16
365 // CHECK-X64-NEXT: | nvsize=32, nvalign=16]
367 struct TestFA : TestF9, A4 {
368 int a;
369 TestFA() : a(0xf00000fa) {}
370 virtual void g() {printf("FA");}
373 // CHECK-LABEL: 0 | struct TestFA{{$}}
374 // CHECK-NEXT: 0 | struct TestF9 (primary base)
375 // CHECK-NEXT: 0 | (TestF9 vftable pointer)
376 // CHECK-NEXT: 4 | struct A4 (base)
377 // CHECK-NEXT: 4 | int a
378 // CHECK-NEXT: 8 | (TestF9 vbtable pointer)
379 // CHECK-NEXT: 12 | int a
380 // CHECK-NEXT: 16 | struct A4 (base)
381 // CHECK-NEXT: 16 | int a
382 // CHECK-NEXT: 20 | int a
383 // CHECK-NEXT: 32 | struct C16 (virtual base)
384 // CHECK-NEXT: 32 | (C16 vftable pointer)
385 // CHECK-NEXT: 48 | int a
386 // CHECK-NEXT: | [sizeof=64, align=16
387 // CHECK-NEXT: | nvsize=32, nvalign=16]
388 // CHECK-X64-LABEL: 0 | struct TestFA{{$}}
389 // CHECK-X64-NEXT: 0 | struct TestF9 (primary base)
390 // CHECK-X64-NEXT: 0 | (TestF9 vftable pointer)
391 // CHECK-X64-NEXT: 8 | struct A4 (base)
392 // CHECK-X64-NEXT: 8 | int a
393 // CHECK-X64-NEXT: 16 | (TestF9 vbtable pointer)
394 // CHECK-X64-NEXT: 24 | int a
395 // CHECK-X64-NEXT: 32 | struct A4 (base)
396 // CHECK-X64-NEXT: 32 | int a
397 // CHECK-X64-NEXT: 36 | int a
398 // CHECK-X64-NEXT: 48 | struct C16 (virtual base)
399 // CHECK-X64-NEXT: 48 | (C16 vftable pointer)
400 // CHECK-X64-NEXT: 64 | int a
401 // CHECK-X64-NEXT: | [sizeof=80, align=16
402 // CHECK-X64-NEXT: | nvsize=48, nvalign=16]
404 struct TestFC : TestFB, A4 {
405 int a;
406 TestFC() : a(0xf00000fc) {}
407 virtual void g() {printf("FC");}
410 // CHECK-LABEL: 0 | struct TestFC{{$}}
411 // CHECK-NEXT: 0 | struct TestFB (primary base)
412 // CHECK-NEXT: 0 | (TestFB vftable pointer)
413 // CHECK-NEXT: 16 | struct A16 (base)
414 // CHECK-NEXT: 16 | int a
415 // CHECK-NEXT: 32 | (TestFB vbtable pointer)
416 // CHECK-NEXT: 48 | int a
417 // CHECK-NEXT: 64 | struct A4 (base)
418 // CHECK-NEXT: 64 | int a
419 // CHECK-NEXT: 68 | int a
420 // CHECK-NEXT: 80 | struct C16 (virtual base)
421 // CHECK-NEXT: 80 | (C16 vftable pointer)
422 // CHECK-NEXT: 96 | int a
423 // CHECK-NEXT: | [sizeof=112, align=16
424 // CHECK-NEXT: | nvsize=80, nvalign=16]
425 // CHECK-X64-LABEL: 0 | struct TestFC{{$}}
426 // CHECK-X64-NEXT: 0 | struct TestFB (primary base)
427 // CHECK-X64-NEXT: 0 | (TestFB vftable pointer)
428 // CHECK-X64-NEXT: 16 | struct A16 (base)
429 // CHECK-X64-NEXT: 16 | int a
430 // CHECK-X64-NEXT: 32 | (TestFB vbtable pointer)
431 // CHECK-X64-NEXT: 48 | int a
432 // CHECK-X64-NEXT: 64 | struct A4 (base)
433 // CHECK-X64-NEXT: 64 | int a
434 // CHECK-X64-NEXT: 68 | int a
435 // CHECK-X64-NEXT: 80 | struct C16 (virtual base)
436 // CHECK-X64-NEXT: 80 | (C16 vftable pointer)
437 // CHECK-X64-NEXT: 96 | int a
438 // CHECK-X64-NEXT: | [sizeof=112, align=16
439 // CHECK-X64-NEXT: | nvsize=80, nvalign=16]
441 struct A16f {
442 __declspec(align(16)) int a;
443 A16f() : a(0xf0000a16) {}
444 virtual void f() {printf("A16f");}
447 struct Y { char y; Y() : y(0xaa) {} };
448 struct X : virtual A16f {};
450 struct B : A4, Y, X {
451 int a;
452 B() : a(0xf000000b) {}
455 struct F0 : A4, B {
456 int a;
457 F0() : a(0xf00000f0) {}
458 virtual void g() {printf("F0");}
461 // CHECK-LABEL: 0 | struct F0{{$}}
462 // CHECK-NEXT: 0 | (F0 vftable pointer)
463 // CHECK-NEXT: 16 | struct A4 (base)
464 // CHECK-NEXT: 16 | int a
465 // CHECK-NEXT: 32 | struct B (base)
466 // CHECK-NEXT: 32 | struct A4 (base)
467 // CHECK-NEXT: 32 | int a
468 // CHECK-NEXT: 36 | struct Y (base)
469 // CHECK-NEXT: 36 | char y
470 // CHECK-NEXT: 48 | struct X (base)
471 // CHECK-NEXT: 48 | (X vbtable pointer)
472 // CHECK-NEXT: 52 | int a
473 // CHECK-NEXT: 64 | int a
474 // CHECK-NEXT: 80 | struct A16f (virtual base)
475 // CHECK-NEXT: 80 | (A16f vftable pointer)
476 // CHECK-NEXT: 96 | int a
477 // CHECK-NEXT: | [sizeof=112, align=16
478 // CHECK-NEXT: | nvsize=80, nvalign=16]
479 // CHECK-X64-LABEL: 0 | struct F0{{$}}
480 // CHECK-X64-NEXT: 0 | (F0 vftable pointer)
481 // CHECK-X64-NEXT: 16 | struct A4 (base)
482 // CHECK-X64-NEXT: 16 | int a
483 // CHECK-X64-NEXT: 32 | struct B (base)
484 // CHECK-X64-NEXT: 32 | struct A4 (base)
485 // CHECK-X64-NEXT: 32 | int a
486 // CHECK-X64-NEXT: 36 | struct Y (base)
487 // CHECK-X64-NEXT: 36 | char y
488 // CHECK-X64-NEXT: 48 | struct X (base)
489 // CHECK-X64-NEXT: 48 | (X vbtable pointer)
490 // CHECK-X64-NEXT: 56 | int a
491 // CHECK-X64-NEXT: 64 | int a
492 // CHECK-X64-NEXT: 80 | struct A16f (virtual base)
493 // CHECK-X64-NEXT: 80 | (A16f vftable pointer)
494 // CHECK-X64-NEXT: 96 | int a
495 // CHECK-X64-NEXT: | [sizeof=112, align=16
496 // CHECK-X64-NEXT: | nvsize=80, nvalign=16]
498 struct F1 : B, A4 {
499 int a;
500 F1() : a(0xf00000f1) {}
501 virtual void g() {printf("F1");}
504 // CHECK-LABEL: 0 | struct F1{{$}}
505 // CHECK-NEXT: 0 | (F1 vftable pointer)
506 // CHECK-NEXT: 16 | struct B (base)
507 // CHECK-NEXT: 16 | struct A4 (base)
508 // CHECK-NEXT: 16 | int a
509 // CHECK-NEXT: 20 | struct Y (base)
510 // CHECK-NEXT: 20 | char y
511 // CHECK-NEXT: 32 | struct X (base)
512 // CHECK-NEXT: 32 | (X vbtable pointer)
513 // CHECK-NEXT: 36 | int a
514 // CHECK-NEXT: 48 | struct A4 (base)
515 // CHECK-NEXT: 48 | int a
516 // CHECK-NEXT: 52 | int a
517 // CHECK-NEXT: 64 | struct A16f (virtual base)
518 // CHECK-NEXT: 64 | (A16f vftable pointer)
519 // CHECK-NEXT: 80 | int a
520 // CHECK-NEXT: | [sizeof=96, align=16
521 // CHECK-NEXT: | nvsize=64, nvalign=16]
522 // CHECK-X64-LABEL: 0 | struct F1{{$}}
523 // CHECK-X64-NEXT: 0 | (F1 vftable pointer)
524 // CHECK-X64-NEXT: 16 | struct B (base)
525 // CHECK-X64-NEXT: 16 | struct A4 (base)
526 // CHECK-X64-NEXT: 16 | int a
527 // CHECK-X64-NEXT: 20 | struct Y (base)
528 // CHECK-X64-NEXT: 20 | char y
529 // CHECK-X64-NEXT: 32 | struct X (base)
530 // CHECK-X64-NEXT: 32 | (X vbtable pointer)
531 // CHECK-X64-NEXT: 40 | int a
532 // CHECK-X64-NEXT: 48 | struct A4 (base)
533 // CHECK-X64-NEXT: 48 | int a
534 // CHECK-X64-NEXT: 52 | int a
535 // CHECK-X64-NEXT: 64 | struct A16f (virtual base)
536 // CHECK-X64-NEXT: 64 | (A16f vftable pointer)
537 // CHECK-X64-NEXT: 80 | int a
538 // CHECK-X64-NEXT: | [sizeof=96, align=16
539 // CHECK-X64-NEXT: | nvsize=64, nvalign=16]
541 struct F2 : A4, virtual A16f {
542 int a;
543 F2() : a(0xf00000f2) {}
544 virtual void g() {printf("F2");}
547 // CHECK-LABEL: 0 | struct F2{{$}}
548 // CHECK-NEXT: 0 | (F2 vftable pointer)
549 // CHECK-NEXT: 4 | struct A4 (base)
550 // CHECK-NEXT: 4 | int a
551 // CHECK-NEXT: 8 | (F2 vbtable pointer)
552 // CHECK-NEXT: 12 | int a
553 // CHECK-NEXT: 16 | struct A16f (virtual base)
554 // CHECK-NEXT: 16 | (A16f vftable pointer)
555 // CHECK-NEXT: 32 | int a
556 // CHECK-NEXT: | [sizeof=48, align=16
557 // CHECK-NEXT: | nvsize=16, nvalign=16]
558 // CHECK-X64-LABEL: 0 | struct F2{{$}}
559 // CHECK-X64-NEXT: 0 | (F2 vftable pointer)
560 // CHECK-X64-NEXT: 8 | struct A4 (base)
561 // CHECK-X64-NEXT: 8 | int a
562 // CHECK-X64-NEXT: 16 | (F2 vbtable pointer)
563 // CHECK-X64-NEXT: 24 | int a
564 // CHECK-X64-NEXT: 32 | struct A16f (virtual base)
565 // CHECK-X64-NEXT: 32 | (A16f vftable pointer)
566 // CHECK-X64-NEXT: 48 | int a
567 // CHECK-X64-NEXT: | [sizeof=64, align=16
568 // CHECK-X64-NEXT: | nvsize=32, nvalign=16]
570 struct F3 : A4, virtual A16f {
571 __declspec(align(16)) int a;
572 F3() : a(0xf00000f3) {}
573 virtual void g() {printf("F3");}
576 // CHECK-LABEL: 0 | struct F3{{$}}
577 // CHECK-NEXT: 0 | (F3 vftable pointer)
578 // CHECK-NEXT: 16 | struct A4 (base)
579 // CHECK-NEXT: 16 | int a
580 // CHECK-NEXT: 20 | (F3 vbtable pointer)
581 // CHECK-NEXT: 48 | int a
582 // CHECK-NEXT: 64 | struct A16f (virtual base)
583 // CHECK-NEXT: 64 | (A16f vftable pointer)
584 // CHECK-NEXT: 80 | int a
585 // CHECK-NEXT: | [sizeof=96, align=16
586 // CHECK-NEXT: | nvsize=64, nvalign=16]
587 // CHECK-X64-LABEL: 0 | struct F3{{$}}
588 // CHECK-X64-NEXT: 0 | (F3 vftable pointer)
589 // CHECK-X64-NEXT: 16 | struct A4 (base)
590 // CHECK-X64-NEXT: 16 | int a
591 // CHECK-X64-NEXT: 24 | (F3 vbtable pointer)
592 // CHECK-X64-NEXT: 48 | int a
593 // CHECK-X64-NEXT: 64 | struct A16f (virtual base)
594 // CHECK-X64-NEXT: 64 | (A16f vftable pointer)
595 // CHECK-X64-NEXT: 80 | int a
596 // CHECK-X64-NEXT: | [sizeof=96, align=16
597 // CHECK-X64-NEXT: | nvsize=64, nvalign=16]
599 struct F4 : A4, B {
600 __declspec(align(16)) int a;
601 F4() : a(0xf00000f4) {}
602 virtual void g() {printf("F4");}
605 // CHECK-LABEL: 0 | struct F4{{$}}
606 // CHECK-NEXT: 0 | (F4 vftable pointer)
607 // CHECK-NEXT: 16 | struct A4 (base)
608 // CHECK-NEXT: 16 | int a
609 // CHECK-NEXT: 32 | struct B (base)
610 // CHECK-NEXT: 32 | struct A4 (base)
611 // CHECK-NEXT: 32 | int a
612 // CHECK-NEXT: 36 | struct Y (base)
613 // CHECK-NEXT: 36 | char y
614 // CHECK-NEXT: 48 | struct X (base)
615 // CHECK-NEXT: 48 | (X vbtable pointer)
616 // CHECK-NEXT: 52 | int a
617 // CHECK-NEXT: 64 | int a
618 // CHECK-NEXT: 80 | struct A16f (virtual base)
619 // CHECK-NEXT: 80 | (A16f vftable pointer)
620 // CHECK-NEXT: 96 | int a
621 // CHECK-NEXT: | [sizeof=112, align=16
622 // CHECK-NEXT: | nvsize=80, nvalign=16]
623 // CHECK-X64-LABEL: 0 | struct F4{{$}}
624 // CHECK-X64-NEXT: 0 | (F4 vftable pointer)
625 // CHECK-X64-NEXT: 16 | struct A4 (base)
626 // CHECK-X64-NEXT: 16 | int a
627 // CHECK-X64-NEXT: 32 | struct B (base)
628 // CHECK-X64-NEXT: 32 | struct A4 (base)
629 // CHECK-X64-NEXT: 32 | int a
630 // CHECK-X64-NEXT: 36 | struct Y (base)
631 // CHECK-X64-NEXT: 36 | char y
632 // CHECK-X64-NEXT: 48 | struct X (base)
633 // CHECK-X64-NEXT: 48 | (X vbtable pointer)
634 // CHECK-X64-NEXT: 56 | int a
635 // CHECK-X64-NEXT: 64 | int a
636 // CHECK-X64-NEXT: 80 | struct A16f (virtual base)
637 // CHECK-X64-NEXT: 80 | (A16f vftable pointer)
638 // CHECK-X64-NEXT: 96 | int a
639 // CHECK-X64-NEXT: | [sizeof=112, align=16
640 // CHECK-X64-NEXT: | nvsize=80, nvalign=16]
642 struct F5 : A16f, virtual A4 {
643 int a;
644 F5() : a(0xf00000f5) {}
645 virtual void g() {printf("F5");}
648 // CHECK-LABEL: 0 | struct F5{{$}}
649 // CHECK-NEXT: 0 | struct A16f (primary base)
650 // CHECK-NEXT: 0 | (A16f vftable pointer)
651 // CHECK-NEXT: 16 | int a
652 // CHECK-NEXT: 32 | (F5 vbtable pointer)
653 // CHECK-NEXT: 48 | int a
654 // CHECK-NEXT: 64 | struct A4 (virtual base)
655 // CHECK-NEXT: 64 | int a
656 // CHECK-NEXT: | [sizeof=80, align=16
657 // CHECK-NEXT: | nvsize=64, nvalign=16]
658 // CHECK-X64-LABEL: 0 | struct F5{{$}}
659 // CHECK-X64-NEXT: 0 | struct A16f (primary base)
660 // CHECK-X64-NEXT: 0 | (A16f vftable pointer)
661 // CHECK-X64-NEXT: 16 | int a
662 // CHECK-X64-NEXT: 32 | (F5 vbtable pointer)
663 // CHECK-X64-NEXT: 48 | int a
664 // CHECK-X64-NEXT: 64 | struct A4 (virtual base)
665 // CHECK-X64-NEXT: 64 | int a
666 // CHECK-X64-NEXT: | [sizeof=80, align=16
667 // CHECK-X64-NEXT: | nvsize=64, nvalign=16]
669 struct F6 : virtual A16f, A4, virtual B {
670 int a;
671 F6() : a(0xf00000f6) {}
672 virtual void g() {printf("F6");}
675 // CHECK-LABEL: 0 | struct F6{{$}}
676 // CHECK-NEXT: 0 | (F6 vftable pointer)
677 // CHECK-NEXT: 4 | struct A4 (base)
678 // CHECK-NEXT: 4 | int a
679 // CHECK-NEXT: 8 | (F6 vbtable pointer)
680 // CHECK-NEXT: 12 | int a
681 // CHECK-NEXT: 16 | struct A16f (virtual base)
682 // CHECK-NEXT: 16 | (A16f vftable pointer)
683 // CHECK-NEXT: 32 | int a
684 // CHECK-NEXT: 48 | struct B (virtual base)
685 // CHECK-NEXT: 48 | struct A4 (base)
686 // CHECK-NEXT: 48 | int a
687 // CHECK-NEXT: 52 | struct Y (base)
688 // CHECK-NEXT: 52 | char y
689 // CHECK-NEXT: 64 | struct X (base)
690 // CHECK-NEXT: 64 | (X vbtable pointer)
691 // CHECK-NEXT: 68 | int a
692 // CHECK-NEXT: | [sizeof=80, align=16
693 // CHECK-NEXT: | nvsize=16, nvalign=16]
694 // CHECK-X64-LABEL: 0 | struct F6{{$}}
695 // CHECK-X64-NEXT: 0 | (F6 vftable pointer)
696 // CHECK-X64-NEXT: 8 | struct A4 (base)
697 // CHECK-X64-NEXT: 8 | int a
698 // CHECK-X64-NEXT: 16 | (F6 vbtable pointer)
699 // CHECK-X64-NEXT: 24 | int a
700 // CHECK-X64-NEXT: 32 | struct A16f (virtual base)
701 // CHECK-X64-NEXT: 32 | (A16f vftable pointer)
702 // CHECK-X64-NEXT: 48 | int a
703 // CHECK-X64-NEXT: 64 | struct B (virtual base)
704 // CHECK-X64-NEXT: 64 | struct A4 (base)
705 // CHECK-X64-NEXT: 64 | int a
706 // CHECK-X64-NEXT: 68 | struct Y (base)
707 // CHECK-X64-NEXT: 68 | char y
708 // CHECK-X64-NEXT: 80 | struct X (base)
709 // CHECK-X64-NEXT: 80 | (X vbtable pointer)
710 // CHECK-X64-NEXT: 88 | int a
711 // CHECK-X64-NEXT: | [sizeof=96, align=16
712 // CHECK-X64-NEXT: | nvsize=32, nvalign=16]
714 struct ArrayFieldOfRecords {
715 A4 InlineElts[2];
718 // CHECK-LABEL: 0 | struct ArrayFieldOfRecords{{$}}
719 // CHECK-NEXT: 0 | A4[2] InlineElts
720 // CHECK-NEXT: | [sizeof=8, align=4
721 // CHECK-NEXT: | nvsize=8, nvalign=4]
722 // CHECK-X64-LABEL: 0 | struct ArrayFieldOfRecords{{$}}
723 // CHECK-X64-NEXT: 0 | A4[2] InlineElts
724 // CHECK-X64-NEXT: | [sizeof=8, align=4
725 // CHECK-X64-NEXT: | nvsize=8, nvalign=4]
727 struct ArrayOfArrayFieldOfRecords {
728 A4 InlineElts[2][2];
731 // CHECK-LABEL: 0 | struct ArrayOfArrayFieldOfRecords{{$}}
732 // CHECK-NEXT: 0 | A4[2][2] InlineElts
733 // CHECK-NEXT: | [sizeof=16, align=4
734 // CHECK-NEXT: | nvsize=16, nvalign=4]
735 // CHECK-X64-LABEL: 0 | struct ArrayOfArrayFieldOfRecords{{$}}
736 // CHECK-X64-NEXT: 0 | A4[2][2] InlineElts
737 // CHECK-X64-NEXT: | [sizeof=16, align=4
738 // CHECK-X64-NEXT: | nvsize=16, nvalign=4]
740 struct RecordArrayTypedef {
741 typedef A4 ArrayTy[2];
742 ArrayTy InlineElts[2];
745 // CHECK-LABEL: 0 | struct RecordArrayTypedef{{$}}
746 // CHECK-NEXT: 0 | ArrayTy[2] InlineElts
747 // CHECK-NEXT: | [sizeof=16, align=4
748 // CHECK-NEXT: | nvsize=16, nvalign=4]
749 // CHECK-X64-LABEL: 0 | struct RecordArrayTypedef{{$}}
750 // CHECK-X64-NEXT: 0 | ArrayTy[2] InlineElts
751 // CHECK-X64-NEXT: | [sizeof=16, align=4
752 // CHECK-X64-NEXT: | nvsize=16, nvalign=4]
754 struct EmptyIntMemb {
755 int FlexArrayMemb[0];
758 // CHECK-LABEL: 0 | struct EmptyIntMemb{{$}}
759 // CHECK-NEXT: 0 | int[0] FlexArrayMemb
760 // CHECK-NEXT: | [sizeof=1, align=4
761 // CHECK-NEXT: | nvsize=0, nvalign=4]
762 // CHECK-X64-LABEL: 0 | struct EmptyIntMemb{{$}}
763 // CHECK-X64-NEXT: 0 | int[0] FlexArrayMemb
764 // CHECK-X64-NEXT: | [sizeof=4, align=4
765 // CHECK-X64-NEXT: | nvsize=0, nvalign=4]
767 struct EmptyLongLongMemb {
768 long long FlexArrayMemb[0];
771 // CHECK-LABEL: 0 | struct EmptyLongLongMemb{{$}}
772 // CHECK-NEXT: 0 | long long[0] FlexArrayMemb
773 // CHECK-NEXT: | [sizeof=1, align=8
774 // CHECK-NEXT: | nvsize=0, nvalign=8]
775 // CHECK-X64-LABEL: 0 | struct EmptyLongLongMemb{{$}}
776 // CHECK-X64-NEXT: 0 | long long[0] FlexArrayMemb
777 // CHECK-X64-NEXT: | [sizeof=8, align=8
778 // CHECK-X64-NEXT: | nvsize=0, nvalign=8]
780 int a[
781 sizeof(TestF0)+
782 sizeof(TestF1)+
783 sizeof(TestF2)+
784 sizeof(TestF3)+
785 sizeof(TestF4)+
786 sizeof(TestF5)+
787 sizeof(TestF6)+
788 sizeof(TestF7)+
789 sizeof(TestF8)+
790 sizeof(TestF9)+
791 sizeof(TestFA)+
792 sizeof(TestFB)+
793 sizeof(TestFC)+
794 sizeof(F0)+
795 sizeof(F1)+
796 sizeof(F2)+
797 sizeof(F3)+
798 sizeof(F4)+
799 sizeof(F5)+
800 sizeof(F6)+
801 sizeof(ArrayFieldOfRecords)+
802 sizeof(ArrayOfArrayFieldOfRecords)+
803 sizeof(RecordArrayTypedef)+
804 sizeof(EmptyIntMemb)+
805 sizeof(EmptyLongLongMemb)+