1 // RUN: %clang_cc1 -fno-rtti -emit-llvm-only -triple i686-pc-win32 -fms-extensions -fdump-record-layouts %s 2>/dev/null \
3 // RUN: %clang_cc1 -fno-rtti -emit-llvm-only -triple x86_64-pc-win32 -fms-extensions -fdump-record-layouts %s 2>/dev/null \
16 // CHECK:*** Dumping AST Record Layout
17 // CHECK-NEXT: 0 | struct A
18 // CHECK-NEXT: 0 | char x
19 // CHECK-NEXT: 4:0-21 | int a
20 // CHECK-NEXT: 8:- | int
21 // CHECK-NEXT: 8:0-9 | int c
22 // CHECK-NEXT: 12:0-2 | char b
23 // CHECK-NEXT: 12:3-6 | char d
24 // CHECK-NEXT: 14 | short y
25 // CHECK-NEXT: | [sizeof=16, align=4]
34 // CHECK:*** Dumping AST Record Layout
35 // CHECK-NEXT: 0 | struct B
36 // CHECK-NEXT: 0 | char x
37 // CHECK-NEXT: 1:- | int
38 // CHECK-NEXT: 2:0-3 | short a
39 // CHECK-NEXT: 4 | char y
40 // CHECK-NEXT: | [sizeof=6, align=2]
49 // CHECK:*** Dumping AST Record Layout
50 // CHECK-NEXT: 0 | struct C
51 // CHECK-NEXT: 0 | char x
52 // CHECK-NEXT: 2:0-3 | short a
53 // CHECK-NEXT: 4:- | int
54 // CHECK-NEXT: 4 | char y
55 // CHECK-NEXT: | [sizeof=8, align=4]
64 // CHECK:*** Dumping AST Record Layout
65 // CHECK-NEXT: 0 | struct D
66 // CHECK-NEXT: 0 | char x
67 // CHECK-NEXT: 1:- | short
68 // CHECK-NEXT: 1:- | int
69 // CHECK-NEXT: 1 | char y
70 // CHECK-NEXT: | [sizeof=2, align=1]
81 // CHECK:*** Dumping AST Record Layout
82 // CHECK-NEXT: 0 | union E
83 // CHECK-NEXT: 0 | char x
84 // CHECK-NEXT: 0:0-2 | long long a
85 // CHECK-NEXT: 0:0-2 | int b
86 // CHECK-NEXT: 0:- | long long
87 // CHECK-NEXT: 0 | short
88 // CHECK-NEXT: | [sizeof=8, align=2]
104 // CHECK:*** Dumping AST Record Layout
105 // CHECK-NEXT: 0 | struct F
106 // CHECK-NEXT: 0 | char x
107 // CHECK-NEXT: 1:0-2 | char a
108 // CHECK-NEXT: 1:3-5 | char b
109 // CHECK-NEXT: 2:0-2 | char c
110 // CHECK-NEXT: 4:0-5 | short d
111 // CHECK-NEXT: 4:6-11 | short e
112 // CHECK-NEXT: 6:0-5 | short f
113 // CHECK-NEXT: 8:0-10 | short g
114 // CHECK-NEXT:10:0-10 | short h
115 // CHECK-NEXT:12:0-10 | short i
116 // CHECK-NEXT: 14 | short y
117 // CHECK-NEXT: | [sizeof=16, align=2]
127 // CHECK:*** Dumping AST Record Layout
128 // CHECK-NEXT: 0 | union G
129 // CHECK-NEXT: 0 | char x
130 // CHECK-NEXT: 0:0-2 | int a
131 // CHECK-NEXT: 0:- | int
132 // CHECK-NEXT: 0:- | long long
133 // CHECK-NEXT: 0 | short y
134 // CHECK-NEXT: | [sizeof=4, align=2]
137 unsigned short a
: 1;
140 unsigned short c
: 1;
143 // CHECK:*** Dumping AST Record Layout
144 // CHECK-NEXT: 0 | struct H
145 // CHECK-NEXT: 0:0-0 | unsigned short a
146 // CHECK-NEXT: 2:- | unsigned char
147 // CHECK-NEXT: 2:- | unsigned long
148 // CHECK-NEXT: 2:0-0 | unsigned short c
149 // CHECK-NEXT: | [sizeof=4, align=2]
153 __declspec(align(16)) short : 8;
157 // CHECK:*** Dumping AST Record Layout
158 // CHECK-NEXT: 0 | struct I
159 // CHECK-NEXT: 0:0-7 | short
160 // CHECK-NEXT: 1:0-7 | short
161 // CHECK-NEXT: | [sizeof=2, align=2]
163 #pragma pack(push, 1)
175 // CHECK:*** Dumping AST Record Layout
176 // CHECK-NEXT: 0 | struct A1
177 // CHECK-NEXT: 0 | char x
178 // CHECK-NEXT: 1:0-21 | int a
179 // CHECK-NEXT: 5:- | int
180 // CHECK-NEXT: 5:0-9 | int c
181 // CHECK-NEXT: 9:0-2 | char b
182 // CHECK-NEXT: 9:3-6 | char d
183 // CHECK-NEXT: 10 | short y
184 // CHECK-NEXT: | [sizeof=12, align=1]
193 // CHECK:*** Dumping AST Record Layout
194 // CHECK-NEXT: 0 | struct B1
195 // CHECK-NEXT: 0 | char x
196 // CHECK-NEXT: 1:- | int
197 // CHECK-NEXT: 1:0-3 | short
198 // CHECK-NEXT: 3 | char y
199 // CHECK-NEXT: | [sizeof=4, align=1]
208 // CHECK:*** Dumping AST Record Layout
209 // CHECK-NEXT: 0 | struct C1
210 // CHECK-NEXT: 0 | char x
211 // CHECK-NEXT: 1:0-3 | short
212 // CHECK-NEXT: 3:- | int
213 // CHECK-NEXT: 3 | char y
214 // CHECK-NEXT: | [sizeof=4, align=1]
223 // CHECK:*** Dumping AST Record Layout
224 // CHECK-NEXT: 0 | struct D1
225 // CHECK-NEXT: 0 | char x
226 // CHECK-NEXT: 1:- | short
227 // CHECK-NEXT: 1:- | int
228 // CHECK-NEXT: 1 | char y
229 // CHECK-NEXT: | [sizeof=2, align=1]
239 // CHECK:*** Dumping AST Record Layout
240 // CHECK-NEXT: 0 | union E1
241 // CHECK-NEXT: 0 | char x
242 // CHECK-NEXT: 0:0-2 | long long a
243 // CHECK-NEXT: 0:0-2 | int b
244 // CHECK-NEXT: 0:- | long long
245 // CHECK-NEXT: 0 | short y
246 // CHECK-NEXT: | [sizeof=8, align=1]
262 // CHECK:*** Dumping AST Record Layout
263 // CHECK-NEXT: 0 | struct F1
264 // CHECK-NEXT: 0 | char x
265 // CHECK-NEXT: 1:0-2 | char a
266 // CHECK-NEXT: 1:3-5 | char b
267 // CHECK-NEXT: 2:0-2 | char c
268 // CHECK-NEXT: 3:0-5 | short d
269 // CHECK-NEXT: 3:6-11 | short e
270 // CHECK-NEXT: 5:0-5 | short f
271 // CHECK-NEXT: 7:0-10 | short g
272 // CHECK-NEXT: 9:0-10 | short h
273 // CHECK-NEXT:11:0-10 | short i
274 // CHECK-NEXT: 13 | short y
275 // CHECK-NEXT: | [sizeof=15, align=1]
285 // CHECK:*** Dumping AST Record Layout
286 // CHECK-NEXT: 0 | union G1
287 // CHECK-NEXT: 0 | char x
288 // CHECK-NEXT: 0:0-2 | int a
289 // CHECK-NEXT: 0:- | int
290 // CHECK-NEXT: 0:- | long long
291 // CHECK-NEXT: 0 | short y
292 // CHECK-NEXT: | [sizeof=4, align=1]
301 // CHECK:*** Dumping AST Record Layout
302 // CHECK-NEXT: 0 | struct H1
303 // CHECK-NEXT: 0:0-0 | unsigned long a
304 // CHECK-NEXT: 4:- | unsigned char
305 // CHECK-NEXT: 4:- | unsigned long
306 // CHECK-NEXT: 4:0-0 | unsigned long c
307 // CHECK-NEXT: | [sizeof=8, align=1]
311 __declspec(align(16)) short : 8;
314 // CHECK:*** Dumping AST Record Layout
315 // CHECK-NEXT: 0 | struct I1
316 // CHECK-NEXT: 0:0-7 | short
317 // CHECK-NEXT: 1:0-7 | short
318 // CHECK-NEXT: | [sizeof=2, align=1]