| 1 |
// RUN: %clang_cc1 -fblocks -emit-llvm %s -o - -triple=i386-pc-win32 -std=c++98 | FileCheck %s |
| 2 |
// RUN: %clang_cc1 -fblocks -emit-llvm %s -o - -triple=x86_64-pc-win32 -std=c++98| FileCheck -check-prefix X64 %s |
| 3 |
// RUN: %clang_cc1 -fblocks -emit-llvm %s -o - -triple=x86_64-uefi -std=c++98| FileCheck -check-prefix X64 %s |
| 4 |
// RUN: %clang_cc1 -fblocks -emit-llvm %s -o - -triple=aarch64-pc-win32 -std=c++98 -DARM | FileCheck -check-prefixes=X64,ARM %s |
| 5 |
|
| 6 |
int a; |
| 7 |
// CHECK-DAG: @"?a@@3HA" |
| 8 |
|
| 9 |
extern "C++" { |
| 10 |
static int __attribute__((used)) ignore_transparent_context; |
| 11 |
// CHECK-DAG: @ignore_transparent_context |
| 12 |
} |
| 13 |
|
| 14 |
namespace N { |
| 15 |
int b; |
| 16 |
// CHECK-DAG: @"?b@N@@3HA" |
| 17 |
|
| 18 |
namespace { |
| 19 |
int anonymous; |
| 20 |
// CHECK-DAG: @"?anonymous@?A0x{{[^@]*}}@N@@3HA" |
| 21 |
} |
| 22 |
} |
| 23 |
|
| 24 |
static int c; |
| 25 |
// CHECK-DAG: @c |
| 26 |
|
| 27 |
int _c(void) {return N::anonymous + c;} |
| 28 |
// CHECK-DAG: @"?_c@@YAHXZ" |
| 29 |
// X64-DAG: @"?_c@@YAHXZ" |
| 30 |
|
| 31 |
const int &NeedsReferenceTemporary = 2; |
| 32 |
// CHECK-DAG: @"?NeedsReferenceTemporary@@3ABHB" = dso_local constant ptr @"?$RT1@NeedsReferenceTemporary@@3ABHB" |
| 33 |
// X64-DAG: @"?NeedsReferenceTemporary@@3AEBHEB" = dso_local constant ptr @"?$RT1@NeedsReferenceTemporary@@3AEBHEB" |
| 34 |
|
| 35 |
class foo { |
| 36 |
static const short d; |
| 37 |
// CHECK-DAG: @"?d@foo@@0FB" |
| 38 |
protected: |
| 39 |
static volatile long e; |
| 40 |
// CHECK-DAG: @"?e@foo@@1JC" |
| 41 |
public: |
| 42 |
static const volatile char f; |
| 43 |
// CHECK-DAG: @"?f@foo@@2DD" |
| 44 |
int operator+(int a); |
| 45 |
foo(){} |
| 46 |
// CHECK-DAG: @"??0foo@@QAE@XZ" |
| 47 |
// X64-DAG: @"??0foo@@QEAA@XZ" |
| 48 |
|
| 49 |
~foo(){} |
| 50 |
// CHECK-DAG: @"??1foo@@QAE@XZ" |
| 51 |
// X64-DAG: @"??1foo@@QEAA@XZ |
| 52 |
|
| 53 |
foo(int i){} |
| 54 |
// CHECK-DAG: @"??0foo@@QAE@H@Z" |
| 55 |
// X64-DAG: @"??0foo@@QEAA@H@Z" |
| 56 |
|
| 57 |
foo(char *q){} |
| 58 |
// CHECK-DAG: @"??0foo@@QAE@PAD@Z" |
| 59 |
// X64-DAG: @"??0foo@@QEAA@PEAD@Z" |
| 60 |
|
| 61 |
static foo* static_method() { return 0; } |
| 62 |
|
| 63 |
}f,s1(1),s2((char*)0); |
| 64 |
|
| 65 |
typedef foo (foo2); |
| 66 |
|
| 67 |
struct bar { |
| 68 |
static int g; |
| 69 |
}; |
| 70 |
|
| 71 |
union baz { |
| 72 |
int a; |
| 73 |
char b; |
| 74 |
double c; |
| 75 |
}; |
| 76 |
|
| 77 |
enum quux { |
| 78 |
qone, |
| 79 |
qtwo, |
| 80 |
qthree |
| 81 |
}; |
| 82 |
|
| 83 |
foo bar() { return foo(); } |
| 84 |
// CHECK-DAG: @"?bar@@YA?AVfoo@@XZ" |
| 85 |
// X64-DAG: @"?bar@@YA?AVfoo@@XZ" |
| 86 |
|
| 87 |
int foo::operator+(int a) { |
| 88 |
// CHECK-DAG: @"??Hfoo@@QAEHH@Z" |
| 89 |
// X64-DAG: @"??Hfoo@@QEAAHH@Z" |
| 90 |
|
| 91 |
foo::static_method(); |
| 92 |
// CHECK-DAG: @"?static_method@foo@@SAPAV1@XZ" |
| 93 |
// X64-DAG: @"?static_method@foo@@SAPEAV1@XZ" |
| 94 |
bar(); |
| 95 |
return a; |
| 96 |
} |
| 97 |
|
| 98 |
const short foo::d = 0; |
| 99 |
volatile long foo::e; |
| 100 |
const volatile char foo::f = 'C'; |
| 101 |
|
| 102 |
int bar::g; |
| 103 |
// CHECK-DAG: @"?g@bar@@2HA" |
| 104 |
|
| 105 |
extern int * const h1 = &a; |
| 106 |
// CHECK-DAG: @"?h1@@3QAHA" |
| 107 |
extern const int * const h2 = &a; |
| 108 |
// CHECK-DAG: @"?h2@@3QBHB" |
| 109 |
extern int * const __restrict h3 = &a; |
| 110 |
// CHECK-DAG: @"?h3@@3QIAHIA" |
| 111 |
// X64-DAG: @"?h3@@3QEIAHEIA" |
| 112 |
|
| 113 |
int i[10][20]; |
| 114 |
// CHECK-DAG: @"?i@@3PAY0BE@HA" |
| 115 |
|
| 116 |
typedef int (*FunT)(int, int); |
| 117 |
FunT FunArr[10][20]; |
| 118 |
// CHECK-DAG: @"?FunArr@@3PAY0BE@P6AHHH@ZA" |
| 119 |
// X64-DAG: @"?FunArr@@3PAY0BE@P6AHHH@ZA" |
| 120 |
|
| 121 |
int (__stdcall *j)(signed char, unsigned char); |
| 122 |
// CHECK-DAG: @"?j@@3P6GHCE@ZA" |
| 123 |
|
| 124 |
const char foo2::*m; |
| 125 |
// CHECK-DAG: @"?m@@3PRfoo@@DR1@" |
| 126 |
// X64-DAG: @"?m@@3PERfoo@@DER1@" |
| 127 |
|
| 128 |
const volatile char foo2::*k; |
| 129 |
// CHECK-DAG: @"?k@@3PTfoo@@DT1@" |
| 130 |
// X64-DAG: @"?k@@3PETfoo@@DET1@" |
| 131 |
|
| 132 |
int (foo2::*l)(int); |
| 133 |
// CHECK-DAG: @"?l@@3P8foo@@AEHH@ZQ1@" |
| 134 |
|
| 135 |
// Ensure typedef CV qualifiers are mangled correctly |
| 136 |
typedef const int cInt; |
| 137 |
typedef volatile int vInt; |
| 138 |
typedef const volatile int cvInt; |
| 139 |
|
| 140 |
extern cInt g_cInt = 1; |
| 141 |
vInt g_vInt = 2; |
| 142 |
cvInt g_cvInt = 3; |
| 143 |
|
| 144 |
// CHECK-DAG: @"?g_cInt@@3HB" |
| 145 |
// CHECK-DAG: @"?g_vInt@@3HC" |
| 146 |
// CHECK-DAG: @"?g_cvInt@@3HD" |
| 147 |
|
| 148 |
// Static functions are mangled, too. |
| 149 |
// Also make sure calling conventions, arglists, and throw specs work. |
| 150 |
static void __stdcall alpha(float a, double b) throw() {} |
| 151 |
bool __fastcall beta(long long a, wchar_t b) throw(signed char, unsigned char) { |
| 152 |
// CHECK-DAG: @"?beta@@YI_N_J_W@Z" |
| 153 |
// X64-DAG: @"?beta@@YA_N_J_W@Z" |
| 154 |
alpha(0.f, 0.0); |
| 155 |
return false; |
| 156 |
} |
| 157 |
|
| 158 |
// CHECK-DAG: @"?alpha@@YGXMN@Z" |
| 159 |
// X64-DAG: @"?alpha@@YAXMN@Z" |
| 160 |
|
| 161 |
// Make sure tag-type mangling works. |
| 162 |
void gamma(class foo, struct bar, union baz, enum quux) {} |
| 163 |
// CHECK-DAG: @"?gamma@@YAXVfoo@@Ubar@@Tbaz@@W4quux@@@Z" |
| 164 |
// X64-DAG: @"?gamma@@YAXVfoo@@Ubar@@Tbaz@@W4quux@@@Z" |
| 165 |
|
| 166 |
// Make sure pointer/reference-type mangling works. |
| 167 |
void delta(int * const a, const long &) {} |
| 168 |
// CHECK-DAG: @"?delta@@YAXQAHABJ@Z" |
| 169 |
// X64-DAG: @"?delta@@YAXQEAHAEBJ@Z" |
| 170 |
|
| 171 |
// Array mangling. |
| 172 |
void epsilon(int a[][10][20]) {} |
| 173 |
// CHECK-DAG: @"?epsilon@@YAXQAY19BE@H@Z" |
| 174 |
// X64-DAG: @"?epsilon@@YAXQEAY19BE@H@Z" |
| 175 |
|
| 176 |
void zeta(int (*)(int, int)) {} |
| 177 |
// CHECK-DAG: @"?zeta@@YAXP6AHHH@Z@Z" |
| 178 |
// X64-DAG: @"?zeta@@YAXP6AHHH@Z@Z" |
| 179 |
|
| 180 |
// Blocks mangling (Clang extension). A block should be mangled slightly |
| 181 |
// differently from a similar function pointer. |
| 182 |
void eta(int (^)(int, int)) {} |
| 183 |
// CHECK-DAG: @"?eta@@YAXP_EAHHH@Z@Z" |
| 184 |
|
| 185 |
typedef int theta_arg(int,int); |
| 186 |
void theta(theta_arg^ block) {} |
| 187 |
// CHECK-DAG: @"?theta@@YAXP_EAHHH@Z@Z" |
| 188 |
|
| 189 |
void operator_new_delete() { |
| 190 |
char *ptr = new char; |
| 191 |
// CHECK-DAG: @"??2@YAPAXI@Z" |
| 192 |
|
| 193 |
delete ptr; |
| 194 |
// CHECK-DAG: @"??3@YAXPAX@Z" |
| 195 |
|
| 196 |
char *array = new char[42]; |
| 197 |
// CHECK-DAG: @"??_U@YAPAXI@Z" |
| 198 |
|
| 199 |
delete [] array; |
| 200 |
// CHECK-DAG: @"??_V@YAXPAX@Z" |
| 201 |
} |
| 202 |
|
| 203 |
// PR13022 |
| 204 |
void (redundant_parens)(); |
| 205 |
void redundant_parens_use() { redundant_parens(); } |
| 206 |
// CHECK-DAG: @"?redundant_parens@@YAXXZ" |
| 207 |
// X64-DAG: @"?redundant_parens@@YAXXZ" |
| 208 |
|
| 209 |
// PR13047 |
| 210 |
typedef double RGB[3]; |
| 211 |
RGB color1; |
| 212 |
// CHECK-DAG: @"?color1@@3PANA" |
| 213 |
extern const RGB color2 = {}; |
| 214 |
// CHECK-DAG: @"?color2@@3QBNB" |
| 215 |
extern RGB const color3[5] = {}; |
| 216 |
// CHECK-DAG: @"?color3@@3QAY02$$CBNA" |
| 217 |
extern RGB const ((color4)[5]) = {}; |
| 218 |
// CHECK-DAG: @"?color4@@3QAY02$$CBNA" |
| 219 |
|
| 220 |
struct B; |
| 221 |
volatile int B::* volatile memptr1; |
| 222 |
// X64-DAG: @"?memptr1@@3RESB@@HES1@" |
| 223 |
volatile int B::* memptr2; |
| 224 |
// X64-DAG: @"?memptr2@@3PESB@@HES1@" |
| 225 |
int B::* volatile memptr3; |
| 226 |
// X64-DAG: @"?memptr3@@3REQB@@HEQ1@" |
| 227 |
typedef int (*fun)(); |
| 228 |
volatile fun B::* volatile funmemptr1; |
| 229 |
// X64-DAG: @"?funmemptr1@@3RESB@@R6AHXZES1@" |
| 230 |
volatile fun B::* funmemptr2; |
| 231 |
// X64-DAG: @"?funmemptr2@@3PESB@@R6AHXZES1@" |
| 232 |
fun B::* volatile funmemptr3; |
| 233 |
// X64-DAG: @"?funmemptr3@@3REQB@@P6AHXZEQ1@" |
| 234 |
void (B::* volatile memptrtofun1)(); |
| 235 |
// X64-DAG: @"?memptrtofun1@@3R8B@@EAAXXZEQ1@" |
| 236 |
const void (B::* memptrtofun2)(); |
| 237 |
// X64-DAG: @"?memptrtofun2@@3P8B@@EAAXXZEQ1@" |
| 238 |
volatile void (B::* memptrtofun3)(); |
| 239 |
// X64-DAG: @"?memptrtofun3@@3P8B@@EAAXXZEQ1@" |
| 240 |
int (B::* volatile memptrtofun4)(); |
| 241 |
// X64-DAG: @"?memptrtofun4@@3R8B@@EAAHXZEQ1@" |
| 242 |
volatile int (B::* memptrtofun5)(); |
| 243 |
// X64-DAG: @"?memptrtofun5@@3P8B@@EAA?CHXZEQ1@" |
| 244 |
const int (B::* memptrtofun6)(); |
| 245 |
// X64-DAG: @"?memptrtofun6@@3P8B@@EAA?BHXZEQ1@" |
| 246 |
fun (B::* volatile memptrtofun7)(); |
| 247 |
// X64-DAG: @"?memptrtofun7@@3R8B@@EAAP6AHXZXZEQ1@" |
| 248 |
volatile fun (B::* memptrtofun8)(); |
| 249 |
// X64-DAG: @"?memptrtofun8@@3P8B@@EAAR6AHXZXZEQ1@" |
| 250 |
const fun (B::* memptrtofun9)(); |
| 251 |
// X64-DAG: @"?memptrtofun9@@3P8B@@EAAQ6AHXZXZEQ1@" |
| 252 |
|
| 253 |
// PR12603 |
| 254 |
enum E {}; |
| 255 |
// CHECK-DAG: "?fooE@@YA?AW4E@@XZ" |
| 256 |
// X64-DAG: "?fooE@@YA?AW4E@@XZ" |
| 257 |
E fooE() { return E(); } |
| 258 |
|
| 259 |
class X {}; |
| 260 |
// CHECK-DAG: "?fooX@@YA?AVX@@XZ" |
| 261 |
// X64-DAG: "?fooX@@YA?AVX@@XZ" |
| 262 |
X fooX() { return X(); } |
| 263 |
|
| 264 |
namespace PR13182 { |
| 265 |
extern char s0[]; |
| 266 |
// CHECK-DAG: @"?s0@PR13182@@3PADA" |
| 267 |
extern char s1[42]; |
| 268 |
// CHECK-DAG: @"?s1@PR13182@@3PADA" |
| 269 |
extern const char s2[]; |
| 270 |
// CHECK-DAG: @"?s2@PR13182@@3QBDB" |
| 271 |
extern const char s3[42]; |
| 272 |
// CHECK-DAG: @"?s3@PR13182@@3QBDB" |
| 273 |
extern volatile char s4[]; |
| 274 |
// CHECK-DAG: @"?s4@PR13182@@3RCDC" |
| 275 |
extern const volatile char s5[]; |
| 276 |
// CHECK-DAG: @"?s5@PR13182@@3SDDD" |
| 277 |
extern const char* const* s6; |
| 278 |
// CHECK-DAG: @"?s6@PR13182@@3PBQBDB" |
| 279 |
|
| 280 |
char foo() { |
| 281 |
return s0[0] + s1[0] + s2[0] + s3[0] + s4[0] + s5[0] + s6[0][0]; |
| 282 |
} |
| 283 |
} |
| 284 |
|
| 285 |
extern "C" inline void extern_c_func() { |
| 286 |
static int local; |
| 287 |
// CHECK-DAG: @"?local@?1??extern_c_func@@9@4HA" |
| 288 |
// X64-DAG: @"?local@?1??extern_c_func@@9@4HA" |
| 289 |
} |
| 290 |
|
| 291 |
void call_extern_c_func() { |
| 292 |
extern_c_func(); |
| 293 |
} |
| 294 |
|
| 295 |
int main() { return 0; } |
| 296 |
// CHECK-DAG: @main |
| 297 |
// X64-DAG: @main |
| 298 |
|
| 299 |
int wmain() { return 0; } |
| 300 |
// CHECK-DAG: @wmain |
| 301 |
// X64-DAG: @wmain |
| 302 |
|
| 303 |
int WinMain() { return 0; } |
| 304 |
// CHECK-DAG: @WinMain |
| 305 |
// X64-DAG: @WinMain |
| 306 |
|
| 307 |
int wWinMain() { return 0; } |
| 308 |
// CHECK-DAG: @wWinMain |
| 309 |
// X64-DAG: @wWinMain |
| 310 |
|
| 311 |
int DllMain() { return 0; } |
| 312 |
// CHECK-DAG: @DllMain |
| 313 |
// X64-DAG: @DllMain |
| 314 |
|
| 315 |
inline int inline_function_with_local_type() { |
| 316 |
static struct { |
| 317 |
int a_field; |
| 318 |
} static_variable_in_inline_function = { 20 }, second_static = { 40 }; |
| 319 |
// CHECK: @"?static_variable_in_inline_function@?1??inline_function_with_local_type@@YAHXZ@4U<unnamed-type-static_variable_in_inline_function>@?1??1@YAHXZ@A" |
| 320 |
|
| 321 |
return static_variable_in_inline_function.a_field + second_static.a_field; |
| 322 |
} |
| 323 |
|
| 324 |
int call_inline_function_with_local_type() { |
| 325 |
return inline_function_with_local_type(); |
| 326 |
} |
| 327 |
|
| 328 |
template <typename T> |
| 329 |
inline int templated_inline_function_with_local_type() { |
| 330 |
static struct { |
| 331 |
int a_field; |
| 332 |
} static_variable_in_templated_inline_function = { 20 }, |
| 333 |
second_static = { 40 }; |
| 334 |
// CHECK: @"?static_variable_in_templated_inline_function@?1???$templated_inline_function_with_local_type@H@@YAHXZ@4U<unnamed-type-static_variable_in_templated_inline_function>@?1???$templated_inline_function_with_local_type@H@@YAHXZ@A" |
| 335 |
|
| 336 |
return static_variable_in_templated_inline_function.a_field + |
| 337 |
second_static.a_field; |
| 338 |
} |
| 339 |
|
| 340 |
int call_templated_inline_function_with_local_type() { |
| 341 |
return templated_inline_function_with_local_type<int>(); |
| 342 |
} |
| 343 |
|
| 344 |
// PR17371 |
| 345 |
struct OverloadedNewDelete { |
| 346 |
// __cdecl |
| 347 |
void *operator new(__SIZE_TYPE__); |
| 348 |
void *operator new[](__SIZE_TYPE__); |
| 349 |
void operator delete(void *); |
| 350 |
void operator delete[](void *); |
| 351 |
// __thiscall |
| 352 |
int operator+(int); |
| 353 |
}; |
| 354 |
|
| 355 |
void *OverloadedNewDelete::operator new(__SIZE_TYPE__ s) { return 0; } |
| 356 |
void *OverloadedNewDelete::operator new[](__SIZE_TYPE__ s) { return 0; } |
| 357 |
void OverloadedNewDelete::operator delete(void *) { } |
| 358 |
void OverloadedNewDelete::operator delete[](void *) { } |
| 359 |
int OverloadedNewDelete::operator+(int x) { return x; }; |
| 360 |
|
| 361 |
// CHECK-DAG: ??2OverloadedNewDelete@@SAPAXI@Z |
| 362 |
// CHECK-DAG: ??_UOverloadedNewDelete@@SAPAXI@Z |
| 363 |
// CHECK-DAG: ??3OverloadedNewDelete@@SAXPAX@Z |
| 364 |
// CHECK-DAG: ??_VOverloadedNewDelete@@SAXPAX@Z |
| 365 |
// CHECK-DAG: ??HOverloadedNewDelete@@QAEHH@Z |
| 366 |
|
| 367 |
// X64-DAG: ??2OverloadedNewDelete@@SAPEAX_K@Z |
| 368 |
// X64-DAG: ??_UOverloadedNewDelete@@SAPEAX_K@Z |
| 369 |
// X64-DAG: ??3OverloadedNewDelete@@SAXPEAX@Z |
| 370 |
// X64-DAG: ??_VOverloadedNewDelete@@SAXPEAX@Z |
| 371 |
// X64-DAG: ??HOverloadedNewDelete@@QEAAHH@Z |
| 372 |
|
| 373 |
// Indirecting the function type through a typedef will require a calling |
| 374 |
// convention adjustment before building the method decl. |
| 375 |
|
| 376 |
typedef void *__thiscall OperatorNewType(__SIZE_TYPE__); |
| 377 |
typedef void __thiscall OperatorDeleteType(void *); |
| 378 |
|
| 379 |
struct TypedefNewDelete { |
| 380 |
OperatorNewType operator new; |
| 381 |
OperatorNewType operator new[]; |
| 382 |
OperatorDeleteType operator delete; |
| 383 |
OperatorDeleteType operator delete[]; |
| 384 |
}; |
| 385 |
|
| 386 |
void *TypedefNewDelete::operator new(__SIZE_TYPE__ s) { return 0; } |
| 387 |
void *TypedefNewDelete::operator new[](__SIZE_TYPE__ s) { return 0; } |
| 388 |
void TypedefNewDelete::operator delete(void *) { } |
| 389 |
void TypedefNewDelete::operator delete[](void *) { } |
| 390 |
|
| 391 |
// CHECK-DAG: ??2TypedefNewDelete@@SAPAXI@Z |
| 392 |
// CHECK-DAG: ??_UTypedefNewDelete@@SAPAXI@Z |
| 393 |
// CHECK-DAG: ??3TypedefNewDelete@@SAXPAX@Z |
| 394 |
// CHECK-DAG: ??_VTypedefNewDelete@@SAXPAX@Z |
| 395 |
|
| 396 |
void __vectorcall vector_func() { } |
| 397 |
// CHECK-DAG: @"?vector_func@@YQXXZ" |
| 398 |
|
| 399 |
template <void (*)(void)> |
| 400 |
void fn_tmpl() {} |
| 401 |
|
| 402 |
template void fn_tmpl<extern_c_func>(); |
| 403 |
// CHECK-DAG: @"??$fn_tmpl@$1?extern_c_func@@YAXXZ@@YAXXZ" |
| 404 |
|
| 405 |
extern "C" void __attribute__((overloadable)) overloaded_fn() {} |
| 406 |
// CHECK-DAG: @"?overloaded_fn@@$$J0YAXXZ" |
| 407 |
|
| 408 |
extern "C" void overloaded_fn2() {} |
| 409 |
// CHECK-DAG: @overloaded_fn2 |
| 410 |
// |
| 411 |
extern "C" void __attribute__((overloadable)) overloaded_fn3(); |
| 412 |
extern "C" void overloaded_fn3() {} |
| 413 |
// CHECK-DAG: @overloaded_fn3 |
| 414 |
|
| 415 |
namespace UnnamedType { |
| 416 |
struct S { |
| 417 |
typedef struct {} *T1[1]; |
| 418 |
typedef struct {} T2; |
| 419 |
typedef struct {} *T3, T4; |
| 420 |
using T5 = struct {}; |
| 421 |
using T6 = struct {} *; |
| 422 |
}; |
| 423 |
void f(S::T1) {} |
| 424 |
void f(S::T2) {} |
| 425 |
void f(S::T3) {} |
| 426 |
void f(S::T4) {} |
| 427 |
void f(S::T5) {} |
| 428 |
void f(S::T6) {} |
| 429 |
// CHECK-DAG: @"?f@UnnamedType@@YAXQAPAU<unnamed-type-T1>@S@1@@Z" |
| 430 |
// CHECK-DAG: @"?f@UnnamedType@@YAXUT2@S@1@@Z" |
| 431 |
// CHECK-DAG: @"?f@UnnamedType@@YAXPAUT4@S@1@@Z" |
| 432 |
// CHECK-DAG: @"?f@UnnamedType@@YAXUT4@S@1@@Z" |
| 433 |
// CHECK-DAG: @"?f@UnnamedType@@YAXUT5@S@1@@Z" |
| 434 |
// CHECK-DAG: @"?f@UnnamedType@@YAXPAU<unnamed-type-T6>@S@1@@Z" |
| 435 |
|
| 436 |
// X64-DAG: @"?f@UnnamedType@@YAXQEAPEAU<unnamed-type-T1>@S@1@@Z" |
| 437 |
// X64-DAG: @"?f@UnnamedType@@YAXUT2@S@1@@Z" |
| 438 |
// X64-DAG: @"?f@UnnamedType@@YAXPEAUT4@S@1@@Z"(ptr |
| 439 |
// X64-DAG: @"?f@UnnamedType@@YAXUT4@S@1@@Z" |
| 440 |
// X64-DAG: @"?f@UnnamedType@@YAXUT5@S@1@@Z" |
| 441 |
// X64-DAG: @"?f@UnnamedType@@YAXPEAU<unnamed-type-T6>@S@1@@Z" |
| 442 |
} |
| 443 |
|
| 444 |
namespace PassObjectSize { |
| 445 |
// NOTE: This mangling is subject to change. |
| 446 |
// Reiterating from the comment in MicrosoftMangle, the scheme is pretend a |
| 447 |
// parameter of type __clang::__pass_object_sizeN exists after each pass object |
| 448 |
// size param P, where N is the Type of the pass_object_size attribute on P. |
| 449 |
// |
| 450 |
// e.g. we want to mangle: |
| 451 |
// void foo(ptr const __attribute__((pass_object_size(0)))); |
| 452 |
// as if it were |
| 453 |
// namespace __clang { enum __pass_object_size0 : size_t {}; } |
| 454 |
// void foo(ptr const, __clang::__pass_object_size0); |
| 455 |
// where __clang is a top-level namespace. |
| 456 |
|
| 457 |
// CHECK-DAG: define dso_local noundef i32 @"?foo@PassObjectSize@@YAHQAHW4__pass_object_size0@__clang@@@Z" |
| 458 |
int foo(int *const i __attribute__((pass_object_size(0)))) { return 0; } |
| 459 |
// CHECK-DAG: define dso_local noundef i32 @"?bar@PassObjectSize@@YAHQAHW4__pass_object_size1@__clang@@@Z" |
| 460 |
int bar(int *const i __attribute__((pass_object_size(1)))) { return 0; } |
| 461 |
// CHECK-DAG: define dso_local noundef i32 @"?qux@PassObjectSize@@YAHQAHW4__pass_object_size1@__clang@@0W4__pass_object_size0@3@@Z" |
| 462 |
int qux(int *const i __attribute__((pass_object_size(1))), int *const j __attribute__((pass_object_size(0)))) { return 0; } |
| 463 |
// CHECK-DAG: define dso_local noundef i32 @"?zot@PassObjectSize@@YAHQAHW4__pass_object_size1@__clang@@01@Z" |
| 464 |
int zot(int *const i __attribute__((pass_object_size(1))), int *const j __attribute__((pass_object_size(1)))) { return 0; } |
| 465 |
// CHECK-DAG: define dso_local noundef i32 @"?silly_word@PassObjectSize@@YAHQAHW4__pass_dynamic_object_size1@__clang@@@Z" |
| 466 |
int silly_word(int *const i __attribute__((pass_dynamic_object_size(1)))) { return 0; } |
| 467 |
} |
| 468 |
|
| 469 |
namespace Atomic { |
| 470 |
// CHECK-DAG: define dso_local void @"?f@Atomic@@YAXU?$_Atomic@H@__clang@@@Z"( |
| 471 |
void f(_Atomic(int)) {} |
| 472 |
} |
| 473 |
namespace Complex { |
| 474 |
// CHECK-DAG: define dso_local void @"?f@Complex@@YAXU?$_Complex@H@__clang@@@Z"( |
| 475 |
void f(_Complex int) {} |
| 476 |
} |
| 477 |
#ifdef ARM |
| 478 |
namespace Float16 { |
| 479 |
// ARM-DAG: define dso_local void @"?f@Float16@@YAXU_Float16@__clang@@@Z"( |
| 480 |
void f(_Float16) {} |
| 481 |
} |
| 482 |
#endif // ARM |
| 483 |
|
| 484 |
namespace PR26029 { |
| 485 |
template <class> |
| 486 |
struct L { |
| 487 |
L() {} |
| 488 |
}; |
| 489 |
template <class> |
| 490 |
class H; |
| 491 |
struct M : L<H<int *> > {}; |
| 492 |
|
| 493 |
template <class> |
| 494 |
struct H {}; |
| 495 |
|
| 496 |
template <class GT> |
| 497 |
void m_fn3() { |
| 498 |
(H<GT *>()); |
| 499 |
M(); |
| 500 |
} |
| 501 |
|
| 502 |
void runOnFunction() { |
| 503 |
L<H<int *> > b; |
| 504 |
m_fn3<int>(); |
| 505 |
} |
| 506 |
// CHECK-DAG: call {{.*}} @"??0?$L@V?$H@PAH@PR26029@@@PR26029@@QAE@XZ" |
| 507 |
} |