1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
|
// RUN: %clang_cc1 -fno-rtti -emit-llvm-only -triple i686-pc-win32 -fdump-record-layouts -fsyntax-only %s 2>/dev/null \
// RUN: | FileCheck %s
// RUN: %clang_cc1 -fno-rtti -emit-llvm-only -triple x86_64-pc-win32 -fdump-record-layouts -fsyntax-only %s 2>/dev/null \
// RUN: | FileCheck %s -check-prefix CHECK-X64
extern "C" int printf(const char *fmt, ...);
struct B0 { B0() { printf("B0 = %p\n", this); } };
struct B1 { B1() { printf("B1 = %p\n", this); } };
struct B2 { B2() { printf("B2 = %p\n", this); } };
struct B3 { B3() { printf("B3 = %p\n", this); } };
struct B4 { B4() { printf("B4 = %p\n", this); } };
struct B5 { B5() { printf("B5 = %p\n", this); } };
struct __declspec(align(2)) B6 { B6() { printf("B6 = %p\n", this); } };
struct __declspec(align(16)) B7 { B7() { printf("B7 = %p\n", this); } };
struct B8 { char c[5]; B8() { printf("B8 = %p\n", this); } };
struct B9 { char c[6]; B9() { printf("B9 = %p\n", this); } };
struct B10 { char c[7]; B10() { printf("B10 = %p\n", this); } };
struct B11 { char c[8]; B11() { printf("B11 = %p\n", this); } };
struct B0X { B0X() { printf("B0 = %p\n", this); } };
struct B1X { B1X() { printf("B1 = %p\n", this); } };
struct __declspec(align(16)) B2X { B2X() { printf("B2 = %p\n", this); } };
struct __declspec(align(2)) B3X { B3X() { printf("B3 = %p\n", this); } };
struct B4X { B4X() { printf("B4 = %p\n", this); } };
struct B5X { B5X() { printf("B5 = %p\n", this); } };
struct B6X { B6X() { printf("B6 = %p\n", this); } };
struct B8X { short a; B8X() : a(0x000000B8) { printf("B8 = %p\n", this); } };
struct AA : B8, B1, virtual B0 {
int a;
AA() : a(0x000000AA) { printf("AA = %p\n", this); }
};
// CHECK: *** Dumping AST Record Layout
// CHECK: *** Dumping AST Record Layout
// CHECK: *** Dumping AST Record Layout
// CHECK: *** Dumping AST Record Layout
// CHECK-NEXT: 0 | struct AA
// CHECK-NEXT: 0 | struct B8 (base)
// CHECK-NEXT: 0 | char [5] c
// CHECK-NEXT: 13 | struct B1 (base) (empty)
// CHECK-NEXT: 8 | (AA vbtable pointer)
// CHECK-NEXT: 16 | int a
// CHECK-NEXT: 20 | struct B0 (virtual base) (empty)
// CHECK-NEXT: | [sizeof=20, align=4
// CHECK-NEXT: | nvsize=20, nvalign=4]
// CHECK-X64: *** Dumping AST Record Layout
// CHECK-X64: *** Dumping AST Record Layout
// CHECK-X64: *** Dumping AST Record Layout
// CHECK-X64: *** Dumping AST Record Layout
// CHECK-X64-NEXT: 0 | struct AA
// CHECK-X64-NEXT: 0 | struct B8 (base)
// CHECK-X64-NEXT: 0 | char [5] c
// CHECK-X64-NEXT: 17 | struct B1 (base) (empty)
// CHECK-X64-NEXT: 8 | (AA vbtable pointer)
// CHECK-X64-NEXT: 20 | int a
// CHECK-X64-NEXT: 24 | struct B0 (virtual base) (empty)
// CHECK-X64-NEXT: | [sizeof=24, align=8
// CHECK-X64-NEXT: | nvsize=24, nvalign=8]
struct AB : B8, B1, virtual B0 {
short a;
AB() : a(0x000000AB) { printf("AB = %p\n", this); }
};
// CHECK: *** Dumping AST Record Layout
// CHECK-NEXT: 0 | struct AB
// CHECK-NEXT: 0 | struct B8 (base)
// CHECK-NEXT: 0 | char [5] c
// CHECK-NEXT: 13 | struct B1 (base) (empty)
// CHECK-NEXT: 8 | (AB vbtable pointer)
// CHECK-NEXT: 14 | short a
// CHECK-NEXT: 16 | struct B0 (virtual base) (empty)
// CHECK-NEXT: | [sizeof=16, align=4
// CHECK-NEXT: | nvsize=16, nvalign=4]
// CHECK-X64: *** Dumping AST Record Layout
// CHECK-X64-NEXT: 0 | struct AB
// CHECK-X64-NEXT: 0 | struct B8 (base)
// CHECK-X64-NEXT: 0 | char [5] c
// CHECK-X64-NEXT: 17 | struct B1 (base) (empty)
// CHECK-X64-NEXT: 8 | (AB vbtable pointer)
// CHECK-X64-NEXT: 18 | short a
// CHECK-X64-NEXT: 24 | struct B0 (virtual base) (empty)
// CHECK-X64-NEXT: | [sizeof=24, align=8
// CHECK-X64-NEXT: | nvsize=24, nvalign=8]
struct AC : B8, B1, virtual B0 {
char a;
AC() : a(0x000000AC) { printf("AC = %p\n", this); }
};
// CHECK: *** Dumping AST Record Layout
// CHECK-NEXT: 0 | struct AC
// CHECK-NEXT: 0 | struct B8 (base)
// CHECK-NEXT: 0 | char [5] c
// CHECK-NEXT: 12 | struct B1 (base) (empty)
// CHECK-NEXT: 8 | (AC vbtable pointer)
// CHECK-NEXT: 12 | char a
// CHECK-NEXT: 16 | struct B0 (virtual base) (empty)
// CHECK-NEXT: | [sizeof=16, align=4
// CHECK-NEXT: | nvsize=16, nvalign=4]
// CHECK-X64: *** Dumping AST Record Layout
// CHECK-X64-NEXT: 0 | struct AC
// CHECK-X64-NEXT: 0 | struct B8 (base)
// CHECK-X64-NEXT: 0 | char [5] c
// CHECK-X64-NEXT: 16 | struct B1 (base) (empty)
// CHECK-X64-NEXT: 8 | (AC vbtable pointer)
// CHECK-X64-NEXT: 16 | char a
// CHECK-X64-NEXT: 24 | struct B0 (virtual base) (empty)
// CHECK-X64-NEXT: | [sizeof=24, align=8
// CHECK-X64-NEXT: | nvsize=24, nvalign=8]
struct AD : B8, B1, virtual B0 {
AD() { printf("AD = %p\n", this); }
};
// CHECK: *** Dumping AST Record Layout
// CHECK-NEXT: 0 | struct AD
// CHECK-NEXT: 0 | struct B8 (base)
// CHECK-NEXT: 0 | char [5] c
// CHECK-NEXT: 12 | struct B1 (base) (empty)
// CHECK-NEXT: 8 | (AD vbtable pointer)
// CHECK-NEXT: 12 | struct B0 (virtual base) (empty)
// CHECK-NEXT: | [sizeof=12, align=4
// CHECK-NEXT: | nvsize=12, nvalign=4]
// CHECK-X64: *** Dumping AST Record Layout
// CHECK-X64-NEXT: 0 | struct AD
// CHECK-X64-NEXT: 0 | struct B8 (base)
// CHECK-X64-NEXT: 0 | char [5] c
// CHECK-X64-NEXT: 16 | struct B1 (base) (empty)
// CHECK-X64-NEXT: 8 | (AD vbtable pointer)
// CHECK-X64-NEXT: 16 | struct B0 (virtual base) (empty)
// CHECK-X64-NEXT: | [sizeof=16, align=8
// CHECK-X64-NEXT: | nvsize=16, nvalign=8]
struct AA1 : B9, B1, virtual B0 {
int a;
AA1() : a(0x00000AA1) { printf("AA1 = %p\n", this); }
};
// CHECK: *** Dumping AST Record Layout
// CHECK: *** Dumping AST Record Layout
// CHECK-NEXT: 0 | struct AA1
// CHECK-NEXT: 0 | struct B9 (base)
// CHECK-NEXT: 0 | char [6] c
// CHECK-NEXT: 14 | struct B1 (base) (empty)
// CHECK-NEXT: 8 | (AA1 vbtable pointer)
// CHECK-NEXT: 16 | int a
// CHECK-NEXT: 20 | struct B0 (virtual base) (empty)
// CHECK-NEXT: | [sizeof=20, align=4
// CHECK-NEXT: | nvsize=20, nvalign=4]
// CHECK-X64: *** Dumping AST Record Layout
// CHECK-X64: *** Dumping AST Record Layout
// CHECK-X64-NEXT: 0 | struct AA1
// CHECK-X64-NEXT: 0 | struct B9 (base)
// CHECK-X64-NEXT: 0 | char [6] c
// CHECK-X64-NEXT: 18 | struct B1 (base) (empty)
// CHECK-X64-NEXT: 8 | (AA1 vbtable pointer)
// CHECK-X64-NEXT: 20 | int a
// CHECK-X64-NEXT: 24 | struct B0 (virtual base) (empty)
// CHECK-X64-NEXT: | [sizeof=24, align=8
// CHECK-X64-NEXT: | nvsize=24, nvalign=8]
struct AB1 : B9, B1, virtual B0 {
short a;
AB1() : a(0x00000AB1) { printf("AB1 = %p\n", this); }
};
// CHECK: *** Dumping AST Record Layout
// CHECK-NEXT: 0 | struct AB1
// CHECK-NEXT: 0 | struct B9 (base)
// CHECK-NEXT: 0 | char [6] c
// CHECK-NEXT: 12 | struct B1 (base) (empty)
// CHECK-NEXT: 8 | (AB1 vbtable pointer)
// CHECK-NEXT: 12 | short a
// CHECK-NEXT: 16 | struct B0 (virtual base) (empty)
// CHECK-NEXT: | [sizeof=16, align=4
// CHECK-NEXT: | nvsize=16, nvalign=4]
// CHECK-X64: *** Dumping AST Record Layout
// CHECK-X64-NEXT: 0 | struct AB1
// CHECK-X64-NEXT: 0 | struct B9 (base)
// CHECK-X64-NEXT: 0 | char [6] c
// CHECK-X64-NEXT: 16 | struct B1 (base) (empty)
// CHECK-X64-NEXT: 8 | (AB1 vbtable pointer)
// CHECK-X64-NEXT: 16 | short a
// CHECK-X64-NEXT: 24 | struct B0 (virtual base) (empty)
// CHECK-X64-NEXT: | [sizeof=24, align=8
// CHECK-X64-NEXT: | nvsize=24, nvalign=8]
struct AC1 : B9, B1, virtual B0 {
char a;
AC1() : a(0x000000C1) { printf("AC1 = %p\n", this); }
};
// CHECK: *** Dumping AST Record Layout
// CHECK-NEXT: 0 | struct AC1
// CHECK-NEXT: 0 | struct B9 (base)
// CHECK-NEXT: 0 | char [6] c
// CHECK-NEXT: 12 | struct B1 (base) (empty)
// CHECK-NEXT: 8 | (AC1 vbtable pointer)
// CHECK-NEXT: 12 | char a
// CHECK-NEXT: 16 | struct B0 (virtual base) (empty)
// CHECK-NEXT: | [sizeof=16, align=4
// CHECK-NEXT: | nvsize=16, nvalign=4]
// CHECK-X64: *** Dumping AST Record Layout
// CHECK-X64-NEXT: 0 | struct AC1
// CHECK-X64-NEXT: 0 | struct B9 (base)
// CHECK-X64-NEXT: 0 | char [6] c
// CHECK-X64-NEXT: 16 | struct B1 (base) (empty)
// CHECK-X64-NEXT: 8 | (AC1 vbtable pointer)
// CHECK-X64-NEXT: 16 | char a
// CHECK-X64-NEXT: 24 | struct B0 (virtual base) (empty)
// CHECK-X64-NEXT: | [sizeof=24, align=8
// CHECK-X64-NEXT: | nvsize=24, nvalign=8]
struct AD1 : B9, B1, virtual B0 {
AD1() { printf("AD1 = %p\n", this); }
};
// CHECK: *** Dumping AST Record Layout
// CHECK-NEXT: 0 | struct AD1
// CHECK-NEXT: 0 | struct B9 (base)
// CHECK-NEXT: 0 | char [6] c
// CHECK-NEXT: 12 | struct B1 (base) (empty)
// CHECK-NEXT: 8 | (AD1 vbtable pointer)
// CHECK-NEXT: 12 | struct B0 (virtual base) (empty)
// CHECK-NEXT: | [sizeof=12, align=4
// CHECK-NEXT: | nvsize=12, nvalign=4]
// CHECK-X64: *** Dumping AST Record Layout
// CHECK-X64-NEXT: 0 | struct AD1
// CHECK-X64-NEXT: 0 | struct B9 (base)
// CHECK-X64-NEXT: 0 | char [6] c
// CHECK-X64-NEXT: 16 | struct B1 (base) (empty)
// CHECK-X64-NEXT: 8 | (AD1 vbtable pointer)
// CHECK-X64-NEXT: 16 | struct B0 (virtual base) (empty)
// CHECK-X64-NEXT: | [sizeof=16, align=8
// CHECK-X64-NEXT: | nvsize=16, nvalign=8]
struct AA2 : B10, B1, virtual B0 {
int a;
AA2() : a(0x00000AA2) { printf("AA2 = %p\n", this); }
};
// CHECK: *** Dumping AST Record Layout
// CHECK: *** Dumping AST Record Layout
// CHECK-NEXT: 0 | struct AA2
// CHECK-NEXT: 0 | struct B10 (base)
// CHECK-NEXT: 0 | char [7] c
// CHECK-NEXT: 15 | struct B1 (base) (empty)
// CHECK-NEXT: 8 | (AA2 vbtable pointer)
// CHECK-NEXT: 16 | int a
// CHECK-NEXT: 20 | struct B0 (virtual base) (empty)
// CHECK-NEXT: | [sizeof=20, align=4
// CHECK-NEXT: | nvsize=20, nvalign=4]
// CHECK-X64: *** Dumping AST Record Layout
// CHECK-X64: *** Dumping AST Record Layout
// CHECK-X64-NEXT: 0 | struct AA2
// CHECK-X64-NEXT: 0 | struct B10 (base)
// CHECK-X64-NEXT: 0 | char [7] c
// CHECK-X64-NEXT: 19 | struct B1 (base) (empty)
// CHECK-X64-NEXT: 8 | (AA2 vbtable pointer)
// CHECK-X64-NEXT: 20 | int a
// CHECK-X64-NEXT: 24 | struct B0 (virtual base) (empty)
// CHECK-X64-NEXT: | [sizeof=24, align=8
// CHECK-X64-NEXT: | nvsize=24, nvalign=8]
struct AB2 : B10, B1, virtual B0 {
short a;
AB2() : a(0x00000AB2) { printf("AB2 = %p\n", this); }
};
// CHECK: *** Dumping AST Record Layout
// CHECK-NEXT: 0 | struct AB2
// CHECK-NEXT: 0 | struct B10 (base)
// CHECK-NEXT: 0 | char [7] c
// CHECK-NEXT: 13 | struct B1 (base) (empty)
// CHECK-NEXT: 8 | (AB2 vbtable pointer)
// CHECK-NEXT: 14 | short a
// CHECK-NEXT: 16 | struct B0 (virtual base) (empty)
// CHECK-NEXT: | [sizeof=16, align=4
// CHECK-NEXT: | nvsize=16, nvalign=4]
// CHECK-X64: *** Dumping AST Record Layout
// CHECK-X64-NEXT: 0 | struct AB2
// CHECK-X64-NEXT: 0 | struct B10 (base)
// CHECK-X64-NEXT: 0 | char [7] c
// CHECK-X64-NEXT: 17 | struct B1 (base) (empty)
// CHECK-X64-NEXT: 8 | (AB2 vbtable pointer)
// CHECK-X64-NEXT: 18 | short a
// CHECK-X64-NEXT: 24 | struct B0 (virtual base) (empty)
// CHECK-X64-NEXT: | [sizeof=24, align=8
// CHECK-X64-NEXT: | nvsize=24, nvalign=8]
struct AC2 : B10, B1, virtual B0 {
char a;
AC2() : a(0x000000C2) { printf("AC2 = %p\n", this); }
};
// CHECK: *** Dumping AST Record Layout
// CHECK-NEXT: 0 | struct AC2
// CHECK-NEXT: 0 | struct B10 (base)
// CHECK-NEXT: 0 | char [7] c
// CHECK-NEXT: 12 | struct B1 (base) (empty)
// CHECK-NEXT: 8 | (AC2 vbtable pointer)
// CHECK-NEXT: 12 | char a
// CHECK-NEXT: 16 | struct B0 (virtual base) (empty)
// CHECK-NEXT: | [sizeof=16, align=4
// CHECK-NEXT: | nvsize=16, nvalign=4]
// CHECK-X64: *** Dumping AST Record Layout
// CHECK-X64-NEXT: 0 | struct AC2
// CHECK-X64-NEXT: 0 | struct B10 (base)
// CHECK-X64-NEXT: 0 | char [7] c
// CHECK-X64-NEXT: 16 | struct B1 (base) (empty)
// CHECK-X64-NEXT: 8 | (AC2 vbtable pointer)
// CHECK-X64-NEXT: 16 | char a
// CHECK-X64-NEXT: 24 | struct B0 (virtual base) (empty)
// CHECK-X64-NEXT: | [sizeof=24, align=8
// CHECK-X64-NEXT: | nvsize=24, nvalign=8]
struct AD2 : B10, B1, virtual B0 {
AD2() { printf("AD2 = %p\n", this); }
};
// CHECK: *** Dumping AST Record Layout
// CHECK-NEXT: 0 | struct AD2
// CHECK-NEXT: 0 | struct B10 (base)
// CHECK-NEXT: 0 | char [7] c
// CHECK-NEXT: 12 | struct B1 (base) (empty)
// CHECK-NEXT: 8 | (AD2 vbtable pointer)
// CHECK-NEXT: 12 | struct B0 (virtual base) (empty)
// CHECK-NEXT: | [sizeof=12, align=4
// CHECK-NEXT: | nvsize=12, nvalign=4]
// CHECK-X64: *** Dumping AST Record Layout
// CHECK-X64-NEXT: 0 | struct AD2
// CHECK-X64-NEXT: 0 | struct B10 (base)
// CHECK-X64-NEXT: 0 | char [7] c
// CHECK-X64-NEXT: 16 | struct B1 (base) (empty)
// CHECK-X64-NEXT: 8 | (AD2 vbtable pointer)
// CHECK-X64-NEXT: 16 | struct B0 (virtual base) (empty)
// CHECK-X64-NEXT: | [sizeof=16, align=8
// CHECK-X64-NEXT: | nvsize=16, nvalign=8]
struct AA3 : B11, B1, virtual B0 {
int a;
AA3() : a(0x00000AA3) { printf("AA3 = %p\n", this); }
};
// CHECK: *** Dumping AST Record Layout
// CHECK: *** Dumping AST Record Layout
// CHECK-NEXT: 0 | struct AA3
// CHECK-NEXT: 0 | struct B11 (base)
// CHECK-NEXT: 0 | char [8] c
// CHECK-NEXT: 12 | struct B1 (base) (empty)
// CHECK-NEXT: 8 | (AA3 vbtable pointer)
// CHECK-NEXT: 12 | int a
// CHECK-NEXT: 16 | struct B0 (virtual base) (empty)
// CHECK-NEXT: | [sizeof=16, align=4
// CHECK-NEXT: | nvsize=16, nvalign=4]
// CHECK-X64: *** Dumping AST Record Layout
// CHECK-X64: *** Dumping AST Record Layout
// CHECK-X64-NEXT: 0 | struct AA3
// CHECK-X64-NEXT: 0 | struct B11 (base)
// CHECK-X64-NEXT: 0 | char [8] c
// CHECK-X64-NEXT: 16 | struct B1 (base) (empty)
// CHECK-X64-NEXT: 8 | (AA3 vbtable pointer)
// CHECK-X64-NEXT: 16 | int a
// CHECK-X64-NEXT: 24 | struct B0 (virtual base) (empty)
// CHECK-X64-NEXT: | [sizeof=24, align=8
// CHECK-X64-NEXT: | nvsize=24, nvalign=8]
struct AB3 : B11, B1, virtual B0 {
short a;
AB3() : a(0x00000AB3) { printf("AB3 = %p\n", this); }
};
// CHECK: *** Dumping AST Record Layout
// CHECK-NEXT: 0 | struct AB3
// CHECK-NEXT: 0 | struct B11 (base)
// CHECK-NEXT: 0 | char [8] c
// CHECK-NEXT: 12 | struct B1 (base) (empty)
// CHECK-NEXT: 8 | (AB3 vbtable pointer)
// CHECK-NEXT: 12 | short a
// CHECK-NEXT: 16 | struct B0 (virtual base) (empty)
// CHECK-NEXT: | [sizeof=16, align=4
// CHECK-NEXT: | nvsize=16, nvalign=4]
// CHECK-X64: *** Dumping AST Record Layout
// CHECK-X64-NEXT: 0 | struct AB3
// CHECK-X64-NEXT: 0 | struct B11 (base)
// CHECK-X64-NEXT: 0 | char [8] c
// CHECK-X64-NEXT: 16 | struct B1 (base) (empty)
// CHECK-X64-NEXT: 8 | (AB3 vbtable pointer)
// CHECK-X64-NEXT: 16 | short a
// CHECK-X64-NEXT: 24 | struct B0 (virtual base) (empty)
// CHECK-X64-NEXT: | [sizeof=24, align=8
// CHECK-X64-NEXT: | nvsize=24, nvalign=8]
struct AC3 : B11, B1, virtual B0 {
char a;
AC3() : a(0x000000C3) { printf("AC3 = %p\n", this); }
};
// CHECK: *** Dumping AST Record Layout
// CHECK-NEXT: 0 | struct AC3
// CHECK-NEXT: 0 | struct B11 (base)
// CHECK-NEXT: 0 | char [8] c
// CHECK-NEXT: 12 | struct B1 (base) (empty)
// CHECK-NEXT: 8 | (AC3 vbtable pointer)
// CHECK-NEXT: 12 | char a
// CHECK-NEXT: 16 | struct B0 (virtual base) (empty)
// CHECK-NEXT: | [sizeof=16, align=4
// CHECK-NEXT: | nvsize=16, nvalign=4]
// CHECK-X64: *** Dumping AST Record Layout
// CHECK-X64-NEXT: 0 | struct AC3
// CHECK-X64-NEXT: 0 | struct B11 (base)
// CHECK-X64-NEXT: 0 | char [8] c
// CHECK-X64-NEXT: 16 | struct B1 (base) (empty)
// CHECK-X64-NEXT: 8 | (AC3 vbtable pointer)
// CHECK-X64-NEXT: 16 | char a
// CHECK-X64-NEXT: 24 | struct B0 (virtual base) (empty)
// CHECK-X64-NEXT: | [sizeof=24, align=8
// CHECK-X64-NEXT: | nvsize=24, nvalign=8]
struct AD3 : B11, B1, virtual B0 {
AD3() { printf("AD3 = %p\n", this); }
};
// CHECK: *** Dumping AST Record Layout
// CHECK-NEXT: 0 | struct AD3
// CHECK-NEXT: 0 | struct B11 (base)
// CHECK-NEXT: 0 | char [8] c
// CHECK-NEXT: 12 | struct B1 (base) (empty)
// CHECK-NEXT: 8 | (AD3 vbtable pointer)
// CHECK-NEXT: 12 | struct B0 (virtual base) (empty)
// CHECK-NEXT: | [sizeof=12, align=4
// CHECK-NEXT: | nvsize=12, nvalign=4]
// CHECK-X64: *** Dumping AST Record Layout
// CHECK-X64-NEXT: 0 | struct AD3
// CHECK-X64-NEXT: 0 | struct B11 (base)
// CHECK-X64-NEXT: 0 | char [8] c
// CHECK-X64-NEXT: 16 | struct B1 (base) (empty)
// CHECK-X64-NEXT: 8 | (AD3 vbtable pointer)
// CHECK-X64-NEXT: 16 | struct B0 (virtual base) (empty)
// CHECK-X64-NEXT: | [sizeof=16, align=8
// CHECK-X64-NEXT: | nvsize=16, nvalign=8]
struct B : B1, B2, virtual B0 {
B() { printf("B = %p\n", this); }
};
// CHECK: *** Dumping AST Record Layout
// CHECK: *** Dumping AST Record Layout
// CHECK-NEXT: 0 | struct B
// CHECK-NEXT: 0 | struct B1 (base) (empty)
// CHECK-NEXT: 8 | struct B2 (base) (empty)
// CHECK-NEXT: 4 | (B vbtable pointer)
// CHECK-NEXT: 8 | struct B0 (virtual base) (empty)
// CHECK-NEXT: | [sizeof=8, align=4
// CHECK-NEXT: | nvsize=8, nvalign=4]
// CHECK-X64: *** Dumping AST Record Layout
// CHECK-X64: *** Dumping AST Record Layout
// CHECK-X64-NEXT: 0 | struct B
// CHECK-X64-NEXT: 0 | struct B1 (base) (empty)
// CHECK-X64-NEXT: 16 | struct B2 (base) (empty)
// CHECK-X64-NEXT: 8 | (B vbtable pointer)
// CHECK-X64-NEXT: 16 | struct B0 (virtual base) (empty)
// CHECK-X64-NEXT: | [sizeof=16, align=8
// CHECK-X64-NEXT: | nvsize=16, nvalign=8]
struct C : B1, B2, B3, virtual B0 {
char a;
C() : a(0x0000000C) { printf("C = %p\n", this); }
};
// CHECK: *** Dumping AST Record Layout
// CHECK: *** Dumping AST Record Layout
// CHECK-NEXT: 0 | struct C
// CHECK-NEXT: 0 | struct B1 (base) (empty)
// CHECK-NEXT: 1 | struct B2 (base) (empty)
// CHECK-NEXT: 8 | struct B3 (base) (empty)
// CHECK-NEXT: 4 | (C vbtable pointer)
// CHECK-NEXT: 8 | char a
// CHECK-NEXT: 12 | struct B0 (virtual base) (empty)
// CHECK-NEXT: | [sizeof=12, align=4
// CHECK-NEXT: | nvsize=12, nvalign=4]
// CHECK-X64: *** Dumping AST Record Layout
// CHECK-X64: *** Dumping AST Record Layout
// CHECK-X64-NEXT: 0 | struct C
// CHECK-X64-NEXT: 0 | struct B1 (base) (empty)
// CHECK-X64-NEXT: 1 | struct B2 (base) (empty)
// CHECK-X64-NEXT: 16 | struct B3 (base) (empty)
// CHECK-X64-NEXT: 8 | (C vbtable pointer)
// CHECK-X64-NEXT: 16 | char a
// CHECK-X64-NEXT: 24 | struct B0 (virtual base) (empty)
// CHECK-X64-NEXT: | [sizeof=24, align=8
// CHECK-X64-NEXT: | nvsize=24, nvalign=8]
struct D : B1, B2, B3, B4, B5, virtual B0 {
int a;
D() : a(0x0000000D) { printf("D = %p\n", this); }
};
// CHECK: *** Dumping AST Record Layout
// CHECK: *** Dumping AST Record Layout
// CHECK: *** Dumping AST Record Layout
// CHECK-NEXT: 0 | struct D
// CHECK-NEXT: 0 | struct B1 (base) (empty)
// CHECK-NEXT: 1 | struct B2 (base) (empty)
// CHECK-NEXT: 2 | struct B3 (base) (empty)
// CHECK-NEXT: 3 | struct B4 (base) (empty)
// CHECK-NEXT: 8 | struct B5 (base) (empty)
// CHECK-NEXT: 4 | (D vbtable pointer)
// CHECK-NEXT: 8 | int a
// CHECK-NEXT: 12 | struct B0 (virtual base) (empty)
// CHECK-NEXT: | [sizeof=12, align=4
// CHECK-NEXT: | nvsize=12, nvalign=4]
// CHECK-X64: *** Dumping AST Record Layout
// CHECK-X64: *** Dumping AST Record Layout
// CHECK-X64: *** Dumping AST Record Layout
// CHECK-X64-NEXT: 0 | struct D
// CHECK-X64-NEXT: 0 | struct B1 (base) (empty)
// CHECK-X64-NEXT: 1 | struct B2 (base) (empty)
// CHECK-X64-NEXT: 2 | struct B3 (base) (empty)
// CHECK-X64-NEXT: 3 | struct B4 (base) (empty)
// CHECK-X64-NEXT: 16 | struct B5 (base) (empty)
// CHECK-X64-NEXT: 8 | (D vbtable pointer)
// CHECK-X64-NEXT: 16 | int a
// CHECK-X64-NEXT: 24 | struct B0 (virtual base) (empty)
// CHECK-X64-NEXT: | [sizeof=24, align=8
// CHECK-X64-NEXT: | nvsize=24, nvalign=8]
struct E : B1, B6, B3, B4, B5, virtual B0 {
int a;
E() : a(0x0000000E) { printf("E = %p\n", this); }
};
// CHECK: *** Dumping AST Record Layout
// CHECK: *** Dumping AST Record Layout
// CHECK-NEXT: 0 | struct E
// CHECK-NEXT: 0 | struct B1 (base) (empty)
// CHECK-NEXT: 2 | struct B6 (base) (empty)
// CHECK-NEXT: 3 | struct B3 (base) (empty)
// CHECK-NEXT: 4 | struct B4 (base) (empty)
// CHECK-NEXT: 13 | struct B5 (base) (empty)
// CHECK-NEXT: 8 | (E vbtable pointer)
// CHECK-NEXT: 16 | int a
// CHECK-NEXT: 20 | struct B0 (virtual base) (empty)
// CHECK-NEXT: | [sizeof=20, align=4
// CHECK-NEXT: | nvsize=20, nvalign=4]
// CHECK-X64: *** Dumping AST Record Layout
// CHECK-X64: *** Dumping AST Record Layout
// CHECK-X64-NEXT: 0 | struct E
// CHECK-X64-NEXT: 0 | struct B1 (base) (empty)
// CHECK-X64-NEXT: 2 | struct B6 (base) (empty)
// CHECK-X64-NEXT: 3 | struct B3 (base) (empty)
// CHECK-X64-NEXT: 4 | struct B4 (base) (empty)
// CHECK-X64-NEXT: 17 | struct B5 (base) (empty)
// CHECK-X64-NEXT: 8 | (E vbtable pointer)
// CHECK-X64-NEXT: 20 | int a
// CHECK-X64-NEXT: 24 | struct B0 (virtual base) (empty)
// CHECK-X64-NEXT: | [sizeof=24, align=8
// CHECK-X64-NEXT: | nvsize=24, nvalign=8]
struct F : B1, B6, B4, B8, B5, virtual B0 {
int a;
F() : a(0x0000000F) { printf("&a = %p\n", &a); printf("F = %p\n", this); }
};
// CHECK: *** Dumping AST Record Layout
// CHECK-NEXT: 0 | struct F
// CHECK-NEXT: 0 | struct B1 (base) (empty)
// CHECK-NEXT: 2 | struct B6 (base) (empty)
// CHECK-NEXT: 3 | struct B4 (base) (empty)
// CHECK-NEXT: 3 | struct B8 (base)
// CHECK-NEXT: 3 | char [5] c
// CHECK-NEXT: 12 | struct B5 (base) (empty)
// CHECK-NEXT: 8 | (F vbtable pointer)
// CHECK-NEXT: 12 | int a
// CHECK-NEXT: 16 | struct B0 (virtual base) (empty)
// CHECK-NEXT: | [sizeof=16, align=4
// CHECK-NEXT: | nvsize=16, nvalign=4]
// CHECK-X64: *** Dumping AST Record Layout
// CHECK-X64-NEXT: 0 | struct F
// CHECK-X64-NEXT: 0 | struct B1 (base) (empty)
// CHECK-X64-NEXT: 2 | struct B6 (base) (empty)
// CHECK-X64-NEXT: 3 | struct B4 (base) (empty)
// CHECK-X64-NEXT: 3 | struct B8 (base)
// CHECK-X64-NEXT: 3 | char [5] c
// CHECK-X64-NEXT: 16 | struct B5 (base) (empty)
// CHECK-X64-NEXT: 8 | (F vbtable pointer)
// CHECK-X64-NEXT: 16 | int a
// CHECK-X64-NEXT: 24 | struct B0 (virtual base) (empty)
// CHECK-X64-NEXT: | [sizeof=24, align=8
// CHECK-X64-NEXT: | nvsize=24, nvalign=8]
struct G : B8, B1, virtual B0 {
int a;
__declspec(align(16)) int a1;
G() : a(0x00000010), a1(0xf0000010) { printf("G = %p\n", this); }
};
// CHECK: *** Dumping AST Record Layout
// CHECK-NEXT: 0 | struct G
// CHECK-NEXT: 0 | struct B8 (base)
// CHECK-NEXT: 0 | char [5] c
// CHECK-NEXT: 21 | struct B1 (base) (empty)
// CHECK-NEXT: 8 | (G vbtable pointer)
// CHECK-NEXT: 24 | int a
// CHECK-NEXT: 32 | int a1
// CHECK-NEXT: 48 | struct B0 (virtual base) (empty)
// CHECK-NEXT: | [sizeof=48, align=16
// CHECK-NEXT: | nvsize=48, nvalign=16]
// CHECK-X64: *** Dumping AST Record Layout
// CHECK-X64-NEXT: 0 | struct G
// CHECK-X64-NEXT: 0 | struct B8 (base)
// CHECK-X64-NEXT: 0 | char [5] c
// CHECK-X64-NEXT: 21 | struct B1 (base) (empty)
// CHECK-X64-NEXT: 8 | (G vbtable pointer)
// CHECK-X64-NEXT: 24 | int a
// CHECK-X64-NEXT: 32 | int a1
// CHECK-X64-NEXT: 48 | struct B0 (virtual base) (empty)
// CHECK-X64-NEXT: | [sizeof=48, align=16
// CHECK-X64-NEXT: | nvsize=48, nvalign=16]
struct AX : B1X, B2X, B3X, B4X, virtual B0X {
int a;
AX() : a(0x0000000A) { printf(" A = %p\n", this); }
};
// CHECK: *** Dumping AST Record Layout
// CHECK: *** Dumping AST Record Layout
// CHECK: *** Dumping AST Record Layout
// CHECK: *** Dumping AST Record Layout
// CHECK: *** Dumping AST Record Layout
// CHECK: *** Dumping AST Record Layout
// CHECK-NEXT: 0 | struct AX
// CHECK-NEXT: 0 | struct B1X (base) (empty)
// CHECK-NEXT: 16 | struct B2X (base) (empty)
// CHECK-NEXT: 18 | struct B3X (base) (empty)
// CHECK-NEXT: 35 | struct B4X (base) (empty)
// CHECK-NEXT: 20 | (AX vbtable pointer)
// CHECK-NEXT: 36 | int a
// CHECK-NEXT: 48 | struct B0X (virtual base) (empty)
// CHECK-NEXT: | [sizeof=48, align=16
// CHECK-NEXT: | nvsize=48, nvalign=16]
// CHECK-X64: *** Dumping AST Record Layout
// CHECK-X64: *** Dumping AST Record Layout
// CHECK-X64: *** Dumping AST Record Layout
// CHECK-X64: *** Dumping AST Record Layout
// CHECK-X64: *** Dumping AST Record Layout
// CHECK-X64: *** Dumping AST Record Layout
// CHECK-X64-NEXT: 0 | struct AX
// CHECK-X64-NEXT: 0 | struct B1X (base) (empty)
// CHECK-X64-NEXT: 16 | struct B2X (base) (empty)
// CHECK-X64-NEXT: 18 | struct B3X (base) (empty)
// CHECK-X64-NEXT: 35 | struct B4X (base) (empty)
// CHECK-X64-NEXT: 24 | (AX vbtable pointer)
// CHECK-X64-NEXT: 36 | int a
// CHECK-X64-NEXT: 48 | struct B0X (virtual base) (empty)
// CHECK-X64-NEXT: | [sizeof=48, align=16
// CHECK-X64-NEXT: | nvsize=48, nvalign=16]
struct BX : B2X, B1X, B3X, B4X, virtual B0X {
int a;
BX() : a(0x0000000B) { printf(" B = %p\n", this); }
};
// CHECK: *** Dumping AST Record Layout
// CHECK-NEXT: 0 | struct BX
// CHECK-NEXT: 0 | struct B2X (base) (empty)
// CHECK-NEXT: 1 | struct B1X (base) (empty)
// CHECK-NEXT: 2 | struct B3X (base) (empty)
// CHECK-NEXT: 19 | struct B4X (base) (empty)
// CHECK-NEXT: 4 | (BX vbtable pointer)
// CHECK-NEXT: 20 | int a
// CHECK-NEXT: 32 | struct B0X (virtual base) (empty)
// CHECK-NEXT: | [sizeof=32, align=16
// CHECK-NEXT: | nvsize=32, nvalign=16]
// CHECK-X64: *** Dumping AST Record Layout
// CHECK-X64-NEXT: 0 | struct BX
// CHECK-X64-NEXT: 0 | struct B2X (base) (empty)
// CHECK-X64-NEXT: 1 | struct B1X (base) (empty)
// CHECK-X64-NEXT: 2 | struct B3X (base) (empty)
// CHECK-X64-NEXT: 19 | struct B4X (base) (empty)
// CHECK-X64-NEXT: 8 | (BX vbtable pointer)
// CHECK-X64-NEXT: 20 | int a
// CHECK-X64-NEXT: 32 | struct B0X (virtual base) (empty)
// CHECK-X64-NEXT: | [sizeof=32, align=16
// CHECK-X64-NEXT: | nvsize=32, nvalign=16]
struct CX : B1X, B3X, B2X, virtual B0X {
int a;
CX() : a(0x0000000C) { printf(" C = %p\n", this); }
};
// CHECK: *** Dumping AST Record Layout
// CHECK-NEXT: 0 | struct CX
// CHECK-NEXT: 0 | struct B1X (base) (empty)
// CHECK-NEXT: 2 | struct B3X (base) (empty)
// CHECK-NEXT: 32 | struct B2X (base) (empty)
// CHECK-NEXT: 16 | (CX vbtable pointer)
// CHECK-NEXT: 32 | int a
// CHECK-NEXT: 48 | struct B0X (virtual base) (empty)
// CHECK-NEXT: | [sizeof=48, align=16
// CHECK-NEXT: | nvsize=48, nvalign=16]
// CHECK-X64: *** Dumping AST Record Layout
// CHECK-X64-NEXT: 0 | struct CX
// CHECK-X64-NEXT: 0 | struct B1X (base) (empty)
// CHECK-X64-NEXT: 2 | struct B3X (base) (empty)
// CHECK-X64-NEXT: 32 | struct B2X (base) (empty)
// CHECK-X64-NEXT: 16 | (CX vbtable pointer)
// CHECK-X64-NEXT: 32 | int a
// CHECK-X64-NEXT: 48 | struct B0X (virtual base) (empty)
// CHECK-X64-NEXT: | [sizeof=48, align=16
// CHECK-X64-NEXT: | nvsize=48, nvalign=16]
struct DX : B8X, B1X, virtual B0X {
int a;
DX() : a(0x0000000D) { printf(" D = %p\n", this); }
};
// CHECK: *** Dumping AST Record Layout
// CHECK: *** Dumping AST Record Layout
// CHECK-NEXT: 0 | struct DX
// CHECK-NEXT: 0 | struct B8X (base)
// CHECK-NEXT: 0 | short a
// CHECK-NEXT: 10 | struct B1X (base) (empty)
// CHECK-NEXT: 4 | (DX vbtable pointer)
// CHECK-NEXT: 12 | int a
// CHECK-NEXT: 16 | struct B0X (virtual base) (empty)
// CHECK-NEXT: | [sizeof=16, align=4
// CHECK-NEXT: | nvsize=16, nvalign=4]
// CHECK-X64: *** Dumping AST Record Layout
// CHECK-X64: *** Dumping AST Record Layout
// CHECK-X64-NEXT: 0 | struct DX
// CHECK-X64-NEXT: 0 | struct B8X (base)
// CHECK-X64-NEXT: 0 | short a
// CHECK-X64-NEXT: 18 | struct B1X (base) (empty)
// CHECK-X64-NEXT: 8 | (DX vbtable pointer)
// CHECK-X64-NEXT: 20 | int a
// CHECK-X64-NEXT: 24 | struct B0X (virtual base) (empty)
// CHECK-X64-NEXT: | [sizeof=24, align=8
// CHECK-X64-NEXT: | nvsize=24, nvalign=8]
struct C0 {};
struct C1 : public C0 { int C1F0; };
struct C2 : public C1, public C0 {};
// CHECK: *** Dumping AST Record Layout
// CHECK: *** Dumping AST Record Layout
// CHECK: *** Dumping AST Record Layout
// CHECK-NEXT: 0 | struct C2
// CHECK-NEXT: 0 | struct C1 (base)
// CHECK-NEXT: 0 | struct C0 (base) (empty)
// CHECK-NEXT: 0 | int C1F0
// CHECK-NEXT: 5 | struct C0 (base) (empty)
// CHECK-NEXT: | [sizeof=8, align=4
// CHECK-NEXT: | nvsize=8, nvalign=4]
// CHECK-X64: *** Dumping AST Record Layout
// CHECK-X64: *** Dumping AST Record Layout
// CHECK-X64: *** Dumping AST Record Layout
// CHECK-X64-NEXT: 0 | struct C2
// CHECK-X64-NEXT: 0 | struct C1 (base)
// CHECK-X64-NEXT: 0 | struct C0 (base) (empty)
// CHECK-X64-NEXT: 0 | int C1F0
// CHECK-X64-NEXT: 5 | struct C0 (base) (empty)
// CHECK-X64-NEXT: | [sizeof=8, align=4
// CHECK-X64-NEXT: | nvsize=8, nvalign=4]
int a[
sizeof(AA)+
sizeof(AB)+
sizeof(AC)+
sizeof(AD)+
sizeof(AA1)+
sizeof(AB1)+
sizeof(AC1)+
sizeof(AD1)+
sizeof(AA2)+
sizeof(AB2)+
sizeof(AC2)+
sizeof(AD2)+
sizeof(AA3)+
sizeof(AB3)+
sizeof(AC3)+
sizeof(AD3)+
sizeof(B)+
sizeof(C)+
sizeof(D)+
sizeof(E)+
sizeof(F)+
sizeof(G)+
sizeof(AX)+
sizeof(BX)+
sizeof(CX)+
sizeof(DX)+
sizeof(C2)];
|