1 // RUN: %clang_cc1 -emit-llvm -o - -triple x86_64-apple-darwin9 %s | FileCheck %s
2 // RUN: %clang_cc1 -emit-llvm -o - -triple thumbv7-apple-ios -target-abi apcs-gnu %s | FileCheck %s -check-prefix=CHECK-ARM
6 // Note that we're declaring global variables with these types,
7 // triggering both Sema and IRGen struct layout.
9 #define ATTR __attribute__((__ms_struct__))
18 // CHECK: @s1 ={{.*}} global i32 2
19 // CHECK-ARM: @s1 ={{.*}} global i32 2
30 // CHECK: @s2 ={{.*}} global i32 2
31 // CHECK-ARM: @s2 ={{.*}} global i32 2
44 // CHECK: @s3 ={{.*}} global i32 2
45 // CHECK-ARM: @s3 ={{.*}} global i32 2
53 // CHECK: @s4 ={{.*}} global i32 1
54 // CHECK-ARM: @s4 ={{.*}} global i32 1
64 // CHECK: @s5 ={{.*}} global i32 1
65 // CHECK-ARM: @s5 ={{.*}} global i32 1
75 // CHECK: @s6 ={{.*}} global i32 1
76 // CHECK-ARM: @s6 ={{.*}} global i32 1
96 // CHECK: @s7 ={{.*}} global i32 9
97 // CHECK-ARM: @s7 ={{.*}} global i32 9
106 // CHECK: @s8 ={{.*}} global i32 0
107 // CHECK-ARM: @s8 ={{.*}} global i32 0
139 // CHECK: @s9 ={{.*}} global i32 28
140 // CHECK-ARM: @s9 ={{.*}} global i32 28
148 int s10
= sizeof(t10
);
149 // CHECK: @s10 ={{.*}} global i32 16
150 // CHECK-ARM: @s10 ={{.*}} global i32 8
152 // rdar://16041826 - ensure that ms_structs work correctly on a
153 // !useBitFieldTypeAlignment() target
159 int s11
= sizeof(t11
);
160 // CHECK: @s11 ={{.*}} global i32 12
161 // CHECK-ARM: @s11 ={{.*}} global i32 12
166 unsigned short c
: 6;
168 int s12
= sizeof(t12
);
169 // CHECK: @s12 ={{.*}} global i32 4
170 // CHECK-ARM: @s12 ={{.*}} global i32 4
175 __attribute__((packed
)) unsigned short c
: 6;
177 int s13
= sizeof(t13
);
178 // CHECK: @s13 ={{.*}} global i32 4
179 // CHECK-ARM: @s13 ={{.*}} global i32 4