File tree Expand file tree Collapse file tree 2 files changed +28
-0
lines changed Expand file tree Collapse file tree 2 files changed +28
-0
lines changed Original file line number Diff line number Diff line change @@ -142,6 +142,10 @@ MRDOCS_DECL
142142void
143143merge (SourceInfo& I, SourceInfo&& Other);
144144
145+ MRDOCS_DECL
146+ OptionalLocation
147+ getPrimaryLocation (SourceInfo const & I);
148+
145149void
146150tag_invoke (
147151 dom::ValueFromTag,
Original file line number Diff line number Diff line change @@ -80,6 +80,30 @@ merge(SourceInfo& I, SourceInfo&& Other)
8080 mergeImpl<true >(I, Other);
8181}
8282
83+ OptionalLocation
84+ getPrimaryLocation (SourceInfo const & I)
85+ {
86+ OptionalLocation primaryLoc;
87+ if (I.DefLoc )
88+ {
89+ primaryLoc = *I.DefLoc ;
90+ }
91+ else if (!I.Loc .empty ())
92+ {
93+ auto const documentedIt = std::ranges::find_if (
94+ I.Loc , &Location::Documented);
95+ if (documentedIt != I.Loc .end ())
96+ {
97+ primaryLoc = *documentedIt;
98+ }
99+ else
100+ {
101+ primaryLoc = I.Loc .front ();
102+ }
103+ }
104+ return primaryLoc;
105+ }
106+
83107template <class IO >
84108void
85109tag_invoke (
You can’t perform that action at this time.
0 commit comments