1; These tests are based on clang/test/CodeGenCXX/mangle-ms-arg-qualifiers.cpp 2; RUN: llvm-undname < %s | FileCheck %s 3 4; CHECK-NOT: Invalid mangled name 5 6?foo@@YAXI@Z 7; CHECK: void __cdecl foo(unsigned int) 8 9?foo@@YAXN@Z 10; CHECK: void __cdecl foo(double) 11 12?foo_pad@@YAXPAD@Z 13; CHECK: void __cdecl foo_pad(char *) 14?foo_pad@@YAXPEAD@Z 15; CHECK: void __cdecl foo_pad(char *) 16 17?foo_pbd@@YAXPBD@Z 18; CHECK: void __cdecl foo_pbd(char const *) 19?foo_pbd@@YAXPEBD@Z 20; CHECK: void __cdecl foo_pbd(char const *) 21 22?foo_pcd@@YAXPCD@Z 23; CHECK: void __cdecl foo_pcd(char volatile *) 24?foo_pcd@@YAXPECD@Z 25; CHECK: void __cdecl foo_pcd(char volatile *) 26 27?foo_qad@@YAXQAD@Z 28; CHECK: void __cdecl foo_qad(char *const) 29?foo_qad@@YAXQEAD@Z 30; CHECK: void __cdecl foo_qad(char *const) 31 32?foo_rad@@YAXRAD@Z 33; CHECK: void __cdecl foo_rad(char *volatile) 34?foo_rad@@YAXREAD@Z 35; CHECK: void __cdecl foo_rad(char *volatile) 36 37?foo_sad@@YAXSAD@Z 38; CHECK: void __cdecl foo_sad(char *const volatile) 39?foo_sad@@YAXSEAD@Z 40; CHECK: void __cdecl foo_sad(char *const volatile) 41 42?foo_piad@@YAXPIAD@Z 43; CHECK: void __cdecl foo_piad(char *__restrict) 44?foo_piad@@YAXPEIAD@Z 45; CHECK: void __cdecl foo_piad(char *__restrict) 46 47?foo_qiad@@YAXQIAD@Z 48; CHECK: void __cdecl foo_qiad(char *const __restrict) 49?foo_qiad@@YAXQEIAD@Z 50; CHECK: void __cdecl foo_qiad(char *const __restrict) 51 52?foo_riad@@YAXRIAD@Z 53; CHECK: void __cdecl foo_riad(char *volatile __restrict) 54?foo_riad@@YAXREIAD@Z 55; CHECK: void __cdecl foo_riad(char *volatile __restrict) 56 57?foo_siad@@YAXSIAD@Z 58; CHECK: void __cdecl foo_siad(char *const volatile __restrict) 59?foo_siad@@YAXSEIAD@Z 60; CHECK: void __cdecl foo_siad(char *const volatile __restrict) 61 62?foo_papad@@YAXPAPAD@Z 63; CHECK: void __cdecl foo_papad(char **) 64?foo_papad@@YAXPEAPEAD@Z 65; CHECK: void __cdecl foo_papad(char **) 66 67?foo_papbd@@YAXPAPBD@Z 68; CHECK: void __cdecl foo_papbd(char const **) 69?foo_papbd@@YAXPEAPEBD@Z 70; CHECK: void __cdecl foo_papbd(char const **) 71 72?foo_papcd@@YAXPAPCD@Z 73; CHECK: void __cdecl foo_papcd(char volatile **) 74?foo_papcd@@YAXPEAPECD@Z 75; CHECK: void __cdecl foo_papcd(char volatile **) 76 77?foo_pbqad@@YAXPBQAD@Z 78; CHECK: void __cdecl foo_pbqad(char *const *) 79?foo_pbqad@@YAXPEBQEAD@Z 80; CHECK: void __cdecl foo_pbqad(char *const *) 81 82?foo_pcrad@@YAXPCRAD@Z 83; CHECK: void __cdecl foo_pcrad(char *volatile *) 84?foo_pcrad@@YAXPECREAD@Z 85; CHECK: void __cdecl foo_pcrad(char *volatile *) 86 87?foo_qapad@@YAXQAPAD@Z 88; CHECK: void __cdecl foo_qapad(char **const) 89?foo_qapad@@YAXQEAPEAD@Z 90; CHECK: void __cdecl foo_qapad(char **const) 91 92?foo_rapad@@YAXRAPAD@Z 93; CHECK: void __cdecl foo_rapad(char **volatile) 94?foo_rapad@@YAXREAPEAD@Z 95; CHECK: void __cdecl foo_rapad(char **volatile) 96 97?foo_pbqbd@@YAXPBQBD@Z 98; CHECK: void __cdecl foo_pbqbd(char const *const *) 99?foo_pbqbd@@YAXPEBQEBD@Z 100; CHECK: void __cdecl foo_pbqbd(char const *const *) 101 102?foo_pbqcd@@YAXPBQCD@Z 103; CHECK: void __cdecl foo_pbqcd(char volatile *const *) 104?foo_pbqcd@@YAXPEBQECD@Z 105; CHECK: void __cdecl foo_pbqcd(char volatile *const *) 106 107?foo_pcrbd@@YAXPCRBD@Z 108; CHECK: void __cdecl foo_pcrbd(char const *volatile *) 109?foo_pcrbd@@YAXPECREBD@Z 110; CHECK: void __cdecl foo_pcrbd(char const *volatile *) 111 112?foo_pcrcd@@YAXPCRCD@Z 113; CHECK: void __cdecl foo_pcrcd(char volatile *volatile *) 114?foo_pcrcd@@YAXPECRECD@Z 115; CHECK: void __cdecl foo_pcrcd(char volatile *volatile *) 116 117?foo_aad@@YAXAAD@Z 118?foo_aad@@YAXAEAD@Z 119; CHECK: void __cdecl foo_aad(char &) 120 121?foo_abd@@YAXABD@Z 122; CHECK: void __cdecl foo_abd(char const &) 123?foo_abd@@YAXAEBD@Z 124; CHECK: void __cdecl foo_abd(char const &) 125 126?foo_aapad@@YAXAAPAD@Z 127; CHECK: void __cdecl foo_aapad(char *&) 128?foo_aapad@@YAXAEAPEAD@Z 129; CHECK: void __cdecl foo_aapad(char *&) 130 131?foo_aapbd@@YAXAAPBD@Z 132; CHECK: void __cdecl foo_aapbd(char const *&) 133?foo_aapbd@@YAXAEAPEBD@Z 134; CHECK: void __cdecl foo_aapbd(char const *&) 135 136?foo_abqad@@YAXABQAD@Z 137; CHECK: void __cdecl foo_abqad(char *const &) 138?foo_abqad@@YAXAEBQEAD@Z 139; CHECK: void __cdecl foo_abqad(char *const &) 140 141?foo_abqbd@@YAXABQBD@Z 142; CHECK: void __cdecl foo_abqbd(char const *const &) 143?foo_abqbd@@YAXAEBQEBD@Z 144; CHECK: void __cdecl foo_abqbd(char const *const &) 145 146?foo_aay144h@@YAXAAY144H@Z 147; CHECK: void __cdecl foo_aay144h(int (&)[5][5]) 148?foo_aay144h@@YAXAEAY144H@Z 149; CHECK: void __cdecl foo_aay144h(int (&)[5][5]) 150 151?foo_aay144cbh@@YAXAAY144$$CBH@Z 152; CHECK: void __cdecl foo_aay144cbh(int const (&)[5][5]) 153?foo_aay144cbh@@YAXAEAY144$$CBH@Z 154; CHECK: void __cdecl foo_aay144cbh(int const (&)[5][5]) 155 156?foo_qay144h@@YAX$$QAY144H@Z 157; CHECK: void __cdecl foo_qay144h(int (&&)[5][5]) 158?foo_qay144h@@YAX$$QEAY144H@Z 159; CHECK: void __cdecl foo_qay144h(int (&&)[5][5]) 160 161?foo_qay144cbh@@YAX$$QAY144$$CBH@Z 162; CHECK: void __cdecl foo_qay144cbh(int const (&&)[5][5]) 163?foo_qay144cbh@@YAX$$QEAY144$$CBH@Z 164; CHECK: void __cdecl foo_qay144cbh(int const (&&)[5][5]) 165 166?foo_p6ahxz@@YAXP6AHXZ@Z 167; CHECK: void __cdecl foo_p6ahxz(int (__cdecl *)(void)) 168?foo_p6ahxz@@YAXP6AHXZ@Z 169; CHECK: void __cdecl foo_p6ahxz(int (__cdecl *)(void)) 170 171?foo_a6ahxz@@YAXA6AHXZ@Z 172; CHECK: void __cdecl foo_a6ahxz(int (__cdecl &)(void)) 173?foo_a6ahxz@@YAXA6AHXZ@Z 174; CHECK: void __cdecl foo_a6ahxz(int (__cdecl &)(void)) 175 176?foo_q6ahxz@@YAX$$Q6AHXZ@Z 177; CHECK: void __cdecl foo_q6ahxz(int (__cdecl &&)(void)) 178?foo_q6ahxz@@YAX$$Q6AHXZ@Z 179; CHECK: void __cdecl foo_q6ahxz(int (__cdecl &&)(void)) 180 181?foo_qay04h@@YAXQAY04H@Z 182?foo_qay04h@@YAXQEAY04H@Z 183; CHECK: void __cdecl foo_qay04h(int (*const)[5]) 184 185?foo_qay04cbh@@YAXQAY04$$CBH@Z 186; CHECK: void __cdecl foo_qay04cbh(int const (*const)[5]) 187?foo_qay04cbh@@YAXQEAY04$$CBH@Z 188; CHECK: void __cdecl foo_qay04cbh(int const (*const)[5]) 189 190?foo@@YAXPAY02N@Z 191; CHECK: void __cdecl foo(double (*)[3]) 192?foo@@YAXPEAY02N@Z 193; CHECK: void __cdecl foo(double (*)[3]) 194 195?foo@@YAXQAN@Z 196; CHECK: void __cdecl foo(double *const) 197?foo@@YAXQEAN@Z 198; CHECK: void __cdecl foo(double *const) 199 200?foo_const@@YAXQBN@Z 201; CHECK: void __cdecl foo_const(double const *const) 202?foo_const@@YAXQEBN@Z 203; CHECK: void __cdecl foo_const(double const *const) 204 205?foo_volatile@@YAXQCN@Z 206; CHECK: void __cdecl foo_volatile(double volatile *const) 207?foo_volatile@@YAXQECN@Z 208; CHECK: void __cdecl foo_volatile(double volatile *const) 209 210?foo@@YAXPAY02NQBNN@Z 211; CHECK: void __cdecl foo(double (*)[3], double const *const, double) 212?foo@@YAXPEAY02NQEBNN@Z 213; CHECK: void __cdecl foo(double (*)[3], double const *const, double) 214 215?foo_fnptrconst@@YAXP6AXQAH@Z@Z 216; CHECK: void __cdecl foo_fnptrconst(void (__cdecl *)(int *const)) 217?foo_fnptrconst@@YAXP6AXQEAH@Z@Z 218; CHECK: void __cdecl foo_fnptrconst(void (__cdecl *)(int *const)) 219 220?foo_fnptrarray@@YAXP6AXQAH@Z@Z 221; CHECK: void __cdecl foo_fnptrarray(void (__cdecl *)(int *const)) 222?foo_fnptrarray@@YAXP6AXQEAH@Z@Z 223; CHECK: void __cdecl foo_fnptrarray(void (__cdecl *)(int *const)) 224 225?foo_fnptrbackref1@@YAXP6AXQAH@Z1@Z 226; CHECK: void __cdecl foo_fnptrbackref1(void (__cdecl *)(int *const), void (__cdecl *)(int *const)) 227?foo_fnptrbackref1@@YAXP6AXQEAH@Z1@Z 228; CHECK: void __cdecl foo_fnptrbackref1(void (__cdecl *)(int *const), void (__cdecl *)(int *const)) 229 230?foo_fnptrbackref2@@YAXP6AXQAH@Z1@Z 231; CHECK: void __cdecl foo_fnptrbackref2(void (__cdecl *)(int *const), void (__cdecl *)(int *const)) 232?foo_fnptrbackref2@@YAXP6AXQEAH@Z1@Z 233; CHECK: void __cdecl foo_fnptrbackref2(void (__cdecl *)(int *const), void (__cdecl *)(int *const)) 234 235?foo_fnptrbackref3@@YAXP6AXQAH@Z1@Z 236; CHECK: void __cdecl foo_fnptrbackref3(void (__cdecl *)(int *const), void (__cdecl *)(int *const)) 237?foo_fnptrbackref3@@YAXP6AXQEAH@Z1@Z 238; CHECK: void __cdecl foo_fnptrbackref3(void (__cdecl *)(int *const), void (__cdecl *)(int *const)) 239 240?foo_fnptrbackref4@@YAXP6AXPAH@Z1@Z 241; CHECK: void __cdecl foo_fnptrbackref4(void (__cdecl *)(int *), void (__cdecl *)(int *)) 242?foo_fnptrbackref4@@YAXP6AXPEAH@Z1@Z 243; CHECK: void __cdecl foo_fnptrbackref4(void (__cdecl *)(int *), void (__cdecl *)(int *)) 244 245?ret_fnptrarray@@YAP6AXQAH@ZXZ 246; CHECK: void (__cdecl * __cdecl ret_fnptrarray(void))(int *const) 247?ret_fnptrarray@@YAP6AXQEAH@ZXZ 248; CHECK: void (__cdecl * __cdecl ret_fnptrarray(void))(int *const) 249 250; The first argument gets mangled as-if it were written int *const 251; The second arg should not form a backref because it isn't qualified 252?mangle_no_backref0@@YAXQAHPAH@Z 253; CHECK: void __cdecl mangle_no_backref0(int *const, int *) 254?mangle_no_backref0@@YAXQEAHPEAH@Z 255; CHECK: void __cdecl mangle_no_backref0(int *const, int *) 256 257?mangle_no_backref1@@YAXQAHQAH@Z 258; CHECK: void __cdecl mangle_no_backref1(int *const, int *const) 259?mangle_no_backref1@@YAXQEAHQEAH@Z 260; CHECK: void __cdecl mangle_no_backref1(int *const, int *const) 261 262; Pointer to function types don't backref with function types 263?mangle_no_backref2@@YAXP6AXXZP6AXXZ@Z 264; CHECK: void __cdecl mangle_no_backref2(void (__cdecl *)(void), void (__cdecl *)(void)) 265?mangle_no_backref2@@YAXP6AXXZP6AXXZ@Z 266; CHECK: void __cdecl mangle_no_backref2(void (__cdecl *)(void), void (__cdecl *)(void)) 267 268?mangle_yes_backref0@@YAXQAH0@Z 269; CHECK: void __cdecl mangle_yes_backref0(int *const, int *const) 270?mangle_yes_backref0@@YAXQEAH0@Z 271; CHECK: void __cdecl mangle_yes_backref0(int *const, int *const) 272 273?mangle_yes_backref1@@YAXQAH0@Z 274; CHECK: void __cdecl mangle_yes_backref1(int *const, int *const) 275?mangle_yes_backref1@@YAXQEAH0@Z 276; CHECK: void __cdecl mangle_yes_backref1(int *const, int *const) 277 278?mangle_yes_backref2@@YAXQBQ6AXXZ0@Z 279; CHECK: void __cdecl mangle_yes_backref2(void (__cdecl *const *const)(void), void (__cdecl *const *const)(void)) 280?mangle_yes_backref2@@YAXQEBQ6AXXZ0@Z 281; CHECK: void __cdecl mangle_yes_backref2(void (__cdecl *const *const)(void), void (__cdecl *const *const)(void)) 282 283?mangle_yes_backref3@@YAXQAP6AXXZ0@Z 284; CHECK: void __cdecl mangle_yes_backref3(void (__cdecl **const)(void), void (__cdecl **const)(void)) 285?mangle_yes_backref3@@YAXQEAP6AXXZ0@Z 286; CHECK: void __cdecl mangle_yes_backref3(void (__cdecl **const)(void), void (__cdecl **const)(void)) 287 288?mangle_yes_backref4@@YAXQIAH0@Z 289; CHECK: void __cdecl mangle_yes_backref4(int *const __restrict, int *const __restrict) 290?mangle_yes_backref4@@YAXQEIAH0@Z 291; CHECK: void __cdecl mangle_yes_backref4(int *const __restrict, int *const __restrict) 292 293?pr23325@@YAXQBUS@@0@Z 294; CHECK: void __cdecl pr23325(struct S const *const, struct S const *const) 295?pr23325@@YAXQEBUS@@0@Z 296; CHECK: void __cdecl pr23325(struct S const *const, struct S const *const) 297 298; ?vla_arg@@YAXHQAY0A@H@Z 299; FIXME: void __cdecl vla_arg(int i, int (*const)[0]) 300; ?vla_arg@@YAXHQEAY0A@H@Z 301; FIXME: void __cdecl vla_arg(int i, int (*const)[0]) 302