Skip to content

Commit 3ff3744

Browse files
authored
fix: legible names handle using declarations as shadow
1 parent eb22089 commit 3ff3744

File tree

5 files changed

+484
-0
lines changed

5 files changed

+484
-0
lines changed

src/lib/Support/LegibleNames.cpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -225,6 +225,13 @@ class LegibleNames::Impl
225225
return getUnnamedInfoName(t);
226226
}
227227
}
228+
else if constexpr(T::isUsing())
229+
{
230+
if (t.Class == UsingClass::Normal && !t.ShadowDeclarations.empty())
231+
{
232+
return getRawUnqualified(t.ShadowDeclarations.front());
233+
}
234+
}
228235
return t.Name;
229236
});
230237
}
Lines changed: 156 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,156 @@
1+
= Reference
2+
:mrdocs:
3+
4+
[#index]
5+
== Global namespace
6+
7+
=== Types
8+
9+
[cols=2]
10+
|===
11+
| Name
12+
| Description
13+
| link:#X[`X`]
14+
| This struct will be inherited as public
15+
| link:#Y[`Y`]
16+
| This struct inherits from X
17+
| link:#fun_ptr[`fun_ptr`]
18+
| A pointer to function typedef
19+
|===
20+
21+
[#fun_ptr]
22+
== fun_ptr
23+
24+
A pointer to function typedef
25+
26+
=== Synopsis
27+
28+
Declared in `<using‐member‐conversion.cpp>`
29+
30+
[source,cpp,subs="verbatim,replacements,macros,-callouts"]
31+
----
32+
using fun_ptr = void(*)();
33+
----
34+
35+
[#X]
36+
== X
37+
38+
This struct will be inherited as public
39+
40+
=== Synopsis
41+
42+
Declared in `<using‐member‐conversion.cpp>`
43+
44+
[source,cpp,subs="verbatim,replacements,macros,-callouts"]
45+
----
46+
struct X;
47+
----
48+
49+
=== Member Functions
50+
51+
[cols=2]
52+
|===
53+
| Name
54+
| Description
55+
| link:#X-2conversion[`operator fun_ptr`]
56+
| Conversion operator to function pointer.
57+
|===
58+
59+
=== Derived Classes
60+
61+
[cols=2]
62+
|===
63+
| Name
64+
| Description
65+
| link:#Y[`Y`]
66+
| This struct inherits from X
67+
|===
68+
69+
[#X-2conversion]
70+
== link:#X[X]::operator link:#fun_ptr[fun_ptr]
71+
72+
Conversion operator to function pointer.
73+
74+
=== Synopsis
75+
76+
Declared in `<using‐member‐conversion.cpp>`
77+
78+
[source,cpp,subs="verbatim,replacements,macros,-callouts"]
79+
----
80+
operator link:#fun_ptr[fun_ptr]() const;
81+
----
82+
83+
=== Return Value
84+
85+
A pointer to function typedef
86+
87+
[#Y]
88+
== Y
89+
90+
This struct inherits from X
91+
92+
=== Synopsis
93+
94+
Declared in `<using‐member‐conversion.cpp>`
95+
96+
[source,cpp,subs="verbatim,replacements,macros,-callouts"]
97+
----
98+
struct Y
99+
: link:#X[X]
100+
----
101+
102+
=== Base Classes
103+
104+
[cols=2]
105+
|===
106+
| Name
107+
| Description
108+
| `link:#X[X]`
109+
| This struct will be inherited as public
110+
|===
111+
112+
=== Member Functions
113+
114+
[cols=2]
115+
|===
116+
| Name
117+
| Description
118+
| link:#X-2conversion[`operator fun_ptr`]
119+
| Conversion operator to function pointer.
120+
|===
121+
122+
=== Using Declarations
123+
124+
[cols=2]
125+
|===
126+
| Name
127+
| Description
128+
| link:#Y-2conversion[`operator void(*)()`]
129+
| Bring X::operator fun_ptr into Y.
130+
|===
131+
132+
[#Y-2conversion]
133+
== link:#Y[Y]::operator void(*)()
134+
135+
Bring X::operator fun_ptr into Y.
136+
137+
=== Synopsis
138+
139+
Declared in `<using‐member‐conversion.cpp>`
140+
141+
[source,cpp,subs="verbatim,replacements,macros,-callouts"]
142+
----
143+
using X::operator void(*)();
144+
----
145+
146+
=== Introduced Symbols
147+
148+
[cols=2]
149+
|===
150+
| Name
151+
| Description
152+
| link:#X-2conversion[X::operator fun_ptr]
153+
| Conversion operator to function pointer.
154+
|===
155+
156+
[.small]#Created with https://www.mrdocs.com[MrDocs]#
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
/// A pointer to function typedef
2+
using fun_ptr = void (*)();
3+
4+
/// This struct will be inherited as public
5+
struct X
6+
{
7+
/// Conversion operator to function pointer.
8+
operator fun_ptr() const;
9+
};
10+
11+
/// This struct inherits from X
12+
struct Y : X
13+
{
14+
/// Bring X::operator fun_ptr into Y.
15+
using X::operator fun_ptr;
16+
};

0 commit comments

Comments
 (0)