freebsd-dev/test/CodeGen/tentative-decls.c

39 lines
804 B
C
Raw Normal View History

2010-01-01 10:34:51 +00:00
// RUN: %clang_cc1 -emit-llvm -o %t %s
2009-06-02 17:58:47 +00:00
2009-11-18 14:59:57 +00:00
// RUN: grep '@r = common global \[1 x .*\] zeroinitializer' %t
2009-06-02 17:58:47 +00:00
int r[];
int (*a)[] = &r;
struct s0;
struct s0 x;
2009-11-18 14:59:57 +00:00
// RUN: grep '@x = common global .struct.s0 zeroinitializer' %t
2009-06-02 17:58:47 +00:00
struct s0 y;
2009-11-18 14:59:57 +00:00
// RUN: grep '@y = common global .struct.s0 zeroinitializer' %t
2009-06-02 17:58:47 +00:00
struct s0 *f0() {
return &y;
}
struct s0 {
int x;
};
2009-11-18 14:59:57 +00:00
// RUN: grep '@b = common global \[1 x .*\] zeroinitializer' %t
2009-06-02 17:58:47 +00:00
int b[];
int *f1() {
return b;
}
// Check that the most recent tentative definition wins.
2009-11-18 14:59:57 +00:00
// RUN: grep '@c = common global \[4 x .*\] zeroinitializer' %t
2009-06-02 17:58:47 +00:00
int c[];
int c[4];
// Check that we emit static tentative definitions
2009-11-18 14:59:57 +00:00
// RUN: grep '@c5 = internal global \[1 x .*\] zeroinitializer' %t
2009-06-02 17:58:47 +00:00
static int c5[];
static int func() { return c5[0]; }
int callfunc() { return func(); }