Added inference of nested template instantiations dependencies for other types

This commit is contained in:
Bartek Kryza
2021-08-07 20:52:17 +02:00
parent 646b38eaac
commit 0d0f93164d

View File

@@ -1278,7 +1278,8 @@ class_ tu_visitor::build_template_instantiation(
tinst_dependency.destination =
nested_tinst.full_name(ctx.config.using_namespace);
LOG_DBG("Creating nested template dependency {} -> {}",
LOG_DBG("Creating nested template dependency to template "
"instantiation {} -> {}",
tinst.full_name(ctx.config.using_namespace),
tinst_dependency.destination);
@@ -1286,6 +1287,24 @@ class_ tu_visitor::build_template_instantiation(
ctx.d.add_class(std::move(nested_tinst));
}
else if (targ.type().value().kind() ==
cppast::cpp_type_kind::user_defined_t) {
class_relationship tinst_dependency;
tinst_dependency.type = relationship_t::kDependency;
tinst_dependency.label = "";
tinst_dependency.destination = cx::util::full_name(
cppast::remove_cv(
cx::util::unreferenced(targ.type().value())),
ctx.entity_index, false);
LOG_DBG("Creating nested template dependency to user defined "
"type {} -> {}",
tinst.full_name(ctx.config.using_namespace),
tinst_dependency.destination);
tinst.add_relationship(std::move(tinst_dependency));
}
}
else if (targ.expression()) {
const auto &exp = targ.expression().value();