1// RUN: %clang_cc1 -triple x86_64-apple-macosx10.7.0 -emit-llvm -o - %s | FileCheck %s
2
3// PR4610
4#pragma pack(4)
5struct ref {
6        struct ref *next;
7} refs;
8
9// PR13580
10struct S
11{
12  char a[3];
13#pragma pack(1)
14  struct T
15  {
16    char b;
17    int c;
18  } d;
19#pragma pack()
20  struct T2
21  {
22    char b;
23    int c;
24  } d2;
25} ss;
26
27struct S3
28{
29  char a[3];
30#pragma pack(push, 2)
31  struct T3
32  {
33    char b;
34    int c;
35  } d;
36#pragma pack(pop)
37  struct T32
38  {
39    char b;
40    int c;
41  } e;
42} s3;
43
44struct S4
45{
46  char a[3];
47#pragma align=packed
48  struct T4
49  {
50    char b;
51    int c;
52  } d;
53  int e;
54} s4;
55
56// CHECK: [[struct_ref:%[a-zA-Z0-9_.]+]] = type { [[struct_ref]]* }
57// CHECK: [[struct_S:%[a-zA-Z0-9_.]+]] = type { [3 x i8], [[struct_T:%[a-zA-Z0-9_.]+]], [[struct_T2:%[a-zA-Z0-9_.]+]] }
58// CHECK: [[struct_T]] = type <{ i8, i32 }>
59// CHECK: [[struct_T2]] = type { i8, i32 }
60
61// CHECK: %struct.S3 = type { [3 x i8], i8, %struct.T3, %struct.T32 }
62// CHECK: %struct.T3 = type <{ i8, i8, i32 }>
63// CHECK: %struct.T32 = type { i8, i32 }
64// CHECK: %struct.S4 = type { [3 x i8], %struct.T4, i32 }
65// CHECK: %struct.T4 = type <{ i8, i32 }>
66
67// CHECK: @refs = common global [[struct_ref]]
68// CHECK: @ss = common global [[struct_S]]
69