annotate clang/test/CodeGenCXX/mangle-lambda-explicit-template-params.cpp @ 206:f17a3b42b08b

Added tag before-12 for changeset b7591485f4cd
author Shinji KONO <kono@ie.u-ryukyu.ac.jp>
date Mon, 07 Jun 2021 21:25:57 +0900
parents 1d019706d866
children 2e18cbf3894f
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
150
anatofuz
parents:
diff changeset
1 // RUN: %clang_cc1 -std=c++2a -triple %itanium_abi_triple -emit-llvm -o - %s -w | FileCheck %s
anatofuz
parents:
diff changeset
2
anatofuz
parents:
diff changeset
3 template<class, int, class>
anatofuz
parents:
diff changeset
4 struct DummyType { };
anatofuz
parents:
diff changeset
5
anatofuz
parents:
diff changeset
6 inline void inline_func() {
anatofuz
parents:
diff changeset
7 // CHECK: UlvE
anatofuz
parents:
diff changeset
8 []{}();
anatofuz
parents:
diff changeset
9
anatofuz
parents:
diff changeset
10 // CHECK: UlTyvE
anatofuz
parents:
diff changeset
11 []<class>{}.operator()<int>();
anatofuz
parents:
diff changeset
12
anatofuz
parents:
diff changeset
13 // CHECK: UlTyT_E
anatofuz
parents:
diff changeset
14 []<class T>(T){}(1);
anatofuz
parents:
diff changeset
15
anatofuz
parents:
diff changeset
16 // CHECK: UlTyTyT_T0_E
anatofuz
parents:
diff changeset
17 []<class T1, class T2>(T1, T2){}(1, 2);
anatofuz
parents:
diff changeset
18
anatofuz
parents:
diff changeset
19 // CHECK: UlTyTyT0_T_E
anatofuz
parents:
diff changeset
20 []<class T1, class T2>(T2, T1){}(2, 1);
anatofuz
parents:
diff changeset
21
anatofuz
parents:
diff changeset
22 // CHECK: UlTniTyTnjT0_E
anatofuz
parents:
diff changeset
23 []<int I, class T, unsigned U>(T){}.operator()<1, int, 2>(3);
anatofuz
parents:
diff changeset
24
anatofuz
parents:
diff changeset
25 // CHECK: UlTyTtTyTniTyETniTyvE
anatofuz
parents:
diff changeset
26 []<class,
anatofuz
parents:
diff changeset
27 template<class, int, class> class,
anatofuz
parents:
diff changeset
28 int,
anatofuz
parents:
diff changeset
29 class>{}.operator()<unsigned, DummyType, 5, int>();
anatofuz
parents:
diff changeset
30 }
anatofuz
parents:
diff changeset
31
anatofuz
parents:
diff changeset
32 void call_inline_func() {
anatofuz
parents:
diff changeset
33 inline_func();
anatofuz
parents:
diff changeset
34 }
anatofuz
parents:
diff changeset
35
anatofuz
parents:
diff changeset
36 template<typename T, int> struct X {};
anatofuz
parents:
diff changeset
37
anatofuz
parents:
diff changeset
38 inline auto pack = []<typename ...T, T ...N>(T (&...)[N]) {};
anatofuz
parents:
diff changeset
39 int arr1[] = {1};
anatofuz
parents:
diff changeset
40 int arr2[] = {1, 2};
anatofuz
parents:
diff changeset
41 // CHECK: @_ZNK4packMUlTpTyTpTnT_DpRAT0__S_E_clIJiiEJLi1ELi2EEEEDaS2_(
anatofuz
parents:
diff changeset
42 void use_pack() { pack(arr1, arr2); }
anatofuz
parents:
diff changeset
43
anatofuz
parents:
diff changeset
44 inline void collision() {
anatofuz
parents:
diff changeset
45 auto a = []<typename T, template<typename U, T> typename>{};
anatofuz
parents:
diff changeset
46 auto b = []<typename T, template<typename U, U> typename>{};
anatofuz
parents:
diff changeset
47 auto c = []<typename T, template<typename U, T> typename>{};
anatofuz
parents:
diff changeset
48 a.operator()<int, X>();
anatofuz
parents:
diff changeset
49 // CHECK: @_ZZ9collisionvENKUlTyTtTyTnT_EvE_clIi1XEEDav
anatofuz
parents:
diff changeset
50 b.operator()<int, X>();
anatofuz
parents:
diff changeset
51 // CHECK: @_ZZ9collisionvENKUlTyTtTyTnTL0__EvE_clIi1XEEDav
anatofuz
parents:
diff changeset
52 c.operator()<int, X>();
anatofuz
parents:
diff changeset
53 // CHECK: @_ZZ9collisionvENKUlTyTtTyTnT_EvE0_clIi1XEEDav
anatofuz
parents:
diff changeset
54 }
anatofuz
parents:
diff changeset
55 void use_collision() { collision(); }
anatofuz
parents:
diff changeset
56
anatofuz
parents:
diff changeset
57 namespace pack_not_pack_expansion {
anatofuz
parents:
diff changeset
58 template<typename T, int, T...> struct X;
anatofuz
parents:
diff changeset
59 // CHECK: @_ZNK23pack_not_pack_expansion1xMUlTyTtTyTnT_TpTnTL0__ETpTyvE_clIiNS_1XEJfEEEDav
anatofuz
parents:
diff changeset
60 inline auto x = []<typename T, template<typename U, T, U...> typename, typename ...V>(){}; void f() { x.operator()<int, X, float>(); }
anatofuz
parents:
diff changeset
61 }
anatofuz
parents:
diff changeset
62
anatofuz
parents:
diff changeset
63 template<typename> void f() {
anatofuz
parents:
diff changeset
64 // CHECK: define linkonce_odr {{.*}} @_ZZ1fIiEvvENKUlT_E_clIiEEDaS0_(
anatofuz
parents:
diff changeset
65 auto x = [](auto){};
anatofuz
parents:
diff changeset
66 x(0);
anatofuz
parents:
diff changeset
67 }
anatofuz
parents:
diff changeset
68 void use_f() { f<int>(); }
anatofuz
parents:
diff changeset
69
anatofuz
parents:
diff changeset
70 template<typename> struct Y {
anatofuz
parents:
diff changeset
71 template<int> struct Z {};
anatofuz
parents:
diff changeset
72 };
anatofuz
parents:
diff changeset
73
anatofuz
parents:
diff changeset
74 template<typename ...T> void expanded() {
anatofuz
parents:
diff changeset
75 auto x = []<T..., template<T> typename...>{};
anatofuz
parents:
diff changeset
76 auto y = []<int, template<int> typename>{};
anatofuz
parents:
diff changeset
77 auto z = []<int, int, template<int> typename, template<int> typename>{};
anatofuz
parents:
diff changeset
78 // FIXME: Should we really require 'template' for y and z?
anatofuz
parents:
diff changeset
79 x.template operator()<(T())..., Y<T>::template Z...>();
anatofuz
parents:
diff changeset
80 y.template operator()<0, Y<int>::Z>();
anatofuz
parents:
diff changeset
81 y.template operator()<1, Y<int>::Z>();
anatofuz
parents:
diff changeset
82 z.template operator()<1, 2, Y<int>::Z, Y<float>::Z>();
anatofuz
parents:
diff changeset
83 }
anatofuz
parents:
diff changeset
84 void use_expanded() {
anatofuz
parents:
diff changeset
85 // CHECK: @_ZZ8expandedIJEEvvENKUlvE_clIJEJEEEDav(
anatofuz
parents:
diff changeset
86 // CHECK: @_ZZ8expandedIJEEvvENKUlTniTtTniEvE_clILi0EN1YIiE1ZEEEDav(
anatofuz
parents:
diff changeset
87 // CHECK: @_ZZ8expandedIJEEvvENKUlTniTtTniEvE_clILi1EN1YIiE1ZEEEDav(
anatofuz
parents:
diff changeset
88 // CHECK: @_ZZ8expandedIJEEvvENKUlTniTniTtTniETtTniEvE_clILi1ELi2EN1YIiE1ZENS2_IfE1ZEEEDav(
anatofuz
parents:
diff changeset
89 expanded<>();
anatofuz
parents:
diff changeset
90
anatofuz
parents:
diff changeset
91 // FIXME: Should we really be using J...E for arguments corresponding to an
anatofuz
parents:
diff changeset
92 // expanded parameter pack?
anatofuz
parents:
diff changeset
93 // Note that the <lambda-sig>s of 'x' and 'y' collide here, after pack expansion.
anatofuz
parents:
diff changeset
94 // CHECK: @_ZZ8expandedIJiEEvvENKUlTniTtTniEvE_clIJLi0EEJN1YIiE1ZEEEEDav(
anatofuz
parents:
diff changeset
95 // CHECK: @_ZZ8expandedIJiEEvvENKUlTniTtTniEvE0_clILi0EN1YIiE1ZEEEDav(
anatofuz
parents:
diff changeset
96 // CHECK: @_ZZ8expandedIJiEEvvENKUlTniTtTniEvE0_clILi1EN1YIiE1ZEEEDav(
anatofuz
parents:
diff changeset
97 // CHECK: @_ZZ8expandedIJiEEvvENKUlTniTniTtTniETtTniEvE_clILi1ELi2EN1YIiE1ZENS2_IfE1ZEEEDav(
anatofuz
parents:
diff changeset
98 expanded<int>();
anatofuz
parents:
diff changeset
99
anatofuz
parents:
diff changeset
100 // Note that the <lambda-sig>s of 'x' and 'z' collide here, after pack expansion.
anatofuz
parents:
diff changeset
101 // CHECK: @_ZZ8expandedIJiiEEvvENKUlTniTniTtTniETtTniEvE_clIJLi0ELi0EEJN1YIiE1ZES4_EEEDav(
anatofuz
parents:
diff changeset
102 // CHECK: @_ZZ8expandedIJiiEEvvENKUlTniTtTniEvE_clILi0EN1YIiE1ZEEEDav(
anatofuz
parents:
diff changeset
103 // CHECK: @_ZZ8expandedIJiiEEvvENKUlTniTtTniEvE_clILi1EN1YIiE1ZEEEDav(
anatofuz
parents:
diff changeset
104 // CHECK: @_ZZ8expandedIJiiEEvvENKUlTniTniTtTniETtTniEvE0_clILi1ELi2EN1YIiE1ZENS2_IfE1ZEEEDav(
anatofuz
parents:
diff changeset
105 expanded<int, int>();
anatofuz
parents:
diff changeset
106 }