ms-x86-basic-layout.cpp 30.4 KB
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 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875
// RUN: %clang_cc1 -fno-rtti -emit-llvm-only -triple i686-pc-win32 -fms-extensions -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 -fms-extensions -fdump-record-layouts -fsyntax-only %s 2>/dev/null \
// RUN:            | FileCheck %s -check-prefix CHECK-X64

extern "C" int printf(const char *fmt, ...);

struct A4 {
	int a;
	A4() : a(0xf00000a4) {}
};

struct B4 {
	int a;
	B4() : a(0xf00000b4) {}
};

struct C4 {
	int a;
	C4() : a(0xf00000c4) {}
	virtual void f() {printf("C4");}
};

struct A16 {
	__declspec(align(16)) int a;
	A16() : a(0xf0000a16) {}
};

struct C16 {
	__declspec(align(16)) int a;
	C16() : a(0xf0000c16) {}
	virtual void f() {printf("C16");}
};

struct TestF0 : A4, virtual B4 {
	int a;
	TestF0() : a(0xf00000F0) {}
};

// CHECK: *** Dumping AST Record Layout
// CHECK: *** Dumping AST Record Layout
// CHECK: *** Dumping AST Record Layout
// CHECK-NEXT:    0 | struct TestF0
// CHECK-NEXT:    0 |   struct A4 (base)
// CHECK-NEXT:    0 |     int a
// CHECK-NEXT:    4 |   (TestF0 vbtable pointer)
// CHECK-NEXT:    8 |   int a
// CHECK-NEXT:   12 |   struct B4 (virtual base)
// CHECK-NEXT:   12 |     int a
// CHECK-NEXT:      | [sizeof=16, 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 TestF0
// CHECK-X64-NEXT:    0 |   struct A4 (base)
// CHECK-X64-NEXT:    0 |     int a
// CHECK-X64-NEXT:    8 |   (TestF0 vbtable pointer)
// CHECK-X64-NEXT:   16 |   int a
// CHECK-X64-NEXT:   24 |   struct B4 (virtual base)
// CHECK-X64-NEXT:   24 |     int a
// CHECK-X64-NEXT:      | [sizeof=32, align=8
// CHECK-X64-NEXT:      |  nvsize=24, nvalign=8]

struct TestF1 : A4, virtual A16 {
	int a;
	TestF1() : a(0xf00000f1) {}
};

// CHECK: *** Dumping AST Record Layout
// CHECK: *** Dumping AST Record Layout
// CHECK-NEXT:    0 | struct TestF1
// CHECK-NEXT:    0 |   struct A4 (base)
// CHECK-NEXT:    0 |     int a
// CHECK-NEXT:    4 |   (TestF1 vbtable pointer)
// CHECK-NEXT:    8 |   int a
// CHECK-NEXT:   16 |   struct A16 (virtual base)
// CHECK-NEXT:   16 |     int a
// CHECK-NEXT:      | [sizeof=32, align=16
// CHECK-NEXT:      |  nvsize=12, nvalign=16]
// CHECK-X64: *** Dumping AST Record Layout
// CHECK-X64: *** Dumping AST Record Layout
// CHECK-X64-NEXT:    0 | struct TestF1
// CHECK-X64-NEXT:    0 |   struct A4 (base)
// CHECK-X64-NEXT:    0 |     int a
// CHECK-X64-NEXT:    8 |   (TestF1 vbtable pointer)
// CHECK-X64-NEXT:   16 |   int a
// CHECK-X64-NEXT:   32 |   struct A16 (virtual base)
// CHECK-X64-NEXT:   32 |     int a
// CHECK-X64-NEXT:      | [sizeof=48, align=16
// CHECK-X64-NEXT:      |  nvsize=24, nvalign=16]

struct TestF2 : A4, virtual C4 {
	int a;
	TestF2() : a(0xf00000f2) {}
};

// CHECK: *** Dumping AST Record Layout
// CHECK: *** Dumping AST Record Layout
// CHECK-NEXT:    0 | struct TestF2
// CHECK-NEXT:    0 |   struct A4 (base)
// CHECK-NEXT:    0 |     int a
// CHECK-NEXT:    4 |   (TestF2 vbtable pointer)
// CHECK-NEXT:    8 |   int a
// CHECK-NEXT:   12 |   struct C4 (virtual base)
// CHECK-NEXT:   12 |     (C4 vftable pointer)
// CHECK-NEXT:   16 |     int a
// CHECK-NEXT:      | [sizeof=20, 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 TestF2
// CHECK-X64-NEXT:    0 |   struct A4 (base)
// CHECK-X64-NEXT:    0 |     int a
// CHECK-X64-NEXT:    8 |   (TestF2 vbtable pointer)
// CHECK-X64-NEXT:   16 |   int a
// CHECK-X64-NEXT:   24 |   struct C4 (virtual base)
// CHECK-X64-NEXT:   24 |     (C4 vftable pointer)
// CHECK-X64-NEXT:   32 |     int a
// CHECK-X64-NEXT:      | [sizeof=40, align=8
// CHECK-X64-NEXT:      |  nvsize=24, nvalign=8]

struct TestF3 : A4, virtual C16 {
	int a;
	TestF3() : a(0xf00000f3) {}
};

