1 // RUN: %clang_cc1 -fno-rtti -emit-llvm-only -triple i686-pc-win32 -fms-extensions -fdump-record-layouts %s 2>/dev/null \ 2 // RUN: | FileCheck %s 3 // RUN: %clang_cc1 -fno-rtti -emit-llvm-only -triple x86_64-pc-win32 -fms-extensions -fdump-record-layouts %s 2>/dev/null \ 4 // RUN: | FileCheck %s -check-prefix CHECK-X64 5 6 extern "C" int printf(const char *fmt, ...); 7 8 struct B0 { char a; B0() : a(0xB0) {} }; 9 struct __declspec(align(1)) B1 {}; 10 11 struct A : virtual B0 {}; 12 13 // CHECK: *** Dumping AST Record Layout 14 // CHECK: *** Dumping AST Record Layout 15 // CHECK-NEXT: 0 | struct A 16 // CHECK-NEXT: 0 | (A vbtable pointer) 17 // CHECK-NEXT: 4 | struct B0 (virtual base) 18 // CHECK-NEXT: 4 | char a 19 // CHECK-NEXT: | [sizeof=5, align=4 20 // CHECK-NEXT: | nvsize=4, nvalign=4] 21 // CHECK-X64: *** Dumping AST Record Layout 22 // CHECK-X64: *** Dumping AST Record Layout 23 // CHECK-X64-NEXT: 0 | struct A 24 // CHECK-X64-NEXT: 0 | (A vbtable pointer) 25 // CHECK-X64-NEXT: 8 | struct B0 (virtual base) 26 // CHECK-X64-NEXT: 8 | char a 27 // CHECK-X64-NEXT: | [sizeof=16, align=8 28 // CHECK-X64-NEXT: | nvsize=8, nvalign=8] 29 30 struct __declspec(align(1)) B : virtual B0 {}; 31 32 // CHECK: *** Dumping AST Record Layout 33 // CHECK-NEXT: 0 | struct B 34 // CHECK-NEXT: 0 | (B vbtable pointer) 35 // CHECK-NEXT: 4 | struct B0 (virtual base) 36 // CHECK-NEXT: 4 | char a 37 // CHECK-NEXT: | [sizeof=8, align=4 38 // CHECK-NEXT: | nvsize=4, nvalign=4] 39 // CHECK-X64: *** Dumping AST Record Layout 40 // CHECK-X64-NEXT: 0 | struct B 41 // CHECK-X64-NEXT: 0 | (B vbtable pointer) 42 // CHECK-X64-NEXT: 8 | struct B0 (virtual base) 43 // CHECK-X64-NEXT: 8 | char a 44 // CHECK-X64-NEXT: | [sizeof=16, align=8 45 // CHECK-X64-NEXT: | nvsize=8, nvalign=8] 46 47 struct C : virtual B0 { int a; C() : a(0xC) {} }; 48 49 // CHECK: *** Dumping AST Record Layout 50 // CHECK-NEXT: 0 | struct C 51 // CHECK-NEXT: 0 | (C vbtable pointer) 52 // CHECK-NEXT: 4 | int a 53 // CHECK-NEXT: 8 | struct B0 (virtual base) 54 // CHECK-NEXT: 8 | char a 55 // CHECK-NEXT: | [sizeof=9, align=4 56 // CHECK-NEXT: | nvsize=8, nvalign=4] 57 // CHECK-X64: *** Dumping AST Record Layout 58 // CHECK-X64-NEXT: 0 | struct C 59 // CHECK-X64-NEXT: 0 | (C vbtable pointer) 60 // CHECK-X64-NEXT: 8 | int a 61 // CHECK-X64-NEXT: 16 | struct B0 (virtual base) 62 // CHECK-X64-NEXT: 16 | char a 63 // CHECK-X64-NEXT: | [sizeof=24, align=8 64 // CHECK-X64-NEXT: | nvsize=16, nvalign=8] 65 66 struct D : virtual B0 { __declspec(align(1)) int a; D() : a(0xD) {} }; 67 68 // CHECK: *** Dumping AST Record Layout 69 // CHECK-NEXT: 0 | struct D 70 // CHECK-NEXT: 0 | (D vbtable pointer) 71 // CHECK-NEXT: 4 | int a 72 // CHECK-NEXT: 8 | struct B0 (virtual base) 73 // CHECK-NEXT: 8 | char a 74 // CHECK-NEXT: | [sizeof=12, align=4 75 // CHECK-NEXT: | nvsize=8, nvalign=4] 76 // CHECK-X64: *** Dumping AST Record Layout 77 // CHECK-X64-NEXT: 0 | struct D 78 // CHECK-X64-NEXT: 0 | (D vbtable pointer) 79 // CHECK-X64-NEXT: 8 | int a 80 // CHECK-X64-NEXT: 16 | struct B0 (virtual base) 81 // CHECK-X64-NEXT: 16 | char a 82 // CHECK-X64-NEXT: | [sizeof=24, align=8 83 // CHECK-X64-NEXT: | nvsize=16, nvalign=8] 84 85 struct E : virtual B0, virtual B1 {}; 86 87 // CHECK: *** Dumping AST Record Layout 88 // CHECK: *** Dumping AST Record Layout 89 // CHECK-NEXT: 0 | struct E 90 // CHECK-NEXT: 0 | (E vbtable pointer) 91 // CHECK-NEXT: 4 | struct B0 (virtual base) 92 // CHECK-NEXT: 4 | char a 93 // CHECK-NEXT: 5 | struct B1 (virtual base) (empty) 94 // CHECK-NEXT: | [sizeof=8, align=4 95 // CHECK-NEXT: | nvsize=4, nvalign=4] 96 // CHECK-X64: *** Dumping AST Record Layout 97 // CHECK-X64: *** Dumping AST Record Layout 98 // CHECK-X64-NEXT: 0 | struct E 99 // CHECK-X64-NEXT: 0 | (E vbtable pointer) 100 // CHECK-X64-NEXT: 8 | struct B0 (virtual base) 101 // CHECK-X64-NEXT: 8 | char a 102 // CHECK-X64-NEXT: 9 | struct B1 (virtual base) (empty) 103 // CHECK-X64-NEXT: | [sizeof=16, align=8 104 // CHECK-X64-NEXT: | nvsize=8, nvalign=8] 105 106 struct F { char a; virtual ~F(); }; 107 108 // CHECK: *** Dumping AST Record Layout 109 // CHECK-NEXT: 0 | struct F 110 // CHECK-NEXT: 0 | (F vftable pointer) 111 // CHECK-NEXT: 4 | char a 112 // CHECK-NEXT: | [sizeof=8, align=4 113 // CHECK-NEXT: | nvsize=8, nvalign=4] 114 // CHECK-X64: *** Dumping AST Record Layout 115 // CHECK-X64-NEXT: 0 | struct F 116 // CHECK-X64-NEXT: 0 | (F vftable pointer) 117 // CHECK-X64-NEXT: 8 | char a 118 // CHECK-X64-NEXT: | [sizeof=16, align=8 119 // CHECK-X64-NEXT: | nvsize=16, nvalign=8] 120 121 int a[ 122 sizeof(A)+ 123 sizeof(B)+ 124 sizeof(C)+ 125 sizeof(D)+ 126 sizeof(E)+ 127 sizeof(F)]; 128