From 3fa39c824dc3ef37b69f0be5c3422a9a17714487 Mon Sep 17 00:00:00 2001 From: alandefreitas Date: Fri, 28 Mar 2025 16:02:18 -0300 Subject: [PATCH] SpecializationInfo is unused #fix --- include/mrdocs/Metadata.hpp | 1 - .../mrdocs/Metadata/Info/Specialization.hpp | 72 ------------------- .../symbol/signature/specialization.hbs | 1 - src/lib/AST/ASTVisitor.cpp | 11 --- src/lib/AST/ASTVisitor.hpp | 3 - src/lib/Gen/hbs/VisitorHelpers.cpp | 4 -- src/lib/Gen/xml/XMLWriter.cpp | 18 ----- src/lib/Metadata/Info/Specialization.cpp | 34 --------- src/lib/Metadata/InfoNodes.json | 4 -- src/lib/Support/LegibleNames.cpp | 11 ++- .../config/auto-relates/remove-friend.adoc | 4 +- .../config/auto-relates/remove-friend.html | 4 +- .../golden-tests/symbols/friend/friend-1.adoc | 4 +- .../golden-tests/symbols/friend/friend-1.html | 4 +- .../golden-tests/symbols/friend/friend-2.adoc | 4 +- .../golden-tests/symbols/friend/friend-2.html | 4 +- .../golden-tests/symbols/friend/friend-3.adoc | 8 +-- .../golden-tests/symbols/friend/friend-3.html | 8 +-- .../golden-tests/symbols/friend/friend-4.adoc | 8 +-- .../golden-tests/symbols/friend/friend-4.html | 8 +-- .../golden-tests/symbols/friend/friend-5.adoc | 8 +-- .../golden-tests/symbols/friend/friend-5.html | 8 +-- .../golden-tests/symbols/friend/friend-6.adoc | 16 ++--- .../golden-tests/symbols/friend/friend-6.html | 16 ++--- .../symbols/function/noreturn.adoc | 4 +- .../symbols/function/noreturn.html | 4 +- .../symbols/overloads/overloads-ostream.adoc | 4 +- .../symbols/overloads/overloads-ostream.html | 4 +- .../symbols/overloads/overloads.adoc | 8 +-- .../symbols/overloads/overloads.html | 8 +-- 30 files changed, 73 insertions(+), 222 deletions(-) delete mode 100644 include/mrdocs/Metadata/Info/Specialization.hpp delete mode 100644 share/mrdocs/addons/generator/common/partials/symbol/signature/specialization.hbs delete mode 100644 src/lib/Metadata/Info/Specialization.cpp diff --git a/include/mrdocs/Metadata.hpp b/include/mrdocs/Metadata.hpp index 918fbcae9..27af52d3d 100644 --- a/include/mrdocs/Metadata.hpp +++ b/include/mrdocs/Metadata.hpp @@ -31,7 +31,6 @@ #include #include #include -#include #include #include #include diff --git a/include/mrdocs/Metadata/Info/Specialization.hpp b/include/mrdocs/Metadata/Info/Specialization.hpp deleted file mode 100644 index 458090f4b..000000000 --- a/include/mrdocs/Metadata/Info/Specialization.hpp +++ /dev/null @@ -1,72 +0,0 @@ -// -// 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 Krystian Stasiowski (sdkrystian@gmail.com) -// -// Official repository: https://github.com/cppalliance/mrdocs -// - -#ifndef MRDOCS_API_METADATA_SPECIALIZATION_HPP -#define MRDOCS_API_METADATA_SPECIALIZATION_HPP - -#include -#include -#include -#include -#include - -namespace clang::mrdocs { - -/** Specialization info for members of implicit instantiations -*/ -struct SpecializationInfo final - : InfoCommonBase -{ - /** The template arguments the parent template is specialized for */ - std::vector> Args; - - /** ID of the template to which the arguments pertain */ - SymbolID Primary = SymbolID::invalid; - - explicit SpecializationInfo(SymbolID ID) noexcept - : InfoCommonBase(ID) - { - } -}; - -MRDOCS_DECL -void -merge(SpecializationInfo& I, SpecializationInfo&& Other); - -/** Map a SpecializationInfo to a dom::Object. - */ -template -void -tag_invoke( - dom::LazyObjectMapTag t, - IO& io, - SpecializationInfo const& I, - DomCorpus const* domCorpus) -{ - tag_invoke(t, io, dynamic_cast(I), domCorpus); -} - -/** Map the SpecializationInfo to a @ref dom::Value object. - */ -inline -void -tag_invoke( - dom::ValueFromTag, - dom::Value& v, - SpecializationInfo const& I, - DomCorpus const* domCorpus) -{ - v = dom::LazyObject(I, domCorpus); -} - - -} // clang::mrdocs - -#endif diff --git a/share/mrdocs/addons/generator/common/partials/symbol/signature/specialization.hbs b/share/mrdocs/addons/generator/common/partials/symbol/signature/specialization.hbs deleted file mode 100644 index f94caae56..000000000 --- a/share/mrdocs/addons/generator/common/partials/symbol/signature/specialization.hbs +++ /dev/null @@ -1 +0,0 @@ -{{!-- specialization --}} \ No newline at end of file diff --git a/src/lib/AST/ASTVisitor.cpp b/src/lib/AST/ASTVisitor.cpp index 811f96856..98194b647 100644 --- a/src/lib/AST/ASTVisitor.cpp +++ b/src/lib/AST/ASTVisitor.cpp @@ -1106,17 +1106,6 @@ populate( populateAttributes(I, D); } -void -ASTVisitor:: -populate( - SpecializationInfo& I, - ClassTemplateSpecializationDecl const* D) -{ - CXXRecordDecl const* PD = getInstantiatedFrom(D); - populate(I.Args, D->getTemplateArgs().asArray()); - generateID(PD, I.Primary); -} - void ASTVisitor:: populate( diff --git a/src/lib/AST/ASTVisitor.hpp b/src/lib/AST/ASTVisitor.hpp index c6f717143..076908221 100644 --- a/src/lib/AST/ASTVisitor.hpp +++ b/src/lib/AST/ASTVisitor.hpp @@ -575,9 +575,6 @@ class ASTVisitor void populate(FieldInfo& I, FieldDecl const* D); - void - populate(SpecializationInfo& I, ClassTemplateSpecializationDecl const* D); - void populate(FriendInfo& I, FriendDecl const* D); diff --git a/src/lib/Gen/hbs/VisitorHelpers.cpp b/src/lib/Gen/hbs/VisitorHelpers.cpp index dc2ec802e..ae3c09b9a 100644 --- a/src/lib/Gen/hbs/VisitorHelpers.cpp +++ b/src/lib/Gen/hbs/VisitorHelpers.cpp @@ -19,10 +19,6 @@ namespace clang::mrdocs::hbs { bool shouldGenerate(Info const& I, Config const& config) { - if (I.isSpecialization()) - { - return false; - } if (I.isEnumConstant()) { return false; diff --git a/src/lib/Gen/xml/XMLWriter.cpp b/src/lib/Gen/xml/XMLWriter.cpp index 69d0222ad..c41a5240a 100644 --- a/src/lib/Gen/xml/XMLWriter.cpp +++ b/src/lib/Gen/xml/XMLWriter.cpp @@ -691,24 +691,6 @@ closeTemplate( tags_.close(templateTagName); } -void -XMLWriter:: -writeSpecialization( - SpecializationInfo const& I) -{ - tags_.open(specializationTagName, { - {I.id}, - {"primary", toBase64Str(I.Primary) } - }); - - for(auto const& targ : I.Args) - writeTemplateArg(*targ, tags_); - - corpus_.traverse(I, *this); - - tags_.close(specializationTagName); -} - //------------------------------------------------ void diff --git a/src/lib/Metadata/Info/Specialization.cpp b/src/lib/Metadata/Info/Specialization.cpp deleted file mode 100644 index 73b1168bc..000000000 --- a/src/lib/Metadata/Info/Specialization.cpp +++ /dev/null @@ -1,34 +0,0 @@ -// -// 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) 2025 Alan de Freitas (alandefreitas@gmail.com) -// -// Official repository: https://github.com/cppalliance/mrdocs -// - -#include -#include -#include - -namespace clang::mrdocs { - -void -merge(SpecializationInfo& I, SpecializationInfo&& Other) -{ - MRDOCS_ASSERT(canMerge(I, Other)); - merge(dynamic_cast(I), std::move(dynamic_cast(Other))); - if (!I.Primary) - { - I.Primary = Other.Primary; - } - if (I.Args.empty()) - { - I.Args = std::move(Other.Args); - } -} - -} // clang::mrdocs - diff --git a/src/lib/Metadata/InfoNodes.json b/src/lib/Metadata/InfoNodes.json index 96ed32905..928c742a0 100644 --- a/src/lib/Metadata/InfoNodes.json +++ b/src/lib/Metadata/InfoNodes.json @@ -35,10 +35,6 @@ "name": "field", "brief": "The symbol is a field" }, - { - "name": "specialization", - "brief": "The symbol is a template specialization" - }, { "name": "friend", "brief": "The symbol is a friend declaration" diff --git a/src/lib/Support/LegibleNames.cpp b/src/lib/Support/LegibleNames.cpp index 2a29a4b89..19f9a1f15 100644 --- a/src/lib/Support/LegibleNames.cpp +++ b/src/lib/Support/LegibleNames.cpp @@ -85,12 +85,11 @@ getUnnamedInfoName(Info const& I) "06typedef", "07variable", "08field", - "09specialization", - "08friend", - "12guide", - "12namespace-alias", - "13using", - "14concept" + "09friend", + "10guide", + "11namespace-alias", + "12using", + "13concept" }; std::size_t const idx = to_underlying(I.Kind) - 1; MRDOCS_ASSERT(idx < std::size(reserved)); diff --git a/test-files/golden-tests/config/auto-relates/remove-friend.adoc b/test-files/golden-tests/config/auto-relates/remove-friend.adoc index 9a1462ff3..0f35e0da8 100644 --- a/test-files/golden-tests/config/auto-relates/remove-friend.adoc +++ b/test-files/golden-tests/config/auto-relates/remove-friend.adoc @@ -46,7 +46,7 @@ class A; |=== | Name | Description -| <> +| <> | Friend function not listed as non‐member |=== @@ -60,7 +60,7 @@ class A; | Non‐member function of A |=== -[#A-08friend] +[#A-09friend] == operator== Friend function not listed as non‐member diff --git a/test-files/golden-tests/config/auto-relates/remove-friend.html b/test-files/golden-tests/config/auto-relates/remove-friend.html index f4e380249..026ab58e9 100644 --- a/test-files/golden-tests/config/auto-relates/remove-friend.html +++ b/test-files/golden-tests/config/auto-relates/remove-friend.html @@ -67,7 +67,7 @@