// CHECK: *** Dumping AST Record Layout
// CHECK: *** Dumping AST Record Layout
// CHECK-NEXT:    0 | struct TestF3
// CHECK-NEXT:    0 |   struct A4 (base)
// CHECK-NEXT:    0 |     int a
// CHECK-NEXT:    4 |   (TestF3 vbtable pointer)
// CHECK-NEXT:    8 |   int a
// CHECK-NEXT:   16 |   struct C16 (virtual base)
// CHECK-NEXT:   16 |     (C16 vftable pointer)
// CHECK-NEXT:   32 |     int a
// CHECK-NEXT:      | [sizeof=48, align=16
// CHECK-NEXT:      |  nvsize=12, nvalign=16]
// CHECK-X64: *** Dumping AST Record Layout
// CHECK-X64: *** Dumping AST Record Layout
// CHECK-X64-NEXT:    0 | struct TestF3
// CHECK-X64-NEXT:    0 |   struct A4 (base)
// CHECK-X64-NEXT:    0 |     int a
// CHECK-X64-NEXT:    8 |   (TestF3 vbtable pointer)
// CHECK-X64-NEXT:   16 |   int a
// CHECK-X64-NEXT:   32 |   struct C16 (virtual base)
// CHECK-X64-NEXT:   32 |     (C16 vftable pointer)
// CHECK-X64-NEXT:   48 |     int a
// CHECK-X64-NEXT:      | [sizeof=64, align=16
// CHECK-X64-NEXT:      |  nvsize=24, nvalign=16]

struct TestF4 : TestF3, A4 {
	int a;
	TestF4() : a(0xf00000f4) {}
};

// CHECK: *** Dumping AST Record Layout
// CHECK-NEXT:    0 | struct TestF4
// CHECK-NEXT:    0 |   struct TestF3 (base)
// CHECK-NEXT:    0 |     struct A4 (base)
// CHECK-NEXT:    0 |       int a
// CHECK-NEXT:    4 |     (TestF3 vbtable pointer)
// CHECK-NEXT:    8 |     int a
// CHECK-NEXT:   12 |   struct A4 (base)
// CHECK-NEXT:   12 |     int a
// CHECK-NEXT:   16 |   int a
// CHECK-NEXT:   32 |   struct C16 (virtual base)
// CHECK-NEXT:   32 |     (C16 vftable pointer)
// CHECK-NEXT:   48 |     int a
// CHECK-NEXT:      | [sizeof=64, align=16
// CHECK-NEXT:      |  nvsize=32, nvalign=16]
// CHECK-X64: *** Dumping AST Record Layout
// CHECK-X64-NEXT:    0 | struct TestF4
// CHECK-X64-NEXT:    0 |   struct TestF3 (base)
// CHECK-X64-NEXT:    0 |     struct A4 (base)
// CHECK-X64-NEXT:    0 |       int a
// CHECK-X64-NEXT:    8 |     (TestF3 vbtable pointer)
// CHECK-X64-NEXT:   16 |     int a
// CHECK-X64-NEXT:   24 |   struct A4 (base)
// CHECK-X64-NEXT:   24 |     int a
// CHECK-X64-NEXT:   28 |   int a
// CHECK-X64-NEXT:   32 |   struct C16 (virtual base)
// CHECK-X64-NEXT:   32 |     (C16 vftable pointer)
// CHECK-X64-NEXT:   48 |     int a
// CHECK-X64-NEXT:      | [sizeof=64, align=16
// CHECK-X64-NEXT:      |  nvsize=32, nvalign=16]

struct TestF5 : TestF3, A4 {
	int a;
	TestF5() : a(0xf00000f5) {}
	virtual void g() {printf("F5");}
};

// CHECK: *** Dumping AST Record Layout
// CHECK-NEXT:    0 | struct TestF5
// CHECK-NEXT:    0 |   (TestF5 vftable pointer)
// CHECK-NEXT:   16 |   struct TestF3 (base)
// CHECK-NEXT:   16 |     struct A4 (base)
// CHECK-NEXT:   16 |       int a
// CHECK-NEXT:   20 |     (TestF3 vbtable pointer)
// CHECK-NEXT:   24 |     int a
// CHECK-NEXT:   28 |   struct A4 (base)
// CHECK-NEXT:   28 |     int a
// CHECK-NEXT:   32 |   int a
// CHECK-NEXT:   48 |   struct C16 (virtual base)
// CHECK-NEXT:   48 |     (C16 vftable pointer)
// CHECK-NEXT:   64 |     int a
// CHECK-NEXT:      | [sizeof=80, align=16
// CHECK-NEXT:      |  nvsize=48, nvalign=16]
// CHECK-X64: *** Dumping AST Record Layout
// CHECK-X64-NEXT:    0 | struct TestF5
// CHECK-X64-NEXT:    0 |   (TestF5 vftable pointer)
// CHECK-X64-NEXT:   16 |   struct TestF3 (base)
// CHECK-X64-NEXT:   16 |     struct A4 (base)
// CHECK-X64-NEXT:   16 |       int a
// CHECK-X64-NEXT:   24 |     (TestF3 vbtable pointer)
// CHECK-X64-NEXT:   32 |     int a
// CHECK-X64-NEXT:   40 |   struct A4 (base)
// CHECK-X64-NEXT:   40 |     int a
// CHECK-X64-NEXT:   44 |   int a
// CHECK-X64-NEXT:   48 |   struct C16 (virtual base)
// CHECK-X64-NEXT:   48 |     (C16 vftable pointer)
// CHECK-X64-NEXT:   64 |     int a
// CHECK-X64-NEXT:      | [sizeof=80, align=16
// CHECK-X64-NEXT:      |  nvsize=48, nvalign=16]

struct TestF6 : TestF3, A4 {
	int a;
	TestF6() : a(0xf00000f6) {}
	virtual void f() {printf("F6");}
};

