Skip to content

Commit 499c541

Browse files
committed
namespace aliases support prefix
#fix
1 parent 56f175a commit 499c541

6 files changed

+175
-1
lines changed

src/lib/AST/ASTVisitor.cpp

+3-1
Original file line numberDiff line numberDiff line change
@@ -1334,9 +1334,11 @@ populate(
13341334
NamespaceAliasDecl* D)
13351335
{
13361336
NamedDecl const* Aliased = D->getAliasedNamespace();
1337-
I.AliasedSymbol = toNameInfo(Aliased);
1337+
NestedNameSpecifier const* NNS = D->getQualifier();
1338+
I.AliasedSymbol = toNameInfo(Aliased, {}, NNS);
13381339
}
13391340

1341+
13401342
void
13411343
ASTVisitor::
13421344
populate(
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
= Reference
2+
:mrdocs:
3+
4+
[#index]
5+
== Global namespace
6+
7+
8+
=== Namespaces
9+
10+
[cols=1]
11+
|===
12+
| Name
13+
14+
| <<B,`B`>>
15+
|===
16+
17+
[#B]
18+
== B
19+
20+
21+
=== Namespaces
22+
23+
[cols=1]
24+
|===
25+
| Name
26+
27+
| <<B-U,`U`>>
28+
|===
29+
30+
[#B-U]
31+
== <<B,B>>::U
32+
33+
34+
=== Namespace Aliases
35+
36+
[cols=1]
37+
|===
38+
| Name
39+
40+
| <<B-U-E,`E`>>
41+
|===
42+
43+
[#B-U-E]
44+
== <<B,B>>::<<B-U,U>>::E
45+
46+
47+
=== Synopsis
48+
49+
50+
Declared in `&lt;excluded&hyphen;namespace&hyphen;alias&period;cpp&gt;`
51+
52+
[source,cpp,subs="verbatim,replacements,macros,-callouts"]
53+
----
54+
namespace E = <<B,B>>::S::E;
55+
----
56+
57+
58+
59+
[.small]#Created with https://www.mrdocs.com[MrDocs]#
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
namespace B {
2+
namespace S {
3+
namespace E {}
4+
}
5+
6+
namespace U {
7+
namespace E = B::S::E;
8+
}
9+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
<html lang="en">
2+
<head>
3+
<title>Reference</title>
4+
</head>
5+
<body>
6+
<div>
7+
<h1>Reference</h1>
8+
<div>
9+
<div>
10+
<h2 id="index">Global namespace</h2>
11+
</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="#B"><code>B</code></a> </td></tr>
22+
</tbody>
23+
</table>
24+
</div>
25+
<div>
26+
<div>
27+
<h2 id="B">B</h2>
28+
</div>
29+
<h2>Namespaces</h2>
30+
<table style="table-layout: fixed; width: 100%;">
31+
<thead>
32+
<tr>
33+
<th>Name</th>
34+
</tr>
35+
</thead>
36+
<tbody>
37+
<tr>
38+
<td><a href="#B-U"><code>U</code></a> </td></tr>
39+
</tbody>
40+
</table>
41+
</div>
42+
<div>
43+
<div>
44+
<h2 id="B-U"><a href="#B">B</a>::U</h2>
45+
</div>
46+
<h2>Namespace Aliases</h2>
47+
<table style="table-layout: fixed; width: 100%;">
48+
<thead>
49+
<tr>
50+
<th>Name</th>
51+
</tr>
52+
</thead>
53+
<tbody>
54+
<tr>
55+
<td><a href="#B-U-E"><code>E</code></a> </td></tr>
56+
</tbody>
57+
</table>
58+
</div>
59+
<div>
60+
<div>
61+
<h2 id="B-U-E"><a href="#B">B</a>::<a href="#B-U">U</a>::E</h2>
62+
</div>
63+
<div>
64+
<h3>Synopsis</h3>
65+
<div>
66+
Declared in <code>&lt;excluded-namespace-alias.cpp&gt;</code></div>
67+
<pre>
68+
<code class="source-code cpp">
69+
namespace E = <a href="#B">B</a>::S::E;
70+
</code>
71+
</pre>
72+
</div>
73+
</div>
74+
75+
</div>
76+
<div>
77+
<h4>Created with <a href="https://www.mrdocs.com">MrDocs</a></h4>
78+
</div>
79+
</body>
80+
</html>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<mrdocs xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
3+
xsi:noNamespaceSchemaLocation="https://github.com/cppalliance/mrdocs/raw/develop/mrdocs.rnc">
4+
<namespace id="//////////////////////////8=">
5+
<namespace name="B" id="kPgq2AM8TvyGDGm5jEWfqYlOPmY=">
6+
<namespace name="S" id="Rj2Fd5N7JujyJxCEKO4hXgEbuZE=">
7+
<namespace name="E" id="3Bv76oUtQq1hnBVVkwioGwKa0oU=">
8+
</namespace>
9+
</namespace>
10+
<namespace name="U" id="X48ZrJbrwHITObLn6vxlcgApA20=">
11+
<namespace-alias name="E" id="TDj0Rc30uD7P5e+F1gsHzHoaV2U=">
12+
<file path="excluded-namespace-alias.cpp" line="7"/>
13+
<aliased name="B::S::E" id="3Bv76oUtQq1hnBVVkwioGwKa0oU="/>
14+
</namespace-alias>
15+
</namespace>
16+
</namespace>
17+
</namespace>
18+
</mrdocs>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
include-symbols:
2+
- 'B::U'
3+
- 'B::U::**'
4+
exclude-symbols:
5+
- 'B::S'
6+
- 'B::S::**'

0 commit comments

Comments
 (0)