1 // RUN: %clang_cc1 -fcxx-exceptions -fexceptions -triple x86_64-apple-darwin10 -emit-llvm %s -o - > %t 2 // RUN: FileCheck %s -check-prefix=CHECK-1 < %t 3 // RUN: FileCheck %s -check-prefix=CHECK-2 < %t 4 5 int f(); 6 7 namespace { 8 // CHECK-1: @_ZN12_GLOBAL__N_11bE = internal global i32 0 9 // CHECK-1: @_ZN12_GLOBAL__N_1L1cE = internal global i32 0 10 // CHECK-1: @_ZN12_GLOBAL__N_11D1dE = internal global i32 0 11 // CHECK-1: @_ZN12_GLOBAL__N_11aE = internal global i32 0 12 int a = 0; 13 14 int b = f(); 15 16 static int c = f(); 17 18 class D { 19 static int d; 20 }; 21 22 int D::d = f(); 23 24 // Check for generation of a VTT with internal linkage 25 // CHECK-1: @_ZTSN12_GLOBAL__N_11X1EE = internal constant 26 struct X { 27 struct EBase { }; 28 struct E : public virtual EBase { virtual ~E() {} }; 29 }; 30 31 // CHECK-1-LABEL: define internal i32 @_ZN12_GLOBAL__N_13fooEv() 32 int foo() { 33 return 32; 34 } 35 36 // CHECK-1-LABEL: define internal i32 @_ZN12_GLOBAL__N_11A3fooEv() 37 namespace A { 38 int foo() { 39 return 45; 40 } 41 } 42 } 43 44 int concrete() { 45 return a + foo() + A::foo(); 46 } 47 48 void test_XE() { throw X::E(); } 49 50 // Miscompile on llvmc plugins. 51 namespace test2 { 52 struct A { 53 template <class T> struct B { 54 static void foo() {} 55 }; 56 }; 57 namespace { 58 struct C; 59 } 60 61 // CHECK-2-LABEL: define void @_ZN5test24testEv() 62 // CHECK-2: call void @_ZN5test21A1BINS_12_GLOBAL__N_11CEE3fooEv() 63 void test() { 64 A::B<C>::foo(); 65 } 66 67 // CHECK-2-LABEL: define internal void @_ZN5test21A1BINS_12_GLOBAL__N_11CEE3fooEv() 68 } 69 70 namespace { 71 72 int bar() { 73 extern int a; 74 return a; 75 } 76 77 } // namespace 78