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;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -43,5 +43,7 @@ TEST_CASE("t00076")
|
||||
REQUIRE(!IsClass(src, "H"));
|
||||
REQUIRE(!IsClass(src, "EE"));
|
||||
REQUIRE(!IsClass(src, "GGG"));
|
||||
|
||||
REQUIRE(IsAssociation<Public>(src, "B", "B::BB"));
|
||||
});
|
||||
}
|
||||
@@ -668,7 +668,7 @@ int main(int argc, char *argv[])
|
||||
std::vector<const char *> argvv = {
|
||||
"clang-uml", "--config", "./test_config_data/simple.yml"};
|
||||
|
||||
argvv.push_back("-vvv");
|
||||
argvv.push_back("-q");
|
||||
|
||||
clih.handle_options(argvv.size(), argvv.data());
|
||||
|
||||
|
||||
Reference in New Issue
Block a user