// CHECK: *** Dumping AST Record Layout
// CHECK-NEXT:    0 | struct TestF6
// CHECK-NEXT:    0 |   struct TestF3 (base)
// CHECK-NEXT:    0 |     struct A4 (base)
// CHECK-NEXT:    0 |       int a
// CHECK-NEXT:    4 |     (TestF3 vbtable pointer)
// CHECK-NEXT:    8 |     int a
// CHECK-NEXT:   12 |   struct A4 (base)
// CHECK-NEXT:   12 |     int a
// CHECK-NEXT:   16 |   int a
// CHECK-NEXT:   44 |   (vtordisp for vbase C16)
// CHECK-NEXT:   48 |   struct C16 (virtual base)
// CHECK-NEXT:   48 |     (C16 vftable pointer)
// CHECK-NEXT:   64 |     int a
// CHECK-NEXT:      | [sizeof=80, align=16
// CHECK-NEXT:      |  nvsize=32, nvalign=16]
// CHECK-X64: *** Dumping AST Record Layout
// CHECK-X64-NEXT:    0 | struct TestF6
// CHECK-X64-NEXT:    0 |   struct TestF3 (base)
// CHECK-X64-NEXT:    0 |     struct A4 (base)
// CHECK-X64-NEXT:    0 |       int a
// CHECK-X64-NEXT:    8 |     (TestF3 vbtable pointer)
// CHECK-X64-NEXT:   16 |     int a
// CHECK-X64-NEXT:   24 |   struct A4 (base)
// CHECK-X64-NEXT:   24 |     int a
// CHECK-X64-NEXT:   28 |   int a
// CHECK-X64-NEXT:   44 |   (vtordisp for vbase C16)
// CHECK-X64-NEXT:   48 |   struct C16 (virtual base)
// CHECK-X64-NEXT:   48 |     (C16 vftable pointer)
// CHECK-X64-NEXT:   64 |     int a
// CHECK-X64-NEXT:      | [sizeof=80, align=16
// CHECK-X64-NEXT:      |  nvsize=32, nvalign=16]

struct TestF7 : A4, virtual C16 {
	int a;
	TestF7() : a(0xf00000f7) {}
	virtual void f() {printf("F7");}
};

// CHECK: *** Dumping AST Record Layout
// CHECK-NEXT:    0 | struct TestF7
// CHECK-NEXT:    0 |   struct A4 (base)
// CHECK-NEXT:    0 |     int a
// CHECK-NEXT:    4 |   (TestF7 vbtable pointer)
// CHECK-NEXT:    8 |   int a
// CHECK-NEXT:   28 |   (vtordisp for vbase C16)
// CHECK-NEXT:   32 |   struct C16 (virtual base)
// CHECK-NEXT:   32 |     (C16 vftable pointer)
// CHECK-NEXT:   48 |     int a
// CHECK-NEXT:      | [sizeof=64, align=16
// CHECK-NEXT:      |  nvsize=12, nvalign=16]
// CHECK-X64: *** Dumping AST Record Layout
// CHECK-X64-NEXT:    0 | struct TestF7
// CHECK-X64-NEXT:    0 |   struct A4 (base)
// CHECK-X64-NEXT:    0 |     int a
// CHECK-X64-NEXT:    8 |   (TestF7 vbtable pointer)
// CHECK-X64-NEXT:   16 |   int a
// CHECK-X64-NEXT:   44 |   (vtordisp for vbase C16)
// CHECK-X64-NEXT:   48 |   struct C16 (virtual base)
// CHECK-X64-NEXT:   48 |     (C16 vftable pointer)
// CHECK-X64-NEXT:   64 |     int a
// CHECK-X64-NEXT:      | [sizeof=80, align=16
// CHECK-X64-NEXT:      |  nvsize=24, nvalign=16]

struct TestF8 : TestF7, A4 {
	int a;
	TestF8() : a(0xf00000f8) {}
	virtual void f() {printf("F8");}
};

// CHECK: *** Dumping AST Record Layout
// CHECK-NEXT:    0 | struct TestF8
// CHECK-NEXT:    0 |   struct TestF7 (base)
// CHECK-NEXT:    0 |     struct A4 (base)
// CHECK-NEXT:    0 |       int a
// CHECK-NEXT:    4 |     (TestF7 vbtable pointer)
// CHECK-NEXT:    8 |     int a
// CHECK-NEXT:   12 |   struct A4 (base)
// CHECK-NEXT:   12 |     int a
// CHECK-NEXT:   16 |   int a
// CHECK-NEXT:   44 |   (vtordisp for vbase C16)
// CHECK-NEXT:   48 |   struct C16 (virtual base)
// CHECK-NEXT:   48 |     (C16 vftable pointer)
// CHECK-NEXT:   64 |     int a
// CHECK-NEXT:      | [sizeof=80, align=16
// CHECK-NEXT:      |  nvsize=32, nvalign=16]
// CHECK-X64: *** Dumping AST Record Layout
// CHECK-X64-NEXT:    0 | struct TestF8
// CHECK-X64-NEXT:    0 |   struct TestF7 (base)
// CHECK-X64-NEXT:    0 |     struct A4 (base)
// CHECK-X64-NEXT:    0 |       int a
// CHECK-X64-NEXT:    8 |     (TestF7 vbtable pointer)
// CHECK-X64-NEXT:   16 |     int a
// CHECK-X64-NEXT:   24 |   struct A4 (base)
// CHECK-X64-NEXT:   24 |     int a
// CHECK-X64-NEXT:   28 |   int a
// CHECK-X64-NEXT:   44 |   (vtordisp for vbase C16)
// CHECK-X64-NEXT:   48 |   struct C16 (virtual base)
// CHECK-X64-NEXT:   48 |     (C16 vftable pointer)
// CHECK-X64-NEXT:   64 |     int a
// CHECK-X64-NEXT:      | [sizeof=80, align=16
// CHECK-X64-NEXT:      |  nvsize=32, nvalign=16]

