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