Fixed package diagram generator
This commit is contained in:
@@ -37,9 +37,11 @@ void generator::generate_relationships(
|
||||
for (const auto &r : p.relationships()) {
|
||||
std::stringstream relstr;
|
||||
try {
|
||||
relstr << p.alias() << " ..> "
|
||||
<< m_model.to_alias(r.destination()) << '\n';
|
||||
ostr << relstr.str();
|
||||
auto destination = m_model.to_alias(r.destination());
|
||||
if (!destination.empty()) {
|
||||
relstr << p.alias() << " ..> " << destination << '\n';
|
||||
ostr << relstr.str();
|
||||
}
|
||||
}
|
||||
catch (error::uml_alias_missing &e) {
|
||||
LOG_DBG("=== Skipping dependency relation from {} to {} due "
|
||||
|
||||
@@ -54,6 +54,9 @@ bool translation_unit_visitor::VisitNamespaceDecl(clang::NamespaceDecl *ns)
|
||||
|
||||
auto qualified_name = common::get_qualified_name(*ns);
|
||||
|
||||
if (!diagram().should_include(qualified_name))
|
||||
return true;
|
||||
|
||||
LOG_DBG("Visiting namespace declaration: {}", qualified_name);
|
||||
|
||||
auto package_path = namespace_{qualified_name};
|
||||
@@ -138,9 +141,10 @@ bool translation_unit_visitor::VisitCXXRecordDecl(clang::CXXRecordDecl *cls)
|
||||
|
||||
found_relationships_t relationships;
|
||||
|
||||
process_class_declaration(*cls, relationships);
|
||||
|
||||
add_relationships(cls, relationships);
|
||||
if(cls->isCompleteDefinition()) {
|
||||
process_class_declaration(*cls, relationships);
|
||||
add_relationships(cls, relationships);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -155,6 +159,11 @@ void translation_unit_visitor::add_relationships(
|
||||
common::to_id(*llvm::cast<clang::NamespaceDecl>(namespace_context));
|
||||
}
|
||||
|
||||
if(current_package_id == 0)
|
||||
// These are relationships to a global namespace, and we don't care
|
||||
// about those
|
||||
return;
|
||||
|
||||
assert(current_package_id != 0);
|
||||
|
||||
auto current_package = diagram().get(current_package_id);
|
||||
|
||||
Reference in New Issue
Block a user