diff --git a/src/package_diagram/visitor/translation_unit_visitor.cc b/src/package_diagram/visitor/translation_unit_visitor.cc index e80fd008..110ba147 100644 --- a/src/package_diagram/visitor/translation_unit_visitor.cc +++ b/src/package_diagram/visitor/translation_unit_visitor.cc @@ -46,26 +46,6 @@ using clanguml::common::model::relationship_t; using clanguml::package_diagram::model::diagram; namespace detail { -access_t cpp_access_specifier_to_access( - cppast::cpp_access_specifier_kind access_specifier) -{ - access_t access = access_t::kPublic; - switch (access_specifier) { - case cppast::cpp_access_specifier_kind::cpp_public: - access = access_t::kPublic; - break; - case cppast::cpp_access_specifier_kind::cpp_private: - access = access_t::kPrivate; - break; - case cppast::cpp_access_specifier_kind::cpp_protected: - access = access_t::kProtected; - break; - default: - break; - } - - return access; -} bool is_constructor(const cppast::cpp_entity &e) { @@ -354,17 +334,16 @@ void translation_unit_visitor::process_function( if (!skip_return_type) { find_relationships( f.return_type(), relationships, relationship_t::kDependency); + } - for (const auto &dependency : relationships) { - auto destination = - common::model::namespace_{std::get<0>(dependency)}; + for (const auto &dependency : relationships) { + auto destination = common::model::namespace_{std::get<0>(dependency)}; - if (!ctx.get_namespace().starts_with(destination) && - !destination.starts_with(ctx.get_namespace())) { - relationship r{ - relationship_t::kDependency, std::get<0>(dependency)}; - current_package.value().add_relationship(std::move(r)); - } + if (!ctx.get_namespace().starts_with(destination) && + !destination.starts_with(ctx.get_namespace())) { + relationship r{ + relationship_t::kDependency, std::get<0>(dependency)}; + current_package.value().add_relationship(std::move(r)); } } } diff --git a/tests/t30002/t30002.cc b/tests/t30002/t30002.cc index bd04af2f..33952535 100644 --- a/tests/t30002/t30002.cc +++ b/tests/t30002/t30002.cc @@ -1,3 +1,4 @@ +#include #include #include #include @@ -57,16 +58,28 @@ namespace A13 { struct CM { }; } +namespace A14 { +struct CN { +}; +} +namespace A15 { +struct CO { +}; +} } namespace B::BB::BBB { -struct CBA : public A::AA::A6::CF { +class CBA : public A::AA::A6::CF { +public: A::AA::A1::CA *ca_; A::AA::A2::CB cb_; std::shared_ptr cc_; - std::map> cd_; + std::map> *cd_; + std::array co_; CBA() = default; + CBA(A::AA::A14::CN *cn) { } + template CBA(std::tuple &items) { } void ce(const std::vector /*ce_*/) { } @@ -78,7 +91,8 @@ struct CBA : public A::AA::A6::CF { { } - template std::map> ci() + template + std::map> ci(T * /*t*/) { return {}; } diff --git a/tests/t30002/test_case.h b/tests/t30002/test_case.h index e77e7b05..765dc8a8 100644 --- a/tests/t30002/test_case.h +++ b/tests/t30002/test_case.h @@ -46,6 +46,8 @@ TEST_CASE("t30002", "[test-case][package]") REQUIRE_THAT(puml, IsPackage("A11")); REQUIRE_THAT(puml, IsPackage("A12")); REQUIRE_THAT(puml, IsPackage("A13")); + REQUIRE_THAT(puml, IsPackage("A14")); + REQUIRE_THAT(puml, IsPackage("A15")); REQUIRE_THAT(puml, IsDependency(_A("BBB"), _A("A1"))); REQUIRE_THAT(puml, IsDependency(_A("BBB"), _A("A2"))); @@ -60,6 +62,8 @@ TEST_CASE("t30002", "[test-case][package]") REQUIRE_THAT(puml, IsDependency(_A("BBB"), _A("A11"))); REQUIRE_THAT(puml, IsDependency(_A("BBB"), _A("A12"))); REQUIRE_THAT(puml, IsDependency(_A("BBB"), _A("A13"))); + REQUIRE_THAT(puml, IsDependency(_A("BBB"), _A("A14"))); + REQUIRE_THAT(puml, IsDependency(_A("BBB"), _A("A15"))); save_puml( "./" + config.output_directory() + "/" + diagram->name + ".puml", puml);