Added filtering of nested template dependencies

This commit is contained in:
Bartek Kryza
2021-08-07 21:02:17 +02:00
parent 0d0f93164d
commit cef3a2df67

View File

@@ -1259,16 +1259,19 @@ class_ tu_visitor::build_template_instantiation(
LOG_DBG("Template argument is a type {}", ct.type); LOG_DBG("Template argument is a type {}", ct.type);
auto fn = cx::util::full_name(
cppast::remove_cv(cx::util::unreferenced(targ.type().value())),
ctx.entity_index, false);
if (ctx.config.should_include(fn)) {
if (targ.type().value().kind() == if (targ.type().value().kind() ==
cppast::cpp_type_kind::template_instantiation_t) { cppast::cpp_type_kind::template_instantiation_t) {
class_ nested_tinst = build_template_instantiation(static_cast< class_ nested_tinst =
build_template_instantiation(static_cast<
const cppast::cpp_template_instantiation_type &>( const cppast::cpp_template_instantiation_type &>(
targ.type().value())); targ.type().value()));
auto fn = cx::util::full_name(
cppast::remove_cv(
cx::util::unreferenced(targ.type().value())),
ctx.entity_index, false);
fn = util::split(fn, "<")[0]; fn = util::split(fn, "<")[0];
class_relationship tinst_dependency; class_relationship tinst_dependency;
@@ -1298,7 +1301,8 @@ class_ tu_visitor::build_template_instantiation(
cx::util::unreferenced(targ.type().value())), cx::util::unreferenced(targ.type().value())),
ctx.entity_index, false); ctx.entity_index, false);
LOG_DBG("Creating nested template dependency to user defined " LOG_DBG(
"Creating nested template dependency to user defined "
"type {} -> {}", "type {} -> {}",
tinst.full_name(ctx.config.using_namespace), tinst.full_name(ctx.config.using_namespace),
tinst_dependency.destination); tinst_dependency.destination);
@@ -1306,6 +1310,7 @@ class_ tu_visitor::build_template_instantiation(
tinst.add_relationship(std::move(tinst_dependency)); tinst.add_relationship(std::move(tinst_dependency));
} }
} }
}
else if (targ.expression()) { else if (targ.expression()) {
const auto &exp = targ.expression().value(); const auto &exp = targ.expression().value();
if (exp.kind() == cppast::cpp_expression_kind::literal_t) if (exp.kind() == cppast::cpp_expression_kind::literal_t)