1*f4a2713aSLionel Sambuc // RUN: %clang_cc1 -fno-rtti -emit-llvm-only -triple i686-pc-win32 -fdump-record-layouts -cxx-abi microsoft %s 2>/dev/null \ 2*f4a2713aSLionel Sambuc // RUN: | FileCheck %s 3*f4a2713aSLionel Sambuc // RUN: %clang_cc1 -fno-rtti -emit-llvm-only -triple x86_64-pc-win32 -fdump-record-layouts -cxx-abi microsoft %s 2>/dev/null \ 4*f4a2713aSLionel Sambuc // RUN: | FileCheck %s -check-prefix CHECK-X64 5*f4a2713aSLionel Sambuc 6*f4a2713aSLionel Sambuc 7*f4a2713aSLionel Sambuc struct U { char a; }; 8*f4a2713aSLionel Sambuc struct V { }; 9*f4a2713aSLionel Sambuc struct W { }; 10*f4a2713aSLionel Sambuc struct X : virtual V { char a; }; 11*f4a2713aSLionel Sambuc struct Y : virtual V { char a; }; 12*f4a2713aSLionel Sambuc struct Z : Y { }; 13*f4a2713aSLionel Sambuc 14*f4a2713aSLionel Sambuc struct A : X, W { char a; }; 15*f4a2713aSLionel Sambuc 16*f4a2713aSLionel Sambuc // CHECK: *** Dumping AST Record Layout 17*f4a2713aSLionel Sambuc // CHECK: 0 | struct A 18*f4a2713aSLionel Sambuc // CHECK: 0 | struct X (base) 19*f4a2713aSLionel Sambuc // CHECK: 0 | (X vbtable pointer) 20*f4a2713aSLionel Sambuc // CHECK: 4 | char a 21*f4a2713aSLionel Sambuc // CHECK: 9 | struct W (base) (empty) 22*f4a2713aSLionel Sambuc // CHECK: 9 | char a 23*f4a2713aSLionel Sambuc // CHECK: 12 | struct V (virtual base) (empty) 24*f4a2713aSLionel Sambuc // CHECK: | [sizeof=12, align=4 25*f4a2713aSLionel Sambuc // CHECK: | nvsize=12, nvalign=4] 26*f4a2713aSLionel Sambuc // CHECK-X64: *** Dumping AST Record Layout 27*f4a2713aSLionel Sambuc // CHECK-X64: 0 | struct A 28*f4a2713aSLionel Sambuc // CHECK-X64: 0 | struct X (base) 29*f4a2713aSLionel Sambuc // CHECK-X64: 0 | (X vbtable pointer) 30*f4a2713aSLionel Sambuc // CHECK-X64: 8 | char a 31*f4a2713aSLionel Sambuc // CHECK-X64: 17 | struct W (base) (empty) 32*f4a2713aSLionel Sambuc // CHECK-X64: 17 | char a 33*f4a2713aSLionel Sambuc // CHECK-X64: 24 | struct V (virtual base) (empty) 34*f4a2713aSLionel Sambuc // CHECK-X64: | [sizeof=24, align=8 35*f4a2713aSLionel Sambuc // CHECK-X64: | nvsize=24, nvalign=8] 36*f4a2713aSLionel Sambuc 37*f4a2713aSLionel Sambuc struct B : X, U, W { char a; }; 38*f4a2713aSLionel Sambuc 39*f4a2713aSLionel Sambuc // CHECK: *** Dumping AST Record Layout 40*f4a2713aSLionel Sambuc // CHECK: 0 | struct B 41*f4a2713aSLionel Sambuc // CHECK: 0 | struct X (base) 42*f4a2713aSLionel Sambuc // CHECK: 0 | (X vbtable pointer) 43*f4a2713aSLionel Sambuc // CHECK: 4 | char a 44*f4a2713aSLionel Sambuc // CHECK: 8 | struct U (base) 45*f4a2713aSLionel Sambuc // CHECK: 8 | char a 46*f4a2713aSLionel Sambuc // CHECK: 9 | struct W (base) (empty) 47*f4a2713aSLionel Sambuc // CHECK: 9 | char a 48*f4a2713aSLionel Sambuc // CHECK: 12 | struct V (virtual base) (empty) 49*f4a2713aSLionel Sambuc // CHECK: | [sizeof=12, align=4 50*f4a2713aSLionel Sambuc // CHECK: | nvsize=12, nvalign=4] 51*f4a2713aSLionel Sambuc // CHECK-X64: *** Dumping AST Record Layout 52*f4a2713aSLionel Sambuc // CHECK-X64: 0 | struct B 53*f4a2713aSLionel Sambuc // CHECK-X64: 0 | struct X (base) 54*f4a2713aSLionel Sambuc // CHECK-X64: 0 | (X vbtable pointer) 55*f4a2713aSLionel Sambuc // CHECK-X64: 8 | char a 56*f4a2713aSLionel Sambuc // CHECK-X64: 16 | struct U (base) 57*f4a2713aSLionel Sambuc // CHECK-X64: 16 | char a 58*f4a2713aSLionel Sambuc // CHECK-X64: 17 | struct W (base) (empty) 59*f4a2713aSLionel Sambuc // CHECK-X64: 17 | char a 60*f4a2713aSLionel Sambuc // CHECK-X64: 24 | struct V (virtual base) (empty) 61*f4a2713aSLionel Sambuc // CHECK-X64: | [sizeof=24, align=8 62*f4a2713aSLionel Sambuc // CHECK-X64: | nvsize=24, nvalign=8] 63*f4a2713aSLionel Sambuc 64*f4a2713aSLionel Sambuc struct C : X, V, W { char a; }; 65*f4a2713aSLionel Sambuc 66*f4a2713aSLionel Sambuc // CHECK: *** Dumping AST Record Layout 67*f4a2713aSLionel Sambuc // CHECK: 0 | struct C 68*f4a2713aSLionel Sambuc // CHECK: 0 | struct X (base) 69*f4a2713aSLionel Sambuc // CHECK: 0 | (X vbtable pointer) 70*f4a2713aSLionel Sambuc // CHECK: 4 | char a 71*f4a2713aSLionel Sambuc // CHECK: 9 | struct V (base) (empty) 72*f4a2713aSLionel Sambuc // CHECK: 10 | struct W (base) (empty) 73*f4a2713aSLionel Sambuc // CHECK: 10 | char a 74*f4a2713aSLionel Sambuc // CHECK: 12 | struct V (virtual base) (empty) 75*f4a2713aSLionel Sambuc // CHECK: | [sizeof=12, align=4 76*f4a2713aSLionel Sambuc // CHECK: | nvsize=12, nvalign=4] 77*f4a2713aSLionel Sambuc // CHECK-X64: *** Dumping AST Record Layout 78*f4a2713aSLionel Sambuc // CHECK-X64: 0 | struct C 79*f4a2713aSLionel Sambuc // CHECK-X64: 0 | struct X (base) 80*f4a2713aSLionel Sambuc // CHECK-X64: 0 | (X vbtable pointer) 81*f4a2713aSLionel Sambuc // CHECK-X64: 8 | char a 82*f4a2713aSLionel Sambuc // CHECK-X64: 17 | struct V (base) (empty) 83*f4a2713aSLionel Sambuc // CHECK-X64: 18 | struct W (base) (empty) 84*f4a2713aSLionel Sambuc // CHECK-X64: 18 | char a 85*f4a2713aSLionel Sambuc // CHECK-X64: 24 | struct V (virtual base) (empty) 86*f4a2713aSLionel Sambuc // CHECK-X64: | [sizeof=24, align=8 87*f4a2713aSLionel Sambuc // CHECK-X64: | nvsize=24, nvalign=8] 88*f4a2713aSLionel Sambuc 89*f4a2713aSLionel Sambuc struct D : X, U, V, W { char a; }; 90*f4a2713aSLionel Sambuc 91*f4a2713aSLionel Sambuc // CHECK: *** Dumping AST Record Layout 92*f4a2713aSLionel Sambuc // CHECK: 0 | struct D 93*f4a2713aSLionel Sambuc // CHECK: 0 | struct X (base) 94*f4a2713aSLionel Sambuc // CHECK: 0 | (X vbtable pointer) 95*f4a2713aSLionel Sambuc // CHECK: 4 | char a 96*f4a2713aSLionel Sambuc // CHECK: 8 | struct U (base) 97*f4a2713aSLionel Sambuc // CHECK: 8 | char a 98*f4a2713aSLionel Sambuc // CHECK: 9 | struct V (base) (empty) 99*f4a2713aSLionel Sambuc // CHECK: 10 | struct W (base) (empty) 100*f4a2713aSLionel Sambuc // CHECK: 10 | char a 101*f4a2713aSLionel Sambuc // CHECK: 12 | struct V (virtual base) (empty) 102*f4a2713aSLionel Sambuc // CHECK: | [sizeof=12, align=4 103*f4a2713aSLionel Sambuc // CHECK: | nvsize=12, nvalign=4] 104*f4a2713aSLionel Sambuc // CHECK-X64: *** Dumping AST Record Layout 105*f4a2713aSLionel Sambuc // CHECK-X64: 0 | struct D 106*f4a2713aSLionel Sambuc // CHECK-X64: 0 | struct X (base) 107*f4a2713aSLionel Sambuc // CHECK-X64: 0 | (X vbtable pointer) 108*f4a2713aSLionel Sambuc // CHECK-X64: 8 | char a 109*f4a2713aSLionel Sambuc // CHECK-X64: 16 | struct U (base) 110*f4a2713aSLionel Sambuc // CHECK-X64: 16 | char a 111*f4a2713aSLionel Sambuc // CHECK-X64: 17 | struct V (base) (empty) 112*f4a2713aSLionel Sambuc // CHECK-X64: 18 | struct W (base) (empty) 113*f4a2713aSLionel Sambuc // CHECK-X64: 18 | char a 114*f4a2713aSLionel Sambuc // CHECK-X64: 24 | struct V (virtual base) (empty) 115*f4a2713aSLionel Sambuc // CHECK-X64: | [sizeof=24, align=8 116*f4a2713aSLionel Sambuc // CHECK-X64: | nvsize=24, nvalign=8] 117*f4a2713aSLionel Sambuc 118*f4a2713aSLionel Sambuc struct E : X, U, Y, V, W { char a; }; 119*f4a2713aSLionel Sambuc 120*f4a2713aSLionel Sambuc // CHECK: *** Dumping AST Record Layout 121*f4a2713aSLionel Sambuc // CHECK: 0 | struct E 122*f4a2713aSLionel Sambuc // CHECK: 0 | struct X (base) 123*f4a2713aSLionel Sambuc // CHECK: 0 | (X vbtable pointer) 124*f4a2713aSLionel Sambuc // CHECK: 4 | char a 125*f4a2713aSLionel Sambuc // CHECK: 8 | struct U (base) 126*f4a2713aSLionel Sambuc // CHECK: 8 | char a 127*f4a2713aSLionel Sambuc // CHECK: 12 | struct Y (base) 128*f4a2713aSLionel Sambuc // CHECK: 12 | (Y vbtable pointer) 129*f4a2713aSLionel Sambuc // CHECK: 16 | char a 130*f4a2713aSLionel Sambuc // CHECK: 21 | struct V (base) (empty) 131*f4a2713aSLionel Sambuc // CHECK: 22 | struct W (base) (empty) 132*f4a2713aSLionel Sambuc // CHECK: 22 | char a 133*f4a2713aSLionel Sambuc // CHECK: 24 | struct V (virtual base) (empty) 134*f4a2713aSLionel Sambuc // CHECK: | [sizeof=24, align=4 135*f4a2713aSLionel Sambuc // CHECK: | nvsize=24, nvalign=4] 136*f4a2713aSLionel Sambuc // CHECK-X64: *** Dumping AST Record Layout 137*f4a2713aSLionel Sambuc // CHECK-X64: 0 | struct E 138*f4a2713aSLionel Sambuc // CHECK-X64: 0 | struct X (base) 139*f4a2713aSLionel Sambuc // CHECK-X64: 0 | (X vbtable pointer) 140*f4a2713aSLionel Sambuc // CHECK-X64: 8 | char a 141*f4a2713aSLionel Sambuc // CHECK-X64: 16 | struct U (base) 142*f4a2713aSLionel Sambuc // CHECK-X64: 16 | char a 143*f4a2713aSLionel Sambuc // CHECK-X64: 24 | struct Y (base) 144*f4a2713aSLionel Sambuc // CHECK-X64: 24 | (Y vbtable pointer) 145*f4a2713aSLionel Sambuc // CHECK-X64: 32 | char a 146*f4a2713aSLionel Sambuc // CHECK-X64: 41 | struct V (base) (empty) 147*f4a2713aSLionel Sambuc // CHECK-X64: 42 | struct W (base) (empty) 148*f4a2713aSLionel Sambuc // CHECK-X64: 42 | char a 149*f4a2713aSLionel Sambuc // CHECK-X64: 48 | struct V (virtual base) (empty) 150*f4a2713aSLionel Sambuc // CHECK-X64: | [sizeof=48, align=8 151*f4a2713aSLionel Sambuc // CHECK-X64: | nvsize=48, nvalign=8] 152*f4a2713aSLionel Sambuc 153*f4a2713aSLionel Sambuc struct F : Z, W { char a; }; 154*f4a2713aSLionel Sambuc 155*f4a2713aSLionel Sambuc // CHECK: *** Dumping AST Record Layout 156*f4a2713aSLionel Sambuc // CHECK: 0 | struct F 157*f4a2713aSLionel Sambuc // CHECK: 0 | struct Z (base) 158*f4a2713aSLionel Sambuc // CHECK: 0 | struct Y (base) 159*f4a2713aSLionel Sambuc // CHECK: 0 | (Y vbtable pointer) 160*f4a2713aSLionel Sambuc // CHECK: 4 | char a 161*f4a2713aSLionel Sambuc // CHECK: 9 | struct W (base) (empty) 162*f4a2713aSLionel Sambuc // CHECK: 9 | char a 163*f4a2713aSLionel Sambuc // CHECK: 12 | struct V (virtual base) (empty) 164*f4a2713aSLionel Sambuc // CHECK: | [sizeof=12, align=4 165*f4a2713aSLionel Sambuc // CHECK: | nvsize=12, nvalign=4] 166*f4a2713aSLionel Sambuc // CHECK-X64: *** Dumping AST Record Layout 167*f4a2713aSLionel Sambuc // CHECK-X64: 0 | struct F 168*f4a2713aSLionel Sambuc // CHECK-X64: 0 | struct Z (base) 169*f4a2713aSLionel Sambuc // CHECK-X64: 0 | struct Y (base) 170*f4a2713aSLionel Sambuc // CHECK-X64: 0 | (Y vbtable pointer) 171*f4a2713aSLionel Sambuc // CHECK-X64: 8 | char a 172*f4a2713aSLionel Sambuc // CHECK-X64: 17 | struct W (base) (empty) 173*f4a2713aSLionel Sambuc // CHECK-X64: 17 | char a 174*f4a2713aSLionel Sambuc // CHECK-X64: 24 | struct V (virtual base) (empty) 175*f4a2713aSLionel Sambuc // CHECK-X64: | [sizeof=24, align=8 176*f4a2713aSLionel Sambuc // CHECK-X64: | nvsize=24, nvalign=8] 177*f4a2713aSLionel Sambuc 178*f4a2713aSLionel Sambuc struct G : X, W, Y, V { char a; }; 179*f4a2713aSLionel Sambuc 180*f4a2713aSLionel Sambuc // CHECK: *** Dumping AST Record Layout 181*f4a2713aSLionel Sambuc // CHECK: 0 | struct G 182*f4a2713aSLionel Sambuc // CHECK: 0 | struct X (base) 183*f4a2713aSLionel Sambuc // CHECK: 0 | (X vbtable pointer) 184*f4a2713aSLionel Sambuc // CHECK: 4 | char a 185*f4a2713aSLionel Sambuc // CHECK: 9 | struct W (base) (empty) 186*f4a2713aSLionel Sambuc // CHECK: 12 | struct Y (base) 187*f4a2713aSLionel Sambuc // CHECK: 12 | (Y vbtable pointer) 188*f4a2713aSLionel Sambuc // CHECK: 16 | char a 189*f4a2713aSLionel Sambuc // CHECK: 21 | struct V (base) (empty) 190*f4a2713aSLionel Sambuc // CHECK: 21 | char a 191*f4a2713aSLionel Sambuc // CHECK: 24 | struct V (virtual base) (empty) 192*f4a2713aSLionel Sambuc // CHECK: | [sizeof=24, align=4 193*f4a2713aSLionel Sambuc // CHECK: | nvsize=24, nvalign=4] 194*f4a2713aSLionel Sambuc // CHECK-X64: *** Dumping AST Record Layout 195*f4a2713aSLionel Sambuc // CHECK-X64: 0 | struct G 196*f4a2713aSLionel Sambuc // CHECK-X64: 0 | struct X (base) 197*f4a2713aSLionel Sambuc // CHECK-X64: 0 | (X vbtable pointer) 198*f4a2713aSLionel Sambuc // CHECK-X64: 8 | char a 199*f4a2713aSLionel Sambuc // CHECK-X64: 17 | struct W (base) (empty) 200*f4a2713aSLionel Sambuc // CHECK-X64: 24 | struct Y (base) 201*f4a2713aSLionel Sambuc // CHECK-X64: 24 | (Y vbtable pointer) 202*f4a2713aSLionel Sambuc // CHECK-X64: 32 | char a 203*f4a2713aSLionel Sambuc // CHECK-X64: 41 | struct V (base) (empty) 204*f4a2713aSLionel Sambuc // CHECK-X64: 41 | char a 205*f4a2713aSLionel Sambuc // CHECK-X64: 48 | struct V (virtual base) (empty) 206*f4a2713aSLionel Sambuc // CHECK-X64: | [sizeof=48, align=8 207*f4a2713aSLionel Sambuc // CHECK-X64: | nvsize=48, nvalign=8] 208*f4a2713aSLionel Sambuc 209*f4a2713aSLionel Sambuc int a[ 210*f4a2713aSLionel Sambuc sizeof(A)+ 211*f4a2713aSLionel Sambuc sizeof(B)+ 212*f4a2713aSLionel Sambuc sizeof(C)+ 213*f4a2713aSLionel Sambuc sizeof(D)+ 214*f4a2713aSLionel Sambuc sizeof(E)+ 215*f4a2713aSLionel Sambuc sizeof(F)+ 216*f4a2713aSLionel Sambuc sizeof(G)]; 217