File tree Expand file tree Collapse file tree 3 files changed +20
-17
lines changed Expand file tree Collapse file tree 3 files changed +20
-17
lines changed Original file line number Diff line number Diff line change @@ -355,6 +355,15 @@ tag_invoke(
355355 });
356356}
357357
358+ inline
359+ OptionalLocation
360+ getPrimaryLocation (Info const & I)
361+ {
362+ return getPrimaryLocation (
363+ dynamic_cast <SourceInfo const &>(I),
364+ I.isRecord () || I.isEnum ());
365+ }
366+
358367} // clang::mrdocs
359368
360369#endif
Original file line number Diff line number Diff line change @@ -144,7 +144,7 @@ merge(SourceInfo& I, SourceInfo&& Other);
144144
145145MRDOCS_DECL
146146OptionalLocation
147- getPrimaryLocation (SourceInfo const & I);
147+ getPrimaryLocation (SourceInfo const & I, bool preferDefinition );
148148
149149void
150150tag_invoke (
Original file line number Diff line number Diff line change @@ -81,27 +81,21 @@ merge(SourceInfo& I, SourceInfo&& Other)
8181}
8282
8383OptionalLocation
84- getPrimaryLocation (SourceInfo const & I)
84+ getPrimaryLocation (SourceInfo const & I, bool const preferDefinition )
8585{
86- OptionalLocation primaryLoc;
87- if (I.DefLoc )
86+ if (I.Loc .empty () ||
87+ (preferDefinition &&
88+ I.DefLoc ))
8889 {
89- primaryLoc = * I.DefLoc ;
90+ return I.DefLoc ;
9091 }
91- else if (!I.Loc .empty ())
92- {
93- auto const documentedIt = std::ranges::find_if (
92+ auto const documentedIt = std::ranges::find_if (
9493 I.Loc , &Location::Documented);
95- if (documentedIt != I.Loc .end ())
96- {
97- primaryLoc = *documentedIt;
98- }
99- else
100- {
101- primaryLoc = I.Loc .front ();
102- }
94+ if (documentedIt != I.Loc .end ())
95+ {
96+ return OptionalLocation (*documentedIt);
10397 }
104- return primaryLoc ;
98+ return OptionalLocation (I. Loc . front ()) ;
10599}
106100
107101template <class IO >
You can’t perform that action at this time.
0 commit comments