struct TestF9 : A4, virtual C16 {
	int a;
	TestF9() : a(0xf00000f9) {}
	virtual void g() {printf("F9");}
};

// CHECK: *** Dumping AST Record Layout
// CHECK-NEXT:    0 | struct TestF9
// CHECK-NEXT:    0 |   (TestF9 vftable pointer)
// CHECK-NEXT:    4 |   struct A4 (base)
// CHECK-NEXT:    4 |     int a
// CHECK-NEXT:    8 |   (TestF9 vbtable pointer)
// CHECK-NEXT:   12 |   int a
// CHECK-NEXT:   16 |   struct C16 (virtual base)
// CHECK-NEXT:   16 |     (C16 vftable pointer)
// CHECK-NEXT:   32 |     int a
// CHECK-NEXT:      | [sizeof=48, align=16
// CHECK-NEXT:      |  nvsize=16, nvalign=16]
// CHECK-X64: *** Dumping AST Record Layout
// CHECK-X64-NEXT:    0 | struct TestF9
// CHECK-X64-NEXT:    0 |   (TestF9 vftable pointer)
// CHECK-X64-NEXT:    8 |   struct A4 (base)
// CHECK-X64-NEXT:    8 |     int a
// CHECK-X64-NEXT:   16 |   (TestF9 vbtable pointer)
// CHECK-X64-NEXT:   24 |   int a
// CHECK-X64-NEXT:   32 |   struct C16 (virtual base)
// CHECK-X64-NEXT:   32 |     (C16 vftable pointer)
// CHECK-X64-NEXT:   48 |     int a
// CHECK-X64-NEXT:      | [sizeof=64, align=16
// CHECK-X64-NEXT:      |  nvsize=32, nvalign=16]

struct TestFA : TestF9, A4 {
	int a;
	TestFA() : a(0xf00000fa) {}
	virtual void g() {printf("FA");}
};

// CHECK: *** Dumping AST Record Layout
// CHECK-NEXT:    0 | struct TestFA
// CHECK-NEXT:    0 |   struct TestF9 (primary base)
// CHECK-NEXT:    0 |     (TestF9 vftable pointer)
// CHECK-NEXT:    4 |     struct A4 (base)
// CHECK-NEXT:    4 |       int a
// CHECK-NEXT:    8 |     (TestF9 vbtable pointer)
// CHECK-NEXT:   12 |     int a
// CHECK-NEXT:   16 |   struct A4 (base)
// CHECK-NEXT:   16 |     int a
// CHECK-NEXT:   20 |   int a
// CHECK-NEXT:   32 |   struct C16 (virtual base)
// CHECK-NEXT:   32 |     (C16 vftable pointer)
// CHECK-NEXT:   48 |     int a
// CHECK-NEXT:      | [sizeof=64, align=16
// CHECK-NEXT:      |  nvsize=32, nvalign=16]
// CHECK-X64: *** Dumping AST Record Layout
// CHECK-X64-NEXT:    0 | struct TestFA
// CHECK-X64-NEXT:    0 |   struct TestF9 (primary base)
// CHECK-X64-NEXT:    0 |     (TestF9 vftable pointer)
// CHECK-X64-NEXT:    8 |     struct A4 (base)
// CHECK-X64-NEXT:    8 |       int a
// CHECK-X64-NEXT:   16 |     (TestF9 vbtable pointer)
// CHECK-X64-NEXT:   24 |     int a
// CHECK-X64-NEXT:   32 |   struct A4 (base)
// CHECK-X64-NEXT:   32 |     int a
// CHECK-X64-NEXT:   36 |   int a
// CHECK-X64-NEXT:   48 |   struct C16 (virtual base)
// CHECK-X64-NEXT:   48 |     (C16 vftable pointer)
// CHECK-X64-NEXT:   64 |     int a
// CHECK-X64-NEXT:      | [sizeof=80, align=16
// CHECK-X64-NEXT:      |  nvsize=48, nvalign=16]

struct TestFB : A16, virtual C16 {
	int a;
	TestFB() : a(0xf00000fb) {}
	virtual void g() {printf("Fb");}
};

// CHECK: *** Dumping AST Record Layout
// CHECK-NEXT:    0 | struct TestFB
// CHECK-NEXT:    0 |   (TestFB vftable pointer)
// CHECK-NEXT:   16 |   struct A16 (base)
// CHECK-NEXT:   16 |     int a
// CHECK-NEXT:   32 |   (TestFB vbtable pointer)
// CHECK-NEXT:   48 |   int a
// CHECK-NEXT:   64 |   struct C16 (virtual base)
// CHECK-NEXT:   64 |     (C16 vftable pointer)
// CHECK-NEXT:   80 |     int a
// CHECK-NEXT:      | [sizeof=96, align=16
// CHECK-NEXT:      |  nvsize=64, nvalign=16]
// CHECK-X64: *** Dumping AST Record Layout
// CHECK-X64-NEXT:    0 | struct TestFB
// CHECK-X64-NEXT:    0 |   (TestFB vftable pointer)
// CHECK-X64-NEXT:   16 |   struct A16 (base)
// CHECK-X64-NEXT:   16 |     int a
// CHECK-X64-NEXT:   32 |   (TestFB vbtable pointer)
// CHECK-X64-NEXT:   48 |   int a
// CHECK-X64-NEXT:   64 |   struct C16 (virtual base)
// CHECK-X64-NEXT:   64 |     (C16 vftable pointer)
// CHECK-X64-NEXT:   80 |     int a
// CHECK-X64-NEXT:      | [sizeof=96, align=16
// CHECK-X64-NEXT:      |  nvsize=64, nvalign=16]

