1// Test with pch.
2// RUN: %clang_cc1 -triple x86_64-apple-darwin9 -emit-pch -o %t1.pch %S/Inputs/chain-external-defs1.h
3// RUN: %clang_cc1 -triple x86_64-apple-darwin9 -emit-pch -o %t2.pch %S/Inputs/chain-external-defs2.h -include-pch %t1.pch
4// RUN: %clang_cc1 -triple x86_64-apple-darwin9 -include-pch %t2.pch -emit-llvm -o %t %s
5// RUN: echo FINI >> %t
6// RUN: FileCheck -input-file=%t -check-prefix=Z %s
7// RUN: FileCheck -input-file=%t -check-prefix=XA %s
8// RUN: FileCheck -input-file=%t -check-prefix=YA %s
9// RUN: FileCheck -input-file=%t -check-prefix=XB %s
10// RUN: FileCheck -input-file=%t -check-prefix=YB %s
11// RUN: FileCheck -input-file=%t -check-prefix=AA %s
12// RUN: FileCheck -input-file=%t -check-prefix=AB %s
13// RUN: FileCheck -input-file=%t -check-prefix=AC %s
14// RUN: FileCheck -input-file=%t -check-prefix=S %s
15
16// Z-NOT: @z
17
18// XA: @x = common global i32 0
19// XA-NOT: @x = common global i32 0
20
21// YA: @y = common global i32 0
22// YA-NOT: @y = common global i32 0
23
24// XB: @x2 = global i32 19
25// XB-NOT: @x2 = global i32 19
26int x2 = 19;
27// YB: @y2 = global i32 18
28// YB-NOT: @y2 = global i32 18
29int y2 = 18;
30
31// AA: @incomplete_array = common global [1 x i32]
32// AA-NOT: @incomplete_array = common global [1 x i32]
33// AB: @incomplete_array2 = common global [17 x i32]
34// AB-NOT: @incomplete_array2 = common global [17 x i32]
35int incomplete_array2[17];
36// AC: @incomplete_array3 = common global [1 x i32]
37// AC-NOT: @incomplete_array3 = common global [1 x i32]
38int incomplete_array3[];
39
40// S: @s = common global %struct.S
41// S-NOT: @s = common global %struct.S
42struct S {
43  int x, y;
44};
45
46// Z: FINI
47// XA: FINI
48// YA: FINI
49// XB: FINI
50// YB: FINI
51// AA: FINI
52// AB: FINI
53// AC: FINI
54// S: FINI
55