summaryrefslogtreecommitdiffstats
path: root/test/CodeGenCXX/static-member-variable-explicit-specialization.cpp
diff options
context:
space:
mode:
authordim <dim@FreeBSD.org>2015-01-18 16:23:48 +0000
committerdim <dim@FreeBSD.org>2015-01-18 16:23:48 +0000
commitc86b984ea8ecb3e944dc3de48539f4c1f65851ea (patch)
tree3eb853da77d46cc77c4b017525a422f9ddb1385b /test/CodeGenCXX/static-member-variable-explicit-specialization.cpp
parentc696171ff15f0ee60dea4abfd99a135473c95656 (diff)
downloadFreeBSD-src-c86b984ea8ecb3e944dc3de48539f4c1f65851ea.zip
FreeBSD-src-c86b984ea8ecb3e944dc3de48539f4c1f65851ea.tar.gz
Vendor import of clang RELEASE_360/rc1 tag r226102 (effectively, 3.6.0 RC1):
https://llvm.org/svn/llvm-project/cfe/tags/RELEASE_360/rc1@226102
Diffstat (limited to 'test/CodeGenCXX/static-member-variable-explicit-specialization.cpp')
-rw-r--r--test/CodeGenCXX/static-member-variable-explicit-specialization.cpp135
1 files changed, 82 insertions, 53 deletions
diff --git a/test/CodeGenCXX/static-member-variable-explicit-specialization.cpp b/test/CodeGenCXX/static-member-variable-explicit-specialization.cpp
index 98c09b8..20b409c 100644
--- a/test/CodeGenCXX/static-member-variable-explicit-specialization.cpp
+++ b/test/CodeGenCXX/static-member-variable-explicit-specialization.cpp
@@ -1,25 +1,42 @@
-// RUN: %clang_cc1 %s -std=c++1y -triple=x86_64-apple-darwin10 -emit-llvm -o - | FileCheck %s
-// CHECK: ; ModuleID
+// RUN: %clang_cc1 %s -std=c++1y -triple=x86_64-pc-linux -emit-llvm -o - | FileCheck --check-prefix=ELF --check-prefix=ALL %s
+// RUN: %clang_cc1 %s -std=c++1y -triple=x86_64-apple-darwin -emit-llvm -o - | FileCheck --check-prefix=MACHO --check-prefix=ALL %s
+
+// ALL: ; ModuleID
extern "C" int foo();
template<typename T> struct A { static int a; };
template<typename T> int A<T>::a = foo();
-// CHECK-NOT: @_ZN1AIcE1aE
+// ALLK-NOT: @_ZN1AIcE1aE
template<> int A<char>::a;
-// CHECK: @_ZN1AIbE1aE = global i32 10
+// ALL: @_ZN1AIbE1aE = global i32 10
template<> int A<bool>::a = 10;
-// CHECK: @llvm.global_ctors = appending global [7 x { i32, void ()*, i8* }]
-// CHECK: [{ i32, void ()*, i8* } { i32 65535, void ()* @[[unordered1:[^,]*]], i8* bitcast (i32* @_ZN1AIsE1aE to i8*) },
-// CHECK: { i32, void ()*, i8* } { i32 65535, void ()* @[[unordered2:[^,]*]], i8* bitcast (i16* @_Z1xIsE to i8*) },
-// CHECK: { i32, void ()*, i8* } { i32 65535, void ()* @[[unordered3:[^,]*]], i8* bitcast (i32* @_ZN2ns1aIiE1iE to i8*) },
-// CHECK: { i32, void ()*, i8* } { i32 65535, void ()* @[[unordered4:[^,]*]], i8* bitcast (i32* @_ZN2ns1b1iIiEE to i8*) },
-// CHECK: { i32, void ()*, i8* } { i32 65535, void ()* @[[unordered5:[^,]*]], i8* bitcast (i32* @_ZN1AIvE1aE to i8*) },
-// CHECK: { i32, void ()*, i8* } { i32 65535, void ()* @[[unordered6:[^,]*]], i8* @_Z1xIcE },
-// CHECK: { i32, void ()*, i8* } { i32 65535, void ()* @_GLOBAL__sub_I_static_member_variable_explicit_specialization.cpp, i8* null }]
+// ALL: @llvm.global_ctors = appending global [8 x { i32, void ()*, i8* }]
+
+// ELF: [{ i32, void ()*, i8* } { i32 65535, void ()* @[[unordered1:[^,]*]], i8* bitcast (i32* @_ZN1AIsE1aE to i8*) },
+// MACHO: [{ i32, void ()*, i8* } { i32 65535, void ()* @[[unordered1:[^,]*]], i8* null },
+
+// ELF: { i32, void ()*, i8* } { i32 65535, void ()* @[[unordered2:[^,]*]], i8* bitcast (i16* @_Z1xIsE to i8*) },
+// MACHO: { i32, void ()*, i8* } { i32 65535, void ()* @[[unordered2:[^,]*]], i8* null },
+
+// ELF: { i32, void ()*, i8* } { i32 65535, void ()* @[[unordered3:[^,]*]], i8* bitcast (i32* @_ZN2ns1aIiE1iE to i8*) },
+// MACHO: { i32, void ()*, i8* } { i32 65535, void ()* @[[unordered3:[^,]*]], i8* null },
+
+// ELF: { i32, void ()*, i8* } { i32 65535, void ()* @[[unordered4:[^,]*]], i8* bitcast (i32* @_ZN2ns1b1iIiEE to i8*) },
+// MACHO: { i32, void ()*, i8* } { i32 65535, void ()* @[[unordered4:[^,]*]], i8* null },
+
+// ELF: { i32, void ()*, i8* } { i32 65535, void ()* @[[unordered5:[^,]*]], i8* bitcast (i32* @_ZN1AIvE1aE to i8*) },
+// MACHO: { i32, void ()*, i8* } { i32 65535, void ()* @[[unordered5:[^,]*]], i8* null },
+
+// ELF: { i32, void ()*, i8* } { i32 65535, void ()* @[[unordered6:[^,]*]], i8* @_Z1xIcE },
+// MACHO: { i32, void ()*, i8* } { i32 65535, void ()* @[[unordered6:[^,]*]], i8* null },
+
+// ALL: { i32, void ()*, i8* } { i32 65535, void ()* @[[unordered7:[^,]*]], i8* null },
+
+// ALL: { i32, void ()*, i8* } { i32 65535, void ()* @_GLOBAL__sub_I_static_member_variable_explicit_specialization.cpp, i8* null }]
template int A<short>::a; // Unordered
int b = foo();
@@ -52,45 +69,57 @@ struct b {
template<typename T> T b::i = foo();
template int b::i<int>;
}
-// CHECK: define internal void @[[unordered1]]
-// CHECK: call i32 @foo()
-// CHECK: store {{.*}} @_ZN1AIsE1aE
-// CHECK: ret
-
-// CHECK: define internal void @[[unordered2]]
-// CHECK: call i32 @foo()
-// CHECK: store {{.*}} @_Z1xIsE
-// CHECK: ret
-
-// CHECK: define internal void @[[unordered3]]
-// CHECK: call i32 @foo()
-// CHECK: store {{.*}} @_ZN2ns1aIiE1iE
-// CHECK: ret
-
-// CHECK: define internal void @[[unordered4]]
-// CHECK: call i32 @foo()
-// CHECK: store {{.*}} @_ZN2ns1b1iIiEE
-// CHECK: ret
-
-// CHECK: define internal void @[[unordered5]]
-// CHECK: call i32 @foo()
-// CHECK: store {{.*}} @_ZN1AIvE1aE
-// CHECK: ret
-
-// CHECK: define internal void @[[unordered6]]
-// CHECK: call i32 @foo()
-// CHECK: store {{.*}} @_Z1xIcE
-// CHECK: ret
-
-// CHECK: define internal void @_GLOBAL__sub_I_static_member_variable_explicit_specialization.cpp()
+
+namespace {
+template<typename T> struct Internal { static int a; };
+template<typename T> int Internal<T>::a = foo();
+}
+int *use_internal_a = &Internal<int>::a;
+
+// ALL: define internal void @[[unordered1]](
+// ALL: call i32 @foo()
+// ALL: store {{.*}} @_ZN1AIsE1aE
+// ALL: ret
+
+// ALL: define internal void @[[unordered2]](
+// ALL: call i32 @foo()
+// ALL: store {{.*}} @_Z1xIsE
+// ALL: ret
+
+// ALL: define internal void @[[unordered3]](
+// ALL: call i32 @foo()
+// ALL: store {{.*}} @_ZN2ns1aIiE1iE
+// ALL: ret
+
+// ALL: define internal void @[[unordered4]](
+// ALL: call i32 @foo()
+// ALL: store {{.*}} @_ZN2ns1b1iIiEE
+// ALL: ret
+
+// ALL: define internal void @[[unordered5]](
+// ALL: call i32 @foo()
+// ALL: store {{.*}} @_ZN1AIvE1aE
+// ALL: ret
+
+// ALL: define internal void @[[unordered6]](
+// ALL: call i32 @foo()
+// ALL: store {{.*}} @_Z1xIcE
+// ALL: ret
+
+// ALL: define internal void @[[unordered7]](
+// ALL: call i32 @foo()
+// ALL: store {{.*}} @_ZN12_GLOBAL__N_18InternalIiE1aE
+// ALL: ret
+
+// ALL: define internal void @_GLOBAL__sub_I_static_member_variable_explicit_specialization.cpp()
// We call unique stubs for every ordered dynamic initializer in the TU.
-// CHECK: call
-// CHECK: call
-// CHECK: call
-// CHECK: call
-// CHECK: call
-// CHECK: call
-// CHECK: call
-// CHECK: call
-// CHECK-NOT: call
-// CHECK: ret
+// ALL: call
+// ALL: call
+// ALL: call
+// ALL: call
+// ALL: call
+// ALL: call
+// ALL: call
+// ALL: call
+// ALL-NOT: call
+// ALL: ret
OpenPOWER on IntegriCloud