struct TestFC : TestFB, A4 {
	int a;
	TestFC() : a(0xf00000fc) {}
	virtual void g() {printf("FC");}
};

// CHECK: *** Dumping AST Record Layout
// CHECK-NEXT:    0 | struct TestFC
// CHECK-NEXT:    0 |   struct TestFB (primary base)
// CHECK-NEXT:    0 |     (TestFB vftable pointer)
// CHECK-NEXT:   16 |     struct A16 (base)
// CHECK-NEXT:   16 |       int a
// CHECK-NEXT:   32 |     (TestFB vbtable pointer)
// CHECK-NEXT:   48 |     int a
// CHECK-NEXT:   64 |   struct A4 (base)
// CHECK-NEXT:   64 |     int a
// CHECK-NEXT:   68 |   int a
// CHECK-NEXT:   80 |   struct C16 (virtual base)
// CHECK-NEXT:   80 |     (C16 vftable pointer)
// CHECK-NEXT:   96 |     int a
// CHECK-NEXT:      | [sizeof=112, align=16
// CHECK-NEXT:      |  nvsize=80, nvalign=16]
// CHECK-X64: *** Dumping AST Record Layout
// CHECK-X64-NEXT:    0 | struct TestFC
// CHECK-X64-NEXT:    0 |   struct TestFB (primary base)
// CHECK-X64-NEXT:    0 |     (TestFB vftable pointer)
// CHECK-X64-NEXT:   16 |     struct A16 (base)
// CHECK-X64-NEXT:   16 |       int a
// CHECK-X64-NEXT:   32 |     (TestFB vbtable pointer)
// CHECK-X64-NEXT:   48 |     int a
// CHECK-X64-NEXT:   64 |   struct A4 (base)
// CHECK-X64-NEXT:   64 |     int a
// CHECK-X64-NEXT:   68 |   int a
// CHECK-X64-NEXT:   80 |   struct C16 (virtual base)
// CHECK-X64-NEXT:   80 |     (C16 vftable pointer)
// CHECK-X64-NEXT:   96 |     int a
// CHECK-X64-NEXT:      | [sizeof=112, align=16
// CHECK-X64-NEXT:      |  nvsize=80, nvalign=16]


struct A16f {
	__declspec(align(16)) int a;
	A16f() : a(0xf0000a16) {}
	virtual void f() {printf("A16f");}
};

struct Y { char y; Y() : y(0xaa) {} };
struct X : virtual A16f {};

struct B : A4, Y, X {
	int a;
	B() : a(0xf000000b) {}
};

struct F0 : A4, B {
	int a;
	F0() : a(0xf00000f0) {}
	virtual void g() {printf("F0");}
};

// 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 F0
// CHECK-NEXT:    0 |   (F0 vftable pointer)
// CHECK-NEXT:   16 |   struct A4 (base)
// CHECK-NEXT:   16 |     int a
// CHECK-NEXT:   32 |   struct B (base)
// CHECK-NEXT:   32 |     struct A4 (base)
// CHECK-NEXT:   32 |       int a
// CHECK-NEXT:   36 |     struct Y (base)
// CHECK-NEXT:   36 |       char y
// CHECK-NEXT:   48 |     struct X (base)
// CHECK-NEXT:   48 |       (X vbtable pointer)
// CHECK-NEXT:   52 |     int a
// CHECK-NEXT:   64 |   int a
// CHECK-NEXT:   80 |   struct A16f (virtual base)
// CHECK-NEXT:   80 |     (A16f vftable pointer)
// CHECK-NEXT:   96 |     int a
// CHECK-NEXT:      | [sizeof=112, align=16
// CHECK-NEXT:      |  nvsize=80, 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-NEXT:    0 | struct F0
// CHECK-X64-NEXT:    0 |   (F0 vftable pointer)
// CHECK-X64-NEXT:   16 |   struct A4 (base)
// CHECK-X64-NEXT:   16 |     int a
// CHECK-X64-NEXT:   32 |   struct B (base)
// CHECK-X64-NEXT:   32 |     struct A4 (base)
// CHECK-X64-NEXT:   32 |       int a
// CHECK-X64-NEXT:   36 |     struct Y (base)
// CHECK-X64-NEXT:   36 |       char y
// CHECK-X64-NEXT:   48 |     struct X (base)
// CHECK-X64-NEXT:   48 |       (X vbtable pointer)
// CHECK-X64-NEXT:   56 |     int a
// CHECK-X64-NEXT:   64 |   int a
// CHECK-X64-NEXT:   80 |   struct A16f (virtual base)
// CHECK-X64-NEXT:   80 |     (A16f vftable pointer)
// CHECK-X64-NEXT:   96 |     int a
// CHECK-X64-NEXT:      | [sizeof=112, align=16
// CHECK-X64-NEXT:      |  nvsize=80, nvalign=16]

struct F1 : B, A4 {
	int a;
	F1() : a(0xf00000f1) {}
	virtual void g() {printf("F1");}
};

