Skip to content

Commit a7024b8

Browse files
vinniefalcoalandefreitas
authored andcommitted
chore: makeInterface does not share
1 parent 609b5da commit a7024b8

File tree

3 files changed

+17
-28
lines changed

3 files changed

+17
-28
lines changed

include/mrdox/Metadata/Interface.hpp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@
1515
#include <mrdox/Platform.hpp>
1616
#include <mrdox/MetadataFwd.hpp>
1717
#include <mrdox/Metadata/Record.hpp>
18-
#include <mrdox/Support/SharedPtr.hpp>
1918
#include <memory>
2019
#include <span>
2120
#include <utility>
@@ -58,7 +57,7 @@ class Interface
5857

5958
MRDOX_DECL
6059
friend
61-
SharedPtr<Interface>
60+
Interface
6261
makeInterface(
6362
RecordInfo const& Derived,
6463
Corpus const& corpus);
@@ -90,7 +89,7 @@ class Interface
9089
@param corpus The complete metadata.
9190
*/
9291
MRDOX_DECL
93-
SharedPtr<Interface>
92+
Interface
9493
makeInterface(
9594
RecordInfo const& Derived,
9695
Corpus const& corpus);

source/Metadata/DomMetadata.cpp

Lines changed: 13 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -664,12 +664,12 @@ template<class T>
664664
class DomTrancheArray : public dom::Array
665665
{
666666
std::span<T const*> list_;
667-
SharedPtr<Interface> sp_;
667+
std::shared_ptr<Interface> sp_;
668668

669669
public:
670670
DomTrancheArray(
671671
std::span<T const*> list,
672-
SharedPtr<Interface> const& sp)
672+
std::shared_ptr<Interface> const& sp)
673673
: list_(list)
674674
, sp_(sp)
675675
{
@@ -692,23 +692,23 @@ class DomTrancheArray : public dom::Array
692692

693693
class DomTranche : public dom::Object
694694
{
695-
SharedPtr<Interface> sp_;
695+
std::shared_ptr<Interface> sp_;
696696
Interface::Tranche const& tranche_;
697697

698698
template<class T>
699699
static
700700
dom::Value
701701
init(
702702
std::span<T const*> list,
703-
SharedPtr<Interface> const& sp)
703+
std::shared_ptr<Interface> const& sp)
704704
{
705705
return makeShared<DomTrancheArray<T>>(list, sp);
706706
}
707707

708708
public:
709709
DomTranche(
710710
Interface::Tranche const& tranche,
711-
SharedPtr<Interface> const& sp) noexcept
711+
std::shared_ptr<Interface> const& sp) noexcept
712712
: dom::Object({
713713
{ "records", init(tranche.Records, sp) },
714714
{ "functions", init(tranche.Functions, sp) },
@@ -727,8 +727,8 @@ class DomTranche : public dom::Object
727727
class DomInterface : public dom::LazyObject
728728
{
729729
RecordInfo const& I_;
730-
AtomicSharedPtr<Interface> sp_;
731730
Corpus const& corpus_;
731+
//std::shared_ptr<Interface> sp_;
732732

733733
public:
734734
DomInterface(
@@ -739,32 +739,22 @@ class DomInterface : public dom::LazyObject
739739
{
740740
}
741741

742-
SharedPtr<Interface>
743-
getInterface() const
744-
{
745-
return sp_.load(
746-
[&]
747-
{
748-
return makeInterface(I_, corpus_);
749-
});
750-
}
751-
752-
dom::ObjectPtr construct() const override
742+
dom::ObjectPtr
743+
construct() const override
753744
{
745+
auto sp = std::make_shared<Interface>(
746+
makeInterface(I_, corpus_));
754747
return makeShared<dom::Object>(
755748
dom::Object::list_type({
756749
{ "public",
757750
makeShared<DomTranche>(
758-
getInterface()->Public,
759-
getInterface()) },
751+
sp->Public, sp) },
760752
{ "protected",
761753
makeShared<DomTranche>(
762-
getInterface()->Protected,
763-
getInterface()) },
754+
sp->Protected, sp) },
764755
{ "private",
765756
makeShared<DomTranche>(
766-
getInterface()->Private,
767-
getInterface()) },
757+
sp->Private, sp) }
768758
}));
769759
}
770760
};

source/Metadata/Interface.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -224,14 +224,14 @@ Interface(
224224
{
225225
}
226226

227-
SharedPtr<Interface>
227+
Interface
228228
makeInterface(
229229
RecordInfo const& Derived,
230230
Corpus const& corpus)
231231
{
232232
Interface I(corpus);
233233
Interface::Build(I, Derived, corpus);
234-
return makeShared<Interface>(std::move(I));
234+
return I;
235235
}
236236

237237
} // mrdox

0 commit comments

Comments
 (0)