Fixed template specialization handling in subclass filter
This commit is contained in:
@@ -141,6 +141,10 @@ void diagram::get_parents(
|
||||
if (found)
|
||||
found_new = true;
|
||||
}
|
||||
else {
|
||||
LOG_WARN("Couldn't find class representing base class: {} [{}]",
|
||||
pp.name(), pp.id());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -277,9 +277,6 @@ bool translation_unit_visitor::VisitTypeAliasTemplateDecl(
|
||||
tbuilder().build(
|
||||
*template_specialization_ptr, cls, *template_type_specialization_ptr);
|
||||
|
||||
if (!template_specialization_ptr)
|
||||
return true;
|
||||
|
||||
if (diagram().should_include(*template_specialization_ptr)) {
|
||||
const auto name = template_specialization_ptr->full_name();
|
||||
const auto id = template_specialization_ptr->id();
|
||||
@@ -1072,22 +1069,28 @@ void translation_unit_visitor::process_class_bases(
|
||||
|
||||
cp.set_name(name_and_ns.to_string());
|
||||
|
||||
if (const auto *record_type =
|
||||
base.getType()->getAs<clang::RecordType>();
|
||||
record_type != nullptr) {
|
||||
cp.set_name(record_type->getDecl()->getQualifiedNameAsString());
|
||||
cp.set_id(common::to_id(*record_type->getDecl()));
|
||||
}
|
||||
else if (const auto *tsp =
|
||||
base.getType()->getAs<clang::TemplateSpecializationType>();
|
||||
tsp != nullptr) {
|
||||
base.getType().dump();
|
||||
|
||||
if (const auto *tsp =
|
||||
base.getType()->getAs<clang::TemplateSpecializationType>();
|
||||
tsp != nullptr) {
|
||||
auto template_specialization_ptr =
|
||||
std::make_unique<class_>(config().using_namespace());
|
||||
tbuilder().build(*template_specialization_ptr, cls, *tsp, {});
|
||||
if (template_specialization_ptr) {
|
||||
cp.set_id(template_specialization_ptr->id());
|
||||
|
||||
cp.set_id(template_specialization_ptr->id());
|
||||
cp.set_name(template_specialization_ptr->full_name(false));
|
||||
|
||||
if (diagram().should_include(*template_specialization_ptr)) {
|
||||
add_class(std::move(template_specialization_ptr));
|
||||
}
|
||||
}
|
||||
else if (const auto *record_type =
|
||||
base.getType()->getAs<clang::RecordType>();
|
||||
record_type != nullptr) {
|
||||
cp.set_name(record_type->getDecl()->getQualifiedNameAsString());
|
||||
cp.set_id(common::to_id(*record_type->getDecl()));
|
||||
}
|
||||
else
|
||||
// This could be a template parameter - we don't want it here
|
||||
continue;
|
||||
@@ -1333,8 +1336,7 @@ void translation_unit_visitor::process_method(
|
||||
unaliased_type->getTemplateName().getAsTemplateDecl(),
|
||||
*unaliased_type, &c);
|
||||
|
||||
if (diagram().should_include(
|
||||
template_specialization_ptr->get_namespace())) {
|
||||
if (diagram().should_include(*template_specialization_ptr)) {
|
||||
relationships.emplace_back(template_specialization_ptr->id(),
|
||||
relationship_t::kDependency);
|
||||
|
||||
@@ -1708,8 +1710,7 @@ void translation_unit_visitor::process_function_parameter(
|
||||
tbuilder().build(*template_specialization_ptr,
|
||||
templ->getTemplateName().getAsTemplateDecl(), *templ, &c);
|
||||
|
||||
if (diagram().should_include(
|
||||
template_specialization_ptr->get_namespace())) {
|
||||
if (diagram().should_include(*template_specialization_ptr)) {
|
||||
relationships.emplace_back(template_specialization_ptr->id(),
|
||||
relationship_t::kDependency);
|
||||
|
||||
|
||||
@@ -498,8 +498,9 @@ tvl::value_t subclass_filter::match(const diagram &d, const element &e) const
|
||||
for (const auto &root : roots_) {
|
||||
for (const auto &parent : parents) {
|
||||
auto full_name = parent.get().full_name(false);
|
||||
if (root == full_name)
|
||||
if (root == full_name) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,8 +1,9 @@
|
||||
type: class
|
||||
title: Nested trait model class hierarchy
|
||||
include_relations_also_as_members: true
|
||||
generate_packages: true
|
||||
glob:
|
||||
- src/common/model/*.cc
|
||||
- src/common/model/package.cc
|
||||
include:
|
||||
namespaces:
|
||||
- clanguml
|
||||
|
||||
@@ -3,17 +3,17 @@ title: Diagram element template builder sequence diagram
|
||||
combine_free_functions_into_file_participants: true
|
||||
generate_method_arguments: none
|
||||
glob:
|
||||
- src/class_diagram/visitor/template_builder.cc
|
||||
- src/common/visitor/template_builder.cc
|
||||
include:
|
||||
namespaces:
|
||||
- clanguml
|
||||
paths:
|
||||
- src/class_diagram/visitor/template_builder.h
|
||||
- src/class_diagram/visitor/template_builder.cc
|
||||
- src/common/visitor/template_builder.h
|
||||
- src/common/visitor/template_builder.cc
|
||||
exclude:
|
||||
paths:
|
||||
- src/common/model/source_location.h
|
||||
using_namespace:
|
||||
- clanguml
|
||||
from:
|
||||
- function: "clanguml::class_diagram::visitor::template_builder::build(const clang::NamedDecl *,const clang::TemplateSpecializationType &,std::optional<class_diagram::model::class_ *>)"
|
||||
- function: "clanguml::common::visitor::template_builder::build(common::model::template_element &,const clang::NamedDecl *,const clang::TemplateSpecializationType &,std::optional<common::model::template_element *>)"
|
||||
|
||||
Reference in New Issue
Block a user