// CHECK: *** Dumping AST Record Layout
// CHECK-NEXT:    0 | struct F1
// CHECK-NEXT:    0 |   (F1 vftable pointer)
// CHECK-NEXT:   16 |   struct B (base)
// CHECK-NEXT:   16 |     struct A4 (base)
// CHECK-NEXT:   16 |       int a
// CHECK-NEXT:   20 |     struct Y (base)
// CHECK-NEXT:   20 |       char y
// CHECK-NEXT:   32 |     struct X (base)
// CHECK-NEXT:   32 |       (X vbtable pointer)
// CHECK-NEXT:   36 |     int a
// CHECK-NEXT:   48 |   struct A4 (base)
// CHECK-NEXT:   48 |     int a
// CHECK-NEXT:   52 |   int a
// CHECK-NEXT:   64 |   struct A16f (virtual base)
// CHECK-NEXT:   64 |     (A16f vftable pointer)
// CHECK-NEXT:   80 |     int a
// CHECK-NEXT:      | [sizeof=96, align=16
// CHECK-NEXT:      |  nvsize=64, nvalign=16]
// CHECK-X64: *** Dumping AST Record Layout
// CHECK-X64-NEXT:    0 | struct F1
// CHECK-X64-NEXT:    0 |   (F1 vftable pointer)
// CHECK-X64-NEXT:   16 |   struct B (base)
// CHECK-X64-NEXT:   16 |     struct A4 (base)
// CHECK-X64-NEXT:   16 |       int a
// CHECK-X64-NEXT:   20 |     struct Y (base)
// CHECK-X64-NEXT:   20 |       char y
// CHECK-X64-NEXT:   32 |     struct X (base)
// CHECK-X64-NEXT:   32 |       (X vbtable pointer)
// CHECK-X64-NEXT:   40 |     int a
// CHECK-X64-NEXT:   48 |   struct A4 (base)
// CHECK-X64-NEXT:   48 |     int a
// CHECK-X64-NEXT:   52 |   int a
// CHECK-X64-NEXT:   64 |   struct A16f (virtual base)
// CHECK-X64-NEXT:   64 |     (A16f vftable pointer)
// CHECK-X64-NEXT:   80 |     int a
// CHECK-X64-NEXT:      | [sizeof=96, align=16
// CHECK-X64-NEXT:      |  nvsize=64, nvalign=16]

struct F2 : A4, virtual A16f {
	int a;
	F2() : a(0xf00000f2) {}
	virtual void g() {printf("F2");}
};

// CHECK: *** Dumping AST Record Layout
// CHECK-NEXT:    0 | struct F2
// CHECK-NEXT:    0 |   (F2 vftable pointer)
// CHECK-NEXT:    4 |   struct A4 (base)
// CHECK-NEXT:    4 |     int a
// CHECK-NEXT:    8 |   (F2 vbtable pointer)
// CHECK-NEXT:   12 |   int a
// CHECK-NEXT:   16 |   struct A16f (virtual base)
// CHECK-NEXT:   16 |     (A16f vftable pointer)
// CHECK-NEXT:   32 |     int a
// CHECK-NEXT:      | [sizeof=48, align=16
// CHECK-NEXT:      |  nvsize=16, nvalign=16]
// CHECK-X64: *** Dumping AST Record Layout
// CHECK-X64-NEXT:    0 | struct F2
// CHECK-X64-NEXT:    0 |   (F2 vftable pointer)
// CHECK-X64-NEXT:    8 |   struct A4 (base)
// CHECK-X64-NEXT:    8 |     int a
// CHECK-X64-NEXT:   16 |   (F2 vbtable pointer)
// CHECK-X64-NEXT:   24 |   int a
// CHECK-X64-NEXT:   32 |   struct A16f (virtual base)
// CHECK-X64-NEXT:   32 |     (A16f vftable pointer)
// CHECK-X64-NEXT:   48 |     int a
// CHECK-X64-NEXT:      | [sizeof=64, align=16
// CHECK-X64-NEXT:      |  nvsize=32, nvalign=16]

struct F3 : A4, virtual A16f {
	__declspec(align(16)) int a;
	F3() : a(0xf00000f3) {}
	virtual void g() {printf("F3");}
};

// CHECK: *** Dumping AST Record Layout
// CHECK-NEXT:    0 | struct F3
// CHECK-NEXT:    0 |   (F3 vftable pointer)
// CHECK-NEXT:   16 |   struct A4 (base)
// CHECK-NEXT:   16 |     int a
// CHECK-NEXT:   20 |   (F3 vbtable pointer)
// CHECK-NEXT:   48 |   int a
// CHECK-NEXT:   64 |   struct A16f (virtual base)
// CHECK-NEXT:   64 |     (A16f vftable pointer)
// CHECK-NEXT:   80 |     int a
// CHECK-NEXT:      | [sizeof=96, align=16
// CHECK-NEXT:      |  nvsize=64, nvalign=16]
// CHECK-X64: *** Dumping AST Record Layout
// CHECK-X64-NEXT:    0 | struct F3
// CHECK-X64-NEXT:    0 |   (F3 vftable pointer)
// CHECK-X64-NEXT:   16 |   struct A4 (base)
// CHECK-X64-NEXT:   16 |     int a
// CHECK-X64-NEXT:   24 |   (F3 vbtable pointer)
// CHECK-X64-NEXT:   48 |   int a
// CHECK-X64-NEXT:   64 |   struct A16f (virtual base)
// CHECK-X64-NEXT:   64 |     (A16f vftable pointer)
// CHECK-X64-NEXT:   80 |     int a
// CHECK-X64-NEXT:      | [sizeof=96, align=16
// CHECK-X64-NEXT:      |  nvsize=64, nvalign=16]

struct F4 : A4, B {
	__declspec(align(16)) int a;
	F4() : a(0xf00000f4) {}
	virtual void g() {printf("F4");}
};

