1*f4a2713aSLionel Sambuc // RUN: %clang_cc1 -fno-rtti -emit-llvm-only -triple i686-pc-win32 -fdump-record-layouts -fsyntax-only -cxx-abi microsoft %s 2>&1 \ 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 -fsyntax-only -cxx-abi microsoft %s 2>/dev/null \ 4*f4a2713aSLionel Sambuc // RUN: | FileCheck %s -check-prefix CHECK-X64 5*f4a2713aSLionel Sambuc 6*f4a2713aSLionel Sambuc struct B0 { }; 7*f4a2713aSLionel Sambuc 8*f4a2713aSLionel Sambuc struct A : virtual B0 { char a : 1; }; 9*f4a2713aSLionel Sambuc 10*f4a2713aSLionel Sambuc // CHECK: *** Dumping AST Record Layout 11*f4a2713aSLionel Sambuc // CHECK: 0 | struct A 12*f4a2713aSLionel Sambuc // CHECK: 0 | (A vbtable pointer) 13*f4a2713aSLionel Sambuc // CHECK: 4 | char a 14*f4a2713aSLionel Sambuc // CHECK: 9 | struct B0 (virtual base) (empty) 15*f4a2713aSLionel Sambuc // CHECK: | [sizeof=9, align=4 16*f4a2713aSLionel Sambuc // CHECK: | nvsize=8, nvalign=4] 17*f4a2713aSLionel Sambuc // CHECK-X64: *** Dumping AST Record Layout 18*f4a2713aSLionel Sambuc // CHECK-X64: 0 | struct A 19*f4a2713aSLionel Sambuc // CHECK-X64: 0 | (A vbtable pointer) 20*f4a2713aSLionel Sambuc // CHECK-X64: 8 | char a 21*f4a2713aSLionel Sambuc // CHECK-X64: 17 | struct B0 (virtual base) (empty) 22*f4a2713aSLionel Sambuc // CHECK-X64: | [sizeof=24, align=8 23*f4a2713aSLionel Sambuc // CHECK-X64: | nvsize=16, nvalign=8] 24*f4a2713aSLionel Sambuc 25*f4a2713aSLionel Sambuc struct B : virtual B0 { short a : 1; }; 26*f4a2713aSLionel Sambuc 27*f4a2713aSLionel Sambuc // CHECK: *** Dumping AST Record Layout 28*f4a2713aSLionel Sambuc // CHECK: 0 | struct B 29*f4a2713aSLionel Sambuc // CHECK: 0 | (B vbtable pointer) 30*f4a2713aSLionel Sambuc // CHECK: 4 | short a 31*f4a2713aSLionel Sambuc // CHECK: 10 | struct B0 (virtual base) (empty) 32*f4a2713aSLionel Sambuc // CHECK: | [sizeof=10, align=4 33*f4a2713aSLionel Sambuc // CHECK: | nvsize=8, nvalign=4] 34*f4a2713aSLionel Sambuc // CHECK-X64: *** Dumping AST Record Layout 35*f4a2713aSLionel Sambuc // CHECK-X64: 0 | struct B 36*f4a2713aSLionel Sambuc // CHECK-X64: 0 | (B vbtable pointer) 37*f4a2713aSLionel Sambuc // CHECK-X64: 8 | short a 38*f4a2713aSLionel Sambuc // CHECK-X64: 18 | struct B0 (virtual base) (empty) 39*f4a2713aSLionel Sambuc // CHECK-X64: | [sizeof=24, align=8 40*f4a2713aSLionel Sambuc // CHECK-X64: | nvsize=16, nvalign=8] 41*f4a2713aSLionel Sambuc 42*f4a2713aSLionel Sambuc struct C : virtual B0 { char a : 1; char : 0; }; 43*f4a2713aSLionel Sambuc 44*f4a2713aSLionel Sambuc // CHECK: *** Dumping AST Record Layout 45*f4a2713aSLionel Sambuc // CHECK: 0 | struct C 46*f4a2713aSLionel Sambuc // CHECK: 0 | (C vbtable pointer) 47*f4a2713aSLionel Sambuc // CHECK: 4 | char a 48*f4a2713aSLionel Sambuc // CHECK: 5 | char 49*f4a2713aSLionel Sambuc // CHECK: 8 | struct B0 (virtual base) (empty) 50*f4a2713aSLionel Sambuc // CHECK: | [sizeof=8, align=4 51*f4a2713aSLionel Sambuc // CHECK: | nvsize=8, nvalign=4] 52*f4a2713aSLionel Sambuc // CHECK-X64: *** Dumping AST Record Layout 53*f4a2713aSLionel Sambuc // CHECK-X64: 0 | struct C 54*f4a2713aSLionel Sambuc // CHECK-X64: 0 | (C vbtable pointer) 55*f4a2713aSLionel Sambuc // CHECK-X64: 8 | char a 56*f4a2713aSLionel Sambuc // CHECK-X64: 9 | char 57*f4a2713aSLionel Sambuc // CHECK-X64: 16 | struct B0 (virtual base) (empty) 58*f4a2713aSLionel Sambuc // CHECK-X64: | [sizeof=16, align=8 59*f4a2713aSLionel Sambuc // CHECK-X64: | nvsize=16, nvalign=8] 60*f4a2713aSLionel Sambuc 61*f4a2713aSLionel Sambuc struct D : virtual B0 { char a : 1; char b; }; 62*f4a2713aSLionel Sambuc 63*f4a2713aSLionel Sambuc // CHECK: *** Dumping AST Record Layout 64*f4a2713aSLionel Sambuc // CHECK: 0 | struct D 65*f4a2713aSLionel Sambuc // CHECK: 0 | (D vbtable pointer) 66*f4a2713aSLionel Sambuc // CHECK: 4 | char a 67*f4a2713aSLionel Sambuc // CHECK: 5 | char b 68*f4a2713aSLionel Sambuc // CHECK: 8 | struct B0 (virtual base) (empty) 69*f4a2713aSLionel Sambuc // CHECK: | [sizeof=8, align=4 70*f4a2713aSLionel Sambuc // CHECK: | nvsize=8, nvalign=4] 71*f4a2713aSLionel Sambuc // CHECK-X64: *** Dumping AST Record Layout 72*f4a2713aSLionel Sambuc // CHECK-X64: 0 | struct D 73*f4a2713aSLionel Sambuc // CHECK-X64: 0 | (D vbtable pointer) 74*f4a2713aSLionel Sambuc // CHECK-X64: 8 | char a 75*f4a2713aSLionel Sambuc // CHECK-X64: 9 | char b 76*f4a2713aSLionel Sambuc // CHECK-X64: 16 | struct B0 (virtual base) (empty) 77*f4a2713aSLionel Sambuc // CHECK-X64: | [sizeof=16, align=8 78*f4a2713aSLionel Sambuc // CHECK-X64: | nvsize=16, nvalign=8] 79*f4a2713aSLionel Sambuc 80*f4a2713aSLionel Sambuc int a[ 81*f4a2713aSLionel Sambuc sizeof(A)+ 82*f4a2713aSLionel Sambuc sizeof(B)+ 83*f4a2713aSLionel Sambuc sizeof(C)+ 84*f4a2713aSLionel Sambuc sizeof(D)]; 85