blob: 450ab6662aaf467f1310fcb80476dc7b09de31b6 [file] [log] [blame]
Zachary Turnerc84f7e82018-07-30 03:12:34 +00001; RUN: llvm-undname < %s | FileCheck %s
2
3; CHECK-NOT: Invalid mangled name
4
5; Test demangling of function local scope discriminator IDs.
6?M@?@??L@@YAHXZ@4HA
7; CHECK: int `int __cdecl L(void)'::`0'::M
8
9?M@?0??L@@YAHXZ@4HA
10; CHECK: int `int __cdecl L(void)'::`1'::M
11
12?M@?1??L@@YAHXZ@4HA
13; CHECK: int `int __cdecl L(void)'::`2'::M
14
15?M@?2??L@@YAHXZ@4HA
16; CHECK: int `int __cdecl L(void)'::`3'::M
17
18?M@?3??L@@YAHXZ@4HA
19; CHECK: int `int __cdecl L(void)'::`4'::M
20
21?M@?4??L@@YAHXZ@4HA
22; CHECK: int `int __cdecl L(void)'::`5'::M
23
24?M@?5??L@@YAHXZ@4HA
25; CHECK: int `int __cdecl L(void)'::`6'::M
26
27?M@?6??L@@YAHXZ@4HA
28; CHECK: int `int __cdecl L(void)'::`7'::M
29
30?M@?7??L@@YAHXZ@4HA
31; CHECK: int `int __cdecl L(void)'::`8'::M
32
33?M@?8??L@@YAHXZ@4HA
34; CHECK: int `int __cdecl L(void)'::`9'::M
35
36?M@?9??L@@YAHXZ@4HA
37; CHECK: int `int __cdecl L(void)'::`10'::M
38
39?M@?L@??L@@YAHXZ@4HA
40; CHECK: int `int __cdecl L(void)'::`11'::M
41
42?M@?M@??L@@YAHXZ@4HA
43; CHECK: int `int __cdecl L(void)'::`12'::M
44
45?M@?N@??L@@YAHXZ@4HA
46; CHECK: int `int __cdecl L(void)'::`13'::M
47
48?M@?O@??L@@YAHXZ@4HA
49; CHECK: int `int __cdecl L(void)'::`14'::M
50
51?M@?P@??L@@YAHXZ@4HA
52; CHECK: int `int __cdecl L(void)'::`15'::M
53
54?M@?BA@??L@@YAHXZ@4HA
55; CHECK: int `int __cdecl L(void)'::`16'::M
56
57?M@?BB@??L@@YAHXZ@4HA
58; CHECK: int `int __cdecl L(void)'::`17'::M
59
60?j@?1??L@@YAHXZ@4UJ@@A
61; CHECK: struct J `int __cdecl L(void)'::`2'::j
62
63; Test demangling of name back-references
64?NN@0XX@@3HA
65; CHECK: int XX::NN::NN
66
67?MM@0NN@XX@@3HA
68; CHECK: int XX::NN::MM::MM
69
70?NN@MM@0XX@@3HA
71; CHECK: int XX::NN::MM::NN
72
73?OO@0NN@01XX@@3HA
74; CHECK: int XX::NN::OO::NN::OO::OO
75
76?NN@OO@010XX@@3HA
77; CHECK: int XX::NN::OO::NN::OO::NN
78
79; Test demangling of name back-references combined with function local scopes.
80?M@?1??0@YAHXZ@4HA
81; CHECK: int `int __cdecl M(void)'::`2'::M
82
83?L@?2??M@0?2??0@YAHXZ@QEAAHXZ@4HA
Nico Weber65bbcca2018-11-13 20:18:26 +000084; CHECK: int `public: int __cdecl `int __cdecl L(void)'::`3'::L::M(void)'::`3'::L
Zachary Turnerc84f7e82018-07-30 03:12:34 +000085
86?M@?2??0L@?2??1@YAHXZ@QEAAHXZ@4HA
Nico Weber65bbcca2018-11-13 20:18:26 +000087; CHECK: int `public: int __cdecl `int __cdecl L(void)'::`3'::L::M(void)'::`3'::M
Zachary Turnerc84f7e82018-07-30 03:12:34 +000088
89; Function local scopes of template functions
90?M@?1???$L@H@@YAHXZ@4HA
91; CHECK: int `int __cdecl L<int>(void)'::`2'::M
92
93; And member functions of template classes
94?SN@?$NS@H@NS@@QEAAHXZ
95; CHECK: int __cdecl NS::NS<int>::SN(void)
96
97?NS@?1??SN@?$NS@H@0@QEAAHXZ@4HA
Nico Weber65bbcca2018-11-13 20:18:26 +000098; CHECK: int `public: int __cdecl NS::NS<int>::SN(void)'::`2'::NS
Zachary Turnerc84f7e82018-07-30 03:12:34 +000099
100?SN@?1??0?$NS@H@NS@@QEAAHXZ@4HA
Nico Weber65bbcca2018-11-13 20:18:26 +0000101; CHECK: int `public: int __cdecl NS::NS<int>::SN(void)'::`2'::SN
Zachary Turnerc84f7e82018-07-30 03:12:34 +0000102
103?NS@?1??SN@?$NS@H@10@QEAAHXZ@4HA
Nico Weber65bbcca2018-11-13 20:18:26 +0000104; CHECK: int `public: int __cdecl NS::SN::NS<int>::SN(void)'::`2'::NS
Zachary Turnerc84f7e82018-07-30 03:12:34 +0000105
106?SN@?1??0?$NS@H@0NS@@QEAAHXZ@4HA
Nico Weber65bbcca2018-11-13 20:18:26 +0000107; CHECK: int `public: int __cdecl NS::SN::NS<int>::SN(void)'::`2'::SN
Zachary Turnerc84f7e82018-07-30 03:12:34 +0000108
109; Make sure instantiated templates participate in back-referencing.
110; In the next 3 examples there should be 3 back-references:
111; 0 = X (right most name)
112; 1 = C<int> (second from right)
113; 2 = C (third from right)
114; Make sure all 3 work as expected by having the 4th component take each value
115; from 0-2 and confirming it is the right component.
116?X@?$C@H@C@0@2HB
117; CHECK: static int const X::C::C<int>::X
118
119?X@?$C@H@C@1@2HB
120; CHECK: static int const C<int>::C::C<int>::X
121
122?X@?$C@H@C@2@2HB
123; CHECK: static int const C::C::C<int>::X
124
125; Putting everything together.
126
127; namespace A { namespace B { namespace C { namespace B { namespace C {
128; template<typename T>
129; struct C {
130; int B() {
131; static C<int> C;
132; static int B = 7;
133; static int A = 7;
134; return C.B() + B + A;
135; }
136; };
137; } } } } }
138
139?C@?1??B@?$C@H@0101A@@QEAAHXZ@4U201013@A
Nico Weber65bbcca2018-11-13 20:18:26 +0000140; CHECK: struct A::B::C::B::C::C<int> `public: int __cdecl A::B::C::B::C::C<int>::B(void)'::`2'::C
Zachary Turnerc84f7e82018-07-30 03:12:34 +0000141
142?B@?1??0?$C@H@C@020A@@QEAAHXZ@4HA
Nico Weber65bbcca2018-11-13 20:18:26 +0000143; CHECK: int `public: int __cdecl A::B::C::B::C::C<int>::B(void)'::`2'::B
Zachary Turnerc84f7e82018-07-30 03:12:34 +0000144
145?A@?1??B@?$C@H@C@1310@QEAAHXZ@4HA
Nico Weber65bbcca2018-11-13 20:18:26 +0000146; CHECK: int `public: int __cdecl A::B::C::B::C::C<int>::B(void)'::`2'::A