From ac6bc04f2507953863f79bd634a772480db7118d Mon Sep 17 00:00:00 2001 From: Gennaro Prota Date: Wed, 26 Aug 2026 12:47:06 +0200 Subject: [PATCH 1/3] fix: using-declarations off a dependent base are extracted A using-declaration of the kind `TemplateParam::Name` is unresolved until the template is instantiated, so Clang keeps it in an `UnresolvedUsingValueDecl` or `UnresolvedUsingTypenameDecl` rather than in a `UsingDecl` with shadow declarations. Only the latter was traversed, so re-exporting a member of a base that is itself a template parameter left nothing in the documentation, and no diagnostic. The `typename` form is now recorded as such, dependent base or not, where it used to be recorded as a plain `using`. Note that setting that class for the first time exposed the signature partial rendering it as `using typenameBase::size_type`, with no intervening space between `typename` and the name. Fixes #1258. --- .../partials/symbol/signature/using.hbs | 8 +- include/mrdocs/ADT/Overload.hpp | 1 + src/mrdocs/AST/ASTVisitor.cpp | 38 +- src/mrdocs/AST/ASTVisitor.hpp | 14 + src/mrdocs/AST/ClangHelpers.hpp | 11 + .../generator/hbs/using-signature/mrdocs.yml | 4 + .../hbs/using-signature/using-signature.adoc | 217 +++++++ .../hbs/using-signature/using-signature.cpp | 35 ++ .../symbols/using/using-dependent-base.cpp | 40 ++ .../symbols/using/using-dependent-base.xml | 584 ++++++++++++++++++ 10 files changed, 946 insertions(+), 6 deletions(-) create mode 100644 tests/golden/fixtures/generator/hbs/using-signature/mrdocs.yml create mode 100644 tests/golden/fixtures/generator/hbs/using-signature/using-signature.adoc create mode 100644 tests/golden/fixtures/generator/hbs/using-signature/using-signature.cpp create mode 100644 tests/golden/fixtures/symbols/using/using-dependent-base.cpp create mode 100644 tests/golden/fixtures/symbols/using/using-dependent-base.xml diff --git a/data/mrdocs/addons/generator/common/partials/symbol/signature/using.hbs b/data/mrdocs/addons/generator/common/partials/symbol/signature/using.hbs index 12abccb86d4..4b16554e8da 100644 --- a/data/mrdocs/addons/generator/common/partials/symbol/signature/using.hbs +++ b/data/mrdocs/addons/generator/common/partials/symbol/signature/using.hbs @@ -1,5 +1,3 @@ -using {{#if (contains (arr "typename" "enum") class)}} {{class}} -{{~/if~}} -{{~#if introducedName~}} - {{>type/name-info introducedName }} -{{~/if}}; \ No newline at end of file +using +{{~#if (contains (arr "typename" "enum") class)}} {{class}}{{/if}} +{{~#if introducedName}} {{>type/name-info introducedName }}{{/if}}; \ No newline at end of file diff --git a/include/mrdocs/ADT/Overload.hpp b/include/mrdocs/ADT/Overload.hpp index f7a979c2cf1..27f352207ce 100644 --- a/include/mrdocs/ADT/Overload.hpp +++ b/include/mrdocs/ADT/Overload.hpp @@ -43,6 +43,7 @@ namespace mrdocs { */ template struct Overload : Ts... { + /// Bring in the call operator of every base. using Ts::operator()...; /** Constructs an Overload from the given callables. diff --git a/src/mrdocs/AST/ASTVisitor.cpp b/src/mrdocs/AST/ASTVisitor.cpp index 3b42726e132..427c49b93e3 100644 --- a/src/mrdocs/AST/ASTVisitor.cpp +++ b/src/mrdocs/AST/ASTVisitor.cpp @@ -311,6 +311,8 @@ traverse(DeclTy const* D) X(CXXDeductionGuide); X(NamespaceAlias); X(Using); + X(UnresolvedUsingValue); + X(UnresolvedUsingTypename); X(Concept); #undef X default: @@ -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); @@ -1292,6 +1294,40 @@ populate( } } +template 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( diff --git a/src/mrdocs/AST/ASTVisitor.hpp b/src/mrdocs/AST/ASTVisitor.hpp index 7d964fb881b..e85e5294d5b 100644 --- a/src/mrdocs/AST/ASTVisitor.hpp +++ b/src/mrdocs/AST/ASTVisitor.hpp @@ -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 DeclTy> + void + populateDependentUsing(UsingSymbol& I, UsingClass cls, DeclTy const* D); + void populate(ConceptSymbol& I, clang::ConceptDecl const* D); diff --git a/src/mrdocs/AST/ClangHelpers.hpp b/src/mrdocs/AST/ClangHelpers.hpp index 93e75ffc3c3..8bc60e48315 100644 --- a/src/mrdocs/AST/ClangHelpers.hpp +++ b/src/mrdocs/AST/ClangHelpers.hpp @@ -195,6 +195,17 @@ template <> struct InfoTypeFor : std::type_identity {}; +// 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 + : std::type_identity {}; + +template <> +struct InfoTypeFor + : std::type_identity {}; + // Extract ConceptSymbol from ConceptDecl template <> struct InfoTypeFor diff --git a/tests/golden/fixtures/generator/hbs/using-signature/mrdocs.yml b/tests/golden/fixtures/generator/hbs/using-signature/mrdocs.yml new file mode 100644 index 00000000000..fc2841fb31b --- /dev/null +++ b/tests/golden/fixtures/generator/hbs/using-signature/mrdocs.yml @@ -0,0 +1,4 @@ +generator: adoc +multipage: false +warn-if-undocumented: false +source-root: . diff --git a/tests/golden/fixtures/generator/hbs/using-signature/using-signature.adoc b/tests/golden/fixtures/generator/hbs/using-signature/using-signature.adoc new file mode 100644 index 00000000000..7ebdcd09c99 --- /dev/null +++ b/tests/golden/fixtures/generator/hbs/using-signature/using-signature.adoc @@ -0,0 +1,217 @@ += Reference +:mrdocs: + +[#index] +== Global namespace + +=== Types + +[cols="1,4"] +|=== +| Name| Description +| link:#Base[`Base`] +| A base with members to re‐export. +| link:#Concrete[`Concrete`] +| Re‐export the same members of a concrete base. +| link:#Dependent[`Dependent`] +| Re‐export members of a base that is a template parameter. +|=== + + +[#Base] +== Base + +A base with members to re‐export. + +=== Synopsis + +Declared in `<using‐signature.cpp>` + +[source,cpp,subs="verbatim,replacements,macros,-callouts"] +---- +struct Base; +---- + +=== Type Aliases + +[cols="1,4"] +|=== +| Name| Description +| link:#Base-size_type[`size_type`] +| The size type. +|=== + + +=== Member Functions + +[cols="1,4"] +|=== +| Name| Description +| link:#Base-size[`size`] +| Return the size. +|=== + + +[#Base-size_type] +== link:#Base[Base]::size_type + +The size type. + +=== Synopsis + +Declared in `<using‐signature.cpp>` + +[source,cpp,subs="verbatim,replacements,macros,-callouts"] +---- +using size_type = int; +---- + +[#Base-size] +== link:#Base[Base]::size + +Return the size. + +=== Synopsis + +Declared in `<using‐signature.cpp>` + +[source,cpp,subs="verbatim,replacements,macros,-callouts"] +---- +link:#Base-size_type[size_type] +size() const; +---- + +=== Return Value + +the size. + +[#Concrete] +== Concrete + +Re‐export the same members of a concrete base. + +=== Synopsis + +Declared in `<using‐signature.cpp>` + +[source,cpp,subs="verbatim,replacements,macros,-callouts"] +---- +template<class T> +struct Concrete; +---- + +=== Using Declarations + +[cols="1,4"] +|=== +| Name| Description +| link:#Concrete-size[`size`] +| A function. +| link:#Concrete-size_type[`size_type`] +| A type, so the declaration says `typename`. +|=== + + +[#Concrete-size] +== link:#Concrete[Concrete]::size + +A function. + +=== Synopsis + +Declared in `<using‐signature.cpp>` + +[source,cpp,subs="verbatim,replacements,macros,-callouts"] +---- +using Base::size; +---- + +=== Introduced Symbols + +[cols="1"] +|=== +| Name +| 2LyeUq3z6s3sEYmVKB4G7MNwVjX6 +|=== + +[#Concrete-size_type] +== link:#Concrete[Concrete]::size_type + +A type, so the declaration says `typename`. + +=== Synopsis + +Declared in `<using‐signature.cpp>` + +[source,cpp,subs="verbatim,replacements,macros,-callouts"] +---- +using typename Base::size_type; +---- + +=== Introduced Symbols + +[cols="1"] +|=== +| Name +| 3h6n5qQ5hGDVyhfrAVJE8FLe2bgi +|=== + +[#Dependent] +== Dependent + +Re‐export members of a base that is a template parameter. + +=== Synopsis + +Declared in `<using‐signature.cpp>` + +[source,cpp,subs="verbatim,replacements,macros,-callouts"] +---- +template< + class T, + class BaseT = link:#Base[Base]> +struct Dependent; +---- + +=== Using Declarations + +[cols="1,4"] +|=== +| Name| Description +| link:#Dependent-size[`size`] +| A function. +| link:#Dependent-size_type[`size_type`] +| A type, so the declaration says `typename`. +|=== + + +[#Dependent-size] +== link:#Dependent[Dependent]::size + +A function. + +=== Synopsis + +Declared in `<using‐signature.cpp>` + +[source,cpp,subs="verbatim,replacements,macros,-callouts"] +---- +using BaseT::size; +---- + +[#Dependent-size_type] +== link:#Dependent[Dependent]::size_type + +A type, so the declaration says `typename`. + +=== Synopsis + +Declared in `<using‐signature.cpp>` + +[source,cpp,subs="verbatim,replacements,macros,-callouts"] +---- +using typename BaseT::size_type; +---- + + +[.small]#Created with https://www.mrdocs.com[MrDocs]# diff --git a/tests/golden/fixtures/generator/hbs/using-signature/using-signature.cpp b/tests/golden/fixtures/generator/hbs/using-signature/using-signature.cpp new file mode 100644 index 00000000000..c6a8510198d --- /dev/null +++ b/tests/golden/fixtures/generator/hbs/using-signature/using-signature.cpp @@ -0,0 +1,35 @@ +// Render the signature of every form of using-declaration: with and +// without the `typename` keyword, off a concrete base and off a base +// that is a template parameter. + +/// A base with members to re-export. +struct Base +{ + /// The size type. + using size_type = int; + + /// Return the size. + size_type size() const; +}; + +/// Re-export members of a base that is a template parameter. +template +struct Dependent : private BaseT +{ + /// A type, so the declaration says `typename`. + using typename BaseT::size_type; + + /// A function. + using BaseT::size; +}; + +/// Re-export the same members of a concrete base. +template +struct Concrete : private Base +{ + /// A type, so the declaration says `typename`. + using typename Base::size_type; + + /// A function. + using Base::size; +}; diff --git a/tests/golden/fixtures/symbols/using/using-dependent-base.cpp b/tests/golden/fixtures/symbols/using/using-dependent-base.cpp new file mode 100644 index 00000000000..f486e0c01d7 --- /dev/null +++ b/tests/golden/fixtures/symbols/using/using-dependent-base.cpp @@ -0,0 +1,40 @@ +// Test that a using-declaration whose qualifier depends on a template +// parameter is extracted. Nothing is named until the template is +// instantiated, so the declaration records the name it introduces and +// no target. The same declarations off a concrete base are here for +// comparison, since those name something already. + +/// A base with members to re-export. +struct Base +{ + /// The size type. + using size_type = int; + + /// Return the size. + size_type size() const; +}; + +/// Re-export members of a base that is a template parameter. +template +struct Dependent : private BaseT +{ + /// A type re-exported from a dependent base. + using typename BaseT::size_type; + + /// A function re-exported from a dependent base. + using BaseT::size; + + /// A member declared directly, for comparison. + int count() const; +}; + +/// Re-export the same members of a concrete base. +template +struct Concrete : private Base +{ + /// A type re-exported from a concrete base. + using typename Base::size_type; + + /// A function re-exported from a concrete base. + using Base::size; +}; diff --git a/tests/golden/fixtures/symbols/using/using-dependent-base.xml b/tests/golden/fixtures/symbols/using/using-dependent-base.xml new file mode 100644 index 00000000000..8266c7aeaca --- /dev/null +++ b/tests/golden/fixtures/symbols/using/using-dependent-base.xml @@ -0,0 +1,584 @@ + + + + index + namespace + 4ZrjxJnU1LA5xSyrWMNuXTvSYKwt + regular + + 2QDQSSTt2u1SGtB1MPniUV22mgRU 2LJqZkcf4MG7rwxxFj3qtdVwD3ap ZvzpNp1EeNa7Bt6US4uTaEu2eT9 + + + + Base + Base + + + using-dependent-base.cpp + using-dependent-base.cpp + 8 + 1 + + + + record + 2QDQSSTt2u1SGtB1MPniUV22mgRU + regular + 4ZrjxJnU1LA5xSyrWMNuXTvSYKwt + + + brief + + + text + A base with members to re-export. + + + + + struct + + + 3h6n5qQ5hGDVyhfrAVJE8FLe2bgi + 2LyeUq3z6s3sEYmVKB4G7MNwVjX6 + + + + + size_type + size_type + + + + using-dependent-base.cpp + using-dependent-base.cpp + 11 + 5 + + + + + typedef + 3h6n5qQ5hGDVyhfrAVJE8FLe2bgi + public + regular + 2QDQSSTt2u1SGtB1MPniUV22mgRU + + + brief + + + text + The size type. + + + + + + + named + + + identifier + int + + + int + + + + + + size + size + + + + using-dependent-base.cpp + using-dependent-base.cpp + 14 + 5 + + + + + function + 2LyeUq3z6s3sEYmVKB4G7MNwVjX6 + public + regular + 2QDQSSTt2u1SGtB1MPniUV22mgRU + + + brief + + + text + Return the size. + + + + + + returns + + + text + the size. + + + + + + + + named + + + identifier + 3h6n5qQ5hGDVyhfrAVJE8FLe2bgi + size_type + + + + + normal + + + + + Concrete + Concrete + + + using-dependent-base.cpp + using-dependent-base.cpp + 32 + 1 + + + + record + 2LJqZkcf4MG7rwxxFj3qtdVwD3ap + regular + 4ZrjxJnU1LA5xSyrWMNuXTvSYKwt + + + brief + + + text + Re-export the same members of a concrete base. + + + + + struct + + + + F9d3GgNReAuoFR25gEbySEh4PDE 3kraMSUBSmfTbr33UtYrydDrGEQQ + + + + + size + size + + + + using-dependent-base.cpp + using-dependent-base.cpp + 39 + 5 + + + + + using + F9d3GgNReAuoFR25gEbySEh4PDE + public + regular + 2LJqZkcf4MG7rwxxFj3qtdVwD3ap + + + brief + + + text + A function re-exported from a concrete base. + + + + + normal + + + identifier + size + + + identifier + 2QDQSSTt2u1SGtB1MPniUV22mgRU + Base + + + + + 2LyeUq3z6s3sEYmVKB4G7MNwVjX6 + + + size + size + + + + using-dependent-base.cpp + using-dependent-base.cpp + 14 + 5 + + + + + function + 2LyeUq3z6s3sEYmVKB4G7MNwVjX6 + public + regular + 2QDQSSTt2u1SGtB1MPniUV22mgRU + + + brief + + + text + Return the size. + + + + + + returns + + + text + the size. + + + + + + + + named + + + identifier + 3h6n5qQ5hGDVyhfrAVJE8FLe2bgi + size_type + + + + + normal + + + + + size_type + size_type + + + + using-dependent-base.cpp + using-dependent-base.cpp + 36 + 5 + + + + + using + 3kraMSUBSmfTbr33UtYrydDrGEQQ + public + regular + 2LJqZkcf4MG7rwxxFj3qtdVwD3ap + + + brief + + + text + A type re-exported from a concrete base. + + + + + typename + + + identifier + size_type + + + identifier + 2QDQSSTt2u1SGtB1MPniUV22mgRU + Base + + + + + 3h6n5qQ5hGDVyhfrAVJE8FLe2bgi + + + size_type + size_type + + + + using-dependent-base.cpp + using-dependent-base.cpp + 11 + 5 + + + + + typedef + 3h6n5qQ5hGDVyhfrAVJE8FLe2bgi + public + regular + 2QDQSSTt2u1SGtB1MPniUV22mgRU + + + brief + + + text + The size type. + + + + + + + named + + + identifier + int + + + int + + + + + + Dependent + Dependent + + + using-dependent-base.cpp + using-dependent-base.cpp + 18 + 1 + + + + record + ZvzpNp1EeNa7Bt6US4uTaEu2eT9 + regular + 4ZrjxJnU1LA5xSyrWMNuXTvSYKwt + + + brief + + + text + Re-export members of a base that is a template parameter. + + + + + struct + + + + 3TwXJh7HgtHQD9m14oCCvJEFv2aH + TD2rgVy7CCJzzh9NBY4G6fFra4K 2nj9tNU6eN74pwLoqQsPirpKxs8S + + + + + count + count + + + + using-dependent-base.cpp + using-dependent-base.cpp + 28 + 5 + + + + + function + 3TwXJh7HgtHQD9m14oCCvJEFv2aH + public + regular + ZvzpNp1EeNa7Bt6US4uTaEu2eT9 + + + brief + + + text + A member declared directly, for comparison. + + + + + + + named + + + identifier + int + + + int + + + normal + + + + + size + size + + + + using-dependent-base.cpp + using-dependent-base.cpp + 25 + 5 + + + + + using + TD2rgVy7CCJzzh9NBY4G6fFra4K + public + regular + ZvzpNp1EeNa7Bt6US4uTaEu2eT9 + + + brief + + + text + A function re-exported from a dependent base. + + + + + normal + + + identifier + size + + + identifier + BaseT + + + + + + + size_type + size_type + + + + using-dependent-base.cpp + using-dependent-base.cpp + 22 + 5 + + + + + using + 2nj9tNU6eN74pwLoqQsPirpKxs8S + public + regular + ZvzpNp1EeNa7Bt6US4uTaEu2eT9 + + + brief + + + text + A type re-exported from a dependent base. + + + + + typename + + + identifier + size_type + + + identifier + BaseT + + + + + + From 33ad6c52f85022bf2f0632285e0ba057aa4aae71 Mon Sep 17 00:00:00 2001 From: Gennaro Prota Date: Wed, 26 Aug 2026 12:56:39 +0200 Subject: [PATCH 2/3] test: using-declarations with nothing to point at Three using-declaration cases end up with no target. One is a base that is a template parameter, covered by the fix in the previous commit. The other two had no coverage at all: - A member of every base in a pack, where the qualifier depends on the pack, so nothing is named until instantiation. - A member of a base that is filtered out, where the target is dropped for being excluded or an implementation detail, while the qualifier survives in the name introduced by the declaration. --- .../symbols/using/using-filtered-base.cpp | 32 ++ .../symbols/using/using-filtered-base.xml | 237 +++++++++++++++ .../symbols/using/using-filtered-base.yml | 4 + .../symbols/using/using-pack-expansion.cpp | 25 ++ .../symbols/using/using-pack-expansion.xml | 282 ++++++++++++++++++ 5 files changed, 580 insertions(+) create mode 100644 tests/golden/fixtures/symbols/using/using-filtered-base.cpp create mode 100644 tests/golden/fixtures/symbols/using/using-filtered-base.xml create mode 100644 tests/golden/fixtures/symbols/using/using-filtered-base.yml create mode 100644 tests/golden/fixtures/symbols/using/using-pack-expansion.cpp create mode 100644 tests/golden/fixtures/symbols/using/using-pack-expansion.xml diff --git a/tests/golden/fixtures/symbols/using/using-filtered-base.cpp b/tests/golden/fixtures/symbols/using/using-filtered-base.cpp new file mode 100644 index 00000000000..1ce4956fe71 --- /dev/null +++ b/tests/golden/fixtures/symbols/using/using-filtered-base.cpp @@ -0,0 +1,32 @@ +// A using-declaration re-exporting a member of a base that is filtered +// out of the documentation. There is nothing left to point at, so the +// declaration records only the name it introduces, the same as one off +// a base that is a template parameter. + +namespace ns { + +/// A base marked as an implementation detail. +struct Detail +{ + /// A member of the detail base. + int hidden() const; +}; + +/// A base excluded from extraction. +struct Excluded +{ + /// A member of the excluded base. + int gone() const; +}; + +/// Re-export a member of each. +struct Reexport : private Detail, private Excluded +{ + /// Re-exported from the implementation-defined base. + using Detail::hidden; + + /// Re-exported from the excluded base. + using Excluded::gone; +}; + +} // namespace ns diff --git a/tests/golden/fixtures/symbols/using/using-filtered-base.xml b/tests/golden/fixtures/symbols/using/using-filtered-base.xml new file mode 100644 index 00000000000..cf145443b43 --- /dev/null +++ b/tests/golden/fixtures/symbols/using/using-filtered-base.xml @@ -0,0 +1,237 @@ + + + + index + namespace + 4ZrjxJnU1LA5xSyrWMNuXTvSYKwt + regular + + M24JSbN7468AETx5E9NkwAwd79o + + + + ns + ns + + + + using-filtered-base.cpp + using-filtered-base.cpp + 6 + 1 + + + + namespace + M24JSbN7468AETx5E9NkwAwd79o + regular + 4ZrjxJnU1LA5xSyrWMNuXTvSYKwt + + 3SGcYLppJA2rdQ8vTWo5rKV22sPK 3c5RuWKWcxGpq8T1Vzzp41kueCYr 3D3Ncqr4SiKkKtsbeUAFYeJcB64v + + + + Detail + Detail + + + using-filtered-base.cpp + using-filtered-base.cpp + 9 + 1 + + + + record + 3SGcYLppJA2rdQ8vTWo5rKV22sPK + implementation-defined + M24JSbN7468AETx5E9NkwAwd79o + + + brief + + + text + A base marked as an implementation detail. + + + + + struct + + + 2pZPcSxiLCTW81Ep9WcR6CSNvBe7 + + + + + hidden + hidden + + + + using-filtered-base.cpp + using-filtered-base.cpp + 12 + 5 + + + + + function + 2pZPcSxiLCTW81Ep9WcR6CSNvBe7 + public + implementation-defined + 3SGcYLppJA2rdQ8vTWo5rKV22sPK + + + brief + + + text + A member of the detail base. + + + + + + + named + + + identifier + int + + + int + + + normal + + + + + Reexport + Reexport + + + using-filtered-base.cpp + using-filtered-base.cpp + 23 + 1 + + + + record + 3D3Ncqr4SiKkKtsbeUAFYeJcB64v + regular + M24JSbN7468AETx5E9NkwAwd79o + + + brief + + + text + Re-export a member of each. + + + + + struct + + + npRa45X8z2orh68KkLG7cQmGXz1 3a9zMXoj73M9zQcYYmsCqtCxtEE4 + + + + + gone + gone + + + + using-filtered-base.cpp + using-filtered-base.cpp + 29 + 5 + + + + + using + npRa45X8z2orh68KkLG7cQmGXz1 + public + regular + 3D3Ncqr4SiKkKtsbeUAFYeJcB64v + + + brief + + + text + Re-exported from the excluded base. + + + + + normal + + + identifier + gone + + + identifier + 3c5RuWKWcxGpq8T1Vzzp41kueCYr + Excluded + + + + + + + hidden + hidden + + + + using-filtered-base.cpp + using-filtered-base.cpp + 26 + 5 + + + + + using + 3a9zMXoj73M9zQcYYmsCqtCxtEE4 + public + regular + 3D3Ncqr4SiKkKtsbeUAFYeJcB64v + + + brief + + + text + Re-exported from the implementation-defined base. + + + + + normal + + + identifier + hidden + + + identifier + 3SGcYLppJA2rdQ8vTWo5rKV22sPK + Detail + + + + + + diff --git a/tests/golden/fixtures/symbols/using/using-filtered-base.yml b/tests/golden/fixtures/symbols/using/using-filtered-base.yml new file mode 100644 index 00000000000..2d0d17608cc --- /dev/null +++ b/tests/golden/fixtures/symbols/using/using-filtered-base.yml @@ -0,0 +1,4 @@ +implementation-defined: + - 'ns::Detail' +exclude-symbols: + - 'ns::Excluded' diff --git a/tests/golden/fixtures/symbols/using/using-pack-expansion.cpp b/tests/golden/fixtures/symbols/using/using-pack-expansion.cpp new file mode 100644 index 00000000000..299c1af7103 --- /dev/null +++ b/tests/golden/fixtures/symbols/using/using-pack-expansion.cpp @@ -0,0 +1,25 @@ +// A using-declaration can name a member of every base in a pack. The +// qualifier depends on the pack, so nothing is named until the template +// is instantiated and the declaration has no target to record. + +/// A base with a member to re-export. +struct First +{ + /// Return the size. + int size() const; +}; + +/// Another base with a member of the same name. +struct Second +{ + /// Return the size. + int size() const; +}; + +/// Re-export the member from every base in the pack. +template +struct FromPack : private Bases... +{ + /// Re-exported from each base in the pack. + using Bases::size...; +}; diff --git a/tests/golden/fixtures/symbols/using/using-pack-expansion.xml b/tests/golden/fixtures/symbols/using/using-pack-expansion.xml new file mode 100644 index 00000000000..3ad6bc9ad9b --- /dev/null +++ b/tests/golden/fixtures/symbols/using/using-pack-expansion.xml @@ -0,0 +1,282 @@ + + + + index + namespace + 4ZrjxJnU1LA5xSyrWMNuXTvSYKwt + regular + + G2eFZG2h7WkioJftequH1fFVCPX 35QU1wZVPUWr1pXrspYwH3zDPFvL 36MyNiKDV7vRJsTiV9XqGJhSHuZv + + + + First + First + + + using-pack-expansion.cpp + using-pack-expansion.cpp + 6 + 1 + + + + record + G2eFZG2h7WkioJftequH1fFVCPX + regular + 4ZrjxJnU1LA5xSyrWMNuXTvSYKwt + + + brief + + + text + A base with a member to re-export. + + + + + struct + + + 24HrDdXZWDbMoV8ib7JFdGumf3ou + + + + + size + size + + + + using-pack-expansion.cpp + using-pack-expansion.cpp + 9 + 5 + + + + + function + 24HrDdXZWDbMoV8ib7JFdGumf3ou + public + regular + G2eFZG2h7WkioJftequH1fFVCPX + + + brief + + + text + Return the size. + + + + + + returns + + + text + the size. + + + + + + + + named + + + identifier + int + + + int + + + normal + + + + + FromPack + FromPack + + + using-pack-expansion.cpp + using-pack-expansion.cpp + 20 + 1 + + + + record + 35QU1wZVPUWr1pXrspYwH3zDPFvL + regular + 4ZrjxJnU1LA5xSyrWMNuXTvSYKwt + + + brief + + + text + Re-export the member from every base in the pack. + + + + + struct + + + + 26yu88AXLchd1K31Kcnhup4Va75U + + + + + size + size + + + + using-pack-expansion.cpp + using-pack-expansion.cpp + 24 + 5 + + + + + using + 26yu88AXLchd1K31Kcnhup4Va75U + public + regular + 35QU1wZVPUWr1pXrspYwH3zDPFvL + + + brief + + + text + Re-exported from each base in the pack. + + + + + normal + + + identifier + size + + + identifier + Bases + + + + + + + Second + Second + + + using-pack-expansion.cpp + using-pack-expansion.cpp + 13 + 1 + + + + record + 36MyNiKDV7vRJsTiV9XqGJhSHuZv + regular + 4ZrjxJnU1LA5xSyrWMNuXTvSYKwt + + + brief + + + text + Another base with a member of the same name. + + + + + struct + + + 3sURfsgQ99oxfJ2ZatgmvNJFrFVZ + + + + + size + size + + + + using-pack-expansion.cpp + using-pack-expansion.cpp + 16 + 5 + + + + + function + 3sURfsgQ99oxfJ2ZatgmvNJFrFVZ + public + regular + 36MyNiKDV7vRJsTiV9XqGJhSHuZv + + + brief + + + text + Return the size. + + + + + + returns + + + text + the size. + + + + + + + + named + + + identifier + int + + + int + + + normal + + + + From e49c106d504094ed235499cfc372f0a2aede0c0d Mon Sep 17 00:00:00 2001 From: Gennaro Prota Date: Wed, 26 Aug 2026 16:54:06 +0200 Subject: [PATCH 3/3] fix: introduced symbols are listed by name The section handed the table the symbol IDs themselves, so a using-declaration listed the hash of what it introduces instead of the name; and the descriptions went missing with it, because the test for whether any of them is documented could not find a doc comment on an ID. They are resolved through the corpus now. --- .../partials/symbol/section/introduced-symbols.hbs | 8 +++++--- .../hbs/using-signature/using-signature.adoc | 14 ++++++++------ 2 files changed, 13 insertions(+), 9 deletions(-) diff --git a/data/mrdocs/addons/generator/common/partials/symbol/section/introduced-symbols.hbs b/data/mrdocs/addons/generator/common/partials/symbol/section/introduced-symbols.hbs index d7178096018..37bf23c1eef 100644 --- a/data/mrdocs/addons/generator/common/partials/symbol/section/introduced-symbols.hbs +++ b/data/mrdocs/addons/generator/common/partials/symbol/section/introduced-symbols.hbs @@ -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}} diff --git a/tests/golden/fixtures/generator/hbs/using-signature/using-signature.adoc b/tests/golden/fixtures/generator/hbs/using-signature/using-signature.adoc index 7ebdcd09c99..e0ecc734c3e 100644 --- a/tests/golden/fixtures/generator/hbs/using-signature/using-signature.adoc +++ b/tests/golden/fixtures/generator/hbs/using-signature/using-signature.adoc @@ -128,10 +128,11 @@ using Base::size; === Introduced Symbols -[cols="1"] +[cols="1,4"] |=== -| Name -| 2LyeUq3z6s3sEYmVKB4G7MNwVjX6 +| Name| Description +| link:#Base-size[`size`] +| Return the size. |=== [#Concrete-size_type] @@ -150,10 +151,11 @@ using typename Base::size_type; === Introduced Symbols -[cols="1"] +[cols="1,4"] |=== -| Name -| 3h6n5qQ5hGDVyhfrAVJE8FLe2bgi +| Name| Description +| link:#Base-size_type[`size_type`] +| The size type. |=== [#Dependent]