Home | History | Annotate | Download | only in CodeGenCXX
      1 // RUN: %clang_cc1 -emit-llvm -o - %s | FileCheck %s
      2 
      3 struct Global { Global(); };
      4 template<typename T> struct X { X() {} };
      5 
      6 
      7 namespace {
      8   struct Anon { Anon() {} };
      9 
     10   // CHECK: @_ZN12_GLOBAL__N_15anon0E = internal global
     11   Global anon0;
     12 }
     13 
     14 // CHECK: @anon1 = internal global
     15 Anon anon1;
     16 
     17 // CHECK: @anon2 = internal global
     18 X<Anon> anon2;
     19 
     20 // rdar: // 8071804
     21 char const * const xyzzy = "Hello, world!";
     22 extern char const * const xyzzy;
     23 
     24 char const * const *test1()
     25 {
     26    // CHECK: @_ZL5xyzzy = internal constant
     27     return &xyzzy;
     28 }
     29 
     30 static char const * const static_xyzzy = "Hello, world!";
     31 extern char const * const static_xyzzy;
     32 
     33 char const * const *test2()
     34 {
     35     // CHECK: @_ZL12static_xyzzy = internal constant
     36     return &static_xyzzy;
     37 }
     38 
     39 static char const * static_nonconst_xyzzy = "Hello, world!";
     40 extern char const * static_nonconst_xyzzy;
     41 
     42 char const * *test3()
     43 {
     44     // CHECK: @_ZL21static_nonconst_xyzzy = internal global
     45     return &static_nonconst_xyzzy;
     46 }
     47 
     48 
     49 char const * extern_nonconst_xyzzy = "Hello, world!";
     50 extern char const * extern_nonconst_xyzzy;
     51 
     52 char const * *test4()
     53 {
     54     // CHECK: @extern_nonconst_xyzzy = global
     55     return &extern_nonconst_xyzzy;
     56 }
     57 
     58 // PR10120
     59 template <typename T> class klass {
     60     virtual void f();
     61 };
     62 namespace { struct S; }
     63 void foo () { klass<S> x; }
     64 // CHECK: @_ZTV5klassIN12_GLOBAL__N_11SEE = internal unnamed_addr constant
     65