2018-02-24 02:18:01 +08:00
|
|
|
// RUN: %clang_cc1 -emit-llvm -w -o - %s | FileCheck %s
|
2009-04-16 06:08:45 +08:00
|
|
|
|
2020-03-09 18:37:28 +08:00
|
|
|
// CHECK-DAG: @r = common {{(dso_local )?}}global [1 x {{.*}}] zeroinitializer
|
2009-04-16 06:08:45 +08:00
|
|
|
|
|
|
|
int r[];
|
|
|
|
int (*a)[] = &r;
|
|
|
|
|
|
|
|
struct s0;
|
|
|
|
struct s0 x;
|
2020-03-09 18:37:28 +08:00
|
|
|
// CHECK-DAG: @x = common {{(dso_local )?}}global %struct.s0 zeroinitializer
|
2009-04-16 06:08:45 +08:00
|
|
|
|
|
|
|
struct s0 y;
|
2020-03-09 18:37:28 +08:00
|
|
|
// CHECK-DAG: @y = common {{(dso_local )?}}global %struct.s0 zeroinitializer
|
2009-04-16 06:08:45 +08:00
|
|
|
struct s0 *f0() {
|
|
|
|
return &y;
|
|
|
|
}
|
|
|
|
|
|
|
|
struct s0 {
|
|
|
|
int x;
|
|
|
|
};
|
|
|
|
|
2020-03-09 18:37:28 +08:00
|
|
|
// CHECK-DAG: @b = common {{(dso_local )?}}global [1 x {{.*}}] zeroinitializer
|
2009-04-16 06:08:45 +08:00
|
|
|
int b[];
|
|
|
|
int *f1() {
|
|
|
|
return b;
|
|
|
|
}
|
|
|
|
|
2009-04-16 23:34:14 +08:00
|
|
|
// Check that the most recent tentative definition wins.
|
2020-03-09 18:37:28 +08:00
|
|
|
// CHECK-DAG: @c = common {{(dso_local )?}}global [4 x {{.*}}] zeroinitializer
|
2009-04-16 23:34:14 +08:00
|
|
|
int c[];
|
|
|
|
int c[4];
|
|
|
|
|
2009-05-01 23:45:53 +08:00
|
|
|
// Check that we emit static tentative definitions
|
2018-02-24 02:18:01 +08:00
|
|
|
// CHECK-DAG: @c5 = internal global [1 x {{.*}}] zeroinitializer
|
2009-05-01 23:45:53 +08:00
|
|
|
static int c5[];
|
|
|
|
static int func() { return c5[0]; }
|
|
|
|
int callfunc() { return func(); }
|
|
|
|
|