Skip to content

Commit 2dcfe68

Browse files
committed
fix: using decl shadows do not contain excluded symbols
1 parent 42ba51e commit 2dcfe68

File tree

6 files changed

+42
-110
lines changed

6 files changed

+42
-110
lines changed

src/lib/AST/ASTVisitor.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1232,7 +1232,10 @@ populate(
12321232
{
12331233
ScopeExitRestore s(mode_, Dependency);
12341234
Decl* S = UDS->getTargetDecl();
1235-
if (Info* SI = findOrTraverse(S))
1235+
using enum ExtractionMode;
1236+
if (Info* SI = findOrTraverse(S);
1237+
SI &&
1238+
!is_one_of(SI->Extraction,{Dependency, ImplementationDefined}))
12361239
{
12371240
I.ShadowDeclarations.emplace_back(SI->id);
12381241
}

test-files/golden-tests/symbols/using/using-function-excluded.adoc

Lines changed: 10 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -4,49 +4,21 @@
44
[#index]
55
== Global namespace
66

7-
=== Namespaces
8-
9-
[cols=1]
10-
|===
11-
| Name
12-
| link:#A[`A`]
13-
|===
14-
157
=== Using Declarations
168

17-
[cols=1]
9+
[cols=2]
1810
|===
1911
| Name
12+
| Description
2013
| link:#f[`f`]
14+
| Using excluded function f
2115
|===
2216

23-
[#A]
24-
== A
25-
26-
=== Functions
27-
28-
[cols=1]
29-
|===
30-
| Name
31-
| link:#A-f[`f`]
32-
|===
33-
34-
[#A-f]
35-
== link:#A[A]::f
36-
37-
=== Synopsis
38-
39-
Declared in `<using‐function‐excluded.cpp>`
40-
41-
[source,cpp,subs="verbatim,replacements,macros,-callouts"]
42-
----
43-
void
44-
f(int);
45-
----
46-
4717
[#f]
4818
== f
4919

20+
Using excluded function f
21+
5022
=== Synopsis
5123

5224
Declared in `<using‐function‐excluded.cpp>`
@@ -56,12 +28,11 @@ Declared in `<using‐function‐excluded.cpp>`
5628
using A::f;
5729
----
5830

59-
=== Introduced Symbols
31+
=== Description
32+
33+
No shadow should be listed because A::f is excluded.
34+
35+
Only included symbols are listed in the shadow list.
6036

61-
[cols=1]
62-
|===
63-
| Name
64-
| link:#A-f[A::f]
65-
|===
6637

6738
[.small]#Created with https://www.mrdocs.com[MrDocs]#
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,14 @@
11
namespace A
22
{
3+
// This symbol is excluded.
34
void f(int);
45
}
56

7+
/** Using excluded function f
8+
9+
No shadow should be listed because A::f is excluded.
10+
11+
Only included symbols are listed in the shadow list.
12+
*/
613
using A::f;
714

test-files/golden-tests/symbols/using/using-function-excluded.html

Lines changed: 7 additions & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -9,72 +9,30 @@ <h1>Reference</h1>
99
<div>
1010
<h2 id="index"><a href="#index"></a></h2>
1111
</div>
12-
<h2>Namespaces</h2>
13-
<table style="table-layout: fixed; width: 100%;">
14-
<thead>
15-
<tr>
16-
<th>Name</th>
17-
</tr>
18-
</thead>
19-
<tbody>
20-
<tr>
21-
<td><a href="#A"><code>A</code></a> </td></tr>
22-
</tbody>
23-
</table>
24-
2512
<h2>Using Declarations</h2>
2613
<table style="table-layout: fixed; width: 100%;">
2714
<thead>
2815
<tr>
2916
<th>Name</th>
17+
<th>Description</th>
3018
</tr>
3119
</thead>
3220
<tbody>
3321
<tr>
34-
<td><a href="#f"><code>f</code></a> </td></tr>
22+
<td><a href="#f"><code>f</code></a> </td><td><span>Using excluded function f</span></td></tr>
3523
</tbody>
3624
</table>
3725

3826
</div>
3927
<div>
4028
<div>
41-
<h2 id="A"><a href="#A">A</a></h2>
42-
</div>
43-
<h2>Functions</h2>
44-
<table style="table-layout: fixed; width: 100%;">
45-
<thead>
46-
<tr>
47-
<th>Name</th>
48-
</tr>
49-
</thead>
50-
<tbody>
51-
<tr>
52-
<td><a href="#A-f"><code>f</code></a> </td></tr>
53-
</tbody>
54-
</table>
55-
56-
</div>
57-
<div>
58-
<div>
59-
<h2 id="A-f"><a href="#A-f">A::f</a></h2>
60-
</div>
61-
<div>
62-
<h3>Synopsis</h3>
29+
<h2 id="f"><a href="#f">f</a></h2>
6330
<div>
64-
Declared in <code>&lt;using-function-excluded.cpp&gt;</code></div>
65-
<pre>
66-
<code class="source-code cpp">void
67-
f(int);
31+
<span>Using excluded function f</span>
6832

69-
</code>
70-
</pre>
7133
</div>
7234
</div>
7335
<div>
74-
<div>
75-
<h2 id="f"><a href="#f">f</a></h2>
76-
</div>
77-
<div>
7836
<h3>Synopsis</h3>
7937
<div>
8038
Declared in <code>&lt;using-function-excluded.cpp&gt;</code></div>
@@ -85,21 +43,10 @@ <h3>Synopsis</h3>
8543
</pre>
8644
</div>
8745
<div>
88-
<h3>Introduced Symbols</h3>
89-
<table>
90-
<thead>
91-
<tr>
92-
<th>Name</th>
93-
</tr>
94-
</thead>
95-
<tbody>
96-
<tr>
97-
<td><a href="#A-f">A::f</a></td>
98-
</tr>
99-
</tbody>
100-
</table>
46+
<h3>Description</h3>
47+
<p>No shadow should be listed because A::f is excluded.</p>
48+
<p>Only included symbols are listed in the shadow list.</p>
10149
</div>
102-
10350
</div>
10451

10552
</div>

test-files/golden-tests/symbols/using/using-function-excluded.xml

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,19 @@
22
<mrdocs xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
33
xsi:noNamespaceSchemaLocation="https://github.com/cppalliance/mrdocs/raw/develop/mrdocs.rnc">
44
<namespace id="//////////////////////////8=">
5-
<namespace name="A" id="jQQu/8mLNzRQvGtbkKMwwloVDpw=">
6-
<function name="f" id="FuaTgMW0VtO+b4uzr/DCmx9vlb0=">
7-
<file short-path="using-function-excluded.cpp" source-path="using-function-excluded.cpp" line="3"/>
8-
<param>
9-
<type name="int"/>
10-
</param>
11-
</function>
12-
</namespace>
135
<using id="FhSdC4kR2+KOxLCiCUQ9mu1WNoY=" class="using" qualifier="A::f">
14-
<file short-path="using-function-excluded.cpp" source-path="using-function-excluded.cpp" line="6"/>
15-
<named id="FuaTgMW0VtO+b4uzr/DCmx9vlb0="/>
6+
<file short-path="using-function-excluded.cpp" source-path="using-function-excluded.cpp" line="13"/>
7+
<doc>
8+
<brief>
9+
<text>Using excluded function f</text>
10+
</brief>
11+
<para>
12+
<text>No shadow should be listed because A::f is excluded.</text>
13+
</para>
14+
<para>
15+
<text>Only included symbols are listed in the shadow list.</text>
16+
</para>
17+
</doc>
1618
</using>
1719
</namespace>
1820
</mrdocs>
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
exclude-symbols:
2+
- 'A::f'

0 commit comments

Comments
 (0)