blob: 3301c234c55aed12298e5a9eb61a71480f1b7e81 [file] [log] [blame]
Daniel Dunbar03f5ad92009-04-15 22:08:45 +00001// RUN: clang-cc -emit-llvm -o %t %s &&
2
3// RUN: grep '@r = common global \[1 x .*\] zeroinitializer' %t &&
4
5int r[];
6int (*a)[] = &r;
7
8struct s0;
9struct s0 x;
10// RUN: grep '@x = common global .struct.s0 zeroinitializer' %t &&
11
12struct s0 y;
13// RUN: grep '@y = common global .struct.s0 zeroinitializer' %t &&
14struct s0 *f0() {
15 return &y;
16}
17
18struct s0 {
19 int x;
20};
21
22// RUN: grep '@b = common global \[1 x .*\] zeroinitializer' %t &&
23int b[];
24int *f1() {
25 return b;
26}
27
Daniel Dunbar6463ef42009-04-16 15:34:14 +000028// Check that the most recent tentative definition wins.
29// RUN: grep '@c = common global \[4 x .*\] zeroinitializer' %t &&
30int c[];
31int c[4];
32
Douglas Gregorebe94112009-05-01 15:45:53 +000033// Check that we emit static tentative definitions
34// RUN: grep '@c5 = internal global \[1 x .*\] zeroinitializer' %t &&
35static int c5[];
36static int func() { return c5[0]; }
37int callfunc() { return func(); }
38
Daniel Dunbar03f5ad92009-04-15 22:08:45 +000039// RUN: true