Fixed friend class root namespace handling

This commit is contained in:
Bartek Kryza
2022-06-22 23:11:31 +02:00
parent 934a8edbbf
commit 96534f8e42
3 changed files with 32 additions and 2 deletions

View File

@@ -1384,7 +1384,7 @@ void translation_unit_visitor::process_friend(const cppast::cpp_friend &f,
r.set_destination(name);
}
else if (f.entity()) {
std::string name;
std::string name = f.entity().value().name();
if (f.entity().value().kind() ==
cppast::cpp_entity_kind::class_template_t) {
@@ -1411,7 +1411,17 @@ void translation_unit_visitor::process_friend(const cppast::cpp_friend &f,
cppast::is_templated(f.entity().value()),
cppast::to_string(f.entity().value().kind()));
name = cx::util::full_name(ctx.get_namespace(), f.entity().value());
const auto &maybe_definition =
cppast::get_definition(ctx.entity_index(), f.entity().value());
if (maybe_definition.has_value()) {
const auto &friend_class = maybe_definition.value();
auto entity_ns =
common::model::namespace_{cx::util::ns(friend_class)};
name = cx::util::full_name(entity_ns, f.entity().value());
}
}
if (!ctx.diagram().should_include(ctx.get_namespace(), name))