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
6 changes: 3 additions & 3 deletions docs/modules/ROOT/pages/generators.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -161,13 +161,13 @@ The `Symbol` object represents a symbol extracted from the source code.The symbo
| `string`
| Whether the symbol was implicitly extracted as a dependency.

| `namespace`
| `parents`
| `<<symbol-fields,Symbol Object[]>>`
| The namespaces of the symbol.
| The parent contexts (namespaces or records) of the symbol.

| `parent`
| `<<symbol-fields,Symbol Object>>`
| The parent namespace of the symbol.
| The parent context (namespace or record) of the symbol.

| `doc`
| `Any`
Expand Down
39 changes: 23 additions & 16 deletions include/mrdocs/Corpus.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -197,18 +197,18 @@ class MRDOCS_VISIBLE

@return A reference to the string `temp`.
*/
// KRYSTIAN NOTE: temporary
MRDOCS_DECL
std::string&
getFullyQualifiedName(
const Info& I,
void
qualifiedName(
Info const& I,
std::string& temp) const;

std::string
getFullyQualifiedName(const Info& I) const
qualifiedName(const Info& I) const
{
std::string temp;
return getFullyQualifiedName(I, temp);
qualifiedName(I, temp);
return temp;
}

};
Expand Down Expand Up @@ -247,9 +247,9 @@ traverseOverloads(
for(const SymbolID& id : S.Members)
{
const Info& member = get(id);
const auto& lookup = S.Lookups.at(member.Name);
const auto& members = S.Lookups.at(member.Name);
auto first_func = std::ranges::find_if(
lookup, [this](const SymbolID& elem)
members, [this](const SymbolID& elem)
{
#if 0
const Info& I = get(elem);
Expand All @@ -258,19 +258,20 @@ traverseOverloads(
return get(elem).isFunction();
#endif
});
bool const nonOverloadedFunction = lookup.size() == 1;
bool const notFunction = first_func == lookup.end();
if(nonOverloadedFunction ||
notFunction)
bool const nonOverloadedFunction = members.size() == 1;
bool const notFunction = first_func == members.end();
if (nonOverloadedFunction ||
notFunction)
{
visit(member, std::forward<F>(f),
std::forward<Args>(args)...);
}
else if(*first_func == id)
else if (*first_func == id)
{
OverloadSet overloads(member.Name,
member.Namespace.front(),
member.Namespace, lookup);
OverloadSet overloads(
member.Name,
member.Parent,
members);
visit(overloads, std::forward<F>(f),
std::forward<Args>(args)...);
}
Expand Down Expand Up @@ -344,6 +345,12 @@ class Corpus::iterator
}
};

/** Return a list of the parent symbols of the specified Info.
*/
MRDOCS_DECL
std::vector<SymbolID>
getParents(Corpus const& C, Info const& I);

} // mrdocs
} // clang

Expand Down
8 changes: 5 additions & 3 deletions include/mrdocs/Metadata/Info.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -100,9 +100,12 @@ struct MRDOCS_VISIBLE
*/
bool Implicit = false;

/** Ordered list of parent namespaces.
/** The parent symbol, if any.

This is the parent namespace or record
where the symbol is defined.
*/
std::vector<SymbolID> Namespace;
SymbolID Parent;

/** The extracted javadoc for this declaration.
*/
Expand Down Expand Up @@ -225,7 +228,6 @@ tag_invoke(
Info const& I,
DomCorpus const* domCorpus);


} // mrdocs
} // clang

Expand Down
5 changes: 0 additions & 5 deletions include/mrdocs/Metadata/Overloads.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,6 @@ struct OverloadSet
/// The parent symbol ID.
SymbolID Parent;

/// The namespace of the overload set.
std::span<const SymbolID> Namespace;

/// The members of the overload set.
std::span<const SymbolID> Members;

Expand All @@ -62,11 +59,9 @@ struct OverloadSet
OverloadSet(
std::string_view name,
const SymbolID& parent,
std::span<const SymbolID> ns,
std::span<const SymbolID> members)
: Name(name)
, Parent(parent)
, Namespace(ns)
, Members(members)
{
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@
{{! We remove whitespace between all tag so the result is in a single line ~}}
{{~#if (ne kind "friend")~}}
{{~#if name~}}
{{! General case: linked namespaces followed by the symbol name ~}}
{{#each (reverse namespace)~}}
{{! General case: linked parent symbols followed by the symbol name ~}}
{{#each parents~}}
{{#if name~}}
{{>symbol/name . link=. nolink=../nolink}}::
{{~/if}}
Expand Down
Loading
Loading