diff options
author | dim <dim@FreeBSD.org> | 2013-12-22 00:07:40 +0000 |
---|---|---|
committer | dim <dim@FreeBSD.org> | 2013-12-22 00:07:40 +0000 |
commit | 952eddef9aff85b1e92626e89baaf7a360e2ac85 (patch) | |
tree | df8df0b0067b381eab470a3b8f28d14a552a6340 /test/CodeGenCXX/mangle-lambdas.cpp | |
parent | ea266cad53e3d49771fa38103913d3ec7a166694 (diff) | |
download | FreeBSD-src-952eddef9aff85b1e92626e89baaf7a360e2ac85.zip FreeBSD-src-952eddef9aff85b1e92626e89baaf7a360e2ac85.tar.gz |
Vendor import of clang release_34 branch r197841 (effectively, 3.4 RC3):
https://llvm.org/svn/llvm-project/cfe/branches/release_34@197841
Diffstat (limited to 'test/CodeGenCXX/mangle-lambdas.cpp')
-rw-r--r-- | test/CodeGenCXX/mangle-lambdas.cpp | 83 |
1 files changed, 46 insertions, 37 deletions
diff --git a/test/CodeGenCXX/mangle-lambdas.cpp b/test/CodeGenCXX/mangle-lambdas.cpp index 0bd5ad2..659b437 100644 --- a/test/CodeGenCXX/mangle-lambdas.cpp +++ b/test/CodeGenCXX/mangle-lambdas.cpp @@ -1,11 +1,11 @@ // RUN: %clang_cc1 -std=c++11 -triple x86_64-apple-macosx10.7.0 -emit-llvm -o - %s | FileCheck %s // CHECK: @_ZZNK7PR12917IJiiEE1nMUlvE_clEvE1n = linkonce_odr global i32 0 -// CHECK: @_ZZN7PR12917IJicdEEC1EicdEd_N1nE = linkonce_odr global i32 0 -// CHECK: @_ZZN7PR12917IJicdEEC1EicdEd0_N1nE = linkonce_odr global i32 0 -// CHECK: @_ZZN7PR12917IJicdEEC1EicdEd1_N1nE = linkonce_odr global i32 0 +// CHECK: @_ZZZN7PR12917IJicdEEC1EicdEd_NKUlvE_clEvE1n = linkonce_odr global i32 0 +// CHECK: @_ZZZN7PR12917IJicdEEC1EicdEd0_NKUlvE_clEvE1n = linkonce_odr global i32 0 +// CHECK: @_ZZZN7PR12917IJicdEEC1EicdEd1_NKUlvE_clEvE1n = linkonce_odr global i32 0 -// CHECK: define linkonce_odr void @_Z11inline_funci +// CHECK-LABEL: define linkonce_odr void @_Z11inline_funci inline void inline_func(int n) { // CHECK: call i32 @_ZZ11inline_funciENKUlvE_clEv int i = []{ return 1; }(); @@ -41,7 +41,7 @@ struct S { void S::g(int i = []{return 1;}(), int j = []{return 2; }()) {} -// CHECK: define void @_Z6test_S1S +// CHECK-LABEL: define void @_Z6test_S1S void test_S(S s) { // CHECK: call i32 @_ZZN1S1fEiiEd0_NKUlvE_clEv // CHECK-NEXT: call i32 @_ZZN1S1fEiiEd0_NKUlvE0_clEv @@ -63,15 +63,15 @@ void test_S(S s) { } // Check the linkage of the lambda call operators used in test_S. -// CHECK: define linkonce_odr i32 @_ZZN1S1fEiiEd0_NKUlvE_clEv +// CHECK-LABEL: define linkonce_odr i32 @_ZZN1S1fEiiEd0_NKUlvE_clEv // CHECK: ret i32 1 -// CHECK: define linkonce_odr i32 @_ZZN1S1fEiiEd0_NKUlvE0_clEv +// CHECK-LABEL: define linkonce_odr i32 @_ZZN1S1fEiiEd0_NKUlvE0_clEv // CHECK: ret i32 2 -// CHECK: define linkonce_odr i32 @_ZZN1S1fEiiEd_NKUlvE_clEv +// CHECK-LABEL: define linkonce_odr i32 @_ZZN1S1fEiiEd_NKUlvE_clEv // CHECK: ret i32 3 -// CHECK: define internal i32 @"_ZNK1S3$_0clEv" +// CHECK-LABEL: define internal i32 @"_ZNK1S3$_0clEv" // CHECK: ret i32 1 -// CHECK: define internal i32 @"_ZNK1S3$_1clEv" +// CHECK-LABEL: define internal i32 @"_ZNK1S3$_1clEv" // CHECK: ret i32 2 template<typename T> @@ -81,7 +81,7 @@ struct ST { T = []{return T(3);}()); }; -// CHECK: define void @_Z7test_ST2STIdE +// CHECK-LABEL: define void @_Z7test_ST2STIdE void test_ST(ST<double> st) { // CHECK: call double @_ZZN2STIdE1fEddEd0_NKUlvE_clEv // CHECK-NEXT: call double @_ZZN2STIdE1fEddEd0_NKUlvE0_clEv @@ -94,11 +94,11 @@ void test_ST(ST<double> st) { } // Check the linkage of the lambda call operators used in test_ST. -// CHECK: define linkonce_odr double @_ZZN2STIdE1fEddEd0_NKUlvE_clEv +// CHECK-LABEL: define linkonce_odr double @_ZZN2STIdE1fEddEd0_NKUlvE_clEv // CHECK: ret double 1 -// CHECK: define linkonce_odr double @_ZZN2STIdE1fEddEd0_NKUlvE0_clEv +// CHECK-LABEL: define linkonce_odr double @_ZZN2STIdE1fEddEd0_NKUlvE0_clEv // CHECK: ret double 2 -// CHECK: define linkonce_odr double @_ZZN2STIdE1fEddEd_NKUlvE_clEv +// CHECK-LABEL: define linkonce_odr double @_ZZN2STIdE1fEddEd_NKUlvE_clEv // CHECK: ret double 3 template<typename T> @@ -106,6 +106,7 @@ struct StaticMembers { static T x; static T y; static T z; + static int (*f)(); }; template<typename T> int accept_lambda(T); @@ -119,39 +120,47 @@ T StaticMembers<T>::y = []{return 3;}(); template<typename T> T StaticMembers<T>::z = accept_lambda([]{return 4;}); -// CHECK: define internal void @__cxx_global_var_init() +template<typename T> +int (*StaticMembers<T>::f)() = []{return 5;}; + +// CHECK-LABEL: define internal void @__cxx_global_var_init() // CHECK: call i32 @_ZNK13StaticMembersIfE1xMUlvE_clEv // CHECK-NEXT: call i32 @_ZNK13StaticMembersIfE1xMUlvE0_clEv // CHECK-NEXT: add nsw -// CHECK: define linkonce_odr i32 @_ZNK13StaticMembersIfE1xMUlvE_clEv +// CHECK-LABEL: define linkonce_odr i32 @_ZNK13StaticMembersIfE1xMUlvE_clEv // CHECK: ret i32 1 -// CHECK: define linkonce_odr i32 @_ZNK13StaticMembersIfE1xMUlvE0_clEv +// CHECK-LABEL: define linkonce_odr i32 @_ZNK13StaticMembersIfE1xMUlvE0_clEv // CHECK: ret i32 2 template float StaticMembers<float>::x; -// CHECK: define internal void @__cxx_global_var_init1() +// CHECK-LABEL: define internal void @__cxx_global_var_init1() // CHECK: call i32 @_ZNK13StaticMembersIfE1yMUlvE_clEv -// CHECK: define linkonce_odr i32 @_ZNK13StaticMembersIfE1yMUlvE_clEv +// CHECK-LABEL: define linkonce_odr i32 @_ZNK13StaticMembersIfE1yMUlvE_clEv // CHECK: ret i32 3 template float StaticMembers<float>::y; -// CHECK: define internal void @__cxx_global_var_init2() +// CHECK-LABEL: define internal void @__cxx_global_var_init2() // CHECK: call i32 @_Z13accept_lambdaIN13StaticMembersIfE1zMUlvE_EEiT_ // CHECK: declare i32 @_Z13accept_lambdaIN13StaticMembersIfE1zMUlvE_EEiT_() template float StaticMembers<float>::z; -// CHECK: define internal void @__cxx_global_var_init3 +// CHECK-LABEL: define internal void @__cxx_global_var_init3() +// CHECK: call {{.*}} @_ZNK13StaticMembersIfE1fMUlvE_cvPFivEEv +// CHECK-LABEL: define linkonce_odr i32 ()* @_ZNK13StaticMembersIfE1fMUlvE_cvPFivEEv +template int (*StaticMembers<float>::f)(); + +// CHECK-LABEL: define internal void @__cxx_global_var_init4 // CHECK: call i32 @"_ZNK13StaticMembersIdE3$_2clEv" -// CHECK: define internal i32 @"_ZNK13StaticMembersIdE3$_2clEv" +// CHECK-LABEL: define internal i32 @"_ZNK13StaticMembersIdE3$_2clEv" // CHECK: ret i32 42 template<> double StaticMembers<double>::z = []{return 42; }(); template<typename T> void func_template(T = []{ return T(); }()); -// CHECK: define void @_Z17use_func_templatev() +// CHECK-LABEL: define void @_Z17use_func_templatev() void use_func_template() { - // CHECK: call i32 @"_ZZ13func_templateIiEvT_ENKS_IiE3$_3clEv" + // CHECK: call i32 @"_ZZ13func_templateIiEvT_ENK3$_3clEv" func_template<int>(); } @@ -183,7 +192,7 @@ namespace PR12123 { }; void B::h() { f(); } } -// CHECK: define linkonce_odr %"struct.PR12123::A"* @_ZZN7PR121231B1fERKSt9type_infoEd_NKUlvE_clEv +// CHECK-LABEL: define linkonce_odr %"struct.PR12123::A"* @_ZZN7PR121231B1fERKSt9type_infoEd_NKUlvE_clEv namespace PR12808 { template <typename> struct B { @@ -196,11 +205,11 @@ namespace PR12808 { void f() { b<int>(1); } - // CHECK: define linkonce_odr void @_ZZN7PR128081bIiEEviENKS0_IiEUlvE_clEv - // CHECK: define linkonce_odr i32 @_ZZZN7PR128081bIiEEviENKS0_IiEUlvE_clEvENKUlvE_clEv + // CHECK-LABEL: define linkonce_odr void @_ZZN7PR128081bIiEEviENKUlvE_clEv + // CHECK-LABEL: define linkonce_odr i32 @_ZZZN7PR128081bIiEEviENKUlvE_clEvENKUlvE_clEv } -// CHECK: define linkonce_odr void @_Z1fIZZNK23TestNestedInstantiationclEvENKUlvE_clEvEUlvE_EvT_ +// CHECK-LABEL: define linkonce_odr void @_Z1fIZZNK23TestNestedInstantiationclEvENKUlvE_clEvEUlvE_EvT_ struct Members { int x = [] { return 1; }() + [] { return 2; }(); @@ -208,7 +217,7 @@ struct Members { }; void test_Members() { - // CHECK: define linkonce_odr void @_ZN7MembersC2Ev + // CHECK-LABEL: define linkonce_odr void @_ZN7MembersC2Ev // CHECK: call i32 @_ZNK7Members1xMUlvE_clEv // CHECK-NEXT: call i32 @_ZNK7Members1xMUlvE0_clE // CHECK-NEXT: add nsw i32 @@ -232,21 +241,21 @@ void test_NestedInstantiation() { } // Check the linkage of the lambdas used in test_Members. -// CHECK: define linkonce_odr i32 @_ZNK7Members1xMUlvE_clEv +// CHECK-LABEL: define linkonce_odr i32 @_ZNK7Members1xMUlvE_clEv // CHECK: ret i32 1 -// CHECK: define linkonce_odr i32 @_ZNK7Members1xMUlvE0_clEv +// CHECK-LABEL: define linkonce_odr i32 @_ZNK7Members1xMUlvE0_clEv // CHECK: ret i32 2 -// CHECK: define linkonce_odr i32 @_ZNK7Members1yMUlvE_clEv +// CHECK-LABEL: define linkonce_odr i32 @_ZNK7Members1yMUlvE_clEv // CHECK: ret i32 3 // Check linkage of the various lambdas. -// CHECK: define linkonce_odr i32 @_ZZ11inline_funciENKUlvE_clEv +// CHECK-LABEL: define linkonce_odr i32 @_ZZ11inline_funciENKUlvE_clEv // CHECK: ret i32 1 -// CHECK: define linkonce_odr i32 @_ZZ11inline_funciENKUlvE0_clEv +// CHECK-LABEL: define linkonce_odr i32 @_ZZ11inline_funciENKUlvE0_clEv // CHECK: ret i32 -// CHECK: define linkonce_odr double @_ZZ11inline_funciENKUlvE1_clEv +// CHECK-LABEL: define linkonce_odr double @_ZZ11inline_funciENKUlvE1_clEv // CHECK: ret double -// CHECK: define linkonce_odr i32 @_ZZ11inline_funciENKUliE_clEi +// CHECK-LABEL: define linkonce_odr i32 @_ZZ11inline_funciENKUliE_clEi // CHECK: ret i32 -// CHECK: define linkonce_odr i32 @_ZZ11inline_funciENKUlvE2_clEv +// CHECK-LABEL: define linkonce_odr i32 @_ZZ11inline_funciENKUlvE2_clEv // CHECK: ret i32 17 |