Clang Project

clang_source_code/test/CodeGen/tentative-decls.c
1// RUN: %clang_cc1 -emit-llvm -w -o - %s | FileCheck %s
2
3// CHECK-DAG: @r = common {{(dso_local )?}}global [1 x {{.*}}] zeroinitializer
4
5int r[];
6int (*a)[] = &r;
7
8struct s0;
9struct s0 x;
10// CHECK-DAG: @x = common {{(dso_local )?}}global %struct.s0 zeroinitializer
11
12struct s0 y;
13// CHECK-DAG: @y = common {{(dso_local )?}}global %struct.s0 zeroinitializer
14struct s0 *f0() {
15  return &y;
16}
17
18struct s0 {
19  int x;
20};
21
22// CHECK-DAG: @b = common {{(dso_local )?}}global [1 x {{.*}}] zeroinitializer
23int b[];
24int *f1() {
25  return b;
26}
27
28// Check that the most recent tentative definition wins.
29// CHECK-DAG: @c = common {{(dso_local )?}}global [4 x {{.*}}] zeroinitializer
30int c[];
31int c[4];
32
33// Check that we emit static tentative definitions
34// CHECK-DAG: @c5 = internal global [1 x {{.*}}] zeroinitializer
35static int c5[];
36static int func() { return c5[0]; }
37int callfunc() { return func(); }
38
39