Skip to content

Commit 8f5391b

Browse files
committed
refactor: replace per-type merge() one-liners with a single generic template
Adds a constrained merge(T&, T&&) template in MergeReflectedType.hpp that works for any type with MRDOCS_DESCRIBE_STRUCT. Non-template overloads (DocComment, SourceInfo, TemplateInfo, ExtractionMode, etc.) are still preferred by overload resolution. This eliminates a bunch of merge() functions that did nothing but forward to mergeReflected(), along with their MRDOCS_DECL declarations in public headers. Three .cpp files that existed solely for those one-liners are deleted entirely (Enum.cpp, EnumConstant.cpp, NamespaceAlias.cpp). Cleans up unused #include <mrdocs/Platform.hpp> from several .cpp files that only needed it for MRDOCS_ASSERT in the deleted functions.
1 parent eb68494 commit 8f5391b

37 files changed

Lines changed: 11 additions & 325 deletions

include/mrdocs/Metadata/Name.hpp

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -89,11 +89,6 @@ tag_invoke(
8989
tag_invoke(dom::ValueFromTag{}, v, *I, domCorpus);
9090
}
9191

92-
/** Merge two Name metadata objects.
93-
*/
94-
void
95-
merge(Name& I, Name&& Other);
96-
9792
} // mrdocs
9893

9994
#endif

include/mrdocs/Metadata/Symbol/Concept.hpp

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -56,12 +56,6 @@ MRDOCS_DESCRIBE_STRUCT(
5656
(Template, Constraint)
5757
)
5858

59-
/** Merge another ConceptSymbol into this one.
60-
*/
61-
MRDOCS_DECL
62-
void
63-
merge(ConceptSymbol& I, ConceptSymbol&& Other);
64-
6559
/** Map a ConceptSymbol to a dom::Object.
6660
6761
@param t The tag type.

include/mrdocs/Metadata/Symbol/Enum.hpp

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -81,14 +81,6 @@ allMembers(EnumSymbol const& T)
8181
return T.Constants;
8282
}
8383

84-
/** Merge another EnumSymbol into this one.
85-
@param I Destination symbol to update.
86-
@param Other Source symbol providing data.
87-
*/
88-
MRDOCS_DECL
89-
void
90-
merge(EnumSymbol& I, EnumSymbol&& Other);
91-
9284
/** Map a EnumSymbol to a dom::Object.
9385
9486
@param t The tag type.

include/mrdocs/Metadata/Symbol/EnumConstant.hpp

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -43,14 +43,6 @@ MRDOCS_DESCRIBE_STRUCT(
4343
(Initializer)
4444
)
4545

46-
/** Merge another EnumConstantSymbol into this one.
47-
@param I Destination symbol to update.
48-
@param Other Source symbol providing data.
49-
*/
50-
MRDOCS_DECL
51-
void
52-
merge(EnumConstantSymbol& I, EnumConstantSymbol&& Other);
53-
5446
/** Map a EnumConstantSymbol to a dom::Object.
5547
5648
@param t The tag type.

include/mrdocs/Metadata/Symbol/Friend.hpp

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -50,12 +50,6 @@ MRDOCS_DESCRIBE_STRUCT(
5050
(Type, id)
5151
)
5252

53-
/** Merge another FriendInfo into this one.
54-
*/
55-
MRDOCS_DECL
56-
void
57-
merge(FriendInfo& I, FriendInfo&& Other);
58-
5953
/** Merge friend declarations, deduplicating by symbol ID.
6054
6155
@param dst The destination.

include/mrdocs/Metadata/Symbol/Function.hpp

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -164,14 +164,6 @@ MRDOCS_DESCRIBE_STRUCT(
164164
RefQualifier, Explicit, Attributes, FunctionObjectImpl)
165165
)
166166

167-
/** Merge metadata from another function symbol.
168-
@param I Destination symbol to update.
169-
@param Other Source symbol providing additional data.
170-
*/
171-
MRDOCS_DECL
172-
void
173-
merge(FunctionSymbol& I, FunctionSymbol&& Other);
174-
175167
/** Map a FunctionSymbol to a dom::Object.
176168
177169
@param t The tag type.

include/mrdocs/Metadata/Symbol/Guide.hpp

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -67,14 +67,6 @@ MRDOCS_DESCRIBE_STRUCT(
6767
(Deduced, Template, Params, Explicit)
6868
)
6969

70-
/** Merge another GuideSymbol into this one.
71-
@param I Destination symbol to update.
72-
@param Other Source symbol providing data.
73-
*/
74-
MRDOCS_DECL
75-
void
76-
merge(GuideSymbol& I, GuideSymbol&& Other);
77-
7870
/** Map a GuideSymbol to a dom::Object.
7971
8072
@param t The tag type.

include/mrdocs/Metadata/Symbol/Namespace.hpp

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -67,12 +67,6 @@ MRDOCS_DESCRIBE_STRUCT(
6767
Functions, Variables, Concepts, Guides, Usings)
6868
)
6969

70-
/** Merge two tranches, appending members from the right-hand side.
71-
*/
72-
MRDOCS_DECL
73-
void
74-
merge(NamespaceTranche& I, NamespaceTranche&& Other);
75-
7670
/** Join all tranche member lists into a single view.
7771
@return Lazy view spanning every category stored in the tranche.
7872
*/
@@ -168,12 +162,6 @@ MRDOCS_DESCRIBE_STRUCT(
168162
(IsInline, IsAnonymous, UsingDirectives, Members)
169163
)
170164

171-
/** Merge two namespaces, keeping existing members stable.
172-
*/
173-
MRDOCS_DECL
174-
void
175-
merge(NamespaceSymbol& I, NamespaceSymbol&& Other);
176-
177165
/** View all members of the namespace across tranches.
178166
@return Lazy view across every member bucket.
179167
*/

include/mrdocs/Metadata/Symbol/NamespaceAlias.hpp

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -47,12 +47,6 @@ MRDOCS_DESCRIBE_STRUCT(
4747
(AliasedSymbol)
4848
)
4949

50-
/** Merge two alias symbols, preferring existing fields when present.
51-
*/
52-
MRDOCS_DECL
53-
void
54-
merge(NamespaceAliasSymbol& I, NamespaceAliasSymbol&& Other);
55-
5650
/** Map a NamespaceAliasSymbol to a dom::Object.
5751
5852
@param t The tag type.

include/mrdocs/Metadata/Symbol/Overloads.hpp

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -65,11 +65,6 @@ MRDOCS_DESCRIBE_STRUCT(
6565
(FuncClass, OverloadedOperator, Members, ReturnType)
6666
)
6767

68-
/** Merge overload sets, preserving ordering in `Members`.
69-
*/
70-
MRDOCS_DECL
71-
void merge(OverloadsSymbol& I, OverloadsSymbol&& Other);
72-
7368
/** Access the list of overload members.
7469
@return Reference to the ID list backing this set.
7570
*/

0 commit comments

Comments
 (0)