| 1 |
// RUN: %clang_cc1 -fms-extensions -fblocks -emit-llvm %s -o - -triple=i386-pc-win32 | FileCheck %s |
| 2 |
|
| 3 |
namespace NS { |
| 4 |
// The name "RT1" for the name of the class below has been specifically |
| 5 |
// chosen to ensure that back reference lookup does not match against the |
| 6 |
// implicitly generated "$RT1" name of the reference temporary symbol. |
| 7 |
struct RT1 { |
| 8 |
static const RT1& singleton; |
| 9 |
int i; |
| 10 |
}; |
| 11 |
const RT1& RT1::singleton = RT1{1}; |
| 12 |
} |
| 13 |
// CHECK: "?$RT1@singleton@RT1@NS@@2ABU23@B" |
| 14 |
// CHECK: "?singleton@RT1@NS@@2ABU12@B" |
| 15 |
|
| 16 |
void f1(const char* a, const char* b) {} |
| 17 |
// CHECK: "?f1@@YAXPBD0@Z" |
| 18 |
|
| 19 |
void f2(const char* a, char* b) {} |
| 20 |
// CHECK: "?f2@@YAXPBDPAD@Z" |
| 21 |
|
| 22 |
void f3(int a, const char* b, const char* c) {} |
| 23 |
// CHECK: "?f3@@YAXHPBD0@Z" |
| 24 |
|
| 25 |
const char *f4(const char* a, const char* b) { return 0; } |
| 26 |
// CHECK: "?f4@@YAPBDPBD0@Z" |
| 27 |
|
| 28 |
void f5(char const* a, unsigned int b, char c, void const* d, char const* e, unsigned int f) {} |
| 29 |
// CHECK: "?f5@@YAXPBDIDPBX0I@Z" |
| 30 |
|
| 31 |
void f6(bool a, bool b) {} |
| 32 |
// CHECK: "?f6@@YAX_N0@Z" |
| 33 |
|
| 34 |
void f7(int a, int* b, int c, int* d, bool e, bool f, bool* g) {} |
| 35 |
// CHECK: "?f7@@YAXHPAHH0_N1PA_N@Z" |
| 36 |
|
| 37 |
// FIXME: tests for more than 10 types? |
| 38 |
|
| 39 |
struct S { |
| 40 |
void mbb(bool a, bool b) {} |
| 41 |
}; |
| 42 |
|
| 43 |
void g1(struct S a) {} |
| 44 |
// CHECK: "?g1@@YAXUS@@@Z" |
| 45 |
|
| 46 |
void g2(struct S a, struct S b) {} |
| 47 |
// CHECK: "?g2@@YAXUS@@0@Z" |
| 48 |
|
| 49 |
void g3(struct S a, struct S b, struct S* c, struct S* d) {} |
| 50 |
// CHECK: "?g3@@YAXUS@@0PAU1@1@Z" |
| 51 |
|
| 52 |
void g4(const char* a, struct S* b, const char* c, struct S* d) { |
| 53 |
// CHECK: "?g4@@YAXPBDPAUS@@01@Z" |
| 54 |
b->mbb(false, false); |
| 55 |
// CHECK: "?mbb@S@@QAEX_N0@Z" |
| 56 |
} |
| 57 |
|
| 58 |
// Make sure that different aliases of built-in types end up mangled as the |
| 59 |
// built-ins. |
| 60 |
typedef unsigned int uintptr_t; |
| 61 |
typedef unsigned int size_t; |
| 62 |
void *h(size_t a, uintptr_t b) { return 0; } |
| 63 |
// CHECK: "?h@@YAPAXII@Z" |
| 64 |
|
| 65 |
// Function pointers might be mangled in a complex way. |
| 66 |
typedef void (*VoidFunc)(); |
| 67 |
typedef int* (*PInt3Func)(int* a, int* b); |
| 68 |
|
| 69 |
void h1(const char* a, const char* b, VoidFunc c, VoidFunc d) {} |
| 70 |
// CHECK: "?h1@@YAXPBD0P6AXXZ1@Z" |
| 71 |
|
| 72 |
void h2(void (*f_ptr)(void *), void *arg) {} |
| 73 |
// CHECK: "?h2@@YAXP6AXPAX@Z0@Z" |
| 74 |
|
| 75 |
PInt3Func h3(PInt3Func x, PInt3Func y, int* z) { return 0; } |
| 76 |
// CHECK: "?h3@@YAP6APAHPAH0@ZP6APAH00@Z10@Z" |
| 77 |
|
| 78 |
namespace foo { |
| 79 |
void foo() { } |
| 80 |
// CHECK: "?foo@0@YAXXZ" |
| 81 |
} |
| 82 |
|
| 83 |
class T01; |
| 84 |
class T02; |
| 85 |
class T03; |
| 86 |
class T04; |
| 87 |
class T05; |
| 88 |
class T06; |
| 89 |
class T07; |
| 90 |
class T08; |
| 91 |
class T09; |
| 92 |
class T10; |
| 93 |
class T11; |
| 94 |
template <typename T> |
| 95 |
class H; |
| 96 |
|
| 97 |
void ManyParams(T01 &, T02 &, T03 &, T04 &, T05 &, T06 &, T07 &, T08 &, T09 &, T10 &, H<T11> &, H<T11> &) {} |
| 98 |
// CHECK: "?ManyParams@@YAXAAVT01@@AAVT02@@AAVT03@@AAVT04@@AAVT05@@AAVT06@@AAVT07@@AAVT08@@AAVT09@@AAVT10@@AAV?$H@VT11@@@@AAV?$H@VT11@@@@@Z" |
| 99 |
|
| 100 |
namespace NS { |
| 101 |
// The name "TSS0" for the name of the class below has been specifically |
| 102 |
// chosen to ensure that back reference lookup does not match against the |
| 103 |
// implicitly generated "$TSS0" name of the thread safe static initialization |
| 104 |
// variable. |
| 105 |
struct __declspec(dllexport) TSS0 { |
| 106 |
static TSS0& get(); |
| 107 |
__forceinline static TSS0& singleton() { |
| 108 |
static TSS0& lsv = get(); |
| 109 |
return lsv; |
| 110 |
} |
| 111 |
}; |
| 112 |
} |
| 113 |
// CHECK: "?singleton@TSS0@NS@@SAAAU12@XZ" |
| 114 |
// CHECK: "?lsv@?1??singleton@TSS0@NS@@SAAAU23@XZ@4AAU23@A" |
| 115 |
// CHECK: "?$TSS0@?1??singleton@TSS0@NS@@SAAAU23@XZ@4HA" |