-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: tranches & overload sets for namespaces
- Loading branch information
1 parent
633a686
commit a7a7330
Showing
20 changed files
with
389 additions
and
452 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,10 @@ | ||
// | ||
// This is a derivative work. originally part of the LLVM Project. | ||
// Licensed under the Apache License v2.0 with LLVM Exceptions. | ||
// See https://llvm.org/LICENSE.txt for license information. | ||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception | ||
// | ||
// Copyright (c) 2023 Vinnie Falco ([email protected]) | ||
// Copyright (c) 2023 Krystian Stasiowski ([email protected]) | ||
// | ||
// Official repository: https://github.com/cppalliance/mrdocs | ||
// | ||
|
@@ -23,41 +23,42 @@ | |
namespace clang { | ||
namespace mrdocs { | ||
|
||
/** A group of children that have the same access specifier. | ||
*/ | ||
struct Tranche | ||
{ | ||
std::vector<SymbolID> Namespaces; | ||
std::vector<SymbolID> Records; | ||
std::vector<SymbolID> Functions; | ||
std::vector<SymbolID> Enums; | ||
std::vector<SymbolID> Types; | ||
std::vector<SymbolID> Fields; | ||
std::vector<SymbolID> StaticFunctions; | ||
std::vector<SymbolID> Variables; | ||
std::vector<SymbolID> Friends; | ||
|
||
ScopeInfo Overloads; | ||
ScopeInfo StaticOverloads; | ||
}; | ||
|
||
/** The aggregated interface for a given struct, class, or union. | ||
*/ | ||
class Interface | ||
{ | ||
public: | ||
/** A group of children that have the same access specifier. | ||
*/ | ||
struct Tranche | ||
{ | ||
std::span<RecordInfo const*> Records; | ||
std::span<FunctionInfo const*> Functions; | ||
std::span<EnumInfo const*> Enums; | ||
std::span<TypedefInfo const*> Types; | ||
std::span<FieldInfo const*> Data; | ||
std::span<FunctionInfo const*> StaticFunctions; | ||
std::span<VariableInfo const*> StaticData; | ||
std::span<FriendInfo const*> Friends; | ||
}; | ||
|
||
Corpus const& corpus; | ||
|
||
/** The aggregated public interfaces. | ||
*/ | ||
Tranche Public; | ||
std::shared_ptr<Tranche> Public; | ||
|
||
/** The aggregated protected interfaces. | ||
*/ | ||
Tranche Protected; | ||
std::shared_ptr<Tranche> Protected; | ||
|
||
/** The aggregated private interfaces. | ||
*/ | ||
Tranche Private; | ||
|
||
ScopeInfo Overloads; | ||
ScopeInfo StaticOverloads; | ||
std::shared_ptr<Tranche> Private; | ||
|
||
MRDOCS_DECL | ||
friend | ||
|
@@ -67,18 +68,7 @@ class Interface | |
Corpus const& corpus); | ||
|
||
private: | ||
class Build; | ||
|
||
explicit Interface(Corpus const&) noexcept; | ||
|
||
std::vector<RecordInfo const*> records_; | ||
std::vector<FunctionInfo const*> functions_; | ||
std::vector<EnumInfo const*> enums_; | ||
std::vector<TypedefInfo const*> types_; | ||
std::vector<FieldInfo const*> data_; | ||
std::vector<FunctionInfo const*> staticfuncs_; | ||
std::vector<VariableInfo const*> staticdata_; | ||
std::vector<FriendInfo const*> friends_; | ||
}; | ||
|
||
//------------------------------------------------ | ||
|
@@ -99,6 +89,20 @@ makeInterface( | |
RecordInfo const& Derived, | ||
Corpus const& corpus); | ||
|
||
/** Return a tranche representing the members of a namespace. | ||
@return The tranche. | ||
@param Derived The namespace to build the tranche for. | ||
@param corpus The complete metadata. | ||
*/ | ||
MRDOCS_DECL | ||
Tranche | ||
makeTranche( | ||
NamespaceInfo const& Namespace, | ||
Corpus const& corpus); | ||
|
||
} // mrdocs | ||
} // clang | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 3 additions & 1 deletion
4
share/mrdocs/addons/generator/asciidoc/layouts/overload-set.adoc.hbs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
8 changes: 4 additions & 4 deletions
8
share/mrdocs/addons/generator/asciidoc/partials/declarator-after.adoc.hbs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,15 @@ | ||
{{#if pointee-type~}} | ||
{{#if (or (eq pointee-type.kind "array") (eq pointee-type.kind "function"))}}){{/if~}} | ||
{{~>declarator-after pointee-type~}} | ||
{{~>declarator-after pointee-type nolink=nolink~}} | ||
{{else if (eq kind "array")~}} | ||
[{{bounds-value}}] | ||
{{~>declarator-after element-type~}} | ||
{{~>declarator-after element-type nolink=nolink~}} | ||
{{else if (eq kind "function")~}} | ||
({{#each param-types~}} | ||
{{~>declarator~}}{{~#unless @last}}, {{/unless~}} | ||
{{~>declarator nolink=../nolink~}}{{~#unless @last}}, {{/unless~}} | ||
{{/each~}}) | ||
{{~#if cv-qualifiers}} {{cv-qualifiers}}{{/if~}} | ||
{{#if (eq ref-qualifier "lvalue")}} &{{else if (eq ref-qualifier "rvalue")}} &&{{/if~}} | ||
{{#if exception-spec}} {{exception-spec}}{{/if~}} | ||
{{~>declarator-after return-type~}} | ||
{{~>declarator-after return-type nolink=nolink~}} | ||
{{/if}} |
14 changes: 7 additions & 7 deletions
14
share/mrdocs/addons/generator/asciidoc/partials/declarator-before.adoc.hbs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,22 @@ | ||
{{#if pointee-type~}} | ||
{{~>declarator-before pointee-type~}} | ||
{{~>declarator-before pointee-type nolink=nolink~}} | ||
{{#if (or (eq pointee-type.kind "array") (eq pointee-type.kind "function"))}}({{/if~}} | ||
{{~/if~}} | ||
{{#if element-type~}}{{~>declarator-before element-type~}}{{/if~}} | ||
{{#if return-type~}}{{~>declarator-before return-type~}}{{/if~}} | ||
{{#if parent-type~}}{{>declarator parent-type}}::{{/if~}} | ||
{{#if element-type~}}{{~>declarator-before element-type nolink=nolink~}}{{/if~}} | ||
{{#if return-type~}}{{~>declarator-before return-type nolink=nolink~}}{{/if~}} | ||
{{#if parent-type~}}{{>declarator parent-type nolink=nolink}}::{{/if~}} | ||
{{#if (eq kind "lvalue-reference")}}&{{/if~}} | ||
{{#if (eq kind "rvalue-reference")}}&&{{/if~}} | ||
{{#if (eq kind "pointer")}}*{{/if~}} | ||
{{#if (eq kind "member-pointer")}}*{{/if~}} | ||
{{#if cv-qualifiers~}} | ||
{{#if pointee-type}} {{cv-qualifiers}}{{else}}{{cv-qualifiers}} {{/if~}} | ||
{{/if~}} | ||
{{#if symbol~}} | ||
{{#if (not parent-type)}}{{>qualified-path symbol=symbol.parent}}{{/if~}} | ||
{{#if (and symbol (not parent-type))}}{{>qualified-path symbol=symbol.parent nolink=nolink}}{{/if~}} | ||
{{#if (and symbol (not nolink))~}} | ||
xref:{{symbol.ref}}[{{name}}] | ||
{{~else if name}}{{name~}} | ||
{{/if~}} | ||
{{#if (eq kind "decltype")}}decltype({{operand}}){{/if~}} | ||
{{#if (eq kind "specialization")}}{{>template-args args=args}}{{/if~}} | ||
{{#if (eq kind "specialization")}}{{>template-args args=args nolink=nolink}}{{/if~}} | ||
{{#if is-pack~}}...{{/if}} |
6 changes: 3 additions & 3 deletions
6
share/mrdocs/addons/generator/asciidoc/partials/declarator-id.adoc.hbs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,8 @@ | ||
{{#if (and (eq kind "function") (eq class "conversion"))~}} | ||
operator {{>declarator return~}} | ||
operator {{>declarator return nolink=nolink~}} | ||
{{else~}} | ||
{{#if link.ref}}xref:{{link.ref}}[{{name}}]{{else}}{{name}}{{/if~}} | ||
{{#if (and link.ref (not nolink))}}xref:{{link.ref}}[{{name}}]{{else}}{{name}}{{/if~}} | ||
{{#if (or (eq template.kind "explicit") (eq template.kind "partial"))~}} | ||
{{>template-args args=template.args~}} | ||
{{>template-args args=template.args nolink=nolink~}} | ||
{{/if~}} | ||
{{/if}} |
6 changes: 3 additions & 3 deletions
6
share/mrdocs/addons/generator/asciidoc/partials/declarator.adoc.hbs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
{{>declarator-before~}} | ||
{{>declarator-before nolink=nolink~}} | ||
{{~#if decl-name}} {{decl-name~}} | ||
{{~#if decl-name-targs~}}{{>template-args args=decl-name-targs}}{{~/if~}} | ||
{{~#if decl-name-targs~}}{{>template-args args=decl-name-targs nolink=nolink}}{{~/if~}} | ||
{{~/if~}} | ||
{{~>declarator-after}} | ||
{{~>declarator-after nolink=nolink}} |
8 changes: 5 additions & 3 deletions
8
share/mrdocs/addons/generator/asciidoc/partials/info-list.adoc.hbs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,10 @@ | ||
{{#if members}} | ||
== {{title}} | ||
[,cols=2] | ||
|=== | ||
|Name |Description | ||
{{#each .}} | ||
|xref:{{ref}}[`pass:v[{{name}}]`] | {{#if (ne kind "overload")}}{{doc.brief}}{{else}}{{#each (unique (pluck (pluck members "doc") "brief"))}}{{.}} | ||
{{/each}}{{/if}} | ||
{{#each members}} | ||
{{>info-member .}} | ||
{{/each}} | ||
|=== | ||
{{/if}} |
Oops, something went wrong.