Skip to content

Commit 5372fdf

Browse files
committed
fix: record friends exclude implementation defined symbols
fix #924
1 parent e4a4a15 commit 5372fdf

File tree

6 files changed

+241
-0
lines changed

6 files changed

+241
-0
lines changed

src/lib/AST/ASTVisitor.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -732,6 +732,12 @@ populate(
732732
}
733733
FriendInfo F;
734734
populate(F, FD);
735+
if (F.id != SymbolID::invalid)
736+
{
737+
Info* FI = this->find(F.id);
738+
MRDOCS_CHECK_OR_CONTINUE(FI);
739+
MRDOCS_CHECK_OR_CONTINUE(FI->Extraction != ExtractionMode::ImplementationDefined);
740+
}
735741
auto it = std::ranges::find_if(I.Friends, [&](FriendInfo const& FI)
736742
{
737743
return FI.id == F.id;
Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
= Reference
2+
:mrdocs:
3+
4+
[#index]
5+
== Global namespace
6+
7+
=== Types
8+
9+
[cols=1]
10+
|===
11+
| Name
12+
| link:#A[`A`]
13+
| link:#B[`B`]
14+
|===
15+
16+
=== Functions
17+
18+
[cols=1]
19+
|===
20+
| Name
21+
| link:#f[`f`]
22+
|===
23+
24+
[#A]
25+
== A
26+
27+
=== Synopsis
28+
29+
Declared in `<friend‐excluded.cpp>`
30+
31+
[source,cpp,subs="verbatim,replacements,macros,-callouts"]
32+
----
33+
class A;
34+
----
35+
36+
=== Friends
37+
38+
[cols=2]
39+
|===
40+
| Name
41+
| Description
42+
| `link:#f[f]`
43+
|
44+
| `link:#B[B]`
45+
|
46+
|===
47+
48+
[#B]
49+
== B
50+
51+
=== Synopsis
52+
53+
Declared in `<friend‐excluded.cpp>`
54+
55+
[source,cpp,subs="verbatim,replacements,macros,-callouts"]
56+
----
57+
class B;
58+
----
59+
60+
[#f]
61+
== f
62+
63+
=== Synopsis
64+
65+
Declared in `<friend‐excluded.cpp>`
66+
67+
[source,cpp,subs="verbatim,replacements,macros,-callouts"]
68+
----
69+
void
70+
f();
71+
----
72+
73+
74+
[.small]#Created with https://www.mrdocs.com[MrDocs]#
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
namespace detail {
2+
class impl;
3+
}
4+
5+
class B {};
6+
7+
void f();
8+
9+
class A
10+
{
11+
friend class detail::impl;
12+
friend class B;
13+
friend void f();
14+
};
Lines changed: 118 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,118 @@
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"><a href="#index"></a></h2>
11+
</div>
12+
<h2>Types</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><tr>
22+
<td><a href="#B"><code>B</code></a> </td></tr>
23+
</tbody>
24+
</table>
25+
26+
<h2>Functions</h2>
27+
<table style="table-layout: fixed; width: 100%;">
28+
<thead>
29+
<tr>
30+
<th>Name</th>
31+
</tr>
32+
</thead>
33+
<tbody>
34+
<tr>
35+
<td><a href="#f"><code>f</code></a> </td></tr>
36+
</tbody>
37+
</table>
38+
39+
</div>
40+
<div>
41+
<div>
42+
<h2 id="A"><a href="#A">A</a></h2>
43+
</div>
44+
<div>
45+
<h3>Synopsis</h3>
46+
<div>
47+
Declared in <code>&lt;friend-excluded.cpp&gt;</code></div>
48+
<pre>
49+
<code class="source-code cpp">
50+
class A;
51+
</code>
52+
</pre>
53+
</div>
54+
55+
56+
<div>
57+
<h2>Friends</h2>
58+
<table>
59+
<thead>
60+
<tr>
61+
<th>Name</th>
62+
<th>Description</th>
63+
</tr>
64+
</thead>
65+
<tbody>
66+
<tr>
67+
<td><code><a href="#f">f</a></code></td>
68+
<td><span></span></td>
69+
</tr>
70+
<tr>
71+
<td><code><a href="#B">B</a></code></td>
72+
<td><span></span></td>
73+
</tr>
74+
|===
75+
</tbody>
76+
</table>
77+
</div>
78+
</div>
79+
<div>
80+
<div>
81+
<h2 id="B"><a href="#B">B</a></h2>
82+
</div>
83+
<div>
84+
<h3>Synopsis</h3>
85+
<div>
86+
Declared in <code>&lt;friend-excluded.cpp&gt;</code></div>
87+
<pre>
88+
<code class="source-code cpp">
89+
class B;
90+
</code>
91+
</pre>
92+
</div>
93+
94+
95+
</div>
96+
<div>
97+
<div>
98+
<h2 id="f"><a href="#f">f</a></h2>
99+
</div>
100+
<div>
101+
<h3>Synopsis</h3>
102+
<div>
103+
Declared in <code>&lt;friend-excluded.cpp&gt;</code></div>
104+
<pre>
105+
<code class="source-code cpp">
106+
void
107+
f();
108+
</code>
109+
</pre>
110+
</div>
111+
</div>
112+
113+
</div>
114+
<div>
115+
<h4>Created with <a href="https://www.mrdocs.com">MrDocs</a></h4>
116+
</div>
117+
</body>
118+
</html>
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
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="detail" id="aMJtdgJFybRcdkRG712j3iC7JeM=">
6+
<class name="impl" id="oDJSYurEZnLafSdjUM2eeeIQ3CI=">
7+
<file short-path="friend-excluded.cpp" source-path="friend-excluded.cpp" line="2"/>
8+
</class>
9+
</namespace>
10+
<class name="A" id="YrPSaKAbmXgzCAX5WByx4eVoqBM=">
11+
<file short-path="friend-excluded.cpp" source-path="friend-excluded.cpp" line="9" class="def"/>
12+
<friend id="s6nsa+zVhpzzrN+yUVPP5rvdXqs=">
13+
<befriended id="s6nsa+zVhpzzrN+yUVPP5rvdXqs="/>
14+
</friend>
15+
<friend id="3JsK1DO0O+wZhv+0meptQrbs3fY=">
16+
<befriended id="3JsK1DO0O+wZhv+0meptQrbs3fY="/>
17+
</friend>
18+
</class>
19+
<class name="B" id="3JsK1DO0O+wZhv+0meptQrbs3fY=">
20+
<file short-path="friend-excluded.cpp" source-path="friend-excluded.cpp" line="5" class="def"/>
21+
</class>
22+
<function name="f" id="s6nsa+zVhpzzrN+yUVPP5rvdXqs=">
23+
<file short-path="friend-excluded.cpp" source-path="friend-excluded.cpp" line="7"/>
24+
<file short-path="friend-excluded.cpp" source-path="friend-excluded.cpp" line="13"/>
25+
</function>
26+
</namespace>
27+
</mrdocs>
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
implementation-defined:
2+
- detail::**

0 commit comments

Comments
 (0)