Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,19 @@
{{#if symbol.shadowDeclarations}}
{{#> markup/section name="introduced-symbols"}}
{{#> markup/dynamic-level-h }}Introduced Symbols{{/markup/dynamic-level-h~}}
{{#if (any_of_by symbol.shadowDeclarations "doc")}}
{{#with (transform symbol.shadowDeclarations @root.mrdocs.corpus.get)}}
{{#if (any_of_by this "doc")}}
{{> markup/table
weights=(arr 1 4)
headers=(arr "Name" "Description")
items=symbol.shadowDeclarations
items=this
columns=(arr "." "doc.brief") }}
{{else}}
{{> markup/table
headers=(arr "Name")
items=symbol.shadowDeclarations
items=this
columns=(arr ".") }}
{{/if}}
{{/with}}
{{/markup/section}}
{{/if}}
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
using {{#if (contains (arr "typename" "enum") class)}} {{class}}
{{~/if~}}
{{~#if introducedName~}}
{{>type/name-info introducedName }}
{{~/if}};
using
{{~#if (contains (arr "typename" "enum") class)}} {{class}}{{/if}}
{{~#if introducedName}} {{>type/name-info introducedName }}{{/if}};
1 change: 1 addition & 0 deletions include/mrdocs/ADT/Overload.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ namespace mrdocs {
*/
template<class... Ts>
struct Overload : Ts... {
/// Bring in the call operator of every base.
using Ts::operator()...;

/** Constructs an Overload from the given callables.
Expand Down
38 changes: 37 additions & 1 deletion src/mrdocs/AST/ASTVisitor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -311,6 +311,8 @@ traverse(DeclTy const* D)
X(CXXDeductionGuide);
X(NamespaceAlias);
X(Using);
X(UnresolvedUsingValue);
X(UnresolvedUsingTypename);
X(Concept);
#undef X
default:
Expand Down Expand Up @@ -1272,7 +1274,7 @@ populate(
UsingSymbol& I,
clang::UsingDecl const* D)
{
I.Class = UsingClass::Normal;
I.Class = D->hasTypename() ? UsingClass::Typename : UsingClass::Normal;
clang::DeclarationName const& Name = D->getNameInfo().getName();
clang::NestedNameSpecifier const& NNS = D->getQualifier();
auto INI = toName(Name, {}, NNS);
Expand All @@ -1292,6 +1294,40 @@ populate(
}
}

template <std::derived_from<clang::NamedDecl> DeclTy>
void
ASTVisitor::
populateDependentUsing(
UsingSymbol& I,
UsingClass const cls,
DeclTy const* D)
{
I.Class = cls;
clang::DeclarationName const& Name = D->getNameInfo().getName();
clang::NestedNameSpecifier const& NNS = D->getQualifier();
auto INI = toName(Name, {}, NNS);
MRDOCS_CHECK_OR(INI);
I.IntroducedName = *INI;
}

void
ASTVisitor::
populate(
UsingSymbol& I,
clang::UnresolvedUsingValueDecl const* D)
{
populateDependentUsing(I, UsingClass::Normal, D);
}

void
ASTVisitor::
populate(
UsingSymbol& I,
clang::UnresolvedUsingTypenameDecl const* D)
{
populateDependentUsing(I, UsingClass::Typename, D);
}

void
ASTVisitor::
populate(
Expand Down
14 changes: 14 additions & 0 deletions src/mrdocs/AST/ASTVisitor.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -643,6 +643,20 @@ class ASTVisitor
void
populate(UsingSymbol& I, clang::UsingDecl const* D);

void
populate(UsingSymbol& I, clang::UnresolvedUsingValueDecl const* D);

void
populate(UsingSymbol& I, clang::UnresolvedUsingTypenameDecl const* D);

// Record the name a dependent using-declaration introduces. There is
// nothing else to record: the qualifier depends on a template
// parameter, so nothing is named until the template is instantiated
// and there are no declarations to point at.
template <std::derived_from<clang::NamedDecl> DeclTy>
void
populateDependentUsing(UsingSymbol& I, UsingClass cls, DeclTy const* D);

void
populate(ConceptSymbol& I, clang::ConceptDecl const* D);

Expand Down
11 changes: 11 additions & 0 deletions src/mrdocs/AST/ClangHelpers.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,17 @@ template <>
struct InfoTypeFor<clang::UsingDecl>
: std::type_identity<UsingSymbol> {};

// A using-declaration whose qualifier depends on a template parameter
// names nothing yet, so Clang keeps it in one of these instead of a
// `UsingDecl` with shadows.
template <>
struct InfoTypeFor<clang::UnresolvedUsingValueDecl>
: std::type_identity<UsingSymbol> {};

template <>
struct InfoTypeFor<clang::UnresolvedUsingTypenameDecl>
: std::type_identity<UsingSymbol> {};

// Extract ConceptSymbol from ConceptDecl
template <>
struct InfoTypeFor<clang::ConceptDecl>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
generator: adoc
multipage: false
warn-if-undocumented: false
source-root: .
Original file line number Diff line number Diff line change
@@ -0,0 +1,219 @@
= Reference
:mrdocs:

[#index]
== Global namespace

=== Types

[cols="1,4"]
|===
| Name| Description
| link:#Base[`Base`]
| A base with members to re&hyphen;export&period;
| link:#Concrete[`Concrete`]
| Re&hyphen;export the same members of a concrete base&period;
| link:#Dependent[`Dependent`]
| Re&hyphen;export members of a base that is a template parameter&period;
|===


[#Base]
== Base

A base with members to re&hyphen;export&period;

=== Synopsis

Declared in `&lt;using&hyphen;signature&period;cpp&gt;`

[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
struct Base;
----

=== Type Aliases

[cols="1,4"]
|===
| Name| Description
| link:#Base-size_type[`size&lowbar;type`]
| The size type&period;
|===


=== Member Functions

[cols="1,4"]
|===
| Name| Description
| link:#Base-size[`size`]
| Return the size&period;
|===


[#Base-size_type]
== link:#Base[Base]::size&lowbar;type

The size type&period;

=== Synopsis

Declared in `&lt;using&hyphen;signature&period;cpp&gt;`

[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
using size&lowbar;type = int;
----

[#Base-size]
== link:#Base[Base]::size

Return the size&period;

=== Synopsis

Declared in `&lt;using&hyphen;signature&period;cpp&gt;`

[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
link:#Base-size_type[size&lowbar;type]
size() const;
----

=== Return Value

the size&period;

[#Concrete]
== Concrete

Re&hyphen;export the same members of a concrete base&period;

=== Synopsis

Declared in `&lt;using&hyphen;signature&period;cpp&gt;`

[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
template&lt;class T&gt;
struct Concrete;
----

=== Using Declarations

[cols="1,4"]
|===
| Name| Description
| link:#Concrete-size[`size`]
| A function&period;
| link:#Concrete-size_type[`size&lowbar;type`]
| A type, so the declaration says `typename`&period;
|===


[#Concrete-size]
== link:#Concrete[Concrete]::size

A function&period;

=== Synopsis

Declared in `&lt;using&hyphen;signature&period;cpp&gt;`

[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
using Base::size;
----

=== Introduced Symbols

[cols="1,4"]
|===
| Name| Description
| link:#Base-size[`size`]
| Return the size&period;
|===

[#Concrete-size_type]
== link:#Concrete[Concrete]::size&lowbar;type

A type, so the declaration says `typename`&period;

=== Synopsis

Declared in `&lt;using&hyphen;signature&period;cpp&gt;`

[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
using typename Base::size&lowbar;type;
----

=== Introduced Symbols

[cols="1,4"]
|===
| Name| Description
| link:#Base-size_type[`size&lowbar;type`]
| The size type&period;
|===

[#Dependent]
== Dependent

Re&hyphen;export members of a base that is a template parameter&period;

=== Synopsis

Declared in `&lt;using&hyphen;signature&period;cpp&gt;`

[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
template&lt;
class T,
class BaseT = link:#Base[Base]&gt;
struct Dependent;
----

=== Using Declarations

[cols="1,4"]
|===
| Name| Description
| link:#Dependent-size[`size`]
| A function&period;
| link:#Dependent-size_type[`size&lowbar;type`]
| A type, so the declaration says `typename`&period;
|===


[#Dependent-size]
== link:#Dependent[Dependent]::size

A function&period;

=== Synopsis

Declared in `&lt;using&hyphen;signature&period;cpp&gt;`

[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
using BaseT::size;
----

[#Dependent-size_type]
== link:#Dependent[Dependent]::size&lowbar;type

A type, so the declaration says `typename`&period;

=== Synopsis

Declared in `&lt;using&hyphen;signature&period;cpp&gt;`

[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
using typename BaseT::size&lowbar;type;
----


[.small]#Created with https://www.mrdocs.com[MrDocs]#
Loading
Loading