Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion include/mrdocs/Dom/Function.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
#include <mrdocs/Platform.hpp>
#include <mrdocs/Dom/Kind.hpp>
#include <mrdocs/Dom/String.hpp>
#include <mrdocs/Support/Error.hpp>
#include <mrdocs/Support/Expected.hpp>
#include <memory>

namespace clang {
Expand Down
2 changes: 1 addition & 1 deletion include/mrdocs/Dom/Object.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
#define MRDOCS_API_DOM_OBJECT_HPP

#include <mrdocs/Platform.hpp>
#include <mrdocs/Support/Error.hpp>
#include <mrdocs/Support/Expected.hpp>
#include <iterator>
#include <memory>
#include <vector>
Expand Down
3 changes: 3 additions & 0 deletions include/mrdocs/Metadata/Info/Overloads.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,9 @@ struct OverloadsInfo final
/// The members of the overload set.
std::vector<SymbolID> Members;

/// Info about the return type of this function.
Polymorphic<TypeInfo> ReturnType;

//--------------------------------------------

explicit OverloadsInfo(SymbolID const& ID) noexcept
Expand Down
25 changes: 25 additions & 0 deletions include/mrdocs/Support/Algorithm.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,31 @@ contains_n(Range const& range, El const& el, std::size_t n)
return false;
}

/** Find the last element in a range that matches an element in the specified range.
@param range The range to search.
@param els The elements to search for.
@return An iterator to the last element found, or range.end() if not found.
*/
template <std::ranges::range Range, std::ranges::range Els>
requires std::equality_comparable_with<std::ranges::range_value_t<Els>, std::ranges::range_value_t<Range>>
auto
find_last_of(Range&& range, Els&& els)
{
if (std::ranges::empty(range))
{
return std::ranges::end(range);
}
auto it = std::ranges::end(range);
do {
--it;
if (contains(els, *it))
{
return it;
}
} while (it != std::ranges::begin(range));
return std::ranges::end(range);
}

} // clang::mrdocs

#endif
Loading