1 | // UNSUPPORTED: system-darwin |
2 | // RUN: %clang %target_itanium_abi_host_triple %s -c -o - -gdwarf-4 -Xclang -gsimple-template-names=mangled -Xclang -debug-forward-template-params -std=c++20 \ |
3 | // RUN: | llvm-dwarfdump --verify - |
4 | // RUN: %clang %target_itanium_abi_host_triple %s -c -o - -gdwarf-4 -Xclang -gsimple-template-names=mangled -Xclang -debug-forward-template-params -std=c++20 -gmlt -fdebug-info-for-profiling \ |
5 | // RUN: | llvm-dwarfdump --verify - |
6 | // RUN: %clang %target_itanium_abi_host_triple %s -c -o - -gdwarf-4 -Xclang -gsimple-template-names=mangled -Xclang -debug-forward-template-params -std=c++20 -fdebug-types-section \ |
7 | // RUN: | llvm-dwarfdump --verify - |
8 | // RUN: %clang %target_itanium_abi_host_triple %s -c -o - -gdwarf-5 -Xclang -gsimple-template-names=mangled -Xclang -debug-forward-template-params -std=c++20 -fdebug-types-section \ |
9 | // RUN: | llvm-dwarfdump --verify - |
10 | |
11 | #include <cstdint> |
12 | #include <cstddef> |
13 | template<typename ...Ts> |
14 | struct t1 { |
15 | }; |
16 | template<typename ...Ts> |
17 | struct t2; |
18 | struct udt { |
19 | }; |
20 | namespace ns { |
21 | struct udt { |
22 | }; |
23 | namespace inner { |
24 | template<typename T> struct ttp { }; |
25 | struct udt { }; |
26 | } |
27 | template<template<typename> class T> |
28 | void ttp_user() { } |
29 | enum Enumeration : int { Enumerator1, Enumerator2, Enumerator3 = 1 }; |
30 | enum class EnumerationClass { Enumerator1, Enumerator2, Enumerator3 = 1 }; |
31 | enum : int { AnonEnum1, AnonEnum2, AnonEnum3 = 1 }; |
32 | enum EnumerationSmall : unsigned char { kNeg = 0xff }; |
33 | } |
34 | template <typename... Ts> |
35 | void f1() { |
36 | t1<Ts...> v1; |
37 | t2<Ts...> *v2; |
38 | } |
39 | template<bool b, int i> |
40 | void f2() { |
41 | } |
42 | template<typename T, T ...A> |
43 | void f3() { |
44 | } |
45 | template<typename T, unsigned = 3> |
46 | void f4() { |
47 | } |
48 | template<typename T, bool b = false> |
49 | struct t3 { }; |
50 | extern template class t3<int>; |
51 | template class t3<int>; |
52 | struct outer_class { |
53 | struct inner_class { |
54 | }; |
55 | }; |
56 | int i = 3; |
57 | template<unsigned N> |
58 | struct t4 { }; |
59 | namespace { |
60 | struct t5 { }; |
61 | enum LocalEnum { LocalEnum1 }; |
62 | } |
63 | template<typename ...T1, typename T2 = int> |
64 | void f5() { } |
65 | template<typename T1, typename ...T2> |
66 | void f6() { } |
67 | struct t6 { |
68 | template<typename T> |
69 | void operator<<(int) { |
70 | } |
71 | template<typename T> |
72 | void operator<(int) { |
73 | } |
74 | template<typename T> |
75 | void operator<=(int) { |
76 | } |
77 | template<typename T = int> |
78 | operator t1<float>*() { |
79 | return nullptr; |
80 | } |
81 | template<typename T> |
82 | void operator-(int) { |
83 | } |
84 | template<typename T> |
85 | void operator*(int) { |
86 | } |
87 | template<typename T> |
88 | void operator/(int) { |
89 | } |
90 | template<typename T> |
91 | void operator%(int) { |
92 | } |
93 | template<typename T> |
94 | void operator^(int) { |
95 | } |
96 | template<typename T> |
97 | void operator&(int) { |
98 | } |
99 | template<typename T> |
100 | void operator|(int) { |
101 | } |
102 | template<typename T> |
103 | void operator~() { |
104 | } |
105 | template<typename T> |
106 | void operator!() { |
107 | } |
108 | template<typename T> |
109 | void operator=(int) { |
110 | } |
111 | template<typename T> |
112 | void operator>(int) { |
113 | } |
114 | template<typename T> |
115 | void operator,(int) { |
116 | } |
117 | template<typename T> |
118 | void operator()() { |
119 | } |
120 | template<typename T> |
121 | void operator[](int) { |
122 | } |
123 | template<typename T> |
124 | void operator<=>(int) { |
125 | } |
126 | template<typename T> |
127 | void* operator new(std::size_t, T) { |
128 | __builtin_unreachable(); |
129 | } |
130 | template<typename T> |
131 | void operator delete(void*, T) { |
132 | } |
133 | template<typename T> |
134 | void* operator new[](std::size_t, T) { |
135 | __builtin_unreachable(); |
136 | } |
137 | template<typename T> |
138 | void operator delete[](void*, T) { |
139 | } |
140 | template<typename T> |
141 | int operator co_await() { __builtin_unreachable(); } |
142 | |
143 | }; |
144 | void operator"" _suff(unsigned long long) {} |
145 | template<template<typename...> class T> void f7() { } |
146 | template<template<typename...> class T, typename T2> void f8() { } |
147 | template<typename T> |
148 | struct t7; |
149 | using t7i = t7<int>; |
150 | template<typename T> |
151 | struct |
152 | __attribute__((__preferred_name__(t7i))) |
153 | t7 { |
154 | }; |
155 | struct t8 { |
156 | void mem(); |
157 | }; |
158 | namespace ns { |
159 | inline namespace inl { |
160 | template<typename T> struct t9 { }; |
161 | } |
162 | } |
163 | template<typename T> |
164 | void (*f9())() { |
165 | return nullptr; |
166 | } |
167 | struct t10 { |
168 | template<typename T = void> |
169 | t10() { } |
170 | }; |
171 | |
172 | template<typename T> |
173 | void operator_not_really() { |
174 | } |
175 | |
176 | template<typename T, T ...A> |
177 | struct t11 { |
178 | }; |
179 | |
180 | struct t12 { |
181 | t11<LocalEnum, LocalEnum1> v1; |
182 | }; |
183 | |
184 | template<decltype(ns::AnonEnum1)> |
185 | void f10() { |
186 | } |
187 | |
188 | int main() { |
189 | struct { } A; |
190 | auto L = []{}; |
191 | f1<int>(); |
192 | f1<float>(); |
193 | f1<bool>(); |
194 | f1<double>(); |
195 | f1<long>(); |
196 | f1<short>(); |
197 | f1<unsigned>(); |
198 | f1<unsigned long long>(); |
199 | f1<long long>(); |
200 | f1<udt>(); |
201 | f1<ns::udt>(); |
202 | f1<ns::udt*>(); |
203 | f1<ns::inner::udt>(); |
204 | f1<t1<int>>(); |
205 | f1<int, float>(); |
206 | f1<int *>(); |
207 | f1<int &>(); |
208 | f1<int &&>(); |
209 | f1<const int>(); |
210 | f1<int[3]>(); |
211 | f1<void>(); |
212 | f1<outer_class::inner_class>(); |
213 | f1<unsigned long>(); |
214 | f2<true, 3>(); |
215 | f3<ns::Enumeration, ns::Enumerator3, (ns::Enumeration)2>(); |
216 | f3<ns::EnumerationClass, ns::EnumerationClass::Enumerator3, (ns::EnumerationClass)2>(); |
217 | f3<ns::EnumerationSmall, ns::kNeg>(); |
218 | f3<decltype(ns::AnonEnum1), ns::AnonEnum3, (decltype(ns::AnonEnum1))2>(); |
219 | f3<LocalEnum, LocalEnum1>(); |
220 | f3<int*, &i>(); |
221 | f3<int*, nullptr>(); |
222 | t4<3> v2; |
223 | f3<unsigned long, 1>(); |
224 | f3<unsigned long long, 1>(); |
225 | f3<long, 1>(); |
226 | f3<unsigned int, 1>(); |
227 | f3<short, 1>(); |
228 | f3<unsigned char, (char)0>(); |
229 | f3<signed char, (char)0>(); |
230 | f3<unsigned short, 1, 2>(); |
231 | f3<char, 0, 1, 6, 7, 13, 14, 31, 32, 33, (char)127, (char)128>(); |
232 | f3<__int128, ((__int128)9223372036854775807) * 2>(); |
233 | f4<unsigned int>(); |
234 | f1<t3<int>>(); |
235 | f1<t3<t3<int>>>(); |
236 | f1<decltype(L)>(); |
237 | t3<decltype(L)> v1; |
238 | f1<t3<t3<decltype(L)>>>(); |
239 | f1<int(float)>(); |
240 | f1<void(...)>(); |
241 | f1<void(int, ...)>(); |
242 | f1<const int &>(); |
243 | f1<const int *&>(); |
244 | f1<t5>(); |
245 | f1<decltype(nullptr)>(); |
246 | f1<long*, long*>(); |
247 | f1<long*, udt*>(); |
248 | f1<void *const>(); |
249 | f1<const void *const *>(); |
250 | f1<void()>(); |
251 | f1<void(*)()>(); |
252 | f1<decltype(&L)>(); |
253 | f1<decltype(A)>(); |
254 | f1<decltype(&A)>(); |
255 | f5<t1<int>>(); |
256 | f5<>(); |
257 | f6<t1<int>>(); |
258 | f1<>(); |
259 | f1<const void*, const void*>(); |
260 | f1<t1<int*>*>(); |
261 | f1<int *[]>(); |
262 | t6 v6; |
263 | v6.operator<< <int>(1); |
264 | v6.operator< <int>(1); |
265 | v6.operator<= <int>(1); |
266 | v6.operator t1<float>*(); |
267 | v6.operator- <int>(3); |
268 | v6.operator* <int>(3); |
269 | v6.operator/ <int>(3); |
270 | v6.operator% <int>(3); |
271 | v6.operator^ <int>(3); |
272 | v6.operator& <int>(3); |
273 | v6.operator| <int>(3); |
274 | v6.operator~ <int>(); |
275 | v6.operator! <int>(); |
276 | v6.operator= <int>(3); |
277 | v6.operator> <int>(3); |
278 | v6.operator, <int>(3); |
279 | v6.operator() <int>(); |
280 | v6.operator[] <int>(3); |
281 | v6.operator<=> <int>(3); |
282 | t6::operator new(0, 0); |
283 | t6::operator new[](0, 0); |
284 | t6::operator delete(nullptr, 0); |
285 | t6::operator delete[](nullptr, 0); |
286 | v6.operator co_await<int>(); |
287 | 42_suff; |
288 | struct t7 { }; |
289 | f1<t7>(); |
290 | f1<int(&)[3]>(); |
291 | f1<int(*)[3]>(); |
292 | f7<t1>(); |
293 | f8<t1, int>(); |
294 | using namespace ns; |
295 | ttp_user<inner::ttp>(); |
296 | f1<int*, decltype(nullptr)*>(); |
297 | t7i x; |
298 | f1<t7i>(); |
299 | f7<ns::inl::t9>(); |
300 | f1<_Atomic(int)>(); |
301 | f1<int, long, volatile char>(); |
302 | f1<__attribute__((__vector_size__(sizeof(int) * 2))) int>(); |
303 | f1<int *const volatile>(); |
304 | f1<const volatile void>(); |
305 | f1<t1<decltype(L)>>(); |
306 | t10 v3; |
307 | f1<void (::udt::*)() const>(); |
308 | f1<void (::udt::*)() volatile &>(); |
309 | f1<void (::udt::*)() const volatile &&>(); |
310 | f9<int>(); |
311 | f1<void (*const)()>(); |
312 | f1<char const (&)[1]>(); |
313 | f1<void () const &>(); |
314 | f1<void () volatile &&>(); |
315 | f1<void () const volatile>(); |
316 | f1<int *const[1]>(); |
317 | f1<int *const(&)[1]>(); |
318 | f1<void (::udt::* const&)()>(); |
319 | f1<void (*(int))(float)>(); |
320 | f1<t1<int>[1]>(); |
321 | f1<void (*)() noexcept>(); |
322 | f1<void (decltype(A))>(); |
323 | struct t8 { decltype(A) m; }; |
324 | f1<void(t8, decltype(A))>(); |
325 | f1<void(t8)>(); |
326 | operator_not_really<int>(); |
327 | t12 v4; |
328 | f1<_BitInt(3)>(); |
329 | f1<const unsigned _BitInt(5)>(); |
330 | f1<void(t1<>, t1<>)>(); |
331 | f1<int t1<>::*>(); |
332 | void fcc() __attribute__((swiftcall)); |
333 | f1<decltype(fcc)>(); |
334 | int fnrt() __attribute__((noreturn)); |
335 | f1<decltype(fnrt)>(); |
336 | f10<ns::AnonEnum1>(); |
337 | } |
338 | void t8::mem() { |
339 | struct t7 { }; |
340 | f1<t7>(); |
341 | f1<decltype(&t8::mem)>(); |
342 | } |
343 | namespace complex_type_units { |
344 | void external_function(); |
345 | namespace { |
346 | struct internal_type; |
347 | } |
348 | template <void (*)() = external_function> struct t2; |
349 | template <typename = t2<>> class t3 {}; |
350 | template <typename = internal_type, typename = t3<>> |
351 | struct t4 { |
352 | }; |
353 | struct t5 { |
354 | t4<> v1; |
355 | }; |
356 | void f1() { |
357 | t5 v1; |
358 | t3<> v2; |
359 | } |
360 | } |
361 | |