Friends

-operator== Friend function not listed as non-member +operator== Friend function not listed as non-member @@ -90,7 +90,7 @@

Non-Member Functions

-

operator==

+

operator==

Friend function not listed as non-member diff --git a/test-files/golden-tests/symbols/friend/friend-1.adoc b/test-files/golden-tests/symbols/friend/friend-1.adoc index d16e7cc57..04d2b1965 100644 --- a/test-files/golden-tests/symbols/friend/friend-1.adoc +++ b/test-files/golden-tests/symbols/friend/friend-1.adoc @@ -40,11 +40,11 @@ struct T; |=== | Name | Description -| <> +| <> | f |=== -[#T-08friend] +[#T-09friend] == f f diff --git a/test-files/golden-tests/symbols/friend/friend-1.html b/test-files/golden-tests/symbols/friend/friend-1.html index 2706e21c7..8c5e5a6ce 100644 --- a/test-files/golden-tests/symbols/friend/friend-1.html +++ b/test-files/golden-tests/symbols/friend/friend-1.html @@ -61,7 +61,7 @@

Friends

-f f +f f @@ -70,7 +70,7 @@

Friends

-

f

+

f

f diff --git a/test-files/golden-tests/symbols/friend/friend-2.adoc b/test-files/golden-tests/symbols/friend/friend-2.adoc index 7d45b7c18..e6e3f2877 100644 --- a/test-files/golden-tests/symbols/friend/friend-2.adoc +++ b/test-files/golden-tests/symbols/friend/friend-2.adoc @@ -40,11 +40,11 @@ struct T; |=== | Name | Description -| <> +| <> | f |=== -[#T-08friend] +[#T-09friend] == f f diff --git a/test-files/golden-tests/symbols/friend/friend-2.html b/test-files/golden-tests/symbols/friend/friend-2.html index d19e26111..6ffeda924 100644 --- a/test-files/golden-tests/symbols/friend/friend-2.html +++ b/test-files/golden-tests/symbols/friend/friend-2.html @@ -61,7 +61,7 @@

Friends

-f f +f f @@ -70,7 +70,7 @@

Friends

-

f

+

f

f diff --git a/test-files/golden-tests/symbols/friend/friend-3.adoc b/test-files/golden-tests/symbols/friend/friend-3.adoc index 2f8e1ad49..7479a8bde 100644 --- a/test-files/golden-tests/symbols/friend/friend-3.adoc +++ b/test-files/golden-tests/symbols/friend/friend-3.adoc @@ -41,11 +41,11 @@ struct T; |=== | Name | Description -| <> +| <> | T::f |=== -[#T-08friend] +[#T-09friend] == f T::f @@ -78,10 +78,10 @@ struct U; [cols=1] |=== | Name -| <> +| <> |=== -[#U-08friend] +[#U-09friend] == f === Synopsis diff --git a/test-files/golden-tests/symbols/friend/friend-3.html b/test-files/golden-tests/symbols/friend/friend-3.html index 8400973c0..3bb066689 100644 --- a/test-files/golden-tests/symbols/friend/friend-3.html +++ b/test-files/golden-tests/symbols/friend/friend-3.html @@ -62,7 +62,7 @@

Friends

-f T::f +f T::f @@ -71,7 +71,7 @@

Friends

-

f

+

f

T::f @@ -113,7 +113,7 @@

Friends

-f +f @@ -122,7 +122,7 @@

Friends

-

f

+

f

Synopsis

diff --git a/test-files/golden-tests/symbols/friend/friend-4.adoc b/test-files/golden-tests/symbols/friend/friend-4.adoc index df8f3f146..a6c3a6326 100644 --- a/test-files/golden-tests/symbols/friend/friend-4.adoc +++ b/test-files/golden-tests/symbols/friend/friend-4.adoc @@ -40,10 +40,10 @@ struct T; [cols=1] |=== | Name -| <> +| <> |=== -[#T-08friend] +[#T-09friend] == f === Synopsis @@ -75,11 +75,11 @@ struct U; |=== | Name | Description -| <> +| <> | U::f |=== -[#U-08friend] +[#U-09friend] == f U::f diff --git a/test-files/golden-tests/symbols/friend/friend-4.html b/test-files/golden-tests/symbols/friend/friend-4.html index a120c4ac3..8976b2699 100644 --- a/test-files/golden-tests/symbols/friend/friend-4.html +++ b/test-files/golden-tests/symbols/friend/friend-4.html @@ -61,7 +61,7 @@

Friends

-f +f @@ -70,7 +70,7 @@

Friends

-

f

+

f

Synopsis

@@ -109,7 +109,7 @@

Friends

-f U::f +f U::f @@ -118,7 +118,7 @@

Friends

-

f

+

f

U::f diff --git a/test-files/golden-tests/symbols/friend/friend-5.adoc b/test-files/golden-tests/symbols/friend/friend-5.adoc index d68561431..9a2c96d07 100644 --- a/test-files/golden-tests/symbols/friend/friend-5.adoc +++ b/test-files/golden-tests/symbols/friend/friend-5.adoc @@ -40,10 +40,10 @@ struct T; [cols=1] |=== | Name -| <> +| <> |=== -[#T-08friend] +[#T-09friend] == f === Synopsis @@ -74,10 +74,10 @@ struct U; [cols=1] |=== | Name -| <> +| <> |=== -[#U-08friend] +[#U-09friend] == f === Synopsis diff --git a/test-files/golden-tests/symbols/friend/friend-5.html b/test-files/golden-tests/symbols/friend/friend-5.html index 4307f6710..a9cafb073 100644 --- a/test-files/golden-tests/symbols/friend/friend-5.html +++ b/test-files/golden-tests/symbols/friend/friend-5.html @@ -61,7 +61,7 @@

Friends

-f +f @@ -70,7 +70,7 @@

Friends

-

f

+

f

Synopsis

@@ -108,7 +108,7 @@

Friends

-f +f @@ -117,7 +117,7 @@

Friends

-

f

+

f

Synopsis

diff --git a/test-files/golden-tests/symbols/friend/friend-6.adoc b/test-files/golden-tests/symbols/friend/friend-6.adoc index 9ff805d52..a2e041f2b 100644 --- a/test-files/golden-tests/symbols/friend/friend-6.adoc +++ b/test-files/golden-tests/symbols/friend/friend-6.adoc @@ -40,13 +40,13 @@ struct T; |=== | Name | Description -| <> +| <> | Friend class Z brief -| <> +| <> | Friend int brief |=== -[#T-08friend-04cb] +[#T-09friend-04cb] == <> Friend class Z brief @@ -60,7 +60,7 @@ Declared in `<friend‐6.cpp>` friend <>; ---- -[#T-08friend-04ce] +[#T-09friend-04ce] == int Friend int brief @@ -94,11 +94,11 @@ struct U; |=== | Name | Description -| <> +| <> | Friend T brief |=== -[#U-08friend] +[#U-09friend] == <> Friend T brief @@ -132,11 +132,11 @@ struct V; |=== | Name | Description -| <> +| <> | Friend struct U brief |=== -[#V-08friend] +[#V-09friend] == <> Friend struct U brief diff --git a/test-files/golden-tests/symbols/friend/friend-6.html b/test-files/golden-tests/symbols/friend/friend-6.html index 05490c357..6497854cb 100644 --- a/test-files/golden-tests/symbols/friend/friend-6.html +++ b/test-files/golden-tests/symbols/friend/friend-6.html @@ -55,8 +55,8 @@

Friends

-class Z Friend class Z brief -int Friend int brief +class Z Friend class Z brief +int Friend int brief @@ -65,7 +65,7 @@

Friends

-

Z

+

Z

Friend class Z brief @@ -84,7 +84,7 @@

Synopsis

-

int

+

int

Friend int brief @@ -129,7 +129,7 @@

Friends

-T Friend T brief +T Friend T brief @@ -138,7 +138,7 @@

Friends

-

T

+

T

Friend T brief @@ -183,7 +183,7 @@

Friends

-struct U Friend struct U brief +struct U Friend struct U brief @@ -192,7 +192,7 @@

Friends

-

U

+

U

Friend struct U brief diff --git a/test-files/golden-tests/symbols/function/noreturn.adoc b/test-files/golden-tests/symbols/function/noreturn.adoc index b2296746b..083ff0b3b 100644 --- a/test-files/golden-tests/symbols/function/noreturn.adoc +++ b/test-files/golden-tests/symbols/function/noreturn.adoc @@ -53,7 +53,7 @@ struct T; [cols=1] |=== | Name -| <> +| <> |=== [#T-f3] @@ -85,7 +85,7 @@ void f2(); ---- -[#T-08friend] +[#T-09friend] == f1 === Synopsis diff --git a/test-files/golden-tests/symbols/function/noreturn.html b/test-files/golden-tests/symbols/function/noreturn.html index 70d90ead2..3a45f33b8 100644 --- a/test-files/golden-tests/symbols/function/noreturn.html +++ b/test-files/golden-tests/symbols/function/noreturn.html @@ -85,7 +85,7 @@

Friends

-f1 +f1 @@ -129,7 +129,7 @@

Synopsis

-

f1

+

f1

Synopsis

diff --git a/test-files/golden-tests/symbols/overloads/overloads-ostream.adoc b/test-files/golden-tests/symbols/overloads/overloads-ostream.adoc index 2024a3677..8cffffdc2 100644 --- a/test-files/golden-tests/symbols/overloads/overloads-ostream.adoc +++ b/test-files/golden-tests/symbols/overloads/overloads-ostream.adoc @@ -198,10 +198,10 @@ class B; [cols=1] |=== | Name -| <> +| <> |=== -[#ostream-B-08friend] +[#ostream-B-09friend] == <>::operator<< === Synopsis diff --git a/test-files/golden-tests/symbols/overloads/overloads-ostream.html b/test-files/golden-tests/symbols/overloads/overloads-ostream.html index 506f1a9aa..d4b2992a7 100644 --- a/test-files/golden-tests/symbols/overloads/overloads-ostream.html +++ b/test-files/golden-tests/symbols/overloads/overloads-ostream.html @@ -274,7 +274,7 @@

Friends

-operator<< +operator<< @@ -283,7 +283,7 @@

Friends

-

ostream::operator<<

+

ostream::operator<<

Synopsis

diff --git a/test-files/golden-tests/symbols/overloads/overloads.adoc b/test-files/golden-tests/symbols/overloads/overloads.adoc index a7d444fa9..e33da4a1f 100644 --- a/test-files/golden-tests/symbols/overloads/overloads.adoc +++ b/test-files/golden-tests/symbols/overloads/overloads.adoc @@ -62,8 +62,8 @@ struct A; [cols=1] |=== | Name -| <> -| <> +| <> +| <> |=== [#A-f-00] @@ -172,7 +172,7 @@ int g(int); ---- -[#A-08friend-0a] +[#A-09friend-0a] == operator== === Synopsis @@ -188,7 +188,7 @@ operator==( <> rhs); ---- -[#A-08friend-0e] +[#A-09friend-0e] == operator== === Synopsis diff --git a/test-files/golden-tests/symbols/overloads/overloads.html b/test-files/golden-tests/symbols/overloads/overloads.html index 06aa6cc6d..9ac0e7e32 100644 --- a/test-files/golden-tests/symbols/overloads/overloads.html +++ b/test-files/golden-tests/symbols/overloads/overloads.html @@ -90,8 +90,8 @@

Friends

-operator== -operator== +operator== +operator== @@ -222,7 +222,7 @@

Synopsis

-

operator==

+

operator==

Synopsis

@@ -241,7 +241,7 @@

Synopsis

-

operator==

+

operator==

Synopsis