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
, ...);
10 B0() : a(0xf00000B0) {}
12 struct __declspec(align(16)) B1
{
14 B1() : a(0xf00000B1) {}
17 __declspec(align(16)) int a
;
18 B2() : a(0xf00000B2) {}
20 struct __declspec(align(16)) B3
{
23 B3() : a(0xf00000B3), a1(0xf00000B3f00000B3ll
) {}
29 struct __declspec(align(32)) A16
{};
30 struct V1
: A16
{ virtual void f() {} };
34 V2() : a(0xf0000011f0000011ll
), a1(0xf0000011) {}
38 V3() : a(0xf0000022) {}
40 struct __declspec(align(16)) A16X
{
42 struct __declspec(align(16)) B0X
{
44 B0X() : a(0xf00000B0), a1(0xf00000B0) {}
48 B1X() : a(0xf00000B1) {}
52 B2X() : a(0xf00000B2) {}
54 struct __declspec(align(16)) B3X
{
56 B3X() : a(0xf00000B3) {}
61 B4X() : a(0xf00000B4), a1(0xf00000B4) {}
63 struct B5X
: virtual A16X
{
65 B5X() : a(0xf00000B5), a1(0xf00000B5) {}
69 B6X() : a(0xf00000B6) {}
72 struct A
: B1
, B0
, B2
, virtual V
{
74 A() : a(0xf000000A) {}
77 // CHECK-LABEL: 0 | struct A{{$}}
78 // CHECK-NEXT: 0 | struct B1 (base)
79 // CHECK-NEXT: 0 | int a
80 // CHECK-NEXT: 4 | struct B0 (base)
81 // CHECK-NEXT: 4 | int a
82 // CHECK-NEXT: 16 | struct B2 (base)
83 // CHECK-NEXT: 16 | int a
84 // CHECK-NEXT: 32 | (A vbtable pointer)
85 // CHECK-NEXT: 48 | int a
86 // CHECK-NEXT: 64 | struct V (virtual base)
87 // CHECK-NEXT: 64 | char a
88 // CHECK-NEXT: | [sizeof=80, align=16
89 // CHECK-NEXT: | nvsize=64, nvalign=16]
90 // CHECK-X64-LABEL: 0 | struct A{{$}}
91 // CHECK-X64-NEXT: 0 | struct B1 (base)
92 // CHECK-X64-NEXT: 0 | int a
93 // CHECK-X64-NEXT: 4 | struct B0 (base)
94 // CHECK-X64-NEXT: 4 | int a
95 // CHECK-X64-NEXT: 16 | struct B2 (base)
96 // CHECK-X64-NEXT: 16 | int a
97 // CHECK-X64-NEXT: 32 | (A vbtable pointer)
98 // CHECK-X64-NEXT: 48 | int a
99 // CHECK-X64-NEXT: 64 | struct V (virtual base)
100 // CHECK-X64-NEXT: 64 | char a
101 // CHECK-X64-NEXT: | [sizeof=80, align=16
102 // CHECK-X64-NEXT: | nvsize=64, nvalign=16]
104 struct B
: B2
, B0
, B1
, virtual V
{
106 B() : a(0xf000000B) {}
109 // CHECK-LABEL: 0 | struct B{{$}}
110 // CHECK-NEXT: 0 | struct B2 (base)
111 // CHECK-NEXT: 0 | int a
112 // CHECK-NEXT: 16 | struct B0 (base)
113 // CHECK-NEXT: 16 | int a
114 // CHECK-NEXT: 32 | struct B1 (base)
115 // CHECK-NEXT: 32 | int a
116 // CHECK-NEXT: 36 | (B vbtable pointer)
117 // CHECK-NEXT: 52 | int a
118 // CHECK-NEXT: 64 | struct V (virtual base)
119 // CHECK-NEXT: 64 | char a
120 // CHECK-NEXT: | [sizeof=80, align=16
121 // CHECK-NEXT: | nvsize=64, nvalign=16]
122 // CHECK-X64-LABEL: 0 | struct B{{$}}
123 // CHECK-X64-NEXT: 0 | struct B2 (base)
124 // CHECK-X64-NEXT: 0 | int a
125 // CHECK-X64-NEXT: 16 | struct B0 (base)
126 // CHECK-X64-NEXT: 16 | int a
127 // CHECK-X64-NEXT: 32 | struct B1 (base)
128 // CHECK-X64-NEXT: 32 | int a
129 // CHECK-X64-NEXT: 40 | (B vbtable pointer)
130 // CHECK-X64-NEXT: 52 | int a
131 // CHECK-X64-NEXT: 64 | struct V (virtual base)
132 // CHECK-X64-NEXT: 64 | char a
133 // CHECK-X64-NEXT: | [sizeof=80, align=16
134 // CHECK-X64-NEXT: | nvsize=64, nvalign=16]
136 struct C
: B1
, B0
, virtual V
{
139 C() : a(0xf000000C), a1(0xf000000Cf000000Cll
) {}
142 // CHECK-LABEL: 0 | struct C{{$}}
143 // CHECK-NEXT: 0 | struct B1 (base)
144 // CHECK-NEXT: 0 | int a
145 // CHECK-NEXT: 4 | struct B0 (base)
146 // CHECK-NEXT: 4 | int a
147 // CHECK-NEXT: 8 | (C vbtable pointer)
148 // CHECK-NEXT: 24 | int a
149 // CHECK-NEXT: 32 | long long a1
150 // CHECK-NEXT: 48 | struct V (virtual base)
151 // CHECK-NEXT: 48 | char a
152 // CHECK-NEXT: | [sizeof=64, align=16
153 // CHECK-NEXT: | nvsize=48, nvalign=16]
154 // CHECK-X64-LABEL: 0 | struct C{{$}}
155 // CHECK-X64-NEXT: 0 | struct B1 (base)
156 // CHECK-X64-NEXT: 0 | int a
157 // CHECK-X64-NEXT: 4 | struct B0 (base)
158 // CHECK-X64-NEXT: 4 | int a
159 // CHECK-X64-NEXT: 8 | (C vbtable pointer)
160 // CHECK-X64-NEXT: 24 | int a
161 // CHECK-X64-NEXT: 32 | long long a1
162 // CHECK-X64-NEXT: 48 | struct V (virtual base)
163 // CHECK-X64-NEXT: 48 | char a
164 // CHECK-X64-NEXT: | [sizeof=64, align=16
165 // CHECK-X64-NEXT: | nvsize=48, nvalign=16]
167 struct D
: B2
, B0
, virtual V
{
169 D() : a(0xf000000D) {}
172 // CHECK-LABEL: 0 | struct D{{$}}
173 // CHECK-NEXT: 0 | struct B2 (base)
174 // CHECK-NEXT: 0 | int a
175 // CHECK-NEXT: 16 | struct B0 (base)
176 // CHECK-NEXT: 16 | int a
177 // CHECK-NEXT: 20 | (D vbtable pointer)
178 // CHECK-NEXT: 36 | int a
179 // CHECK-NEXT: 48 | struct V (virtual base)
180 // CHECK-NEXT: 48 | char a
181 // CHECK-NEXT: | [sizeof=64, align=16
182 // CHECK-NEXT: | nvsize=48, nvalign=16]
183 // CHECK-X64-LABEL: 0 | struct D{{$}}
184 // CHECK-X64-NEXT: 0 | struct B2 (base)
185 // CHECK-X64-NEXT: 0 | int a
186 // CHECK-X64-NEXT: 16 | struct B0 (base)
187 // CHECK-X64-NEXT: 16 | int a
188 // CHECK-X64-NEXT: 24 | (D vbtable pointer)
189 // CHECK-X64-NEXT: 36 | int a
190 // CHECK-X64-NEXT: 48 | struct V (virtual base)
191 // CHECK-X64-NEXT: 48 | char a
192 // CHECK-X64-NEXT: | [sizeof=64, align=16
193 // CHECK-X64-NEXT: | nvsize=48, nvalign=16]
195 struct E
: B3
, B0
, virtual V
{
197 E() : a(0xf000000E) {}
200 // CHECK-LABEL: 0 | struct E{{$}}
201 // CHECK-NEXT: 0 | struct B3 (base)
202 // CHECK-NEXT: 0 | long long a1
203 // CHECK-NEXT: 8 | int a
204 // CHECK-NEXT: 16 | struct B0 (base)
205 // CHECK-NEXT: 16 | int a
206 // CHECK-NEXT: 20 | (E vbtable pointer)
207 // CHECK-NEXT: 36 | int a
208 // CHECK-NEXT: 48 | struct V (virtual base)
209 // CHECK-NEXT: 48 | char a
210 // CHECK-NEXT: | [sizeof=64, align=16
211 // CHECK-NEXT: | nvsize=48, nvalign=16]
212 // CHECK-X64-LABEL: 0 | struct E{{$}}
213 // CHECK-X64-NEXT: 0 | struct B3 (base)
214 // CHECK-X64-NEXT: 0 | long long a1
215 // CHECK-X64-NEXT: 8 | int a
216 // CHECK-X64-NEXT: 16 | struct B0 (base)
217 // CHECK-X64-NEXT: 16 | int a
218 // CHECK-X64-NEXT: 24 | (E vbtable pointer)
219 // CHECK-X64-NEXT: 36 | int a
220 // CHECK-X64-NEXT: 48 | struct V (virtual base)
221 // CHECK-X64-NEXT: 48 | char a
222 // CHECK-X64-NEXT: | [sizeof=64, align=16
223 // CHECK-X64-NEXT: | nvsize=48, nvalign=16]
225 struct F
: B0
, virtual V1
{
226 __declspec(align(16)) int a
;
227 F() : a(0xf000000F) {}
231 // CHECK-LABEL: 0 | struct F{{$}}
232 // CHECK-NEXT: 0 | struct B0 (base)
233 // CHECK-NEXT: 0 | int a
234 // CHECK-NEXT: 4 | (F vbtable pointer)
235 // CHECK-NEXT: 32 | int a
236 // CHECK-NEXT: 92 | (vtordisp for vbase V1)
237 // CHECK-NEXT: 96 | struct V1 (virtual base)
238 // CHECK-NEXT: 96 | (V1 vftable pointer)
239 // CHECK-NEXT: 128 | struct A16 (base) (empty)
240 // CHECK-NEXT: | [sizeof=128, align=32
241 // CHECK-NEXT: | nvsize=48, nvalign=32]
242 // CHECK-X64-LABEL: 0 | struct F{{$}}
243 // CHECK-X64-NEXT: 0 | struct B0 (base)
244 // CHECK-X64-NEXT: 0 | int a
245 // CHECK-X64-NEXT: 8 | (F vbtable pointer)
246 // CHECK-X64-NEXT: 32 | int a
247 // CHECK-X64-NEXT: 92 | (vtordisp for vbase V1)
248 // CHECK-X64-NEXT: 96 | struct V1 (virtual base)
249 // CHECK-X64-NEXT: 96 | (V1 vftable pointer)
250 // CHECK-X64-NEXT: 128 | struct A16 (base) (empty)
251 // CHECK-X64-NEXT: | [sizeof=128, align=32
252 // CHECK-X64-NEXT: | nvsize=48, nvalign=32]
254 struct G
: virtual V2
, virtual V3
{
256 G() : a(0xf0000001) {}
259 // CHECK-LABEL: 0 | struct G{{$}}
260 // CHECK-NEXT: 0 | (G vbtable pointer)
261 // CHECK-NEXT: 4 | int a
262 // CHECK-NEXT: 8 | struct V2 (virtual base)
263 // CHECK-NEXT: 8 | long long a
264 // CHECK-NEXT: 16 | int a1
265 // CHECK-NEXT: 24 | struct V3 (virtual base)
266 // CHECK-NEXT: 24 | int a
267 // CHECK-NEXT: | [sizeof=28, align=8
268 // CHECK-NEXT: | nvsize=8, nvalign=8]
269 // CHECK-X64-LABEL: 0 | struct G{{$}}
270 // CHECK-X64-NEXT: 0 | (G vbtable pointer)
271 // CHECK-X64-NEXT: 8 | int a
272 // CHECK-X64-NEXT: 16 | struct V2 (virtual base)
273 // CHECK-X64-NEXT: 16 | long long a
274 // CHECK-X64-NEXT: 24 | int a1
275 // CHECK-X64-NEXT: 32 | struct V3 (virtual base)
276 // CHECK-X64-NEXT: 32 | int a
277 // CHECK-X64-NEXT: | [sizeof=40, align=8
278 // CHECK-X64-NEXT: | nvsize=16, nvalign=8]
281 __declspec(align(16)) int a
;
283 H() : a(0xf0000010), b(0xf0000010) {}
286 // CHECK-LABEL: 0 | struct H{{$}}
287 // CHECK-NEXT: 0 | int a
288 // CHECK-NEXT: 4 | int b
289 // CHECK-NEXT: | [sizeof=16, align=16
290 // CHECK-NEXT: | nvsize=16, nvalign=16]
291 // CHECK-X64-LABEL: 0 | struct H{{$}}
292 // CHECK-X64-NEXT: 0 | int a
293 // CHECK-X64-NEXT: 4 | int b
294 // CHECK-X64-NEXT: | [sizeof=16, align=16
295 // CHECK-X64-NEXT: | nvsize=16, nvalign=16]
300 I() : b(0xf0000010) {}
303 // CHECK-LABEL: 0 | struct I{{$}}
304 // CHECK-NEXT: 0 | struct B2 a
305 // CHECK-NEXT: 0 | int a
307 // CHECK-NEXT: | [sizeof=32, align=16
308 // CHECK-NEXT: | nvsize=32, nvalign=16]
309 // CHECK-X64-LABEL: 0 | struct I{{$}}
310 // CHECK-X64-NEXT: 0 | struct B2 a
311 // CHECK-X64-NEXT: 0 | int a
312 // CHECK-X64: 16 | int b
313 // CHECK-X64-NEXT: | [sizeof=32, align=16
314 // CHECK-X64-NEXT: | nvsize=32, nvalign=16]
316 struct AX
: B0X
, virtual B2X
, virtual B6X
, virtual B3X
{
318 AX() : a(0xf000000A) {}
323 // CHECK-LABEL: 0 | struct AX{{$}}
324 // CHECK-NEXT: 0 | (AX vftable pointer)
325 // CHECK-NEXT: 16 | struct B0X (base)
326 // CHECK-NEXT: 16 | int a
327 // CHECK-NEXT: 20 | int a1
328 // CHECK-NEXT: 24 | (AX vbtable pointer)
329 // CHECK-NEXT: 40 | int a
330 // CHECK-NEXT: 48 | struct B2X (virtual base)
331 // CHECK-NEXT: 48 | int a
332 // CHECK-NEXT: 52 | struct B6X (virtual base)
333 // CHECK-NEXT: 52 | int a
334 // CHECK-NEXT: 76 | (vtordisp for vbase B3X)
335 // CHECK-NEXT: 80 | struct B3X (virtual base)
336 // CHECK-NEXT: 80 | (B3X vftable pointer)
337 // CHECK-NEXT: 84 | int a
338 // CHECK-NEXT: | [sizeof=96, align=16
339 // CHECK-NEXT: | nvsize=48, nvalign=16]
340 // CHECK-X64-LABEL: 0 | struct AX{{$}}
341 // CHECK-X64-NEXT: 0 | (AX vftable pointer)
342 // CHECK-X64-NEXT: 16 | struct B0X (base)
343 // CHECK-X64-NEXT: 16 | int a
344 // CHECK-X64-NEXT: 20 | int a1
345 // CHECK-X64-NEXT: 24 | (AX vbtable pointer)
346 // CHECK-X64-NEXT: 40 | int a
347 // CHECK-X64-NEXT: 48 | struct B2X (virtual base)
348 // CHECK-X64-NEXT: 48 | int a
349 // CHECK-X64-NEXT: 52 | struct B6X (virtual base)
350 // CHECK-X64-NEXT: 52 | int a
351 // CHECK-X64-NEXT: 76 | (vtordisp for vbase B3X)
352 // CHECK-X64-NEXT: 80 | struct B3X (virtual base)
353 // CHECK-X64-NEXT: 80 | (B3X vftable pointer)
354 // CHECK-X64-NEXT: 88 | int a
355 // CHECK-X64-NEXT: | [sizeof=96, align=16
356 // CHECK-X64-NEXT: | nvsize=48, nvalign=16]
358 struct BX
: B4X
, virtual B2X
, virtual B6X
, virtual B3X
{
360 BX() : a(0xf000000B) {}
365 // CHECK-LABEL: 0 | struct BX{{$}}
366 // CHECK-NEXT: 0 | (BX vftable pointer)
367 // CHECK-NEXT: 16 | struct B4X (base)
368 // CHECK-NEXT: 16 | struct A16X (base) (empty)
369 // CHECK-NEXT: 16 | int a
370 // CHECK-NEXT: 20 | int a1
371 // CHECK-NEXT: 32 | (BX vbtable pointer)
372 // CHECK-NEXT: 48 | int a
373 // CHECK-NEXT: 64 | struct B2X (virtual base)
374 // CHECK-NEXT: 64 | int a
375 // CHECK-NEXT: 68 | struct B6X (virtual base)
376 // CHECK-NEXT: 68 | int a
377 // CHECK-NEXT: 92 | (vtordisp for vbase B3X)
378 // CHECK-NEXT: 96 | struct B3X (virtual base)
379 // CHECK-NEXT: 96 | (B3X vftable pointer)
380 // CHECK-NEXT: 100 | int a
381 // CHECK-NEXT: | [sizeof=112, align=16
382 // CHECK-NEXT: | nvsize=64, nvalign=16]
383 // CHECK-X64-LABEL: 0 | struct BX{{$}}
384 // CHECK-X64-NEXT: 0 | (BX vftable pointer)
385 // CHECK-X64-NEXT: 16 | struct B4X (base)
386 // CHECK-X64-NEXT: 16 | struct A16X (base) (empty)
387 // CHECK-X64-NEXT: 16 | int a
388 // CHECK-X64-NEXT: 20 | int a1
389 // CHECK-X64-NEXT: 32 | (BX vbtable pointer)
390 // CHECK-X64-NEXT: 48 | int a
391 // CHECK-X64-NEXT: 64 | struct B2X (virtual base)
392 // CHECK-X64-NEXT: 64 | int a
393 // CHECK-X64-NEXT: 68 | struct B6X (virtual base)
394 // CHECK-X64-NEXT: 68 | int a
395 // CHECK-X64-NEXT: 92 | (vtordisp for vbase B3X)
396 // CHECK-X64-NEXT: 96 | struct B3X (virtual base)
397 // CHECK-X64-NEXT: 96 | (B3X vftable pointer)
398 // CHECK-X64-NEXT: 104 | int a
399 // CHECK-X64-NEXT: | [sizeof=112, align=16
400 // CHECK-X64-NEXT: | nvsize=64, nvalign=16]
402 struct CX
: B5X
, virtual B2X
, virtual B6X
, virtual B3X
{
404 CX() : a(0xf000000C) {}
409 // CHECK-LABEL: 0 | struct CX{{$}}
410 // CHECK-NEXT: 0 | (CX vftable pointer)
411 // CHECK-NEXT: 16 | struct B5X (base)
412 // CHECK-NEXT: 16 | (B5X vbtable pointer)
413 // CHECK-NEXT: 20 | int a
414 // CHECK-NEXT: 24 | int a1
415 // CHECK-NEXT: 28 | int a
416 // CHECK-NEXT: 32 | struct A16X (virtual base) (empty)
417 // CHECK-NEXT: 32 | struct B2X (virtual base)
418 // CHECK-NEXT: 32 | int a
419 // CHECK-NEXT: 36 | struct B6X (virtual base)
420 // CHECK-NEXT: 36 | int a
421 // CHECK-NEXT: 60 | (vtordisp for vbase B3X)
422 // CHECK-NEXT: 64 | struct B3X (virtual base)
423 // CHECK-NEXT: 64 | (B3X vftable pointer)
424 // CHECK-NEXT: 68 | int a
425 // CHECK-NEXT: | [sizeof=80, align=16
426 // CHECK-NEXT: | nvsize=32, nvalign=16]
427 // CHECK-X64-LABEL: 0 | struct CX{{$}}
428 // CHECK-X64-NEXT: 0 | (CX vftable pointer)
429 // CHECK-X64-NEXT: 16 | struct B5X (base)
430 // CHECK-X64-NEXT: 16 | (B5X vbtable pointer)
431 // CHECK-X64-NEXT: 24 | int a
432 // CHECK-X64-NEXT: 28 | int a1
433 // CHECK-X64-NEXT: 32 | int a
434 // CHECK-X64-NEXT: 48 | struct A16X (virtual base) (empty)
435 // CHECK-X64-NEXT: 48 | struct B2X (virtual base)
436 // CHECK-X64-NEXT: 48 | int a
437 // CHECK-X64-NEXT: 52 | struct B6X (virtual base)
438 // CHECK-X64-NEXT: 52 | int a
439 // CHECK-X64-NEXT: 76 | (vtordisp for vbase B3X)
440 // CHECK-X64-NEXT: 80 | struct B3X (virtual base)
441 // CHECK-X64-NEXT: 80 | (B3X vftable pointer)
442 // CHECK-X64-NEXT: 88 | int a
443 // CHECK-X64-NEXT: | [sizeof=96, align=16
444 // CHECK-X64-NEXT: | nvsize=48, nvalign=16]
446 struct __declspec(align(16)) DX
{
448 DX() : a(0xf000000D) {}
452 // CHECK-LABEL: 0 | struct DX{{$}}
453 // CHECK-NEXT: 0 | (DX vftable pointer)
454 // CHECK-NEXT: 4 | int a
455 // CHECK-NEXT: | [sizeof=16, align=16
456 // CHECK-NEXT: | nvsize=8, nvalign=16]
457 // CHECK-X64-LABEL: 0 | struct DX{{$}}
458 // CHECK-X64-NEXT: 0 | (DX vftable pointer)
459 // CHECK-X64-NEXT: 8 | int a
460 // CHECK-X64-NEXT: | [sizeof=16, align=16
461 // CHECK-X64-NEXT: | nvsize=16, nvalign=16]