1 // RUN: %clang_cc1 -fno-rtti -emit-llvm-only -triple i686-pc-win32 -fms-extensions -fdump-record-layouts -fsyntax-only %s 2>/dev/null \
2 // RUN: | FileCheck %s --strict-whitespace
3 // RUN: %clang_cc1 -fno-rtti -emit-llvm-only -triple x86_64-pc-win32 -fms-extensions -fdump-record-layouts -fsyntax-only %s 2>/dev/null \
4 // RUN: | FileCheck %s --strict-whitespace
6 extern "C" int printf(const char *fmt
, ...);
8 struct __declspec(align(8)) B0
{ B0() {printf("B0 : %p\n", this);} };
9 struct __declspec(align(8)) B1
{ B1() {printf("B1 : %p\n", this);} };
10 struct __declspec(align(8)) B2
{ B2() {printf("B2 : %p\n", this);} };
11 struct __declspec(align(8)) B3
{ B3() {printf("B3 : %p\n", this);} };
12 struct __declspec(align(8)) B4
{ B4() {printf("B4 : %p\n", this);} };
14 struct C0
{ int a
; C0() : a(0xf00000C0) {printf("C0 : %p\n", this);} };
15 struct C1
{ int a
; C1() : a(0xf00000C1) {printf("C1 : %p\n", this);} };
16 struct C2
{ int a
; C2() : a(0xf00000C2) {printf("C2 : %p\n", this);} };
17 struct C3
{ int a
; C3() : a(0xf00000C3) {printf("C3 : %p\n", this);} };
18 struct C4
{ int a
; C4() : a(0xf00000C4) {printf("C4 : %p\n", this);} };
22 A() : a(0xf000000A) {printf("X : %p\n", this);}
25 // CHECK-LABEL: 0 | struct A{{$}}
26 // CHECK-NEXT: 0 | struct B0 (base) (empty)
27 // CHECK-NEXT: 0 | int a
28 // CHECK-NEXT: | [sizeof=8, align=8
29 // CHECK-NEXT: | nvsize=8, nvalign=8]
34 B() : a(0xf000000B) {printf("X : %p\n", this);}
37 // CHECK-LABEL: 0 | struct B{{$}}
38 // CHECK-NEXT: 0 | struct B0 (base) (empty)
39 // CHECK-NEXT: 0 | struct B0 b0 (empty)
41 // CHECK-NEXT: | [sizeof=16, align=8
42 // CHECK-NEXT: | nvsize=16, nvalign=8]
44 struct C
: B0
, B1
, B2
, B3
, B4
{
46 C() : a(0xf000000C) {printf("X : %p\n", this);}
49 // CHECK-LABEL: 0 | struct C{{$}}
50 // CHECK-NEXT: 0 | struct B0 (base) (empty)
51 // CHECK-NEXT: 8 | struct B1 (base) (empty)
52 // CHECK-NEXT: 16 | struct B2 (base) (empty)
53 // CHECK-NEXT: 24 | struct B3 (base) (empty)
54 // CHECK-NEXT: 32 | struct B4 (base) (empty)
55 // CHECK-NEXT: 32 | int a
56 // CHECK-NEXT: | [sizeof=40, align=8
57 // CHECK-NEXT: | nvsize=40, nvalign=8]
66 D() : a(0xf000000D) {printf("X : %p\n", this);}
69 // CHECK-LABEL: 0 | struct D{{$}}
70 // CHECK-NEXT: 0 | struct B0 b0 (empty)
71 // CHECK: 8 | struct C0 c0
72 // CHECK-NEXT: 8 | int a
73 // CHECK: 12 | struct C1 c1
74 // CHECK-NEXT: 12 | int a
75 // CHECK: 16 | struct C2 c2
76 // CHECK-NEXT: 16 | int a
77 // CHECK: 24 | struct B1 b1 (empty)
79 // CHECK-NEXT: | [sizeof=40, align=8
80 // CHECK-NEXT: | nvsize=40, nvalign=8]
82 struct E
: B0
, C0
, C1
, C2
, B1
{
84 E() : a(0xf000000E) {printf("X : %p\n", this);}
87 // CHECK-LABEL: 0 | struct E{{$}}
88 // CHECK-NEXT: 0 | struct B0 (base) (empty)
89 // CHECK-NEXT: 0 | struct C0 (base)
90 // CHECK-NEXT: 0 | int a
91 // CHECK-NEXT: 4 | struct C1 (base)
92 // CHECK-NEXT: 4 | int a
93 // CHECK-NEXT: 8 | struct C2 (base)
94 // CHECK-NEXT: 8 | int a
95 // CHECK-NEXT: 16 | struct B1 (base) (empty)
96 // CHECK-NEXT: 16 | int a
97 // CHECK-NEXT: | [sizeof=24, align=8
98 // CHECK-NEXT: | nvsize=24, nvalign=8]
100 struct F
: C0
, B0
, B1
, C1
{
102 F() : a(0xf000000F) {printf("X : %p\n", this);}
105 // CHECK-LABEL: 0 | struct F{{$}}
106 // CHECK-NEXT: 0 | struct C0 (base)
107 // CHECK-NEXT: 0 | int a
108 // CHECK-NEXT: 8 | struct B0 (base) (empty)
109 // CHECK-NEXT: 16 | struct B1 (base) (empty)
110 // CHECK-NEXT: 16 | struct C1 (base)
111 // CHECK-NEXT: 16 | int a
112 // CHECK-NEXT: 20 | int a
113 // CHECK-NEXT: | [sizeof=24, align=8
114 // CHECK-NEXT: | nvsize=24, nvalign=8]
116 struct G
: B0
, B1
, B2
, B3
, B4
{
117 __declspec(align(32)) int a
;
118 G() : a(0xf0000011) {printf("X : %p\n", this);}
121 // CHECK-LABEL: 0 | struct G{{$}}
122 // CHECK-NEXT: 0 | struct B0 (base) (empty)
123 // CHECK-NEXT: 8 | struct B1 (base) (empty)
124 // CHECK-NEXT: 16 | struct B2 (base) (empty)
125 // CHECK-NEXT: 24 | struct B3 (base) (empty)
126 // CHECK-NEXT: 32 | struct B4 (base) (empty)
127 // CHECK-NEXT: 32 | int a
128 // CHECK-NEXT: | [sizeof=64, align=32
129 // CHECK-NEXT: | nvsize=64, nvalign=32]
131 struct __declspec(align(32)) H
: B0
, B1
, B2
, B3
, B4
{
133 H() : a(0xf0000011) {printf("X : %p\n", this);}
136 // CHECK-LABEL: 0 | struct H{{$}}
137 // CHECK-NEXT: 0 | struct B0 (base) (empty)
138 // CHECK-NEXT: 8 | struct B1 (base) (empty)
139 // CHECK-NEXT: 16 | struct B2 (base) (empty)
140 // CHECK-NEXT: 24 | struct B3 (base) (empty)
141 // CHECK-NEXT: 32 | struct B4 (base) (empty)
142 // CHECK-NEXT: 32 | int a
143 // CHECK-NEXT: | [sizeof=64, align=32
144 // CHECK-NEXT: | nvsize=40, nvalign=32]
150 // CHECK-LABEL: 0 | struct I{{$}}
151 // CHECK-NEXT: 0 | int[0] i0
152 // CHECK-NEXT: | [sizeof={{1|4}}, align=4,
153 // CHECK-NEXT: | nvsize=0, nvalign=4]
159 // CHECK-LABEL: 0 | struct J{{$}}
160 // CHECK-NEXT: 0 | struct I (base)
161 // CHECK-NEXT: 0 | int[0] i0
162 // CHECK-NEXT: 0 | int j
163 // CHECK-NEXT: | [sizeof=4, align=4,
164 // CHECK-NEXT: | nvsize=4, nvalign=4]