diff options
Diffstat (limited to 'clang/test')
-rw-r--r-- | clang/test/CXX/temp/temp.spec/temp.explicit/p1-emit.cpp | 4 | ||||
-rw-r--r-- | clang/test/CodeGenCXX/const-init-cxx11.cpp | 22 | ||||
-rw-r--r-- | clang/test/CodeGenCXX/const-init-cxx1y.cpp | 30 | ||||
-rw-r--r-- | clang/test/CodeGenCXX/cxx11-thread-local.cpp | 8 | ||||
-rw-r--r-- | clang/test/CodeGenCXX/cxx1y-variable-template.cpp | 4 | ||||
-rw-r--r-- | clang/test/CodeGenCXX/specialized-static-data-mem-init.cpp | 4 | ||||
-rw-r--r-- | clang/test/CodeGenCXX/static-init-3.cpp | 4 | ||||
-rw-r--r-- | clang/test/CodeGenCXX/template-instantiation.cpp | 4 | ||||
-rw-r--r-- | clang/test/CodeGenCXX/vla.cpp | 2 |
9 files changed, 67 insertions, 15 deletions
diff --git a/clang/test/CXX/temp/temp.spec/temp.explicit/p1-emit.cpp b/clang/test/CXX/temp/temp.spec/temp.explicit/p1-emit.cpp index d0df305941d..24f68a094e5 100644 --- a/clang/test/CXX/temp/temp.spec/temp.explicit/p1-emit.cpp +++ b/clang/test/CXX/temp/temp.spec/temp.explicit/p1-emit.cpp @@ -20,8 +20,8 @@ template int X<int>::member2; // For implicit instantiation of long& get(bool Cond1, bool Cond2) { - // CHECK: @_ZN1XIlE7member1E = weak_odr global i64 0 - // CHECK: @_ZN1XIlE7member2E = weak_odr global i64 17 + // CHECK: @_ZN1XIlE7member1E = linkonce_odr global i64 0 + // CHECK: @_ZN1XIlE7member2E = linkonce_odr global i64 17 // CHECK: @_ZN1XIlE7member3E = external global i64 return Cond1? X<long>::member1 : Cond2? X<long>::member2 diff --git a/clang/test/CodeGenCXX/const-init-cxx11.cpp b/clang/test/CodeGenCXX/const-init-cxx11.cpp index d21e91178e4..26ad9cb7676 100644 --- a/clang/test/CodeGenCXX/const-init-cxx11.cpp +++ b/clang/test/CodeGenCXX/const-init-cxx11.cpp @@ -393,6 +393,9 @@ namespace UnemittedTemporaryDecl { // CHECK: @_ZZN12LocalVarInit3aggEvE1a = internal constant {{.*}} i32 101 // CHECK: @_ZZN12LocalVarInit4ctorEvE1a = internal constant {{.*}} i32 102 // CHECK: @_ZZN12LocalVarInit8mutable_EvE1a = private unnamed_addr constant {{.*}} i32 103 +// CHECK: @_ZGRN33ClassTemplateWithStaticDataMember1SIvE1aE = linkonce_odr constant i32 5 +// CHECK: @_ZN33ClassTemplateWithStaticDataMember3useE = constant i32* @_ZGRN33ClassTemplateWithStaticDataMember1SIvE1aE +// CHECK: @_ZGRZN20InlineStaticConstRef3funEvE1i = linkonce_odr constant i32 10 // Constant initialization tests go before this point, // dynamic initialization tests go after. @@ -552,3 +555,22 @@ namespace Null { // CHECK: call {{.*}} @_ZN4Null4nullEv( int S::*q = null(); } + +namespace InlineStaticConstRef { + inline const int &fun() { + static const int &i = 10; + return i; + // CHECK: ret i32* @_ZGRZN20InlineStaticConstRef3funEvE1i + } + const int &use = fun(); +} + +namespace ClassTemplateWithStaticDataMember { + template <typename T> + struct S { + static const int &a; + }; + template <typename T> + const int &S<T>::a = 5; + const int &use = S<void>::a; +} diff --git a/clang/test/CodeGenCXX/const-init-cxx1y.cpp b/clang/test/CodeGenCXX/const-init-cxx1y.cpp index 5dd15a35281..d9bbc68b363 100644 --- a/clang/test/CodeGenCXX/const-init-cxx1y.cpp +++ b/clang/test/CodeGenCXX/const-init-cxx1y.cpp @@ -38,6 +38,36 @@ namespace ModifyStaticTemporary { // CHECK: @_ZN21ModifyStaticTemporary1cE = global {{.*}} zeroinitializer } +// CHECK: @_ZGRN28VariableTemplateWithConstRef1iIvEE = linkonce_odr constant i32 5, align 4 +// CHECK: @_ZN28VariableTemplateWithConstRef3useE = constant i32* @_ZGRN28VariableTemplateWithConstRef1iIvEE +namespace VariableTemplateWithConstRef { + template <typename T> + const int &i = 5; + const int &use = i<void>; +} + +// CHECK: @_ZGRN24VariableTemplateWithPack1sIJLi1ELi2ELi3ELi4EEEE = linkonce_odr constant i32 1 +// CHECK: @_ZGRN24VariableTemplateWithPack1sIJLi1ELi2ELi3ELi4EEEE2 = linkonce_odr global {{.*}} { i32* @_ZGRN24VariableTemplateWithPack1sIJLi1ELi2ELi3ELi4EEEE } +// CHECK: @_ZGRN24VariableTemplateWithPack1sIJLi1ELi2ELi3ELi4EEEE3 = linkonce_odr constant i32 2 +// CHECK: @_ZGRN24VariableTemplateWithPack1sIJLi1ELi2ELi3ELi4EEEE4 = linkonce_odr global {{.*}} { i32* @_ZGRN24VariableTemplateWithPack1sIJLi1ELi2ELi3ELi4EEEE3 } +// CHECK: @_ZGRN24VariableTemplateWithPack1sIJLi1ELi2ELi3ELi4EEEE5 = linkonce_odr constant i32 3 +// CHECK: @_ZGRN24VariableTemplateWithPack1sIJLi1ELi2ELi3ELi4EEEE6 = linkonce_odr global {{.*}} { i32* @_ZGRN24VariableTemplateWithPack1sIJLi1ELi2ELi3ELi4EEEE5 } +// CHECK: @_ZGRN24VariableTemplateWithPack1sIJLi1ELi2ELi3ELi4EEEE7 = linkonce_odr constant i32 4 +// CHECK: @_ZGRN24VariableTemplateWithPack1sIJLi1ELi2ELi3ELi4EEEE8 = linkonce_odr global {{.*}} { i32* @_ZGRN24VariableTemplateWithPack1sIJLi1ELi2ELi3ELi4EEEE7 } +// CHECK: @_ZGRN24VariableTemplateWithPack1sIJLi1ELi2ELi3ELi4EEEE9 = linkonce_odr global {{.*}} { {{.*}} @_ZGRN24VariableTemplateWithPack1sIJLi1ELi2ELi3ELi4EEEE2, {{.*}} @_ZGRN24VariableTemplateWithPack1sIJLi1ELi2ELi3ELi4EEEE4, {{.*}} @_ZGRN24VariableTemplateWithPack1sIJLi1ELi2ELi3ELi4EEEE6, {{.*}} @_ZGRN24VariableTemplateWithPack1sIJLi1ELi2ELi3ELi4EEEE8 } +// CHECK: @_ZN24VariableTemplateWithPack1pE = global {{.*}} @_ZGRN24VariableTemplateWithPack1sIJLi1ELi2ELi3ELi4EEEE9 +namespace VariableTemplateWithPack { + struct A { + const int &r; + }; + struct S { + A &&a, &&b, &&c, &&d; + }; + template <int... N> + S &&s = {A{N}...}; + S *p = &s<1, 2, 3, 4>; +} + // CHECK: __cxa_atexit({{.*}} @_ZN1BD1Ev {{.*}} @b // CHECK: define diff --git a/clang/test/CodeGenCXX/cxx11-thread-local.cpp b/clang/test/CodeGenCXX/cxx11-thread-local.cpp index 86734cd79c8..b91f46d5d49 100644 --- a/clang/test/CodeGenCXX/cxx11-thread-local.cpp +++ b/clang/test/CodeGenCXX/cxx11-thread-local.cpp @@ -21,7 +21,7 @@ template<typename T> thread_local int V<T>::m = g(); // CHECK: @e = global i32 0 int e = V<int>::m; -// CHECK: @_ZN1VIiE1mE = weak_odr thread_local global i32 0 +// CHECK: @_ZN1VIiE1mE = linkonce_odr thread_local global i32 0 // CHECK: @_ZZ1fvE1n = internal thread_local global i32 0 @@ -35,9 +35,9 @@ int e = V<int>::m; // CHECK: @_ZZ8tls_dtorvE1u = internal thread_local global // CHECK: @_ZGVZ8tls_dtorvE1u = internal thread_local global i8 0 -// CHECK: @_ZGRZ8tls_dtorvE1u = private thread_local global +// CHECK: @_ZGRZ8tls_dtorvE1u = internal thread_local global -// CHECK: @_ZGVN1VIiE1mE = weak_odr thread_local global i64 0 +// CHECK: @_ZGVN1VIiE1mE = linkonce_odr thread_local global i64 0 // CHECK: @__tls_guard = internal thread_local global i8 0 @@ -46,7 +46,7 @@ int e = V<int>::m; // CHECK: @_ZTH1a = alias void ()* @__tls_init // CHECK: @_ZTHL1d = alias internal void ()* @__tls_init // CHECK: @_ZTHN1U1mE = alias void ()* @__tls_init -// CHECK: @_ZTHN1VIiE1mE = alias weak_odr void ()* @__tls_init +// CHECK: @_ZTHN1VIiE1mE = alias linkonce_odr void ()* @__tls_init // Individual variable initialization functions: diff --git a/clang/test/CodeGenCXX/cxx1y-variable-template.cpp b/clang/test/CodeGenCXX/cxx1y-variable-template.cpp index d1e70603e28..cd73817d850 100644 --- a/clang/test/CodeGenCXX/cxx1y-variable-template.cpp +++ b/clang/test/CodeGenCXX/cxx1y-variable-template.cpp @@ -18,7 +18,7 @@ int init_arr(); template<typename T> template<typename U> template<typename V> int Outer<T>::Inner<U>::arr[sizeof(T) + sizeof(U) + sizeof(V)] = { init_arr() }; int *p = Outer<char[100]>::Inner<char[20]>::arr<char[3]>; -// CHECK: @_ZN5OuterIA100_cE5InnerIA20_cE3arrIA3_cEE = weak_odr global [123 x i32] zeroinitializer -// CHECK: @_ZGVN5OuterIA100_cE5InnerIA20_cE3arrIA3_cEE = weak_odr global +// CHECK: @_ZN5OuterIA100_cE5InnerIA20_cE3arrIA3_cEE = linkonce_odr global [123 x i32] zeroinitializer +// CHECK: @_ZGVN5OuterIA100_cE5InnerIA20_cE3arrIA3_cEE = linkonce_odr global // CHECK: call {{.*}}@_Z8init_arrv diff --git a/clang/test/CodeGenCXX/specialized-static-data-mem-init.cpp b/clang/test/CodeGenCXX/specialized-static-data-mem-init.cpp index 21bc1239a1e..68799624f26 100644 --- a/clang/test/CodeGenCXX/specialized-static-data-mem-init.cpp +++ b/clang/test/CodeGenCXX/specialized-static-data-mem-init.cpp @@ -2,8 +2,8 @@ // rdar: // 8562966 // pr8409 -// CHECK: @_ZN1CIiE11needs_guardE = weak_odr global -// CHECK: @_ZGVN1CIiE11needs_guardE = weak_odr global +// CHECK: @_ZN1CIiE11needs_guardE = linkonce_odr global +// CHECK: @_ZGVN1CIiE11needs_guardE = linkonce_odr global struct K { diff --git a/clang/test/CodeGenCXX/static-init-3.cpp b/clang/test/CodeGenCXX/static-init-3.cpp index dc28d5a32a6..083e00144c1 100644 --- a/clang/test/CodeGenCXX/static-init-3.cpp +++ b/clang/test/CodeGenCXX/static-init-3.cpp @@ -16,8 +16,8 @@ struct X1 } }; -// CHECK: @_ZN2X1I2X2I1BEE8instanceE = weak_odr global %struct.X2* null, align 8 -// CHECJ: @_ZN2X1I2X2I1AEE8instanceE = weak_odr global %struct.X2* null, align 8 +// CHECK: @_ZN2X1I2X2I1BEE8instanceE = linkonce_odr global %struct.X2* null, align 8 +// CHECJ: @_ZN2X1I2X2I1AEE8instanceE = linkonce_odr global %struct.X2* null, align 8 template<class T> T & X1<T>::instance = X1<T>::get(); class A { }; diff --git a/clang/test/CodeGenCXX/template-instantiation.cpp b/clang/test/CodeGenCXX/template-instantiation.cpp index 3baa946b0b1..90b8099f0a2 100644 --- a/clang/test/CodeGenCXX/template-instantiation.cpp +++ b/clang/test/CodeGenCXX/template-instantiation.cpp @@ -9,8 +9,8 @@ // CHECK-NOT: @_ZTVN5test018stdio_sync_filebufIA2_iEE // CHECK: @_ZTVN5test018stdio_sync_filebufIA3_iEE = weak_odr unnamed_addr constant -// CHECK: @_ZN7PR100011SIiE3arrE = weak_odr global [3 x i32] -// CHECK-NOT: @_ZN7PR100011SIiE3arr2E = weak_odr global [3 x i32]A +// CHECK: @_ZN7PR100011SIiE3arrE = linkonce_odr global [3 x i32] +// CHECK-NOT: @_ZN7PR100011SIiE3arr2E = linkonce_odr global [3 x i32]A // CHECK: @_ZTVN5test018stdio_sync_filebufIA4_iEE = linkonce_odr unnamed_addr constant diff --git a/clang/test/CodeGenCXX/vla.cpp b/clang/test/CodeGenCXX/vla.cpp index b22f21c3faf..a6616d374fe 100644 --- a/clang/test/CodeGenCXX/vla.cpp +++ b/clang/test/CodeGenCXX/vla.cpp @@ -9,7 +9,7 @@ template<typename T> int S<T>::n = 5; int f() { // Make sure that the reference here is enough to trigger the instantiation of // the static data member. - // CHECK: @_ZN1SIiE1nE = weak_odr global i32 5 + // CHECK: @_ZN1SIiE1nE = linkonce_odr global i32 5 int a[S<int>::n]; return sizeof a; } |