Skip to content

Commit 9ca2efd

Browse files
committed
fix: preserve extraction mode when copying members from derived classes
Fixes #1119
1 parent 2463633 commit 9ca2efd

27 files changed

+150
-1129
lines changed

include/mrdocs/Metadata/Symbol/Function.hpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,8 @@ struct FunctionSymbol final
136136
{
137137
}
138138

139+
FunctionSymbol(FunctionSymbol const& ID) = default;
140+
139141
/** Compare functions by signature, qualifiers, and metadata.
140142
*/
141143
std::strong_ordering

src/lib/Metadata/Finalizers/BaseMembersFinalizer.cpp

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -98,16 +98,6 @@ inheritBaseMembers(
9898
std::vector<SymbolID>& derived,
9999
std::vector<SymbolID> const& base)
100100
{
101-
Symbol const* derivedInfo = nullptr;
102-
auto const getDerivedInfo = [&]() -> Symbol const*
103-
{
104-
if (!derivedInfo)
105-
{
106-
derivedInfo = corpus_.find(derivedId);
107-
}
108-
return derivedInfo;
109-
};
110-
111101
for (SymbolID const& otherID: base)
112102
{
113103
// Find the info from the base class
@@ -173,14 +163,6 @@ inheritBaseMembers(
173163
std::format("{}-{}", toBase16Str(otherCopy->Parent),
174164
toBase16Str(otherInfo.id)));
175165
derived.push_back(otherCopy->id);
176-
// Get the extraction mode from the derived class
177-
if (otherCopy->Extraction == ExtractionMode::Dependency ||
178-
otherCopy->Extraction == ExtractionMode::ImplementationDefined)
179-
{
180-
Symbol const* derivedInfoPtr = getDerivedInfo();
181-
MRDOCS_CHECK_OR_CONTINUE(derivedInfoPtr);
182-
otherCopy->Extraction = derivedInfoPtr->Extraction;
183-
}
184166
corpus_.info_.insert(std::move(otherCopy));
185167
}
186168
}

test-files/golden-tests/config/extract-implicit-specializations/extract-implicit-specializations.adoc

Lines changed: 0 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -36,27 +36,6 @@ struct A
3636
|
3737
|===
3838

