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