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