// CHECK: *** Dumping AST Record Layout
// CHECK-NEXT:    0 | struct F4
// CHECK-NEXT:    0 |   (F4 vftable pointer)
// CHECK-NEXT:   16 |   struct A4 (base)
// CHECK-NEXT:   16 |     int a
// CHECK-NEXT:   32 |   struct B (base)
// CHECK-NEXT:   32 |     struct A4 (base)
// CHECK-NEXT:   32 |       int a
// CHECK-NEXT:   36 |     struct Y (base)
// CHECK-NEXT:   36 |       char y
// CHECK-NEXT:   48 |     struct X (base)
// CHECK-NEXT:   48 |       (X vbtable pointer)
// CHECK-NEXT:   52 |     int a
// CHECK-NEXT:   64 |   int a
// CHECK-NEXT:   80 |   struct A16f (virtual base)
// CHECK-NEXT:   80 |     (A16f vftable pointer)
// CHECK-NEXT:   96 |     int a
// CHECK-NEXT:      | [sizeof=112, align=16
// CHECK-NEXT:      |  nvsize=80, nvalign=16]
// CHECK-X64: *** Dumping AST Record Layout
// CHECK-X64-NEXT:    0 | struct F4
// CHECK-X64-NEXT:    0 |   (F4 vftable pointer)
// CHECK-X64-NEXT:   16 |   struct A4 (base)
// CHECK-X64-NEXT:   16 |     int a
// CHECK-X64-NEXT:   32 |   struct B (base)
// CHECK-X64-NEXT:   32 |     struct A4 (base)
// CHECK-X64-NEXT:   32 |       int a
// CHECK-X64-NEXT:   36 |     struct Y (base)
// CHECK-X64-NEXT:   36 |       char y
// CHECK-X64-NEXT:   48 |     struct X (base)
// CHECK-X64-NEXT:   48 |       (X vbtable pointer)
// CHECK-X64-NEXT:   56 |     int a
// CHECK-X64-NEXT:   64 |   int a
// CHECK-X64-NEXT:   80 |   struct A16f (virtual base)
// CHECK-X64-NEXT:   80 |     (A16f vftable pointer)
// CHECK-X64-NEXT:   96 |     int a
// CHECK-X64-NEXT:      | [sizeof=112, align=16
// CHECK-X64-NEXT:      |  nvsize=80, nvalign=16]

struct F5 : A16f, virtual A4 {
	int a;
	F5() : a(0xf00000f5) {}
	virtual void g() {printf("F5");}
};

// CHECK: *** Dumping AST Record Layout
// CHECK-NEXT:    0 | struct F5
// CHECK-NEXT:    0 |   struct A16f (primary base)
// CHECK-NEXT:    0 |     (A16f vftable pointer)
// CHECK-NEXT:   16 |     int a
// CHECK-NEXT:   32 |   (F5 vbtable pointer)
// CHECK-NEXT:   48 |   int a
// CHECK-NEXT:   64 |   struct A4 (virtual base)
// CHECK-NEXT:   64 |     int a
// CHECK-NEXT:      | [sizeof=80, align=16
// CHECK-NEXT:      |  nvsize=64, nvalign=16]
// CHECK-X64: *** Dumping AST Record Layout
// CHECK-X64-NEXT:    0 | struct F5
// CHECK-X64-NEXT:    0 |   struct A16f (primary base)
// CHECK-X64-NEXT:    0 |     (A16f vftable pointer)
// CHECK-X64-NEXT:   16 |     int a
// CHECK-X64-NEXT:   32 |   (F5 vbtable pointer)
// CHECK-X64-NEXT:   48 |   int a
// CHECK-X64-NEXT:   64 |   struct A4 (virtual base)
// CHECK-X64-NEXT:   64 |     int a
// CHECK-X64-NEXT:      | [sizeof=80, align=16
// CHECK-X64-NEXT:      |  nvsize=64, nvalign=16]

struct F6 : virtual A16f, A4, virtual B {
	int a;
	F6() : a(0xf00000f6) {}
	virtual void g() {printf("F6");}
};

// CHECK: *** Dumping AST Record Layout
// CHECK-NEXT:    0 | struct F6
// CHECK-NEXT:    0 |   (F6 vftable pointer)
// CHECK-NEXT:    4 |   struct A4 (base)
// CHECK-NEXT:    4 |     int a
// CHECK-NEXT:    8 |   (F6 vbtable pointer)
// CHECK-NEXT:   12 |   int a
// CHECK-NEXT:   16 |   struct A16f (virtual base)
// CHECK-NEXT:   16 |     (A16f vftable pointer)
// CHECK-NEXT:   32 |     int a
// CHECK-NEXT:   48 |   struct B (virtual base)
// CHECK-NEXT:   48 |     struct A4 (base)
// CHECK-NEXT:   48 |       int a
// CHECK-NEXT:   52 |     struct Y (base)
// CHECK-NEXT:   52 |       char y
// CHECK-NEXT:   64 |     struct X (base)
// CHECK-NEXT:   64 |       (X vbtable pointer)
// CHECK-NEXT:   68 |     int a
// CHECK-NEXT:      | [sizeof=80, align=16
// CHECK-NEXT:      |  nvsize=16, nvalign=16]
// CHECK-X64: *** Dumping AST Record Layout
// CHECK-X64-NEXT:    0 | struct F6
// CHECK-X64-NEXT:    0 |   (F6 vftable pointer)
// CHECK-X64-NEXT:    8 |   struct A4 (base)
// CHECK-X64-NEXT:    8 |     int a
// CHECK-X64-NEXT:   16 |   (F6 vbtable pointer)
// CHECK-X64-NEXT:   24 |   int a
// CHECK-X64-NEXT:   32 |   struct A16f (virtual base)
// CHECK-X64-NEXT:   32 |     (A16f vftable pointer)
// CHECK-X64-NEXT:   48 |     int a
// CHECK-X64-NEXT:   64 |   struct B (virtual base)
// CHECK-X64-NEXT:   64 |     struct A4 (base)
// CHECK-X64-NEXT:   64 |       int a
// CHECK-X64-NEXT:   68 |     struct Y (base)
// CHECK-X64-NEXT:   68 |       char y
// CHECK-X64-NEXT:   80 |     struct X (base)
// CHECK-X64-NEXT:   80 |       (X vbtable pointer)
// CHECK-X64-NEXT:   88 |     int a
// CHECK-X64-NEXT:      | [sizeof=96, align=16
// CHECK-X64-NEXT:      |  nvsize=32, nvalign=16]

