Skip to content

Commit 9508933

Browse files
committed
feat: unnamed records are implementation-defined
1 parent aefc53c commit 9508933

File tree

5 files changed

+102
-0
lines changed

5 files changed

+102
-0
lines changed

src/lib/AST/ASTVisitor.cpp

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -641,6 +641,15 @@ populate(
641641
RecordInfo& I,
642642
CXXRecordDecl const* D)
643643
{
644+
// Unnamed structs and classes are implementation-defined
645+
// or dependencies at best. There are never pages for them.
646+
if (D->getIdentifier() == nullptr)
647+
{
648+
I.Extraction = mostSpecific(
649+
ExtractionMode::ImplementationDefined,
650+
I.Extraction);
651+
}
652+
644653
if (D->getTypedefNameForAnonDecl())
645654
{
646655
I.IsTypeDef = true;
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
= Reference
2+
:mrdocs:
3+
4+
[#index]
5+
== Global namespace
6+
7+
=== Variables
8+
9+
[cols=1]
10+
|===
11+
| Name
12+
| link:#F[`F`]
13+
|===
14+
15+
[#F]
16+
== F
17+
18+
=== Synopsis
19+
20+
Declared in `<unnamed.cpp>`
21+
22+
[source,cpp,subs="verbatim,replacements,macros,-callouts"]
23+
----
24+
constexpr /* implementation-defined */ F = {};
25+
----
26+
27+
28+
[.small]#Created with https://www.mrdocs.com[MrDocs]#
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
constexpr struct
2+
{
3+
void operator()() const;
4+
} const F{};
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
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>Variables</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="#F"><code>F</code></a> </td></tr>
22+
</tbody>
23+
</table>
24+
25+
</div>
26+
<div>
27+
<div>
28+
<h2 id="F"><a href="#F">F</a></h2>
29+
</div>
30+
<div>
31+
<h3>Synopsis</h3>
32+
<div>
33+
Declared in <code>&lt;unnamed.cpp&gt;</code></div>
34+
<pre>
35+
<code class="source-code cpp">constexpr /* implementation-defined */ F = {};
36+
37+
</code>
38+
</pre>
39+
</div>
40+
</div>
41+
42+
</div>
43+
<div>
44+
<h4>Created with <a href="https://www.mrdocs.com">MrDocs</a></h4>
45+
</div>
46+
</body>
47+
</html>
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
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+
<struct name="" id="F1Jq7+g4G9C/ONGL1uiGY4NNso4=">
6+
<file short-path="unnamed.cpp" source-path="unnamed.cpp" line="1" class="def"/>
7+
</struct>
8+
<variable name="F" id="BGjARRRB5KxbD8yjAiXJFTuHZdc=" default="{}">
9+
<file short-path="unnamed.cpp" source-path="unnamed.cpp" line="1" class="def"/>
10+
<attr id="is-constexpr"/>
11+
<type id="F1Jq7+g4G9C/ONGL1uiGY4NNso4=" name=""/>
12+
</variable>
13+
</namespace>
14+
</mrdocs>

0 commit comments

Comments
 (0)