Fixed handling of relationships to nested structs
This commit is contained in:
@@ -241,10 +241,17 @@ void diagram::remove_redundant_dependencies()
|
||||
}
|
||||
|
||||
util::erase_if(c.get().relationships(),
|
||||
[&dependency_relationships_to_remove](const auto &r) {
|
||||
return r.type() == relationship_t::kDependency &&
|
||||
[&dependency_relationships_to_remove, &c](const auto &r) {
|
||||
if (r.type() != relationship_t::kDependency)
|
||||
return false;
|
||||
|
||||
auto has_another_relationship_to_destination =
|
||||
dependency_relationships_to_remove.count(r.destination()) >
|
||||
0;
|
||||
auto is_self_dependency = r.destination() == c.get().id();
|
||||
|
||||
return has_another_relationship_to_destination ||
|
||||
is_self_dependency;
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1433,13 +1433,13 @@ bool translation_unit_visitor::find_relationships(const clang::QualType &type,
|
||||
}
|
||||
}
|
||||
else if (type->getAsCXXRecordDecl() != nullptr) {
|
||||
const auto target_id = common::to_id(*type->getAsCXXRecordDecl());
|
||||
relationships.emplace_back(target_id, relationship_hint);
|
||||
relationships.emplace_back(
|
||||
type->getAsCXXRecordDecl()->getID(), relationship_hint);
|
||||
result = true;
|
||||
}
|
||||
else {
|
||||
const auto target_id = common::to_id(*type->getAsRecordDecl());
|
||||
relationships.emplace_back(target_id, relationship_hint);
|
||||
relationships.emplace_back(
|
||||
type->getAsRecordDecl()->getID(), relationship_hint);
|
||||
result = true;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user