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(
355
355
});
356
356
}
357
357
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
+
358
367
} // clang::mrdocs
359
368
360
369
#endif
Original file line number Diff line number Diff line change @@ -144,7 +144,7 @@ merge(SourceInfo& I, SourceInfo&& Other);
144
144
145
145
MRDOCS_DECL
146
146
OptionalLocation
147
- getPrimaryLocation (SourceInfo const & I);
147
+ getPrimaryLocation (SourceInfo const & I, bool preferDefinition );
148
148
149
149
void
150
150
tag_invoke (
Original file line number Diff line number Diff line change @@ -81,27 +81,21 @@ merge(SourceInfo& I, SourceInfo&& Other)
81
81
}
82
82
83
83
OptionalLocation
84
- getPrimaryLocation (SourceInfo const & I)
84
+ getPrimaryLocation (SourceInfo const & I, bool const preferDefinition )
85
85
{
86
- OptionalLocation primaryLoc;
87
- if (I.DefLoc )
86
+ if (I.Loc .empty () ||
87
+ (preferDefinition &&
88
+ I.DefLoc ))
88
89
{
89
- primaryLoc = * I.DefLoc ;
90
+ return I.DefLoc ;
90
91
}
91
- else if (!I.Loc .empty ())
92
- {
93
- auto const documentedIt = std::ranges::find_if (
92
+ auto const documentedIt = std::ranges::find_if (
94
93
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);
103
97
}
104
- return primaryLoc ;
98
+ return OptionalLocation (I. Loc . front ()) ;
105
99
}
106
100
107
101
template <class IO >
You can’t perform that action at this time.
0 commit comments