struct ArrayFieldOfRecords {
  A4 InlineElts[2];
};

// CHECK: *** Dumping AST Record Layout
// CHECK-NEXT:    0 | struct ArrayFieldOfRecords
// CHECK-NEXT:    0 |   struct A4 [2] InlineElts
// CHECK-NEXT:      | [sizeof=8, align=4
// CHECK-NEXT:      |  nvsize=8, nvalign=4]
// CHECK-X64: *** Dumping AST Record Layout
// CHECK-X64-NEXT:    0 | struct ArrayFieldOfRecords
// CHECK-X64-NEXT:    0 |   struct A4 [2] InlineElts
// CHECK-X64-NEXT:      | [sizeof=8, align=4
// CHECK-X64-NEXT:      |  nvsize=8, nvalign=4]

struct ArrayOfArrayFieldOfRecords {
  A4 InlineElts[2][2];
};

// CHECK: *** Dumping AST Record Layout
// CHECK-NEXT:    0 | struct ArrayOfArrayFieldOfRecords
// CHECK-NEXT:    0 |   struct A4 [2][2] InlineElts
// CHECK-NEXT:      | [sizeof=16, align=4
// CHECK-NEXT:      |  nvsize=16, nvalign=4]
// CHECK-X64: *** Dumping AST Record Layout
// CHECK-X64-NEXT:    0 | struct ArrayOfArrayFieldOfRecords
// CHECK-X64-NEXT:    0 |   struct A4 [2][2] InlineElts
// CHECK-X64-NEXT:      | [sizeof=16, align=4
// CHECK-X64-NEXT:      |  nvsize=16, nvalign=4]

struct RecordArrayTypedef {
  typedef A4 ArrayTy[2];
  ArrayTy InlineElts[2];
};

// CHECK: *** Dumping AST Record Layout
// CHECK-NEXT:    0 | struct RecordArrayTypedef
// CHECK-NEXT:    0 |   RecordArrayTypedef::ArrayTy [2] InlineElts
// CHECK-NEXT:      | [sizeof=16, align=4
// CHECK-NEXT:      |  nvsize=16, nvalign=4]
// CHECK-X64: *** Dumping AST Record Layout
// CHECK-X64-NEXT:    0 | struct RecordArrayTypedef
// CHECK-X64-NEXT:    0 |   RecordArrayTypedef::ArrayTy [2] InlineElts
// CHECK-X64-NEXT:      | [sizeof=16, align=4
// CHECK-X64-NEXT:      |  nvsize=16, nvalign=4]

struct EmptyIntMemb {
  int FlexArrayMemb[0];
};

// CHECK: *** Dumping AST Record Layout
// CHECK-NEXT:    0 | struct EmptyIntMemb
// CHECK-NEXT:    0 |   int [0] FlexArrayMemb
// CHECK-NEXT:      | [sizeof=1, align=4
// CHECK-NEXT:      |  nvsize=0, nvalign=4]
// CHECK-X64: *** Dumping AST Record Layout
// CHECK-X64-NEXT:    0 | struct EmptyIntMemb
// CHECK-X64-NEXT:    0 |   int [0] FlexArrayMemb
// CHECK-X64-NEXT:      | [sizeof=4, align=4
// CHECK-X64-NEXT:      |  nvsize=0, nvalign=4]

struct EmptyLongLongMemb {
  long long FlexArrayMemb[0];
};

// CHECK: *** Dumping AST Record Layout
// CHECK-NEXT:    0 | struct EmptyLongLongMemb
// CHECK-NEXT:    0 |   long long [0] FlexArrayMemb
// CHECK-NEXT:      | [sizeof=1, align=8
// CHECK-NEXT:      |  nvsize=0, nvalign=8]
// CHECK-X64: *** Dumping AST Record Layout
// CHECK-X64-NEXT:    0 | struct EmptyLongLongMemb
// CHECK-X64-NEXT:    0 |   long long [0] FlexArrayMemb
// CHECK-X64-NEXT:      | [sizeof=8, align=8
// CHECK-X64-NEXT:      |  nvsize=0, nvalign=8]

int a[
sizeof(TestF0)+
sizeof(TestF1)+
sizeof(TestF2)+
sizeof(TestF3)+
sizeof(TestF4)+
sizeof(TestF5)+
sizeof(TestF6)+
sizeof(TestF7)+
sizeof(TestF8)+
sizeof(TestF9)+
sizeof(TestFA)+
sizeof(TestFB)+
sizeof(TestFC)+
sizeof(F0)+
sizeof(F1)+
sizeof(F2)+
sizeof(F3)+
sizeof(F4)+
sizeof(F5)+
sizeof(F6)+
sizeof(ArrayFieldOfRecords)+
sizeof(ArrayOfArrayFieldOfRecords)+
sizeof(RecordArrayTypedef)+
sizeof(EmptyIntMemb)+
sizeof(EmptyLongLongMemb)+
0];