39-
=== Member Functions
40-
41-
[cols=1]
42-
|===
43-
| Name
44-
| link:#A-value[`value`]
45-
|===
46-
47-
[#A-value]
48-
== link:#A[A]::value
49-
50-
=== Synopsis
51-
52-
Declared in `&lt;extract&hyphen;implicit&hyphen;specializations&period;cpp&gt;`
53-
54-
[source,cpp,subs="verbatim,replacements,macros,-callouts"]
55-
----
56-
int&
57-
value();
58-
----
59-
6039
[#B-00]
6140
== B
6241

test-files/golden-tests/config/extract-implicit-specializations/extract-implicit-specializations.html

Lines changed: 0 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -51,35 +51,8 @@ <h2>Base Classes</h2>
5151
</tbody>
5252
</table>
5353
</div>
54-
<h2>Member Functions</h2>
55-
<table style="table-layout: fixed; width: 100%;">
56-
<thead>
57-
<tr>
58-
<th>Name</th>
59-
</tr>
60-
</thead>
61-
<tbody>
62-
<tr>
63-
<td><a href="#A-value"><code>value</code></a> </td></tr>
64-
</tbody>
65-
</table>
66-
6754

6855

69-
</div>
70-
<div>
71-
<div>
72-
<h2 id="A-value">A::value</h2>
73-
</div>
74-
<div>
75-
<h3>Synopsis</h3>
76-
<div>
77-
Declared in <code>&lt;extract-implicit-specializations.cpp&gt;</code></div>
78-
<pre>
79-
<code class="source-code cpp">int&
80-
value();</code>
81-
</pre>
82-
</div>
8356
</div>
8457
<div>
8558
<div>

test-files/golden-tests/config/extract-implicit-specializations/extract-implicit-specializations.xml

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,6 @@
77
<base>
88
<type id="Bu/3QcmNOdsc7RSM3OKHnuCxGPU=" name="B&lt;int&gt;"/>
99
</base>
10-
<function name="value" id="i2Kh9WfDseks8Lnr/kapVaR9r4g=">
11-
<file short-path="extract-implicit-specializations.cpp" source-path="extract-implicit-specializations.cpp" line="3"/>
12-
<return>
13-
<type class="lvalue-reference">
14-
<pointee-type name="int"/>
15-
</type>
16-
</return>
17-
</function>
1810
</struct>
1911
<template>
2012
<tparam name="T" class="type"/>

test-files/golden-tests/config/inherit-base-members/copy-dependencies.adoc

Lines changed: 0 additions & 102 deletions
Original file line numberDiff line numberDiff line change
@@ -318,8 +318,6 @@ class derived
318318
| This function should be indirectly inherited by derived classes&period;
319319
| link:#derived-do_derived_shadowed[`do&lowbar;derived&lowbar;shadowed`]
320320
| This function should shadow the base class function&period;
321-
| link:#derived-excluded_inherited[`excluded&lowbar;inherited`]
322-
| This function should be inherited by derived classes&period;
323321
|===
324322

325323
=== Protected Member Functions
@@ -333,10 +331,6 @@ class derived
333331
| This function should shadow the excluded&lowbar;base function&period;
334332
| link:#base-do_derived_shadowed[`do&lowbar;derived&lowbar;shadowed`]
335333
| This function should be shadowed by derived classes&period;
336-
| link:#derived-do_excluded_inherited[`do&lowbar;excluded&lowbar;inherited`]
337-
| This function should be inherited by derived classes&period;
338-
| link:#derived-do_shadowed[`do&lowbar;shadowed`]
339-
| This function should be shadowed by derived classes&period;
340334
|===
341335

342336
[#derived-derived_shadowed]
@@ -377,51 +371,6 @@ do&lowbar;derived&lowbar;shadowed();
377371

378372
A class that derives from base and excluded&lowbar;base
379373

380-
[#derived-excluded_inherited]
381-
== link:#derived[derived]::excluded&lowbar;inherited
382-
383-
This function should be inherited by derived classes&period;
384-
385-
=== Synopsis
386-
387-
Declared in `&lt;copy&hyphen;dependencies&period;cpp&gt;`
388-
389-
[source,cpp,subs="verbatim,replacements,macros,-callouts"]
390-
----
391-
excluded&lowbar;base&
392-
excluded&lowbar;inherited();
393-
----
394-
395-
[#derived-do_excluded_inherited]
396-
== link:#derived[derived]::do&lowbar;excluded&lowbar;inherited
397-
398-
This function should be inherited by derived classes&period;
399-
400-
=== Synopsis
401-
402-
Declared in `&lt;copy&hyphen;dependencies&period;cpp&gt;`
403-
404-
[source,cpp,subs="verbatim,replacements,macros,-callouts"]
405-
----
406-
excluded&lowbar;base&
407-
do&lowbar;excluded&lowbar;inherited();
408-
----
409-
410-
[#derived-do_shadowed]
411-
== link:#derived[derived]::do&lowbar;shadowed
412-
413-
This function should be shadowed by derived classes&period;
414-
415-
=== Synopsis
416-
417-
Declared in `&lt;copy&hyphen;dependencies&period;cpp&gt;`
418-
419-
[source,cpp,subs="verbatim,replacements,macros,-callouts"]
420-
----
421-
excluded&lowbar;base&
422-
do&lowbar;shadowed();
423-
----
424-
425374
[#private_derived]
426375
== private&lowbar;derived
427376

@@ -547,12 +496,6 @@ class protected&lowbar;derived
547496
| This function should shadow the excluded&lowbar;base function&period;
548497
| link:#base-do_derived_shadowed[`do&lowbar;derived&lowbar;shadowed`]
549498
| This function should be shadowed by derived classes&period;
550-
| link:#protected_derived-do_excluded_inherited[`do&lowbar;excluded&lowbar;inherited`]
551-
| This function should be inherited by derived classes&period;
552-
| link:#protected_derived-do_shadowed[`do&lowbar;shadowed`]
553-
| This function should be shadowed by derived classes&period;
554-
| link:#protected_derived-excluded_inherited[`excluded&lowbar;inherited`]
555-
| This function should be inherited by derived classes&period;
556499
|===
557500

558501
[#protected_derived-derived_shadowed]
@@ -593,50 +536,5 @@ do&lowbar;derived&lowbar;shadowed();
593536

594537
A class that should inherit functions as protected&period;
595538

596-
[#protected_derived-do_excluded_inherited]
597-
== link:#protected_derived[protected&lowbar;derived]::do&lowbar;excluded&lowbar;inherited
598-
599-
This function should be inherited by derived classes&period;
600-
601-
=== Synopsis
602-
603-
Declared in `&lt;copy&hyphen;dependencies&period;cpp&gt;`
604-
605-
[source,cpp,subs="verbatim,replacements,macros,-callouts"]
606-
----
607-
excluded&lowbar;base&
608-
do&lowbar;excluded&lowbar;inherited();
609-
----
610-
611-
[#protected_derived-do_shadowed]
612-
== link:#protected_derived[protected&lowbar;derived]::do&lowbar;shadowed
613-
614-
This function should be shadowed by derived classes&period;
615-
616-
=== Synopsis
617-
618-
Declared in `&lt;copy&hyphen;dependencies&period;cpp&gt;`
619-
620-
[source,cpp,subs="verbatim,replacements,macros,-callouts"]
621-
----
622-
excluded&lowbar;base&
623-
do&lowbar;shadowed();
624-
----
625-
626-
[#protected_derived-excluded_inherited]
627-
== link:#protected_derived[protected&lowbar;derived]::excluded&lowbar;inherited
628-
629-
This function should be inherited by derived classes&period;
630-
631-
=== Synopsis
632-
633-
Declared in `&lt;copy&hyphen;dependencies&period;cpp&gt;`
634-
635-
[source,cpp,subs="verbatim,replacements,macros,-callouts"]
636-
----
637-
excluded&lowbar;base&
638-
excluded&lowbar;inherited();
639-
----
640-
641539

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

0 commit comments

Comments
 (0)