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