From 0d0f93164d503e1af0a80903a8a9033e7bf14653 Mon Sep 17 00:00:00 2001 From: Bartek Kryza Date: Sat, 7 Aug 2021 20:52:17 +0200 Subject: [PATCH] Added inference of nested template instantiations dependencies for other types --- src/uml/class_diagram_visitor.cc | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/src/uml/class_diagram_visitor.cc b/src/uml/class_diagram_visitor.cc index 151c56aa..609003ee 100644 --- a/src/uml/class_diagram_visitor.cc +++ b/src/uml/class_diagram_visitor.cc @@ -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();