1 // RUN: %clang_cc1 %s -emit-llvm -o /dev/null -triple=i686-apple-darwin9 -fdump-record-layouts-simple | FileCheck %s
3 // Test struct layout for x86-darwin target
5 struct STest1
{int x
; short y
[4]; double z
; } st1
;
6 struct STest2
{short a
,b
; int c
,d
; } st2
;
7 struct STest3
{char a
; short b
; int c
; } st3
;
10 struct STestB1
{char a
; char b
:2; } stb1
;
11 struct STestB2
{char a
; char b
:5; char c
:4; } stb2
;
12 struct STestB3
{char a
; char b
:2; } stb3
;
13 struct STestB4
{char a
; short b
:2; char c
; } stb4
;
14 struct STestB5
{char a
; short b
:10; char c
; } stb5
;
15 struct STestB6
{int a
:1; char b
; int c
:13; } stb6
;
17 // Packed struct STestP1 {char a; short b; int c; } __attribute__((__packed__)) stp1;
19 // CHECK-LABEL: LLVMType:%struct.STest1 =
20 // CHECK-SAME: type { i32, [4 x i16], double }
24 // CHECK-LABEL: LLVMType:%struct.STest2 =
25 // CHECK-SAME: type { i16, i16, i32, i32 }
29 // CHECK-LABEL: LLVMType:%struct.STest3 =
30 // CHECK-SAME: type { i8, i16, i32 }
34 // CHECK-LABEL: LLVMType:%struct.STestB1 =
35 // CHECK-SAME: type { i8, i8 }
37 // CHECK-NEXT: <CGBitFieldInfo Offset:0 Size:2 IsSigned:1 StorageSize:8 StorageOffset:1
40 // CHECK-LABEL: LLVMType:%struct.STestB2 =
41 // CHECK-SAME: type <{ i8, i16 }>
43 // CHECK-NEXT: <CGBitFieldInfo Offset:0 Size:5 IsSigned:1 StorageSize:16 StorageOffset:1
44 // CHECK-NEXT: <CGBitFieldInfo Offset:8 Size:4 IsSigned:1 StorageSize:16 StorageOffset:1
47 // CHECK-LABEL: LLVMType:%struct.STestB3 =
48 // CHECK-SAME: type { i8, i8 }
50 // CHECK-NEXT: <CGBitFieldInfo Offset:0 Size:2 IsSigned:1 StorageSize:8 StorageOffset:1
53 // CHECK-LABEL: LLVMType:%struct.STestB4 =
54 // CHECK-SAME: type { i8, i8, i8, i8 }
56 // CHECK-NEXT: <CGBitFieldInfo Offset:0 Size:2 IsSigned:1 StorageSize:8 StorageOffset:1
59 // CHECK-LABEL: LLVMType:%struct.STestB5 =
60 // CHECK-SAME: type { i8, i16, i8 }
62 // CHECK-NEXT: <CGBitFieldInfo Offset:0 Size:10 IsSigned:1 StorageSize:16 StorageOffset:2
65 // CHECK-LABEL: LLVMType:%struct.STestB6 =
66 // CHECK-SAME: type { i8, i8, i16 }
68 // CHECK-NEXT: <CGBitFieldInfo Offset:0 Size:1 IsSigned:1 StorageSize:8 StorageOffset:0
69 // CHECK-NEXT: <CGBitFieldInfo Offset:0 Size:13 IsSigned:1 StorageSize:16 StorageOffset:2