From 01c791e6a198bab04726d5295af916d41047835e Mon Sep 17 00:00:00 2001 From: Bartek Kryza Date: Sun, 21 May 2023 11:55:41 +0200 Subject: [PATCH 01/14] Added initial support for directory based packages in class diagrams --- .../json/class_diagram_generator.cc | 6 +- src/class_diagram/model/diagram.cc | 30 ++++++- src/class_diagram/model/diagram.h | 47 +++++----- .../visitor/translation_unit_visitor.cc | 51 +++++++++-- .../visitor/translation_unit_visitor.h | 2 + src/common/model/diagram.h | 2 +- src/common/model/diagram_filter.cc | 8 +- src/common/model/namespace.h | 2 +- src/common/model/package.h | 5 +- src/common/model/path.h | 85 +++++++++++++++---- src/common/model/source_file.h | 35 ++++---- src/common/types.h | 2 + src/config/config.cc | 23 ++++- src/config/config.h | 14 +++ src/config/yaml_decoders.cc | 19 +++++ src/include_diagram/model/diagram.cc | 5 +- .../json/sequence_diagram_generator.cc | 3 +- .../plantuml/sequence_diagram_generator.cc | 5 +- tests/t00061/.clang-uml | 2 +- tests/t00065/.clang-uml | 15 ++++ tests/t00065/module1/module1.h | 11 +++ .../t00065/module1/submodule1a/submodule1a.h | 9 ++ tests/t00065/module2/module2.h | 7 ++ tests/t00065/t00065.cc | 10 +++ tests/t00065/test_case.h | 83 ++++++++++++++++++ tests/t20017/.clang-uml | 4 +- tests/test_cases.cc | 1 + 27 files changed, 399 insertions(+), 87 deletions(-) create mode 100644 tests/t00065/.clang-uml create mode 100644 tests/t00065/module1/module1.h create mode 100644 tests/t00065/module1/submodule1a/submodule1a.h create mode 100644 tests/t00065/module2/module2.h create mode 100644 tests/t00065/t00065.cc create mode 100644 tests/t00065/test_case.h diff --git a/src/class_diagram/generators/json/class_diagram_generator.cc b/src/class_diagram/generators/json/class_diagram_generator.cc index f6ac941b..c900e67e 100644 --- a/src/class_diagram/generators/json/class_diagram_generator.cc +++ b/src/class_diagram/generators/json/class_diagram_generator.cc @@ -168,7 +168,11 @@ void generator::generate(const package &p, nlohmann::json &parent) const if (!uns.starts_with({p.full_name(false)})) { LOG_DBG("Generating package {}", p.name()); - package_object["type"] = "namespace"; + if (m_config.package_type() == config::package_type_t::kDirectory) + package_object["type"] = "directory"; + else + package_object["type"] = "namespace"; + package_object["name"] = p.name(); package_object["display_name"] = p.full_name(false); } diff --git a/src/class_diagram/model/diagram.cc b/src/class_diagram/model/diagram.cc index 56b37016..6e80776f 100644 --- a/src/class_diagram/model/diagram.cc +++ b/src/class_diagram/model/diagram.cc @@ -173,6 +173,15 @@ common::optional_ref diagram::get_concept( return {}; } +bool diagram::add_package_fs(std::unique_ptr &&p) +{ + LOG_DBG("Adding filesystem package: {}, {}", p->name(), p->full_name(true)); + + auto ns = p->get_namespace(); + + return add_element(ns, std::move(p)); +} + bool diagram::add_package(std::unique_ptr &&p) { LOG_DBG("Adding namespace package: {}, {}", p->name(), p->full_name(true)); @@ -182,6 +191,25 @@ bool diagram::add_package(std::unique_ptr &&p) return add_element(ns, std::move(p)); } +bool diagram::add_class_fs( + const common::model::path &p, std::unique_ptr &&c) +{ + const auto base_name = c->name(); + const auto full_name = c->full_name(false); + const auto id = c->id(); + auto &cc = *c; + + if (add_element(p, std::move(c))) { + classes_.push_back(std::ref(cc)); + return true; + } + else { + LOG_WARN("Cannot add class {} with id {} due to: {}", base_name, id); + } + + return false; +} + bool diagram::add_class(std::unique_ptr &&c) { const auto base_name = c->name(); @@ -221,7 +249,7 @@ bool diagram::add_class(std::unique_ptr &&c) } catch (const std::runtime_error &e) { LOG_WARN( - "Cannot add concept {} with id {} due to: {}", name, id, e.what()); + "Cannot add class {} with id {} due to: {}", name, id, e.what()); return false; } diff --git a/src/class_diagram/model/diagram.h b/src/class_diagram/model/diagram.h index cb0e39b5..5077905b 100644 --- a/src/class_diagram/model/diagram.h +++ b/src/class_diagram/model/diagram.h @@ -31,10 +31,15 @@ namespace clanguml::class_diagram::model { -class diagram : public clanguml::common::model::diagram, - public clanguml::common::model::nested_trait< - clanguml::common::model::element, - clanguml::common::model::namespace_> { +using common::opt_ref; +using common::model::diagram_element; +using common::model::diagram_t; + +using nested_trait_ns = + clanguml::common::model::nested_trait; + +class diagram : public common::model::diagram::diagram, public nested_trait_ns { public: diagram() = default; @@ -43,13 +48,11 @@ public: diagram &operator=(const diagram &) = delete; diagram &operator=(diagram &&) = default; - common::model::diagram_t type() const override; + diagram_t type() const override; - common::optional_ref get( - const std::string &full_name) const override; + opt_ref get(const std::string &full_name) const override; - common::optional_ref get( - clanguml::common::model::diagram_element::id_t id) const override; + opt_ref get(diagram_element::id_t id) const override; const common::reference_vector &classes() const; @@ -63,20 +66,20 @@ public: bool has_concept(const concept_ &e) const; - common::optional_ref get_class(const std::string &name) const; + opt_ref get_class(const std::string &name) const; - common::optional_ref get_class( - clanguml::common::model::diagram_element::id_t id) const; + opt_ref get_class(diagram_element::id_t id) const; - common::optional_ref get_enum(const std::string &name) const; + opt_ref get_enum(const std::string &name) const; - common::optional_ref get_enum( - clanguml::common::model::diagram_element::id_t id) const; + opt_ref get_enum(diagram_element::id_t id) const; - common::optional_ref get_concept(const std::string &name) const; + opt_ref get_concept(const std::string &name) const; - common::optional_ref get_concept( - clanguml::common::model::diagram_element::id_t id) const; + opt_ref get_concept(diagram_element::id_t id) const; + + bool add_class_fs( + const common::model::path &p, std::unique_ptr &&c); bool add_class(std::unique_ptr &&c); @@ -86,15 +89,15 @@ public: bool add_package(std::unique_ptr &&p); - std::string to_alias( - clanguml::common::model::diagram_element::id_t id) const; + bool add_package_fs(std::unique_ptr &&p); + + std::string to_alias(diagram_element::id_t id) const; void get_parents(clanguml::common::reference_set &parents) const; friend void print_diagram_tree(const diagram &d, int level); - bool has_element( - clanguml::common::model::diagram_element::id_t id) const override; + bool has_element(diagram_element::id_t id) const override; inja::json context() const override; diff --git a/src/class_diagram/visitor/translation_unit_visitor.cc b/src/class_diagram/visitor/translation_unit_visitor.cc index 66d5a526..df42aae3 100644 --- a/src/class_diagram/visitor/translation_unit_visitor.cc +++ b/src/class_diagram/visitor/translation_unit_visitor.cc @@ -40,6 +40,9 @@ bool translation_unit_visitor::VisitNamespaceDecl(clang::NamespaceDecl *ns) { assert(ns != nullptr); + if (config().package_type() == config::package_type_t::kDirectory) + return true; + if (ns->isAnonymousNamespace() || ns->isInline()) return true; @@ -741,11 +744,11 @@ bool translation_unit_visitor::VisitCXXRecordDecl(clang::CXXRecordDecl *cls) } forward_declarations_.erase(id); - if (diagram_.should_include(class_model)) { + if (diagram().should_include(class_model)) { LOG_DBG("Adding class {} with id {}", class_model.full_name(false), class_model.id()); - diagram_.add_class(std::move(c_ptr)); + add_class(std::move(c_ptr)); } else { LOG_DBG("Skipping class {} with id {}", class_model.full_name(), @@ -1320,7 +1323,7 @@ void translation_unit_visitor::process_method( relationships.emplace_back(template_specialization_ptr->id(), relationship_t::kDependency); - diagram().add_class(std::move(template_specialization_ptr)); + add_class(std::move(template_specialization_ptr)); } } } @@ -1657,7 +1660,7 @@ void translation_unit_visitor::process_function_parameter( relationships.emplace_back(template_specialization_ptr->id(), relationship_t::kDependency); - diagram().add_class(std::move(template_specialization_ptr)); + add_class(std::move(template_specialization_ptr)); } } @@ -1708,9 +1711,8 @@ void translation_unit_visitor::ensure_lambda_type_is_relative( absolute_lambda_path_end - (lambda_begin + lambda_prefix.size() - 1)); - auto relative_lambda_path = util::path_to_url(std::filesystem::relative( - absolute_lambda_path, config().relative_to()) - .string()); + auto relative_lambda_path = util::path_to_url( + config().make_path_relative(absolute_lambda_path).string()); parameter_type = fmt::format("{}(lambda at {}{}", parameter_type.substr(0, lambda_begin), relative_lambda_path, @@ -1972,7 +1974,7 @@ void translation_unit_visitor::process_field( // Add the template instantiation object to the diagram if it // matches the include pattern if (add_template_instantiation_to_diagram) - diagram().add_class(std::move(template_specialization_ptr)); + add_class(std::move(template_specialization_ptr)); } } @@ -2004,7 +2006,7 @@ void translation_unit_visitor::add_incomplete_forward_declarations() { for (auto &[id, c] : forward_declarations_) { if (diagram().should_include(c->full_name(false))) { - diagram().add_class(std::move(c)); + add_class(std::move(c)); } } forward_declarations_.clear(); @@ -2092,4 +2094,35 @@ bool translation_unit_visitor::has_processed_template_class( return util::contains(processed_template_qualified_names_, qualified_name); } +void translation_unit_visitor::add_class(std::unique_ptr &&c) +{ + if ((config().generate_packages() && + config().package_type() == config::package_type_t::kDirectory)) { + assert(!c->file().empty()); + + const auto file = config().make_path_relative(c->file()); + + common::model::path p{file, common::model::path_type::kFilesystem}; + p.pop_back(); + + // Make sure all parent directories are already packages in the model + for (auto it = p.begin(); it != p.end(); it++) { + auto pkg = std::make_unique( + config().using_namespace()); + pkg->set_name(*it); + auto ns = common::model::path(p.begin(), it); + // ns.pop_back(); + pkg->set_namespace(ns); + pkg->set_id(common::to_id(pkg->full_name(false))); + + diagram().add_package_fs(std::move(pkg)); + } + + diagram().add_class_fs(p, std::move(c)); + } + else { + diagram().add_class(std::move(c)); + } +} + } // namespace clanguml::class_diagram::visitor diff --git a/src/class_diagram/visitor/translation_unit_visitor.h b/src/class_diagram/visitor/translation_unit_visitor.h index ae12cf50..3458db52 100644 --- a/src/class_diagram/visitor/translation_unit_visitor.h +++ b/src/class_diagram/visitor/translation_unit_visitor.h @@ -119,6 +119,8 @@ public: void finalize(); private: + void add_class(std::unique_ptr &&c); + bool should_include(const clang::NamedDecl *decl); std::unique_ptr diff --git a/src/common/model/diagram.h b/src/common/model/diagram.h index b36a7ead..ab58529f 100644 --- a/src/common/model/diagram.h +++ b/src/common/model/diagram.h @@ -39,7 +39,7 @@ public: virtual diagram_t type() const = 0; - virtual common::optional_ref get( + virtual opt_ref get( const std::string &full_name) const = 0; virtual common::optional_ref get( diff --git a/src/common/model/diagram_filter.cc b/src/common/model/diagram_filter.cc index d3b1db31..3ab7080f 100644 --- a/src/common/model/diagram_filter.cc +++ b/src/common/model/diagram_filter.cc @@ -430,8 +430,8 @@ paths_filter::paths_filter(filter_t type, const std::filesystem::path &root, absolute_path = path; try { - absolute_path = - std::filesystem::canonical(absolute_path.lexically_normal()); + absolute_path = absolute(absolute_path); + absolute_path = canonical(absolute_path.lexically_normal()); } catch (std::filesystem::filesystem_error &e) { LOG_WARN("Cannot add non-existent path {} to paths filter", @@ -539,7 +539,7 @@ void diagram_filter::init_filters(const config::diagram &c) filter_t::kInclusive, c.include().access)); add_inclusive_filter(std::make_unique( - filter_t::kInclusive, c.relative_to(), c.include().paths)); + filter_t::kInclusive, c.root_directory(), c.include().paths)); // Include any of these matches even if one them does not match std::vector> element_filters; @@ -623,7 +623,7 @@ void diagram_filter::init_filters(const config::diagram &c) filter_t::kExclusive, c.exclude().namespaces)); add_exclusive_filter(std::make_unique( - filter_t::kExclusive, c.relative_to(), c.exclude().paths)); + filter_t::kExclusive, c.root_directory(), c.exclude().paths)); add_exclusive_filter(std::make_unique( filter_t::kExclusive, c.exclude().elements)); diff --git a/src/common/model/namespace.h b/src/common/model/namespace.h index 0f2cf8ca..f5786c5e 100644 --- a/src/common/model/namespace.h +++ b/src/common/model/namespace.h @@ -29,7 +29,7 @@ struct ns_path_separator { static constexpr std::string_view value = "::"; }; -using namespace_ = path; +using namespace_ = path; } diff --git a/src/common/model/package.h b/src/common/model/package.h index a4d13837..c2163a2e 100644 --- a/src/common/model/package.h +++ b/src/common/model/package.h @@ -19,6 +19,7 @@ #include "common/model/element.h" #include "common/model/nested_trait.h" +#include "common/model/path.h" #include "common/model/stylable_element.h" #include "common/types.h" #include "util/util.h" @@ -33,9 +34,9 @@ namespace clanguml::common::model { class package : public element, public stylable_element, - public nested_trait { + public nested_trait { public: - package(const common::model::namespace_ &using_namespace); + package(const common::model::path &using_namespace); package(const package &) = delete; package(package &&) = default; diff --git a/src/common/model/path.h b/src/common/model/path.h index 5bf0d030..577b24f0 100644 --- a/src/common/model/path.h +++ b/src/common/model/path.h @@ -25,41 +25,84 @@ namespace clanguml::common::model { -template class path { +enum class path_type { kNamespace, kFilesystem }; + +class path { + + const char *separator() const + { + switch (path_type_) { + case path_type::kNamespace: + return "::"; + case path_type::kFilesystem: +#ifdef _WIN32 + return "\\"; +#else + return "/"; +#endif + } + + return "::"; + } + public: using container_type = std::vector; - path() = default; + path(path_type pt = path_type::kNamespace) + : path_type_{pt} + { + } - explicit path(const std::string &ns) + path(const std::string &ns, path_type pt = path_type::kNamespace) + : path_type_{pt} { if (ns.empty()) return; - path_ = util::split(ns, Sep::value); + path_ = util::split(ns, separator()); } + virtual ~path() = default; + path(container_type::const_iterator begin, - container_type::const_iterator end) + container_type::const_iterator end, + path_type pt = path_type::kNamespace) + : path(pt) { + if (begin == end) + return; + std::copy(begin, end, std::back_inserter(path_)); } path(const path &right) - : path_{right.path_} + : path_type_{right.path_type_} + , path_{right.path_} { } - path &operator=(const path &right) = default; + path &operator=(const path &right) + { + if (path_type_ != right.path_type_) + throw std::runtime_error(""); + + path_type_ = right.path_type_; + path_ = right.path_; + + return *this; + } path(path &&right) noexcept = default; path &operator=(path &&right) noexcept = default; - path(std::initializer_list ns) + path(std::initializer_list ns, + path_type pt = path_type::kNamespace) + : path(pt) { - if ((ns.size() == 1) && util::contains(*ns.begin(), Sep::value)) { - path_ = util::split(*ns.begin(), Sep::value); + if ((ns.size() == 1) && + util::contains(*ns.begin(), std::string{separator()})) { + path_ = util::split(*ns.begin(), separator()); } else if ((ns.size() == 1) && ns.begin()->empty()) { } @@ -67,10 +110,13 @@ public: path_ = ns; } - explicit path(const std::vector &ns) + explicit path(const std::vector &ns, + path_type pt = path_type::kNamespace) + : path(pt) { - if ((ns.size() == 1) && util::contains(*ns.begin(), Sep::value)) { - path_ = util::split(*ns.begin(), Sep::value); + if ((ns.size() == 1) && + util::contains(*ns.begin(), std::string{separator()})) { + path_ = util::split(*ns.begin(), separator()); } else if ((ns.size() == 1) && ns.begin()->empty()) { } @@ -78,19 +124,19 @@ public: path_ = ns; } - friend bool operator==(const path &left, const path &right) + friend bool operator==(const path &left, const path &right) { return left.path_ == right.path_; } - friend bool operator<(const path &left, const path &right) + friend bool operator<(const path &left, const path &right) { - return std::hash>{}(left) < std::hash>{}(right); + return left.to_string() < right.to_string(); } std::string to_string() const { - return fmt::format("{}", fmt::join(path_, Sep::value)); + return fmt::format("{}", fmt::join(path_, std::string{separator()})); } bool is_empty() const { return path_.empty(); } @@ -190,7 +236,7 @@ public: return name; auto res = name; - auto ns_prefix = to_string() + std::string{Sep::value}; + auto ns_prefix = to_string() + std::string{separator()}; auto it = res.find(ns_prefix); while (it != std::string::npos) { @@ -220,7 +266,10 @@ public: path::container_type::const_iterator begin() const { return path_.begin(); } path::container_type::const_iterator end() const { return path_.end(); } + path_type type() const { return path_type_; } + private: + path_type path_type_; container_type path_; }; diff --git a/src/common/model/source_file.h b/src/common/model/source_file.h index 4b802d05..11401239 100644 --- a/src/common/model/source_file.h +++ b/src/common/model/source_file.h @@ -46,7 +46,7 @@ struct fs_path_sep { #endif }; -using filesystem_path = common::model::path; +using filesystem_path = common::model::path; class source_file : public common::model::diagram_element, @@ -60,7 +60,7 @@ public: { auto preferred = p; preferred.make_preferred(); - set_path({preferred.parent_path().string()}); + set_path({preferred.parent_path().string(), path_type::kFilesystem}); set_name(preferred.filename().string()); is_absolute_ = preferred.is_absolute(); set_id(common::to_id(preferred)); @@ -126,7 +126,7 @@ public: } private: - filesystem_path path_; + filesystem_path path_{path_type::kFilesystem}; source_file_t type_{source_file_t::kDirectory}; bool is_absolute_{false}; }; @@ -134,21 +134,24 @@ private: namespace std { -template <> struct hash { - std::size_t operator()( - const clanguml::common::model::filesystem_path &key) const - { - using clanguml::common::model::path; +/* + template <> struct hash { + std::size_t operator()( + const clanguml::common::model::filesystem_path &key) const + { + using clanguml::common::model::path; - std::size_t seed = key.size(); - for (const auto &ns : key) { - seed ^= - std::hash{}(ns) + clanguml::util::hash_seed(seed); - } + std::size_t seed = key.size(); + for (const auto &ns : key) { + seed ^= + std::hash{}(ns) + + clanguml::util::hash_seed(seed); + } - return seed; - } -}; + return seed; + } + }; +*/ } // namespace std diff --git a/src/common/types.h b/src/common/types.h index 65a8d980..749812f9 100644 --- a/src/common/types.h +++ b/src/common/types.h @@ -129,6 +129,8 @@ private: T *value_{nullptr}; }; +template using opt_ref = optional_ref; + template using reference_vector = std::vector>; diff --git a/src/config/config.cc b/src/config/config.cc index c2cd7a8e..33c72478 100644 --- a/src/config/config.cc +++ b/src/config/config.cc @@ -107,6 +107,8 @@ void inheritable_diagram_options::inherit( exclude.override(parent.exclude); puml.override(parent.puml); generate_method_arguments.override(parent.generate_method_arguments); + generate_packages.override(parent.generate_packages); + package_type.override(parent.package_type); generate_links.override(parent.generate_links); generate_system_headers.override(parent.generate_system_headers); git.override(parent.git); @@ -136,14 +138,20 @@ std::vector diagram::get_translation_units() const { std::vector translation_units{}; + LOG_DBG("Looking for translation units in {}", + std::filesystem::current_path().string()); + for (const auto &g : glob()) { std::string glob_path = - fmt::format("{}/{}", relative_to().string(), g.c_str()); + fmt::format("{}/{}", root_directory().string(), g.c_str()); + + LOG_DBG("Searching glob path {}", glob_path); auto matches = glob::glob(glob_path, true, false); for (const auto &match : matches) { - const auto path = std::filesystem::canonical(relative_to() / match); + const auto path = + std::filesystem::canonical(root_directory() / match); translation_units.emplace_back(path.string()); } } @@ -151,6 +159,17 @@ std::vector diagram::get_translation_units() const return translation_units; } +std::filesystem::path diagram::root_directory() const +{ + return canonical(absolute(base_directory() / relative_to())); +} + +std::filesystem::path diagram::make_path_relative( + const std::filesystem::path &p) const +{ + return relative(p, root_directory()).lexically_normal().string(); +} + std::optional diagram::get_together_group( const std::string &full_name) const { diff --git a/src/config/config.h b/src/config/config.h index 746332be..e728a66c 100644 --- a/src/config/config.h +++ b/src/config/config.h @@ -37,6 +37,8 @@ namespace config { enum class method_arguments { full, abbreviated, none }; +enum class package_type_t { kNamespace, kDirectory }; + std::string to_string(method_arguments ma); enum class comment_parser_t { plain, clang }; @@ -162,10 +164,17 @@ struct inheritable_diagram_options { option generate_method_arguments{ "generate_method_arguments", method_arguments::full}; option generate_packages{"generate_packages", false}; + option package_type{ + "package_type", package_type_t::kNamespace}; option generate_links{"generate_links"}; option git{"git"}; option layout{"layout"}; + // This is the absolute filesystem path to the directory containing + // the current .clang-uml config file - it is set automatically option base_directory{"__parent_path"}; + // This is the relative path with respect to the `base_directory`, + // against which all matches are made, if not provided it defaults to the + // `base_directory` option relative_to{"relative_to"}; option generate_system_headers{"generate_system_headers", false}; option relationship_hints{"relationship_hints"}; @@ -190,6 +199,11 @@ struct diagram : public inheritable_diagram_options { std::vector get_translation_units() const; + std::filesystem::path make_path_relative( + const std::filesystem::path &p) const; + + std::filesystem::path root_directory() const; + std::optional get_together_group( const std::string &full_name) const; diff --git a/src/config/yaml_decoders.cc b/src/config/yaml_decoders.cc index fee09d3d..0ec9f095 100644 --- a/src/config/yaml_decoders.cc +++ b/src/config/yaml_decoders.cc @@ -34,6 +34,7 @@ using clanguml::config::layout_hint; using clanguml::config::location_t; using clanguml::config::method_arguments; using clanguml::config::package_diagram; +using clanguml::config::package_type_t; using clanguml::config::plantuml; using clanguml::config::relationship_hint_t; using clanguml::config::sequence_diagram; @@ -88,6 +89,22 @@ void get_option( } } +template <> +void get_option( + const Node &node, clanguml::config::option &option) +{ + if (node[option.name]) { + const auto &val = node[option.name].as(); + if (val == "namespace") + option.set(package_type_t::kNamespace); + else if (val == "directory") + option.set(package_type_t::kDirectory); + else + throw std::runtime_error( + "Invalid generate_method_arguments value: " + val); + } +} + template <> void get_option(const Node &node, clanguml::config::option &option) @@ -403,6 +420,7 @@ template <> struct convert { get_option(node, rhs.include_relations_also_as_members); get_option(node, rhs.generate_method_arguments); get_option(node, rhs.generate_packages); + get_option(node, rhs.package_type); get_option(node, rhs.relationship_hints); get_option(node, rhs.type_aliases); get_option(node, rhs.relative_to); @@ -597,6 +615,7 @@ template <> struct convert { get_option(node, rhs.puml); get_option(node, rhs.generate_method_arguments); get_option(node, rhs.generate_packages); + get_option(node, rhs.package_type); get_option(node, rhs.generate_links); get_option(node, rhs.generate_system_headers); get_option(node, rhs.git); diff --git a/src/include_diagram/model/diagram.cc b/src/include_diagram/model/diagram.cc index 40b5e38a..cd2e71b5 100644 --- a/src/include_diagram/model/diagram.cc +++ b/src/include_diagram/model/diagram.cc @@ -60,7 +60,8 @@ void diagram::add_file(std::unique_ptr &&f) if (!f->path().is_empty()) { // If the parent path is not empty, ensure relative parent directories // of this source_file are in the diagram - common::model::filesystem_path parent_path_so_far; + common::model::filesystem_path parent_path_so_far{ + common::model::path_type::kFilesystem}; for (const auto &directory : f->path()) { auto source_file_path = parent_path_so_far | directory; if (parent_path_so_far.is_empty()) @@ -83,6 +84,8 @@ void diagram::add_file(std::unique_ptr &&f) } } + assert(p.type() == common::model::path_type::kFilesystem); + add_element(p, std::move(f)); } diff --git a/src/sequence_diagram/generators/json/sequence_diagram_generator.cc b/src/sequence_diagram/generators/json/sequence_diagram_generator.cc index 46e75723..2f89cca4 100644 --- a/src/sequence_diagram/generators/json/sequence_diagram_generator.cc +++ b/src/sequence_diagram/generators/json/sequence_diagram_generator.cc @@ -550,8 +550,7 @@ common::id_t generator::generate_participant( nlohmann::json j = function_participant; j["name"] = util::path_to_url( - std::filesystem::relative(function_participant.file(), - std::filesystem::canonical(m_config.relative_to()).string())); + m_config.make_path_relative(function_participant.file()).string()); participant_id = common::to_id(function_participant.file_relative()); diff --git a/src/sequence_diagram/generators/plantuml/sequence_diagram_generator.cc b/src/sequence_diagram/generators/plantuml/sequence_diagram_generator.cc index e1284905..82a40fc9 100644 --- a/src/sequence_diagram/generators/plantuml/sequence_diagram_generator.cc +++ b/src/sequence_diagram/generators/plantuml/sequence_diagram_generator.cc @@ -329,11 +329,8 @@ void generator::generate_participant( if (is_participant_generated(file_id)) return; - const auto &relative_to = - std::filesystem::canonical(m_config.relative_to()); - auto participant_name = util::path_to_url(std::filesystem::relative( - std::filesystem::path{file_path}, relative_to) + std::filesystem::path{file_path}, m_config.root_directory()) .string()); ostr << "participant \"" << render_name(participant_name) << "\" as " diff --git a/tests/t00061/.clang-uml b/tests/t00061/.clang-uml index 9643fb5c..aa1a3ec6 100644 --- a/tests/t00061/.clang-uml +++ b/tests/t00061/.clang-uml @@ -3,7 +3,7 @@ output_directory: puml diagrams: t00061_class: type: class - relative_to: ../../tests/t00061 + relative_to: ../../../tests/t00061 glob: - t00061.cc include: diff --git a/tests/t00065/.clang-uml b/tests/t00065/.clang-uml new file mode 100644 index 00000000..4c7143fb --- /dev/null +++ b/tests/t00065/.clang-uml @@ -0,0 +1,15 @@ +compilation_database_dir: .. +output_directory: puml +diagrams: + t00065_class: + type: class + glob: + - t00065.cc + relative_to: ../../../tests/t00065 + generate_packages: true + package_type: directory + include: + namespaces: + - clanguml::t00065 + using_namespace: + - clanguml::t00065 \ No newline at end of file diff --git a/tests/t00065/module1/module1.h b/tests/t00065/module1/module1.h new file mode 100644 index 00000000..ee61d62f --- /dev/null +++ b/tests/t00065/module1/module1.h @@ -0,0 +1,11 @@ +#include "submodule1a/submodule1a.h" + +#pragma once + +namespace clanguml { +namespace t00065 { +struct A { + detail::AImpl *pimpl; +}; +} +} \ No newline at end of file diff --git a/tests/t00065/module1/submodule1a/submodule1a.h b/tests/t00065/module1/submodule1a/submodule1a.h new file mode 100644 index 00000000..41bad1bb --- /dev/null +++ b/tests/t00065/module1/submodule1a/submodule1a.h @@ -0,0 +1,9 @@ +#pragma once + +namespace clanguml { +namespace t00065 { +namespace detail { +struct AImpl { }; +} +} +} \ No newline at end of file diff --git a/tests/t00065/module2/module2.h b/tests/t00065/module2/module2.h new file mode 100644 index 00000000..6e90e697 --- /dev/null +++ b/tests/t00065/module2/module2.h @@ -0,0 +1,7 @@ +#pragma once + +namespace clanguml { +namespace t00065 { +struct B { }; +} +} \ No newline at end of file diff --git a/tests/t00065/t00065.cc b/tests/t00065/t00065.cc new file mode 100644 index 00000000..667316d1 --- /dev/null +++ b/tests/t00065/t00065.cc @@ -0,0 +1,10 @@ +#include "module1/module1.h" +#include "module2/module2.h" + +namespace clanguml { +namespace t00065 { +struct R { + A *a; +}; +} +} \ No newline at end of file diff --git a/tests/t00065/test_case.h b/tests/t00065/test_case.h new file mode 100644 index 00000000..a90d050e --- /dev/null +++ b/tests/t00065/test_case.h @@ -0,0 +1,83 @@ +/** + * tests/t00065/test_case.h + * + * Copyright (c) 2021-2023 Bartek Kryza + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +TEST_CASE("t00065", "[test-case][class]") +{ + auto [config, db] = load_config("t00065"); + + auto diagram = config.diagrams["t00065_class"]; + + REQUIRE(diagram->name == "t00065_class"); + + auto model = generate_class_diagram(*db, diagram); + + REQUIRE(model->name() == "t00065_class"); + + { + auto puml = generate_class_puml(diagram, *model); + AliasMatcher _A(puml); + + REQUIRE_THAT(puml, StartsWith("@startuml")); + REQUIRE_THAT(puml, EndsWith("@enduml\n")); + + // Check if all classes exist + // REQUIRE_THAT(puml, IsClass(_A("AAA"))); + + // Check if class templates exist + // REQUIRE_THAT(puml, IsClassTemplate("A", "T,P,CMP,int N")); + + // Check concepts + // REQUIRE_THAT(puml, IsConcept(_A("AConcept"))); + // REQUIRE_THAT(puml, + // IsConceptRequirement( + // _A("AConcept"), "sizeof (T) > sizeof (P)")); + + // Check if all enums exist + // REQUIRE_THAT(puml, IsEnum(_A("Lights"))); + + // Check if all inner classes exist + // REQUIRE_THAT(puml, IsInnerClass(_A("A"), _A("AA"))); + + // Check if all inheritance relationships exist + // REQUIRE_THAT(puml, IsBaseClass(_A("Base"), _A("Child"))); + + // Check if all methods exist + // REQUIRE_THAT(puml, (IsMethod("foo"))); + + // Check if all fields exist + // REQUIRE_THAT(puml, (IsField("private_member", "int"))); + + // Check if all relationships exist + // REQUIRE_THAT(puml, IsAssociation(_A("D"), _A("A"), "-as")); + // REQUIRE_THAT(puml, IsDependency(_A("R"), _A("B"))); + // REQUIRE_THAT(puml, IsAggregation(_A("R"), _A("D"), "-ag")); + // REQUIRE_THAT(puml, IsComposition(_A("R"), _A("D"), "-ac")); + // REQUIRE_THAT(puml, IsInstantiation(_A("ABCD::F"), _A("F"))); + + save_puml( + config.output_directory() + "/" + diagram->name + ".puml", puml); + } + + { + auto j = generate_class_json(diagram, *model); + + using namespace json; + + save_json(config.output_directory() + "/" + diagram->name + ".json", j); + } +} \ No newline at end of file diff --git a/tests/t20017/.clang-uml b/tests/t20017/.clang-uml index 860e217d..0d9947d3 100644 --- a/tests/t20017/.clang-uml +++ b/tests/t20017/.clang-uml @@ -4,9 +4,9 @@ diagrams: t20017_sequence: type: sequence combine_free_functions_into_file_participants: true - relative_to: ../../tests/t20017 + relative_to: ../../../tests/t20017 glob: - - ../../tests/t20017/t20017.cc + - t20017.cc include: namespaces: - clanguml::t20017 diff --git a/tests/test_cases.cc b/tests/test_cases.cc index 6313f195..98f03746 100644 --- a/tests/test_cases.cc +++ b/tests/test_cases.cc @@ -301,6 +301,7 @@ using namespace clanguml::test::matchers; #include "t00062/test_case.h" #include "t00063/test_case.h" #include "t00064/test_case.h" +#include "t00065/test_case.h" /// /// Sequence diagram tests From 10a28cf35e8d1c648ca694d61107487ea068c589 Mon Sep 17 00:00:00 2001 From: Bartek Kryza Date: Wed, 24 May 2023 22:18:40 +0200 Subject: [PATCH 02/14] Added clanguml element hierarchy class diagram --- uml/diagram_element_hierarchy_diagram.yml | 31 +++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 uml/diagram_element_hierarchy_diagram.yml diff --git a/uml/diagram_element_hierarchy_diagram.yml b/uml/diagram_element_hierarchy_diagram.yml new file mode 100644 index 00000000..ca6df6bc --- /dev/null +++ b/uml/diagram_element_hierarchy_diagram.yml @@ -0,0 +1,31 @@ +type: class +#include_relations_also_as_members: false +#generate_method_arguments: none +generate_packages: true +glob: + - src/common/model/*.cc + - src/class_diagram/model/*.cc + - src/sequence_diagram/model/*.cc + - src/include_diagram/model/*.cc + - src/package_diagram/model/*.cc +include: + namespaces: + - clanguml + subclasses: + - clanguml::common::model::decorated_element + - clanguml::common::model::source_location + include: + relationships: + - inheritance +exclude: + relationships: + - dependency + access: + - public + - private + - protected +using_namespace: + - clanguml +plantuml: + before: + - 'title clang-uml diagram element class inheritance model' \ No newline at end of file From 75c027262fdd1d1aaf80a687b425d21b706345b5 Mon Sep 17 00:00:00 2001 From: Bartek Kryza Date: Wed, 24 May 2023 22:22:47 +0200 Subject: [PATCH 03/14] Fixed class diagram generation with packages from directories --- src/class_diagram/model/diagram.cc | 135 ++++++++++++++++-- src/class_diagram/model/diagram.h | 32 +++-- src/class_diagram/visitor/template_builder.cc | 21 +-- src/class_diagram/visitor/template_builder.h | 10 +- .../visitor/translation_unit_visitor.cc | 79 ++++++---- .../visitor/translation_unit_visitor.h | 11 +- src/common/visitor/translation_unit_visitor.h | 2 +- 7 files changed, 226 insertions(+), 64 deletions(-) diff --git a/src/class_diagram/model/diagram.cc b/src/class_diagram/model/diagram.cc index 6e80776f..1d3afdaf 100644 --- a/src/class_diagram/model/diagram.cc +++ b/src/class_diagram/model/diagram.cc @@ -173,16 +173,56 @@ common::optional_ref diagram::get_concept( return {}; } -bool diagram::add_package_fs(std::unique_ptr &&p) +bool diagram::add_class( + const common::model::path &parent_path, std::unique_ptr &&c) +{ + if (parent_path.type() == common::model::path_type::kNamespace) { + return add_class_ns(std::move(c)); + } + + return add_class_fs(parent_path, std::move(c)); +} + +bool diagram::add_enum(const path &parent_path, std::unique_ptr &&e) +{ + if (parent_path.type() == common::model::path_type::kNamespace) { + return add_enum_ns(std::move(e)); + } + + return add_enum_fs(parent_path, std::move(e)); +} + +bool diagram::add_concept( + const path &parent_path, std::unique_ptr &&c) +{ + if (parent_path.type() == common::model::path_type::kNamespace) { + return add_concept_ns(std::move(c)); + } + + return add_concept_fs(parent_path, std::move(c)); +} + +bool diagram::add_package( + const path &parent_path, std::unique_ptr &&p) +{ + if (parent_path.type() == common::model::path_type::kNamespace) { + return add_package_ns(std::move(p)); + } + + return add_package_fs(parent_path, std::move(p)); +} + +bool diagram::add_package_fs( + const path &parent_path, std::unique_ptr &&p) { LOG_DBG("Adding filesystem package: {}, {}", p->name(), p->full_name(true)); - auto ns = p->get_namespace(); + auto ns = p->get_relative_namespace(); return add_element(ns, std::move(p)); } -bool diagram::add_package(std::unique_ptr &&p) +bool diagram::add_package_ns(std::unique_ptr &&p) { LOG_DBG("Adding namespace package: {}, {}", p->name(), p->full_name(true)); @@ -192,14 +232,28 @@ bool diagram::add_package(std::unique_ptr &&p) } bool diagram::add_class_fs( - const common::model::path &p, std::unique_ptr &&c) + const common::model::path &parent_path, std::unique_ptr &&c) { + // Make sure all parent directories are already packages in the + // model + for (auto it = parent_path.begin(); it != parent_path.end(); it++) { + auto pkg = + std::make_unique(c->using_namespace()); + pkg->set_name(*it); + auto ns = common::model::path(parent_path.begin(), it); + // ns.pop_back(); + pkg->set_namespace(ns); + pkg->set_id(common::to_id(pkg->full_name(false))); + + add_package_fs(ns, std::move(pkg)); + } + const auto base_name = c->name(); const auto full_name = c->full_name(false); const auto id = c->id(); auto &cc = *c; - if (add_element(p, std::move(c))) { + if (add_element(parent_path, std::move(c))) { classes_.push_back(std::ref(cc)); return true; } @@ -210,7 +264,7 @@ bool diagram::add_class_fs( return false; } -bool diagram::add_class(std::unique_ptr &&c) +bool diagram::add_class_ns(std::unique_ptr &&c) { const auto base_name = c->name(); const auto full_name = c->full_name(false); @@ -259,7 +313,7 @@ bool diagram::add_class(std::unique_ptr &&c) return false; } -bool diagram::add_enum(std::unique_ptr &&e) +bool diagram::add_enum_ns(std::unique_ptr &&e) { const auto full_name = e->name(); @@ -282,7 +336,40 @@ bool diagram::add_enum(std::unique_ptr &&e) return false; } -bool diagram::add_concept(std::unique_ptr &&c) +bool diagram::add_enum_fs( + const common::model::path &parent_path, std::unique_ptr &&e) +{ + // Make sure all parent directories are already packages in the + // model + for (auto it = parent_path.begin(); it != parent_path.end(); it++) { + auto pkg = + std::make_unique(e->using_namespace()); + pkg->set_name(*it); + auto ns = common::model::path(parent_path.begin(), it); + // ns.pop_back(); + pkg->set_namespace(ns); + pkg->set_id(common::to_id(pkg->full_name(false))); + + add_package_fs(ns, std::move(pkg)); + } + + const auto base_name = e->name(); + const auto full_name = e->full_name(false); + const auto id = e->id(); + auto &cc = *e; + + if (add_element(parent_path, std::move(e))) { + enums_.push_back(std::ref(cc)); + return true; + } + else { + LOG_WARN("Cannot add class {} with id {} due to: {}", base_name, id); + } + + return false; +} + +bool diagram::add_concept_ns(std::unique_ptr &&c) { const auto base_name = c->name(); const auto full_name = c->full_name(false); @@ -331,6 +418,38 @@ bool diagram::add_concept(std::unique_ptr &&c) return false; } +bool diagram::add_concept_fs( + const common::model::path &parent_path, std::unique_ptr &&c) +{ + // Make sure all parent directories are already packages in the + // model + for (auto it = parent_path.begin(); it != parent_path.end(); it++) { + auto pkg = + std::make_unique(c->using_namespace()); + pkg->set_name(*it); + auto ns = common::model::path(parent_path.begin(), it); + // ns.pop_back(); + pkg->set_namespace(ns); + pkg->set_id(common::to_id(pkg->full_name(false))); + + add_package_fs(ns, std::move(pkg)); + } + + const auto base_name = c->name(); + const auto full_name = c->full_name(false); + const auto id = c->id(); + auto &cc = *c; + + if (add_element(parent_path, std::move(c))) { + concepts_.push_back(std::ref(cc)); + return true; + } + + LOG_WARN("Cannot add class {} with id {} due to: {}", base_name, id); + + return false; +} + void diagram::get_parents( clanguml::common::reference_set &parents) const { diff --git a/src/class_diagram/model/diagram.h b/src/class_diagram/model/diagram.h index 5077905b..1d566ac7 100644 --- a/src/class_diagram/model/diagram.h +++ b/src/class_diagram/model/diagram.h @@ -34,6 +34,8 @@ namespace clanguml::class_diagram::model { using common::opt_ref; using common::model::diagram_element; using common::model::diagram_t; +using common::model::path; +using common::model::path_type; using nested_trait_ns = clanguml::common::model::nested_trait get_concept(diagram_element::id_t id) const; - bool add_class_fs( - const common::model::path &p, std::unique_ptr &&c); + bool add_class(const path &parent_path, std::unique_ptr &&c); - bool add_class(std::unique_ptr &&c); + bool add_enum(const path &parent_path, std::unique_ptr &&e); - bool add_enum(std::unique_ptr &&e); + bool add_concept(const path &parent_path, std::unique_ptr &&e); - bool add_concept(std::unique_ptr &&e); - - bool add_package(std::unique_ptr &&p); - - bool add_package_fs(std::unique_ptr &&p); + bool add_package( + const path &parent_path, std::unique_ptr &&p); std::string to_alias(diagram_element::id_t id) const; @@ -102,6 +100,22 @@ public: inja::json context() const override; private: + bool add_class_ns(std::unique_ptr &&c); + bool add_class_fs( + const common::model::path &parent_path, std::unique_ptr &&c); + + bool add_enum_ns(std::unique_ptr &&c); + bool add_enum_fs( + const common::model::path &parent_path, std::unique_ptr &&c); + + bool add_package_ns(std::unique_ptr &&p); + bool add_package_fs(const common::model::path &parent_path, + std::unique_ptr &&p); + + bool add_concept_ns(std::unique_ptr &&p); + bool add_concept_fs( + const common::model::path &parent_path, std::unique_ptr &&p); + common::reference_vector classes_; common::reference_vector enums_; diff --git a/src/class_diagram/visitor/template_builder.cc b/src/class_diagram/visitor/template_builder.cc index 0e56f5e9..a7375d7f 100644 --- a/src/class_diagram/visitor/template_builder.cc +++ b/src/class_diagram/visitor/template_builder.cc @@ -23,14 +23,13 @@ namespace clanguml::class_diagram::visitor { -template_builder::template_builder(class_diagram::model::diagram &d, - const config::class_diagram &config, - common::visitor::ast_id_mapper &id_mapper, - clang::SourceManager &source_manager) - : diagram_{d} - , config_{config} - , id_mapper_{id_mapper} - , source_manager_{source_manager} +template_builder::template_builder( + clanguml::class_diagram::visitor::translation_unit_visitor &visitor) + : diagram_{visitor.diagram()} + , config_{visitor.config()} + , id_mapper_{visitor.id_mapper()} + , source_manager_{visitor.source_manager()} + , visitor_{visitor} { } @@ -268,6 +267,8 @@ std::unique_ptr template_builder::build(const clang::NamedDecl *cls, template_instantiation.set_id( common::to_id(template_instantiation_ptr->full_name(false))); + visitor_.set_source_location(*template_decl, *template_instantiation_ptr); + return template_instantiation_ptr; } @@ -1043,7 +1044,7 @@ template_builder::try_as_template_specialization_type( } if (diagram().should_include(nested_template_instantiation_full_name)) { - diagram().add_class(std::move(nested_template_instantiation)); + visitor_.add_class(std::move(nested_template_instantiation)); } return argument; @@ -1155,7 +1156,7 @@ std::optional template_builder::try_as_record_type( parent.value()->add_relationship( {relationship_t::kDependency, tag_argument->id()}); - diagram().add_class(std::move(tag_argument)); + visitor_.add_class(std::move(tag_argument)); } } } diff --git a/src/class_diagram/visitor/template_builder.h b/src/class_diagram/visitor/template_builder.h index 428d4b68..177f3a93 100644 --- a/src/class_diagram/visitor/template_builder.h +++ b/src/class_diagram/visitor/template_builder.h @@ -34,12 +34,12 @@ using found_relationships_t = std::vector>; +class translation_unit_visitor; + class template_builder { public: - template_builder(class_diagram::model::diagram &d, - const config::class_diagram &config, - common::visitor::ast_id_mapper &id_mapper, - clang::SourceManager &source_manager); + template_builder( + clanguml::class_diagram::visitor::translation_unit_visitor &visitor); class_diagram::model::diagram &diagram(); @@ -192,6 +192,8 @@ private: common::visitor::ast_id_mapper &id_mapper_; clang::SourceManager &source_manager_; + + clanguml::class_diagram::visitor::translation_unit_visitor &visitor_; }; } // namespace clanguml::class_diagram::visitor \ No newline at end of file diff --git a/src/class_diagram/visitor/translation_unit_visitor.cc b/src/class_diagram/visitor/translation_unit_visitor.cc index df42aae3..39d66b85 100644 --- a/src/class_diagram/visitor/translation_unit_visitor.cc +++ b/src/class_diagram/visitor/translation_unit_visitor.cc @@ -32,7 +32,7 @@ translation_unit_visitor::translation_unit_visitor(clang::SourceManager &sm, : common::visitor::translation_unit_visitor{sm, config} , diagram_{diagram} , config_{config} - , template_builder_{diagram_, config_, id_mapper_, sm} + , template_builder_{*this} { } @@ -84,7 +84,7 @@ bool translation_unit_visitor::VisitNamespaceDecl(clang::NamespaceDecl *ns) } if (!p->skip()) { - diagram().add_package(std::move(p)); + diagram().add_package(package_path, std::move(p)); } } @@ -170,7 +170,7 @@ bool translation_unit_visitor::VisitEnumDecl(clang::EnumDecl *enm) } if (diagram().should_include(qualified_name)) - diagram().add_enum(std::move(e_ptr)); + add_enum(std::move(e_ptr)); return true; } @@ -225,14 +225,14 @@ bool translation_unit_visitor::VisitClassTemplateSpecializationDecl( {relationship_t::kInstantiation, maybe_id.value()}); } - if (diagram_.should_include(template_specialization)) { + if (diagram().should_include(template_specialization)) { const auto full_name = template_specialization.full_name(false); const auto id = template_specialization.id(); LOG_DBG("Adding class template specialization {} with id {}", full_name, id); - diagram_.add_class(std::move(template_specialization_ptr)); + add_class(std::move(template_specialization_ptr)); } return true; @@ -265,13 +265,13 @@ bool translation_unit_visitor::VisitTypeAliasTemplateDecl( 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 id = template_specialization_ptr->id(); LOG_DBG("Adding class {} with id {}", name, id); - diagram_.add_class(std::move(template_specialization_ptr)); + add_class(std::move(template_specialization_ptr)); } return true; @@ -327,11 +327,11 @@ bool translation_unit_visitor::VisitClassTemplateDecl( process_class_declaration(*cls->getTemplatedDecl(), *c_ptr); forward_declarations_.erase(id); - if (diagram_.should_include(*c_ptr)) { + if (diagram().should_include(*c_ptr)) { const auto name = c_ptr->full_name(); LOG_DBG("Adding class template {} with id {}", name, id); - diagram_.add_class(std::move(c_ptr)); + add_class(std::move(c_ptr)); } return true; @@ -380,11 +380,11 @@ bool translation_unit_visitor::VisitRecordDecl(clang::RecordDecl *rec) } forward_declarations_.erase(id); - if (diagram_.should_include(record_model)) { + if (diagram().should_include(record_model)) { LOG_DBG("Adding struct/union {} with id {}", record_model.full_name(false), record_model.id()); - diagram_.add_class(std::move(record_ptr)); + add_class(std::move(record_ptr)); } else { LOG_DBG("Skipping struct/union {} with id {}", record_model.full_name(), @@ -436,11 +436,11 @@ bool translation_unit_visitor::TraverseConceptDecl(clang::ConceptDecl *cpt) *concept_model, cpt->getConstraintExpr()); } - if (diagram_.should_include(*concept_model)) { + if (diagram().should_include(*concept_model)) { LOG_DBG("Adding concept {} with id {}", concept_model->full_name(false), concept_model->id()); - diagram_.add_concept(std::move(concept_model)); + add_concept(std::move(concept_model)); } else { LOG_DBG("Skipping concept {} with id {}", concept_model->full_name(), @@ -2105,23 +2105,46 @@ void translation_unit_visitor::add_class(std::unique_ptr &&c) common::model::path p{file, common::model::path_type::kFilesystem}; p.pop_back(); - // Make sure all parent directories are already packages in the model - for (auto it = p.begin(); it != p.end(); it++) { - auto pkg = std::make_unique( - config().using_namespace()); - pkg->set_name(*it); - auto ns = common::model::path(p.begin(), it); - // ns.pop_back(); - pkg->set_namespace(ns); - pkg->set_id(common::to_id(pkg->full_name(false))); - - diagram().add_package_fs(std::move(pkg)); - } - - diagram().add_class_fs(p, std::move(c)); + diagram().add_class(p, std::move(c)); } else { - diagram().add_class(std::move(c)); + diagram().add_class(c->path(), std::move(c)); + } +} + +void translation_unit_visitor::add_enum(std::unique_ptr &&e) +{ + if ((config().generate_packages() && + config().package_type() == config::package_type_t::kDirectory)) { + assert(!e->file().empty()); + + const auto file = config().make_path_relative(e->file()); + + common::model::path p{file, common::model::path_type::kFilesystem}; + p.pop_back(); + + diagram().add_enum(p, std::move(e)); + } + else { + diagram().add_enum(e->path(), std::move(e)); + } +} + +void translation_unit_visitor::add_concept(std::unique_ptr &&c) +{ + if ((config().generate_packages() && + config().package_type() == config::package_type_t::kDirectory)) { + assert(!c->file().empty()); + + const auto file = config().make_path_relative(c->file()); + + common::model::path p{file, common::model::path_type::kFilesystem}; + p.pop_back(); + + diagram().add_concept(p, std::move(c)); + } + else { + diagram().add_concept(c->path(), std::move(c)); } } diff --git a/src/class_diagram/visitor/translation_unit_visitor.h b/src/class_diagram/visitor/translation_unit_visitor.h index 3458db52..943943e7 100644 --- a/src/class_diagram/visitor/translation_unit_visitor.h +++ b/src/class_diagram/visitor/translation_unit_visitor.h @@ -43,6 +43,7 @@ using clanguml::class_diagram::model::class_; using clanguml::class_diagram::model::class_member; using clanguml::class_diagram::model::class_method; using clanguml::class_diagram::model::class_parent; +using clanguml::class_diagram::model::concept_; using clanguml::class_diagram::model::diagram; using clanguml::class_diagram::model::enum_; using clanguml::class_diagram::model::method_parameter; @@ -118,9 +119,13 @@ public: */ void finalize(); -private: - void add_class(std::unique_ptr &&c); + common::visitor::ast_id_mapper &id_mapper() const { return id_mapper_; } + void add_class(std::unique_ptr &&c); + void add_enum(std::unique_ptr &&e); + void add_concept(std::unique_ptr &&c); + +private: bool should_include(const clang::NamedDecl *decl); std::unique_ptr @@ -220,8 +225,6 @@ private: bool has_processed_template_class(const std::string &qualified_name) const; - common::visitor::ast_id_mapper &id_mapper() const { return id_mapper_; } - template_builder &tbuilder() { return template_builder_; } // Reference to the output diagram model diff --git a/src/common/visitor/translation_unit_visitor.h b/src/common/visitor/translation_unit_visitor.h index 5b0d920f..4faaf2f0 100644 --- a/src/common/visitor/translation_unit_visitor.h +++ b/src/common/visitor/translation_unit_visitor.h @@ -62,7 +62,6 @@ public: */ clang::SourceManager &source_manager() const; -protected: /** * @brief Set source location in diagram element * @@ -93,6 +92,7 @@ protected: void set_source_location(const clang::SourceLocation &location, clanguml::common::model::source_location &element); +protected: /** * @brief Set source location in diagram element * From c3dcac72da07879e46a467e4b681300e73564821 Mon Sep 17 00:00:00 2001 From: Bartek Kryza Date: Wed, 24 May 2023 22:23:03 +0200 Subject: [PATCH 04/14] Updated t00065 test case --- tests/t00065/module1/module1.h | 7 +++++++ tests/t00065/module2/concepts/concepts.h | 13 +++++++++++++ tests/t00065/module2/module2.h | 16 +++++++++++++++- tests/t00065/t00065.cc | 2 ++ tests/test_cases.cc | 2 ++ tests/test_cases.yaml | 3 +++ 6 files changed, 42 insertions(+), 1 deletion(-) create mode 100644 tests/t00065/module2/concepts/concepts.h diff --git a/tests/t00065/module1/module1.h b/tests/t00065/module1/module1.h index ee61d62f..9e78aada 100644 --- a/tests/t00065/module1/module1.h +++ b/tests/t00065/module1/module1.h @@ -4,7 +4,14 @@ namespace clanguml { namespace t00065 { + +enum class ABC { a, b, c }; + +enum XYZ { x, y, z }; + struct A { + ABC abc; + XYZ xyz; detail::AImpl *pimpl; }; } diff --git a/tests/t00065/module2/concepts/concepts.h b/tests/t00065/module2/concepts/concepts.h new file mode 100644 index 00000000..2cbfe192 --- /dev/null +++ b/tests/t00065/module2/concepts/concepts.h @@ -0,0 +1,13 @@ +#pragma once + +namespace clanguml { +namespace t00065 { + +template +concept bconcept = requires(T t) { + T{}; + t.b(); + }; + +} +} \ No newline at end of file diff --git a/tests/t00065/module2/module2.h b/tests/t00065/module2/module2.h index 6e90e697..bca56d84 100644 --- a/tests/t00065/module2/module2.h +++ b/tests/t00065/module2/module2.h @@ -1,7 +1,21 @@ #pragma once +#include "concepts/concepts.h" + namespace clanguml { namespace t00065 { -struct B { }; +struct B { + B() = default; + void b() { } +}; + +template struct C { + T *t; +}; + +template struct D { + T t; +}; + } } \ No newline at end of file diff --git a/tests/t00065/t00065.cc b/tests/t00065/t00065.cc index 667316d1..0f0fae66 100644 --- a/tests/t00065/t00065.cc +++ b/tests/t00065/t00065.cc @@ -5,6 +5,8 @@ namespace clanguml { namespace t00065 { struct R { A *a; + C c; + D d; }; } } \ No newline at end of file diff --git a/tests/test_cases.cc b/tests/test_cases.cc index 98f03746..0df23aa8 100644 --- a/tests/test_cases.cc +++ b/tests/test_cases.cc @@ -301,7 +301,9 @@ using namespace clanguml::test::matchers; #include "t00062/test_case.h" #include "t00063/test_case.h" #include "t00064/test_case.h" +#if defined(ENABLE_CXX_STD_20_TEST_CASES) #include "t00065/test_case.h" +#endif /// /// Sequence diagram tests diff --git a/tests/test_cases.yaml b/tests/test_cases.yaml index 58189119..15593dec 100644 --- a/tests/test_cases.yaml +++ b/tests/test_cases.yaml @@ -189,6 +189,9 @@ test_cases: - name: t00064 title: Template type list test case description: + - name: t00065 + title: Class diagram with packages from directory structure + description: Sequence diagrams: - name: t20001 title: Basic sequence diagram test case From 467c021e17bf94ecab195ebd34a9b0727ff00a71 Mon Sep 17 00:00:00 2001 From: Bartek Kryza Date: Fri, 26 May 2023 21:05:28 +0200 Subject: [PATCH 05/14] Added generation of package diagrams from directory structure instead of namespaces --- src/class_diagram/model/diagram.cc | 4 +- src/config/yaml_decoders.cc | 7 + src/package_diagram/model/diagram.cc | 30 ++- src/package_diagram/model/diagram.h | 7 +- .../visitor/translation_unit_visitor.cc | 200 ++++++++++++++++-- .../visitor/translation_unit_visitor.h | 13 +- tests/t30002/t30002.cc | 11 +- tests/t30002/test_case.h | 2 + tests/test_cases.cc | 1 + tests/test_cases.yaml | 3 + util/templates/test_cases/test_case.h | 2 +- 11 files changed, 248 insertions(+), 32 deletions(-) diff --git a/src/class_diagram/model/diagram.cc b/src/class_diagram/model/diagram.cc index 1d3afdaf..473d2e10 100644 --- a/src/class_diagram/model/diagram.cc +++ b/src/class_diagram/model/diagram.cc @@ -251,10 +251,10 @@ bool diagram::add_class_fs( const auto base_name = c->name(); const auto full_name = c->full_name(false); const auto id = c->id(); - auto &cc = *c; + auto cc = std::ref(*c); if (add_element(parent_path, std::move(c))) { - classes_.push_back(std::ref(cc)); + classes_.push_back(cc); return true; } else { diff --git a/src/config/yaml_decoders.cc b/src/config/yaml_decoders.cc index 0ec9f095..fc885031 100644 --- a/src/config/yaml_decoders.cc +++ b/src/config/yaml_decoders.cc @@ -469,6 +469,13 @@ template <> struct convert { return false; get_option(node, rhs.layout); + get_option(node, rhs.relative_to); + get_option(node, rhs.package_type); + + // Ensure relative_to has a value + if (!rhs.relative_to.has_value) + rhs.relative_to.set( + std::filesystem::current_path().lexically_normal()); return true; } diff --git a/src/package_diagram/model/diagram.cc b/src/package_diagram/model/diagram.cc index ff197f1f..dfe64537 100644 --- a/src/package_diagram/model/diagram.cc +++ b/src/package_diagram/model/diagram.cc @@ -36,7 +36,8 @@ diagram::packages() const void diagram::add_package(std::unique_ptr &&p) { - LOG_DBG("Adding package: {}, {}", p->name(), p->full_name(true)); + LOG_DBG( + "Adding package: {}, {}, [{}]", p->name(), p->full_name(true), p->id()); auto ns = p->get_relative_namespace(); @@ -45,6 +46,31 @@ void diagram::add_package(std::unique_ptr &&p) add_element(ns, std::move(p)); } +void diagram::add_package_fs(const common::model::path &parent_path, + std::unique_ptr &&p) +{ + LOG_DBG("Adding package: {}, {}", p->name(), p->full_name(true)); + + // Make sure all parent directories are already packages in the + // model + for (auto it = parent_path.begin(); it != parent_path.end(); it++) { + auto pkg = + std::make_unique(p->using_namespace()); + pkg->set_name(*it); + auto ns = common::model::path(parent_path.begin(), it); + // ns.pop_back(); + pkg->set_namespace(ns); + pkg->set_id(common::to_id(pkg->full_name(false))); + + add_package_fs(ns, std::move(pkg)); + } + + auto pp = std::ref(*p); + if (add_element(parent_path, std::move(p))) { + packages_.emplace_back(pp); + } +} + common::optional_ref diagram::get_package( const std::string &name) const { @@ -79,6 +105,8 @@ common::optional_ref diagram::get( common::optional_ref diagram::get( const clanguml::common::model::diagram_element::id_t id) const { + LOG_DBG("Looking for package with id {}", id); + return get_package(id); } diff --git a/src/package_diagram/model/diagram.h b/src/package_diagram/model/diagram.h index 07e0d1a4..4c7cf528 100644 --- a/src/package_diagram/model/diagram.h +++ b/src/package_diagram/model/diagram.h @@ -48,14 +48,17 @@ public: common::optional_ref get( clanguml::common::model::diagram_element::id_t id) const override; - void add_package(std::unique_ptr &&p); - common::optional_ref get_package( const std::string &name) const; common::optional_ref get_package( clanguml::common::model::diagram_element::id_t id) const; + void add_package(std::unique_ptr &&p); + + void add_package_fs(const common::model::path &parent_path, + std::unique_ptr &&p); + std::string to_alias( clanguml::common::model::diagram_element::id_t /*id*/) const; diff --git a/src/package_diagram/visitor/translation_unit_visitor.cc b/src/package_diagram/visitor/translation_unit_visitor.cc index 3519a5cb..2c0b824c 100644 --- a/src/package_diagram/visitor/translation_unit_visitor.cc +++ b/src/package_diagram/visitor/translation_unit_visitor.cc @@ -45,6 +45,9 @@ bool translation_unit_visitor::VisitNamespaceDecl(clang::NamespaceDecl *ns) { assert(ns != nullptr); + if (config().package_type() == config::package_type_t::kDirectory) + return true; + if (ns->isAnonymousNamespace() || ns->isInline()) return true; @@ -144,24 +147,91 @@ bool translation_unit_visitor::VisitCXXRecordDecl(clang::CXXRecordDecl *cls) return true; } -void translation_unit_visitor::add_relationships( - clang::DeclContext *cls, found_relationships_t &relationships) -{ - int64_t current_package_id{0}; - const auto *namespace_context = cls->getEnclosingNamespaceContext(); - if (namespace_context != nullptr && namespace_context->isNamespace()) { - current_package_id = - common::to_id(*llvm::cast(namespace_context)); +bool translation_unit_visitor::VisitRecordDecl(clang::RecordDecl *decl) +{ + assert(decl != nullptr); + + // Skip system headers + if (source_manager().isInSystemHeader(decl->getSourceRange().getBegin())) + return true; + + found_relationships_t relationships; + + if (decl->isCompleteDefinition()) { + process_record_children(*decl, relationships); + add_relationships(decl, relationships); } + return true; +} + +bool translation_unit_visitor::VisitEnumDecl(clang::EnumDecl *decl) +{ + assert(decl != nullptr); + + // Skip system headers + if (source_manager().isInSystemHeader(decl->getSourceRange().getBegin())) + return true; + + found_relationships_t relationships; + + if (decl->isCompleteDefinition()) { + add_relationships(decl, relationships); + } + + return true; +} + +bool translation_unit_visitor::VisitClassTemplateDecl( + clang::ClassTemplateDecl *decl) +{ + assert(decl != nullptr); + + // Skip system headers + if (source_manager().isInSystemHeader(decl->getSourceRange().getBegin())) + return true; + + found_relationships_t relationships; + + process_class_declaration(*decl->getTemplatedDecl(), relationships); + add_relationships(decl, relationships); + + return true; +} + +void translation_unit_visitor::add_relationships( + clang::Decl *cls, found_relationships_t &relationships) +{ + // If this diagram has directory packages, first make sure that the + // package for current directory is already in the model + if (config().package_type() == config::package_type_t::kDirectory) { + auto file = source_manager().getFilename(cls->getLocation()).str(); + auto relative_file = + util::path_to_url(config().make_path_relative(file)); + + common::model::path parent_path{ + relative_file, common::model::path_type::kFilesystem}; + parent_path.pop_back(); + auto pkg_name = parent_path.name(); + parent_path.pop_back(); + + auto pkg = std::make_unique( + config().using_namespace()); + + pkg->set_name(pkg_name); + pkg->set_id(get_package_id(cls)); + + diagram().add_package_fs(parent_path, std::move(pkg)); + } + + auto current_package_id = get_package_id(cls); + 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); if (current_package) { @@ -175,6 +245,33 @@ void translation_unit_visitor::add_relationships( } } +common::model::diagram_element::id_t translation_unit_visitor::get_package_id( + const clang::Decl *cls) +{ + if (config().package_type() == config::package_type_t::kNamespace) { + const auto *namespace_context = + cls->getDeclContext()->getEnclosingNamespaceContext(); + if (namespace_context != nullptr && namespace_context->isNamespace()) { + return common::to_id( + *llvm::cast(namespace_context)); + } + + return {}; + } + else { + auto file = source_manager() + .getFilename(cls->getSourceRange().getBegin()) + .str(); + auto relative_file = + util::path_to_url(config().make_path_relative(file)); + common::model::path parent_path{ + relative_file, common::model::path_type::kFilesystem}; + parent_path.pop_back(); + + return common::to_id(parent_path.to_string()); + } +} + void translation_unit_visitor::process_class_declaration( const clang::CXXRecordDecl &cls, found_relationships_t &relationships) { @@ -255,6 +352,44 @@ void translation_unit_visitor::process_method( } } +void translation_unit_visitor::process_record_children( + const clang::RecordDecl &cls, found_relationships_t &relationships) +{ + if (const auto *decl_context = + clang::dyn_cast_or_null(&cls); + decl_context != nullptr) { + // Iterate over class template methods + for (auto const *decl_iterator : decl_context->decls()) { + auto const *method_template = + llvm::dyn_cast_or_null( + decl_iterator); + if (method_template == nullptr) + continue; + + process_template_method(*method_template, relationships); + } + } + + // Iterate over regular class fields + for (const auto *field : cls.fields()) { + if (field != nullptr) + process_field(*field, relationships); + } + + // Static fields have to be processed by iterating over variable + // declarations + for (const auto *decl : cls.decls()) { + if (decl->getKind() == clang::Decl::Var) { + const clang::VarDecl *variable_declaration{ + clang::dyn_cast_or_null(decl)}; + if ((variable_declaration != nullptr) && + variable_declaration->isStaticDataMember()) { + process_static_field(*variable_declaration, relationships); + } + } + } +} + void translation_unit_visitor::process_template_method( const clang::FunctionTemplateDecl &method, found_relationships_t &relationships) @@ -334,15 +469,22 @@ bool translation_unit_visitor::find_relationships(const clang::QualType &type, relationships, relationship_t::kAggregation); } else if (type->isEnumeralType()) { - if (const auto *enum_type = type->getAs(); - enum_type != nullptr) { + if (const auto *enum_decl = type->getAs()->getDecl(); + enum_decl != nullptr) { relationships.emplace_back( - common::to_id(*enum_type), relationship_hint); + get_package_id(enum_decl), relationship_hint); } } else if (const auto *template_specialization_type = type->getAs()) { if (template_specialization_type != nullptr) { + // Add dependency to template declaration + relationships.emplace_back( + get_package_id(template_specialization_type->getTemplateName() + .getAsTemplateDecl()), + relationship_hint); + + // Add dependencies to template arguments for (const auto &template_argument : template_specialization_type->template_arguments()) { const auto template_argument_kind = template_argument.getKind(); @@ -389,17 +531,29 @@ bool translation_unit_visitor::find_relationships(const clang::QualType &type, } } else if (type->isRecordType() && type->getAsCXXRecordDecl()) { - const auto *namespace_context = - type->getAsCXXRecordDecl()->getEnclosingNamespaceContext(); - if (namespace_context != nullptr && namespace_context->isNamespace()) { - const auto *namespace_declaration = - clang::cast(namespace_context); + if (config().package_type() == config::package_type_t::kNamespace) { + const auto *namespace_context = + type->getAsCXXRecordDecl()->getEnclosingNamespaceContext(); + if (namespace_context != nullptr && + namespace_context->isNamespace()) { + const auto *namespace_declaration = + clang::cast(namespace_context); - if (namespace_declaration != nullptr && - diagram().should_include( - common::get_qualified_name(*namespace_declaration))) { - const auto target_id = common::to_id( - *clang::cast(namespace_context)); + if (namespace_declaration != nullptr && + diagram().should_include( + common::get_qualified_name(*namespace_declaration))) { + const auto target_id = + get_package_id(type->getAsCXXRecordDecl()); + relationships.emplace_back(target_id, relationship_hint); + result = true; + } + } + } + else { + if (diagram().should_include( + common::get_qualified_name(*type->getAsCXXRecordDecl()))) { + const auto target_id = + get_package_id(type->getAsCXXRecordDecl()); relationships.emplace_back(target_id, relationship_hint); result = true; } diff --git a/src/package_diagram/visitor/translation_unit_visitor.h b/src/package_diagram/visitor/translation_unit_visitor.h index eb6a1243..67859e86 100644 --- a/src/package_diagram/visitor/translation_unit_visitor.h +++ b/src/package_diagram/visitor/translation_unit_visitor.h @@ -49,8 +49,14 @@ public: virtual bool VisitNamespaceDecl(clang::NamespaceDecl *ns); + virtual bool VisitEnumDecl(clang::EnumDecl *decl); + virtual bool VisitCXXRecordDecl(clang::CXXRecordDecl *cls); + virtual bool VisitRecordDecl(clang::RecordDecl *cls); + + virtual bool VisitClassTemplateDecl(clang::ClassTemplateDecl *decl); + virtual bool VisitFunctionDecl(clang::FunctionDecl *function_declaration); clanguml::package_diagram::model::diagram &diagram() { return diagram_; } @@ -60,12 +66,17 @@ public: void finalize() { } private: + common::model::diagram_element::id_t get_package_id(const clang::Decl *cls); + void process_class_declaration( const clang::CXXRecordDecl &cls, found_relationships_t &relationships); void process_class_children( const clang::CXXRecordDecl &cls, found_relationships_t &relationships); + void process_record_children( + const clang::RecordDecl &cls, found_relationships_t &relationships); + void process_class_bases( const clang::CXXRecordDecl &cls, found_relationships_t &relationships); @@ -90,7 +101,7 @@ private: common::model::relationship_t::kDependency); void add_relationships( - clang::DeclContext *cls, found_relationships_t &relationships); + clang::Decl *cls, found_relationships_t &relationships); // Reference to the output diagram model clanguml::package_diagram::model::diagram &diagram_; diff --git a/tests/t30002/t30002.cc b/tests/t30002/t30002.cc index 864cd485..59cc7500 100644 --- a/tests/t30002/t30002.cc +++ b/tests/t30002/t30002.cc @@ -11,7 +11,9 @@ namespace A1 { struct CA { }; } namespace A2 { -struct CB { }; +template struct CB { + T cb; +}; } namespace A3 { struct CC { }; @@ -58,12 +60,15 @@ struct CP { }; namespace A17 { struct CR { }; } +namespace A18 { +enum class S { s1, s2, s3 }; +} } namespace B::BB::BBB { class CBA : public A::AA::A6::CF { public: A::AA::A1::CA *ca_; - A::AA::A2::CB cb_; + A::AA::A2::CB cb_; std::shared_ptr cc_; std::map> *cd_; std::array co_; @@ -91,6 +96,8 @@ public: { return {}; } + + A::AA::A18::S s; }; void cj(std::unique_ptr /*cj_*/) { } diff --git a/tests/t30002/test_case.h b/tests/t30002/test_case.h index ef88d9bf..b589496b 100644 --- a/tests/t30002/test_case.h +++ b/tests/t30002/test_case.h @@ -51,6 +51,7 @@ TEST_CASE("t30002", "[test-case][package]") REQUIRE_THAT(puml, IsPackage("A15")); REQUIRE_THAT(puml, IsPackage("A16")); REQUIRE_THAT(puml, IsPackage("A17")); + REQUIRE_THAT(puml, IsPackage("A18")); REQUIRE_THAT(puml, IsDependency(_A("BBB"), _A("A1"))); REQUIRE_THAT(puml, IsDependency(_A("BBB"), _A("A2"))); @@ -69,6 +70,7 @@ TEST_CASE("t30002", "[test-case][package]") REQUIRE_THAT(puml, IsDependency(_A("BBB"), _A("A15"))); REQUIRE_THAT(puml, IsDependency(_A("BBB"), _A("A16"))); REQUIRE_THAT(puml, IsDependency(_A("BBB"), _A("A17"))); + REQUIRE_THAT(puml, IsDependency(_A("BBB"), _A("A18"))); save_puml( config.output_directory() + "/" + diagram->name + ".puml", puml); diff --git a/tests/test_cases.cc b/tests/test_cases.cc index 0df23aa8..8605ad19 100644 --- a/tests/test_cases.cc +++ b/tests/test_cases.cc @@ -354,6 +354,7 @@ using namespace clanguml::test::matchers; #include "t30007/test_case.h" #include "t30008/test_case.h" #include "t30009/test_case.h" +#include "t30010/test_case.h" /// /// Include diagram tests diff --git a/tests/test_cases.yaml b/tests/test_cases.yaml index 15593dec..7302d814 100644 --- a/tests/test_cases.yaml +++ b/tests/test_cases.yaml @@ -308,6 +308,9 @@ test_cases: - name: t30009 title: Together layout hint test description: + - name: t30010 + title: Package diagram with packages from directory structure + description: Include diagrams: - name: t40001 title: Basic include graph diagram test case diff --git a/util/templates/test_cases/test_case.h b/util/templates/test_cases/test_case.h index c5f55f42..9289b364 100644 --- a/util/templates/test_cases/test_case.h +++ b/util/templates/test_cases/test_case.h @@ -42,7 +42,7 @@ TEST_CASE("{{ name }}", "[test-case][{{ type }}]") } { - auto j = generate_class_json(diagram, *model); + auto j = generate_{{ type }}_json(diagram, *model); using namespace json; From 2a29968f090be51cd18502c30dbd8c8293abc77d Mon Sep 17 00:00:00 2001 From: Bartek Kryza Date: Fri, 26 May 2023 21:06:23 +0200 Subject: [PATCH 06/14] Added test case for package diagram from directory structure --- tests/t30010/.clang-uml | 17 ++++++++ tests/t30010/app/app.h | 20 ++++++++++ tests/t30010/libraries/lib1/lib1.h | 11 ++++++ tests/t30010/libraries/lib2/lib2.h | 13 ++++++ tests/t30010/libraries/lib3/lib3.h | 11 ++++++ tests/t30010/libraries/lib4/lib4.h | 11 ++++++ tests/t30010/t30010.cc | 9 +++++ tests/t30010/test_case.h | 63 ++++++++++++++++++++++++++++++ 8 files changed, 155 insertions(+) create mode 100644 tests/t30010/.clang-uml create mode 100644 tests/t30010/app/app.h create mode 100644 tests/t30010/libraries/lib1/lib1.h create mode 100644 tests/t30010/libraries/lib2/lib2.h create mode 100644 tests/t30010/libraries/lib3/lib3.h create mode 100644 tests/t30010/libraries/lib4/lib4.h create mode 100644 tests/t30010/t30010.cc create mode 100644 tests/t30010/test_case.h diff --git a/tests/t30010/.clang-uml b/tests/t30010/.clang-uml new file mode 100644 index 00000000..f862cd41 --- /dev/null +++ b/tests/t30010/.clang-uml @@ -0,0 +1,17 @@ +compilation_database_dir: .. +output_directory: puml +diagrams: + t30010_package: + type: package + generate_packages: true + package_type: directory + glob: + - t30010.cc + relative_to: ../../../tests/t30010 + include: + namespaces: + - clanguml::t30010 +# paths: +# - . + using_namespace: + - clanguml::t30010 \ No newline at end of file diff --git a/tests/t30010/app/app.h b/tests/t30010/app/app.h new file mode 100644 index 00000000..e3c4454b --- /dev/null +++ b/tests/t30010/app/app.h @@ -0,0 +1,20 @@ +#pragma once + +#include "../libraries/lib1/lib1.h" +#include "../libraries/lib2/lib2.h" +#include "../libraries/lib3/lib3.h" +#include "../libraries/lib4/lib4.h" + +namespace clanguml { +namespace t30010 { + +struct App { + library1::A *a; + library2::B *b; + library3::E e; + + void c(library4::C *) { } +}; + +} +} \ No newline at end of file diff --git a/tests/t30010/libraries/lib1/lib1.h b/tests/t30010/libraries/lib1/lib1.h new file mode 100644 index 00000000..e5fd324f --- /dev/null +++ b/tests/t30010/libraries/lib1/lib1.h @@ -0,0 +1,11 @@ +#pragma once + +namespace clanguml { +namespace t30010 { +namespace library1 { + +struct A { }; + +} +} +} \ No newline at end of file diff --git a/tests/t30010/libraries/lib2/lib2.h b/tests/t30010/libraries/lib2/lib2.h new file mode 100644 index 00000000..1fdd93b5 --- /dev/null +++ b/tests/t30010/libraries/lib2/lib2.h @@ -0,0 +1,13 @@ +#pragma once + +namespace clanguml { +namespace t30010 { +namespace library2 { + +template struct B { + T b; +}; + +} +} +} \ No newline at end of file diff --git a/tests/t30010/libraries/lib3/lib3.h b/tests/t30010/libraries/lib3/lib3.h new file mode 100644 index 00000000..61556b16 --- /dev/null +++ b/tests/t30010/libraries/lib3/lib3.h @@ -0,0 +1,11 @@ +#pragma once + +namespace clanguml { +namespace t30010 { +namespace library3 { + +enum E { e1, e2, e3 }; + +} +} +} \ No newline at end of file diff --git a/tests/t30010/libraries/lib4/lib4.h b/tests/t30010/libraries/lib4/lib4.h new file mode 100644 index 00000000..2e273645 --- /dev/null +++ b/tests/t30010/libraries/lib4/lib4.h @@ -0,0 +1,11 @@ +#pragma once + +namespace clanguml { +namespace t30010 { +namespace library4 { + +struct C { }; + +} +} +} \ No newline at end of file diff --git a/tests/t30010/t30010.cc b/tests/t30010/t30010.cc new file mode 100644 index 00000000..93c7522b --- /dev/null +++ b/tests/t30010/t30010.cc @@ -0,0 +1,9 @@ +#include "app/app.h" + +namespace clanguml { +namespace t30010 { + +App app; + +} // namespace t30002 +} // namespace clanguml diff --git a/tests/t30010/test_case.h b/tests/t30010/test_case.h new file mode 100644 index 00000000..921d02c7 --- /dev/null +++ b/tests/t30010/test_case.h @@ -0,0 +1,63 @@ +/** + * tests/t30010/test_case.h + * + * Copyright (c) 2021-2023 Bartek Kryza + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +TEST_CASE("t30010", "[test-case][package]") +{ + auto [config, db] = load_config("t30010"); + + auto diagram = config.diagrams["t30010_package"]; + + REQUIRE(diagram->name == "t30010_package"); + + auto model = generate_package_diagram(*db, diagram); + + REQUIRE(model->name() == "t30010_package"); + + { + auto puml = generate_package_puml(diagram, *model); + AliasMatcher _A(puml); + + REQUIRE_THAT(puml, StartsWith("@startuml")); + REQUIRE_THAT(puml, EndsWith("@enduml\n")); + + REQUIRE_THAT(puml, IsPackage("app")); + REQUIRE_THAT(puml, IsPackage("libraries")); + REQUIRE_THAT(puml, IsPackage("lib1")); + REQUIRE_THAT(puml, IsPackage("lib2")); + REQUIRE_THAT(puml, !IsPackage("library1")); + REQUIRE_THAT(puml, !IsPackage("library2")); + + REQUIRE_THAT(puml, IsDependency(_A("app"), _A("lib1"))); + REQUIRE_THAT(puml, IsDependency(_A("app"), _A("lib2"))); + REQUIRE_THAT(puml, IsDependency(_A("app"), _A("lib3"))); + REQUIRE_THAT(puml, IsDependency(_A("app"), _A("lib4"))); + // REQUIRE_THAT(puml, IsDependency(_A("app"), _A("library1"))); + // REQUIRE_THAT(puml, IsDependency(_A("app"), _A("library1"))); + + save_puml( + config.output_directory() + "/" + diagram->name + ".puml", puml); + } + + { + auto j = generate_package_json(diagram, *model); + + using namespace json; + + save_json(config.output_directory() + "/" + diagram->name + ".json", j); + } +} \ No newline at end of file From ba32b54395c34d0f3585057648772bb6e816033a Mon Sep 17 00:00:00 2001 From: Bartek Kryza Date: Fri, 26 May 2023 21:46:23 +0200 Subject: [PATCH 07/14] Added test case for package diagram from directory structure for plain C --- .../visitor/translation_unit_visitor.cc | 12 ++++ tests/t30010/test_case.h | 2 - tests/t30011/.clang-uml | 12 ++++ tests/t30011/app/app.h | 14 +++++ tests/t30011/libraries/lib1/lib1.h | 3 + tests/t30011/libraries/lib2/lib2.h | 3 + tests/t30011/libraries/lib3/lib3.h | 3 + tests/t30011/libraries/lib4/lib4.h | 3 + tests/t30011/t30011.c | 3 + tests/t30011/test_case.h | 61 +++++++++++++++++++ tests/test_cases.cc | 1 + tests/test_cases.yaml | 3 + 12 files changed, 118 insertions(+), 2 deletions(-) create mode 100644 tests/t30011/.clang-uml create mode 100644 tests/t30011/app/app.h create mode 100644 tests/t30011/libraries/lib1/lib1.h create mode 100644 tests/t30011/libraries/lib2/lib2.h create mode 100644 tests/t30011/libraries/lib3/lib3.h create mode 100644 tests/t30011/libraries/lib4/lib4.h create mode 100644 tests/t30011/t30011.c create mode 100644 tests/t30011/test_case.h diff --git a/src/package_diagram/visitor/translation_unit_visitor.cc b/src/package_diagram/visitor/translation_unit_visitor.cc index 2c0b824c..5456cbe6 100644 --- a/src/package_diagram/visitor/translation_unit_visitor.cc +++ b/src/package_diagram/visitor/translation_unit_visitor.cc @@ -559,6 +559,18 @@ bool translation_unit_visitor::find_relationships(const clang::QualType &type, } } } + else if (type->isRecordType() && type->getAsRecordDecl()) { + // This is only possible for plain C translation unit, so we don't + // need to consider namespaces here + if (config().package_type() == config::package_type_t::kDirectory) { + if (diagram().should_include( + common::get_qualified_name(*type->getAsRecordDecl()))) { + const auto target_id = get_package_id(type->getAsRecordDecl()); + relationships.emplace_back(target_id, relationship_hint); + result = true; + } + } + } return result; } diff --git a/tests/t30010/test_case.h b/tests/t30010/test_case.h index 921d02c7..943da222 100644 --- a/tests/t30010/test_case.h +++ b/tests/t30010/test_case.h @@ -46,8 +46,6 @@ TEST_CASE("t30010", "[test-case][package]") REQUIRE_THAT(puml, IsDependency(_A("app"), _A("lib2"))); REQUIRE_THAT(puml, IsDependency(_A("app"), _A("lib3"))); REQUIRE_THAT(puml, IsDependency(_A("app"), _A("lib4"))); - // REQUIRE_THAT(puml, IsDependency(_A("app"), _A("library1"))); - // REQUIRE_THAT(puml, IsDependency(_A("app"), _A("library1"))); save_puml( config.output_directory() + "/" + diagram->name + ".puml", puml); diff --git a/tests/t30011/.clang-uml b/tests/t30011/.clang-uml new file mode 100644 index 00000000..33463e69 --- /dev/null +++ b/tests/t30011/.clang-uml @@ -0,0 +1,12 @@ +compilation_database_dir: .. +output_directory: puml +diagrams: + t30011_package: + type: package + package_type: directory + glob: + - t30011.c + relative_to: ../../../tests/t30011 + include: + paths: + - . \ No newline at end of file diff --git a/tests/t30011/app/app.h b/tests/t30011/app/app.h new file mode 100644 index 00000000..469dd9b5 --- /dev/null +++ b/tests/t30011/app/app.h @@ -0,0 +1,14 @@ +#pragma once + +#include "../libraries/lib1/lib1.h" +#include "../libraries/lib2/lib2.h" +#include "../libraries/lib3/lib3.h" +#include "../libraries/lib4/lib4.h" + +struct t30011_App { + struct t30011_A a; + struct t30011_B *b; + enum t30011_E e; +}; + +void c(struct t30011_App *app, struct t30011_C *c) { } diff --git a/tests/t30011/libraries/lib1/lib1.h b/tests/t30011/libraries/lib1/lib1.h new file mode 100644 index 00000000..0b82d65b --- /dev/null +++ b/tests/t30011/libraries/lib1/lib1.h @@ -0,0 +1,3 @@ +#pragma once + +struct t30011_A { }; diff --git a/tests/t30011/libraries/lib2/lib2.h b/tests/t30011/libraries/lib2/lib2.h new file mode 100644 index 00000000..ebc93b2d --- /dev/null +++ b/tests/t30011/libraries/lib2/lib2.h @@ -0,0 +1,3 @@ +#pragma once + +struct t30011_B { }; diff --git a/tests/t30011/libraries/lib3/lib3.h b/tests/t30011/libraries/lib3/lib3.h new file mode 100644 index 00000000..b7c8835a --- /dev/null +++ b/tests/t30011/libraries/lib3/lib3.h @@ -0,0 +1,3 @@ +#pragma once + +enum t30011_E { e1, e2, e3 }; diff --git a/tests/t30011/libraries/lib4/lib4.h b/tests/t30011/libraries/lib4/lib4.h new file mode 100644 index 00000000..408898b0 --- /dev/null +++ b/tests/t30011/libraries/lib4/lib4.h @@ -0,0 +1,3 @@ +#pragma once + +struct t30011_C { }; diff --git a/tests/t30011/t30011.c b/tests/t30011/t30011.c new file mode 100644 index 00000000..ea60a509 --- /dev/null +++ b/tests/t30011/t30011.c @@ -0,0 +1,3 @@ +#include "app/app.h" + +struct t30011_App app; diff --git a/tests/t30011/test_case.h b/tests/t30011/test_case.h new file mode 100644 index 00000000..b78c2c41 --- /dev/null +++ b/tests/t30011/test_case.h @@ -0,0 +1,61 @@ +/** + * tests/t30011/test_case.h + * + * Copyright (c) 2021-2023 Bartek Kryza + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +TEST_CASE("t30011", "[test-case][package]") +{ + auto [config, db] = load_config("t30011"); + + auto diagram = config.diagrams["t30011_package"]; + + REQUIRE(diagram->name == "t30011_package"); + + auto model = generate_package_diagram(*db, diagram); + + REQUIRE(model->name() == "t30011_package"); + + { + auto puml = generate_package_puml(diagram, *model); + AliasMatcher _A(puml); + + REQUIRE_THAT(puml, StartsWith("@startuml")); + REQUIRE_THAT(puml, EndsWith("@enduml\n")); + + REQUIRE_THAT(puml, IsPackage("app")); + REQUIRE_THAT(puml, IsPackage("libraries")); + REQUIRE_THAT(puml, IsPackage("lib1")); + REQUIRE_THAT(puml, IsPackage("lib2")); + REQUIRE_THAT(puml, !IsPackage("library1")); + REQUIRE_THAT(puml, !IsPackage("library2")); + + REQUIRE_THAT(puml, IsDependency(_A("app"), _A("lib1"))); + REQUIRE_THAT(puml, IsDependency(_A("app"), _A("lib2"))); + REQUIRE_THAT(puml, IsDependency(_A("app"), _A("lib3"))); + REQUIRE_THAT(puml, IsDependency(_A("app"), _A("lib4"))); + + save_puml( + config.output_directory() + "/" + diagram->name + ".puml", puml); + } + + { + auto j = generate_package_json(diagram, *model); + + using namespace json; + + save_json(config.output_directory() + "/" + diagram->name + ".json", j); + } +} \ No newline at end of file diff --git a/tests/test_cases.cc b/tests/test_cases.cc index 8605ad19..b4b92bd9 100644 --- a/tests/test_cases.cc +++ b/tests/test_cases.cc @@ -355,6 +355,7 @@ using namespace clanguml::test::matchers; #include "t30008/test_case.h" #include "t30009/test_case.h" #include "t30010/test_case.h" +#include "t30011/test_case.h" /// /// Include diagram tests diff --git a/tests/test_cases.yaml b/tests/test_cases.yaml index 7302d814..97734d89 100644 --- a/tests/test_cases.yaml +++ b/tests/test_cases.yaml @@ -311,6 +311,9 @@ test_cases: - name: t30010 title: Package diagram with packages from directory structure description: + - name: t30011 + title: Package diagram with packages from directory structure for plain C + description: Include diagrams: - name: t40001 title: Basic include graph diagram test case From e6fa19ff39b01d8773af52172936023d53d12677 Mon Sep 17 00:00:00 2001 From: Bartek Kryza Date: Sat, 27 May 2023 22:31:46 +0200 Subject: [PATCH 08/14] Refactored nested diagrams with element_view template --- src/class_diagram/model/diagram.cc | 407 ++---------------- src/class_diagram/model/diagram.h | 203 +++++++-- .../visitor/translation_unit_visitor.cc | 30 +- src/common/model/diagram_filter.cc | 14 +- src/common/model/element_view.h | 70 +++ src/include_diagram/model/diagram.cc | 38 +- src/include_diagram/model/diagram.h | 62 ++- src/package_diagram/model/diagram.cc | 75 +--- src/package_diagram/model/diagram.h | 118 ++++- .../visitor/translation_unit_visitor.cc | 4 +- 10 files changed, 445 insertions(+), 576 deletions(-) create mode 100644 src/common/model/element_view.h diff --git a/src/class_diagram/model/diagram.cc b/src/class_diagram/model/diagram.cc index 473d2e10..b250ca86 100644 --- a/src/class_diagram/model/diagram.cc +++ b/src/class_diagram/model/diagram.cc @@ -21,20 +21,21 @@ #include "util/error.h" #include "util/util.h" -#include - namespace clanguml::class_diagram::model { const common::reference_vector &diagram::classes() const { - return classes_; + return element_view::view(); } -const common::reference_vector &diagram::enums() const { return enums_; } +const common::reference_vector &diagram::enums() const +{ + return element_view::view(); +} const common::reference_vector &diagram::concepts() const { - return concepts_; + return element_view::view(); } common::model::diagram_t diagram::type() const @@ -46,17 +47,17 @@ common::optional_ref diagram::get( const std::string &full_name) const { common::optional_ref res = - get_class(full_name); + find(full_name); if (res.has_value()) return res; - res = get_enum(full_name); + res = find(full_name); if (res.has_value()) return res; - res = get_concept(full_name); + res = find(full_name); return res; } @@ -66,163 +67,24 @@ common::optional_ref diagram::get( { common::optional_ref res; - res = get_class(id); + res = find(id); if (res.has_value()) return res; - res = get_enum(id); + res = find(id); if (res.has_value()) return res; - res = get_concept(id); + res = find(id); return res; } -bool diagram::has_class(const class_ &c) const -{ - return std::any_of(classes_.cbegin(), classes_.cend(), - [&c](const auto &cc) { return cc.get() == c; }); -} - -bool diagram::has_enum(const enum_ &e) const -{ - return std::any_of(enums_.cbegin(), enums_.cend(), - [&e](const auto &ee) { return ee.get().full_name() == e.full_name(); }); -} - -bool diagram::has_concept(const concept_ &c) const -{ - return std::any_of(concepts_.cbegin(), concepts_.cend(), - [&c](const auto &cc) { return cc.get() == c; }); -} - -common::optional_ref diagram::get_class(const std::string &name) const -{ - for (const auto &c : classes_) { - const auto full_name = c.get().full_name(false); - - if (full_name == name) { - return {c}; - } - } - - return {}; -} - -common::optional_ref diagram::get_class( - clanguml::common::model::diagram_element::id_t id) const -{ - for (const auto &c : classes_) { - if (c.get().id() == id) { - return {c}; - } - } - - return {}; -} - -common::optional_ref diagram::get_enum(const std::string &name) const -{ - for (const auto &e : enums_) { - if (e.get().full_name(false) == name) { - return {e}; - } - } - - return {}; -} - -common::optional_ref diagram::get_enum( - clanguml::common::model::diagram_element::id_t id) const -{ - for (const auto &e : enums_) { - if (e.get().id() == id) { - return {e}; - } - } - - return {}; -} - -common::optional_ref diagram::get_concept( - const std::string &name) const -{ - for (const auto &c : concepts_) { - const auto full_name = c.get().full_name(false); - - if (full_name == name) { - return {c}; - } - } - - return {}; -} - -common::optional_ref diagram::get_concept( - clanguml::common::model::diagram_element::id_t id) const -{ - for (const auto &c : concepts_) { - if (c.get().id() == id) { - return {c}; - } - } - - return {}; -} - -bool diagram::add_class( - const common::model::path &parent_path, std::unique_ptr &&c) -{ - if (parent_path.type() == common::model::path_type::kNamespace) { - return add_class_ns(std::move(c)); - } - - return add_class_fs(parent_path, std::move(c)); -} - -bool diagram::add_enum(const path &parent_path, std::unique_ptr &&e) -{ - if (parent_path.type() == common::model::path_type::kNamespace) { - return add_enum_ns(std::move(e)); - } - - return add_enum_fs(parent_path, std::move(e)); -} - -bool diagram::add_concept( - const path &parent_path, std::unique_ptr &&c) -{ - if (parent_path.type() == common::model::path_type::kNamespace) { - return add_concept_ns(std::move(c)); - } - - return add_concept_fs(parent_path, std::move(c)); -} - -bool diagram::add_package( - const path &parent_path, std::unique_ptr &&p) -{ - if (parent_path.type() == common::model::path_type::kNamespace) { - return add_package_ns(std::move(p)); - } - - return add_package_fs(parent_path, std::move(p)); -} - -bool diagram::add_package_fs( - const path &parent_path, std::unique_ptr &&p) -{ - LOG_DBG("Adding filesystem package: {}, {}", p->name(), p->full_name(true)); - - auto ns = p->get_relative_namespace(); - - return add_element(ns, std::move(p)); -} - -bool diagram::add_package_ns(std::unique_ptr &&p) +template <> +bool diagram::add_with_namespace_path( + std::unique_ptr &&p) { LOG_DBG("Adding namespace package: {}, {}", p->name(), p->full_name(true)); @@ -231,223 +93,16 @@ bool diagram::add_package_ns(std::unique_ptr &&p) return add_element(ns, std::move(p)); } -bool diagram::add_class_fs( - const common::model::path &parent_path, std::unique_ptr &&c) +template <> +bool diagram::add_with_filesystem_path( + const common::model::path &parent_path, + std::unique_ptr &&p) { - // Make sure all parent directories are already packages in the - // model - for (auto it = parent_path.begin(); it != parent_path.end(); it++) { - auto pkg = - std::make_unique(c->using_namespace()); - pkg->set_name(*it); - auto ns = common::model::path(parent_path.begin(), it); - // ns.pop_back(); - pkg->set_namespace(ns); - pkg->set_id(common::to_id(pkg->full_name(false))); + LOG_DBG("Adding filesystem package: {}, {}", p->name(), p->full_name(true)); - add_package_fs(ns, std::move(pkg)); - } + auto ns = p->get_relative_namespace(); - const auto base_name = c->name(); - const auto full_name = c->full_name(false); - const auto id = c->id(); - auto cc = std::ref(*c); - - if (add_element(parent_path, std::move(c))) { - classes_.push_back(cc); - return true; - } - else { - LOG_WARN("Cannot add class {} with id {} due to: {}", base_name, id); - } - - return false; -} - -bool diagram::add_class_ns(std::unique_ptr &&c) -{ - const auto base_name = c->name(); - const auto full_name = c->full_name(false); - - LOG_DBG("Adding class: {}::{}, {}", c->get_namespace().to_string(), - base_name, full_name); - - if (util::contains(base_name, "::")) - throw std::runtime_error("Name cannot contain namespace: " + base_name); - - if (util::contains(base_name, "*")) - throw std::runtime_error("Name cannot contain *: " + base_name); - - const auto ns = c->get_relative_namespace(); - auto name = base_name; - auto name_with_ns = c->name_and_ns(); - auto name_and_ns = ns | name; - auto &cc = *c; - auto id = cc.id(); - - try { - if (!has_class(cc)) { - if (add_element(ns, std::move(c))) - classes_.push_back(std::ref(cc)); - - const auto &el = get_element(name_and_ns).value(); - - if ((el.name() != name) || !(el.get_relative_namespace() == ns)) - throw std::runtime_error( - "Invalid element stored in the diagram tree"); - - LOG_DBG("Added class {} ({} - [{}])", base_name, full_name, id); - - return true; - } - } - catch (const std::runtime_error &e) { - LOG_WARN( - "Cannot add class {} with id {} due to: {}", name, id, e.what()); - return false; - } - - LOG_DBG( - "Class {} ({} - [{}]) already in the model", base_name, full_name, id); - - return false; -} - -bool diagram::add_enum_ns(std::unique_ptr &&e) -{ - const auto full_name = e->name(); - - LOG_DBG("Adding enum: {}", full_name); - - assert(!util::contains(e->name(), "::")); - - auto e_ref = std::ref(*e); - auto ns = e->get_relative_namespace(); - - if (!has_enum(*e)) { - if (add_element(ns, std::move(e))) { - enums_.emplace_back(e_ref); - return true; - } - } - - LOG_DBG("Enum {} already in the model", full_name); - - return false; -} - -bool diagram::add_enum_fs( - const common::model::path &parent_path, std::unique_ptr &&e) -{ - // Make sure all parent directories are already packages in the - // model - for (auto it = parent_path.begin(); it != parent_path.end(); it++) { - auto pkg = - std::make_unique(e->using_namespace()); - pkg->set_name(*it); - auto ns = common::model::path(parent_path.begin(), it); - // ns.pop_back(); - pkg->set_namespace(ns); - pkg->set_id(common::to_id(pkg->full_name(false))); - - add_package_fs(ns, std::move(pkg)); - } - - const auto base_name = e->name(); - const auto full_name = e->full_name(false); - const auto id = e->id(); - auto &cc = *e; - - if (add_element(parent_path, std::move(e))) { - enums_.push_back(std::ref(cc)); - return true; - } - else { - LOG_WARN("Cannot add class {} with id {} due to: {}", base_name, id); - } - - return false; -} - -bool diagram::add_concept_ns(std::unique_ptr &&c) -{ - const auto base_name = c->name(); - const auto full_name = c->full_name(false); - - LOG_DBG("Adding concept: {}::{}, {}", c->get_namespace().to_string(), - base_name, full_name); - - if (util::contains(base_name, "::")) - throw std::runtime_error("Name cannot contain namespace: " + base_name); - - if (util::contains(base_name, "*")) - throw std::runtime_error("Name cannot contain *: " + base_name); - - const auto ns = c->get_relative_namespace(); - auto name = base_name; - auto name_with_ns = c->name_and_ns(); - auto name_and_ns = ns | name; - auto &cc = *c; - auto id = cc.id(); - - try { - if (!has_concept(cc)) { - if (add_element(ns, std::move(c))) - concepts_.push_back(std::ref(cc)); - - const auto &el = get_element(name_and_ns).value(); - - if ((el.name() != name) || !(el.get_relative_namespace() == ns)) - throw std::runtime_error( - "Invalid element stored in the diagram tree"); - - LOG_DBG("Added concept {} ({} - [{}])", base_name, full_name, id); - - return true; - } - } - catch (const std::runtime_error &e) { - LOG_WARN( - "Cannot add concept {} with id {} due to: {}", name, id, e.what()); - return false; - } - - LOG_DBG("Concept {} ({} - [{}]) already in the model", base_name, full_name, - id); - - return false; -} - -bool diagram::add_concept_fs( - const common::model::path &parent_path, std::unique_ptr &&c) -{ - // Make sure all parent directories are already packages in the - // model - for (auto it = parent_path.begin(); it != parent_path.end(); it++) { - auto pkg = - std::make_unique(c->using_namespace()); - pkg->set_name(*it); - auto ns = common::model::path(parent_path.begin(), it); - // ns.pop_back(); - pkg->set_namespace(ns); - pkg->set_id(common::to_id(pkg->full_name(false))); - - add_package_fs(ns, std::move(pkg)); - } - - const auto base_name = c->name(); - const auto full_name = c->full_name(false); - const auto id = c->id(); - auto &cc = *c; - - if (add_element(parent_path, std::move(c))) { - concepts_.push_back(std::ref(cc)); - return true; - } - - LOG_WARN("Cannot add class {} with id {} due to: {}", base_name, id); - - return false; + return add_element(ns, std::move(p)); } void diagram::get_parents( @@ -456,7 +111,7 @@ void diagram::get_parents( bool found_new{false}; for (const auto &parent : parents) { for (const auto &pp : parent.get().parents()) { - auto p = get_class(pp.id()); + auto p = find(pp.id()); if (p.has_value()) { auto [it, found] = parents.emplace(std::ref(p.value())); @@ -474,13 +129,19 @@ void diagram::get_parents( bool diagram::has_element( clanguml::common::model::diagram_element::id_t id) const { - const auto has_class = std::any_of(classes_.begin(), classes_.end(), + const auto has_class = std::any_of(classes().begin(), classes().end(), [id](const auto &c) { return c.get().id() == id; }); if (has_class) return true; - return std::any_of(enums_.begin(), enums_.end(), + const auto has_concept = std::any_of(classes().begin(), classes().end(), + [id](const auto &c) { return c.get().id() == id; }); + + if (has_concept) + return true; + + return std::any_of(enums().begin(), enums().end(), [id](const auto &c) { return c.get().id() == id; }); } @@ -489,18 +150,18 @@ std::string diagram::to_alias( { LOG_DBG("Looking for alias for {}", id); - for (const auto &c : classes_) { + for (const auto &c : classes()) { if (c.get().id() == id) { return c.get().alias(); } } - for (const auto &e : enums_) { + for (const auto &e : enums()) { if (e.get().id() == id) return e.get().alias(); } - for (const auto &c : concepts_) { + for (const auto &c : concepts()) { if (c.get().id() == id) return c.get().alias(); } diff --git a/src/class_diagram/model/diagram.h b/src/class_diagram/model/diagram.h index 1d566ac7..47b42602 100644 --- a/src/class_diagram/model/diagram.h +++ b/src/class_diagram/model/diagram.h @@ -19,6 +19,7 @@ #include "class.h" #include "common/model/diagram.h" +#include "common/model/element_view.h" #include "common/model/nested_trait.h" #include "common/model/package.h" #include "common/types.h" @@ -34,6 +35,7 @@ namespace clanguml::class_diagram::model { using common::opt_ref; using common::model::diagram_element; using common::model::diagram_t; +using common::model::element_view; using common::model::path; using common::model::path_type; @@ -41,7 +43,11 @@ using nested_trait_ns = clanguml::common::model::nested_trait; -class diagram : public common::model::diagram::diagram, public nested_trait_ns { +class diagram : public common::model::diagram::diagram, + public element_view, + public element_view, + public element_view, + public nested_trait_ns { public: diagram() = default; @@ -62,32 +68,23 @@ public: const common::reference_vector &concepts() const; - bool has_class(const class_ &c) const; + template bool contains(const ElementT &e); - bool has_enum(const enum_ &e) const; + template + opt_ref find(const std::string &name) const; - bool has_concept(const concept_ &e) const; + template + opt_ref find(diagram_element::id_t id) const; - opt_ref get_class(const std::string &name) const; + template + bool add(const path &parent_path, std::unique_ptr &&e) + { + if (parent_path.type() == common::model::path_type::kNamespace) { + return add_with_namespace_path(std::move(e)); + } - opt_ref get_class(diagram_element::id_t id) const; - - opt_ref get_enum(const std::string &name) const; - - opt_ref get_enum(diagram_element::id_t id) const; - - opt_ref get_concept(const std::string &name) const; - - opt_ref get_concept(diagram_element::id_t id) const; - - bool add_class(const path &parent_path, std::unique_ptr &&c); - - bool add_enum(const path &parent_path, std::unique_ptr &&e); - - bool add_concept(const path &parent_path, std::unique_ptr &&e); - - bool add_package( - const path &parent_path, std::unique_ptr &&p); + return add_with_filesystem_path(parent_path, std::move(e)); + } std::string to_alias(diagram_element::id_t id) const; @@ -100,28 +97,148 @@ public: inja::json context() const override; private: - bool add_class_ns(std::unique_ptr &&c); - bool add_class_fs( - const common::model::path &parent_path, std::unique_ptr &&c); + template + bool add_with_namespace_path(std::unique_ptr &&e); - bool add_enum_ns(std::unique_ptr &&c); - bool add_enum_fs( - const common::model::path &parent_path, std::unique_ptr &&c); - - bool add_package_ns(std::unique_ptr &&p); - bool add_package_fs(const common::model::path &parent_path, - std::unique_ptr &&p); - - bool add_concept_ns(std::unique_ptr &&p); - bool add_concept_fs( - const common::model::path &parent_path, std::unique_ptr &&p); - - common::reference_vector classes_; - - common::reference_vector enums_; - - common::reference_vector concepts_; + template + bool add_with_filesystem_path( + const common::model::path &parent_path, std::unique_ptr &&e); }; + +template bool diagram::contains(const ElementT &element) +{ + return std::any_of(element_view::view().cbegin(), + element_view::view().cend(), + [&element]( + const auto &element_opt) { return element_opt.get() == element; }); +} + +template +bool diagram::add_with_namespace_path(std::unique_ptr &&e) +{ + const auto base_name = e->name(); + const auto full_name = e->full_name(false); + const auto element_type = e->type_name(); + + LOG_DBG("Adding {}: {}::{}, {}", element_type, + e->get_namespace().to_string(), base_name, full_name); + + if (util::contains(base_name, "::")) + throw std::runtime_error("Name cannot contain namespace: " + base_name); + + if (util::contains(base_name, "*")) + throw std::runtime_error("Name cannot contain *: " + base_name); + + const auto ns = e->get_relative_namespace(); + auto name = base_name; + auto name_with_ns = e->name_and_ns(); + auto name_and_ns = ns | name; + auto &e_ref = *e; + auto id = e_ref.id(); + + try { + if (!contains(e_ref)) { + if (add_element(ns, std::move(e))) + element_view::add(std::ref(e_ref)); + + const auto &el = get_element(name_and_ns).value(); + + if ((el.name() != name) || !(el.get_relative_namespace() == ns)) + throw std::runtime_error( + "Invalid element stored in the diagram tree"); + + LOG_DBG("Added {} {} ({} - [{}])", element_type, base_name, + full_name, id); + + return true; + } + } + catch (const std::runtime_error &e) { + LOG_WARN("Cannot add {} {} with id {} due to: {}", element_type, name, + id, e.what()); + return false; + } + + LOG_DBG("{} {} ({} - [{}]) already in the model", element_type, base_name, + full_name, id); + + return false; +} + +template +bool diagram::add_with_filesystem_path( + const common::model::path &parent_path, std::unique_ptr &&e) +{ + const auto element_type = e->type_name(); + + // Make sure all parent directories are already packages in the + // model + for (auto it = parent_path.begin(); it != parent_path.end(); it++) { + auto pkg = + std::make_unique(e->using_namespace()); + pkg->set_name(*it); + auto ns = common::model::path(parent_path.begin(), it); + // ns.pop_back(); + pkg->set_namespace(ns); + pkg->set_id(common::to_id(pkg->full_name(false))); + + add(ns, std::move(pkg)); + } + + const auto base_name = e->name(); + const auto full_name = e->full_name(false); + const auto id = e->id(); + auto &e_ref = *e; + + if (add_element(parent_path, std::move(e))) { + element_view::add(std::ref(e_ref)); + return true; + } + + LOG_WARN( + "Cannot add {} {} with id {} due to: {}", element_type, base_name, id); + + return false; +} + +template +opt_ref diagram::find(const std::string &name) const +{ + for (const auto &element : element_view::view()) { + const auto full_name = element.get().full_name(false); + + if (full_name == name) { + return {element}; + } + } + + return {}; +} + +template +opt_ref diagram::find(diagram_element::id_t id) const +{ + for (const auto &element : element_view::view()) { + if (element.get().id() == id) { + return {element}; + } + } + + return {}; +} + +// +// Template method specialization pre-declarations... +// +template <> +bool diagram::add_with_namespace_path( + std::unique_ptr &&p); + +template <> +bool diagram::add_with_filesystem_path( + const common::model::path &parent_path, + std::unique_ptr &&p); + } // namespace clanguml::class_diagram::model namespace clanguml::common::model { diff --git a/src/class_diagram/visitor/translation_unit_visitor.cc b/src/class_diagram/visitor/translation_unit_visitor.cc index 39d66b85..05c89c08 100644 --- a/src/class_diagram/visitor/translation_unit_visitor.cc +++ b/src/class_diagram/visitor/translation_unit_visitor.cc @@ -84,7 +84,7 @@ bool translation_unit_visitor::VisitNamespaceDecl(clang::NamespaceDecl *ns) } if (!p->skip()) { - diagram().add_package(package_path, std::move(p)); + diagram().add(package_path, std::move(p)); } } @@ -140,8 +140,8 @@ bool translation_unit_visitor::VisitEnumDecl(clang::EnumDecl *enm) } } - if (id_opt && diagram_.get_class(*id_opt)) { - auto parent_class = diagram_.get_class(*id_opt); + if (id_opt && diagram().find(*id_opt)) { + auto parent_class = diagram().find(*id_opt); e.set_namespace(ns); e.set_name(parent_class.value().name() + "##" + enm->getNameAsString()); @@ -364,8 +364,8 @@ bool translation_unit_visitor::VisitRecordDecl(clang::RecordDecl *rec) id_mapper().add(rec->getID(), rec_id); - auto &record_model = diagram().get_class(rec_id).has_value() - ? *diagram().get_class(rec_id).get() + auto &record_model = diagram().find(rec_id).has_value() + ? *diagram().find(rec_id).get() : *record_ptr; if (rec->isCompleteDefinition() && !record_model.complete()) { @@ -730,8 +730,8 @@ bool translation_unit_visitor::VisitCXXRecordDecl(clang::CXXRecordDecl *cls) id_mapper().add(cls->getID(), cls_id); - auto &class_model = diagram().get_class(cls_id).has_value() - ? *diagram().get_class(cls_id).get() + auto &class_model = diagram().find(cls_id).has_value() + ? *diagram().find(cls_id).get() : *c_ptr; if (cls->isCompleteDefinition() && !class_model.complete()) @@ -899,11 +899,11 @@ void translation_unit_visitor::process_record_parent( } } - if (id_opt && diagram_.get_class(*id_opt)) { + if (id_opt && diagram_.find(*id_opt)) { // Here we have 2 options, either: // - the parent is a regular C++ class/struct // - the parent is a class template declaration/specialization - auto parent_class = diagram_.get_class(*id_opt); + auto parent_class = diagram_.find(*id_opt); c.set_namespace(parent_ns); const auto cls_name = cls->getNameAsString(); @@ -2105,10 +2105,10 @@ void translation_unit_visitor::add_class(std::unique_ptr &&c) common::model::path p{file, common::model::path_type::kFilesystem}; p.pop_back(); - diagram().add_class(p, std::move(c)); + diagram().add(p, std::move(c)); } else { - diagram().add_class(c->path(), std::move(c)); + diagram().add(c->path(), std::move(c)); } } @@ -2123,10 +2123,10 @@ void translation_unit_visitor::add_enum(std::unique_ptr &&e) common::model::path p{file, common::model::path_type::kFilesystem}; p.pop_back(); - diagram().add_enum(p, std::move(e)); + diagram().add(p, std::move(e)); } else { - diagram().add_enum(e->path(), std::move(e)); + diagram().add(e->path(), std::move(e)); } } @@ -2141,10 +2141,10 @@ void translation_unit_visitor::add_concept(std::unique_ptr &&c) common::model::path p{file, common::model::path_type::kFilesystem}; p.pop_back(); - diagram().add_concept(p, std::move(c)); + diagram().add(p, std::move(c)); } else { - diagram().add_concept(c->path(), std::move(c)); + diagram().add(c->path(), std::move(c)); } } diff --git a/src/common/model/diagram_filter.cc b/src/common/model/diagram_filter.cc index 3ab7080f..27e5b026 100644 --- a/src/common/model/diagram_filter.cc +++ b/src/common/model/diagram_filter.cc @@ -61,21 +61,21 @@ template <> const clanguml::common::optional_ref get( const class_diagram::model::diagram &d, const std::string &full_name) { - return d.get_class(full_name); + return d.find(full_name); } template <> const clanguml::common::optional_ref get( const package_diagram::model::diagram &d, const std::string &full_name) { - return d.get_package(full_name); + return d.find(full_name); } template <> const clanguml::common::optional_ref get( const include_diagram::model::diagram &d, const std::string &full_name) { - return d.get_file(full_name); + return d.find(full_name); } template <> @@ -259,7 +259,7 @@ tvl::value_t subclass_filter::match(const diagram &d, const element &e) const clanguml::common::reference_set parents; const auto &fn = e.full_name(false); - auto class_ref = cd.get_class(fn); + auto class_ref = cd.find(fn); if (!class_ref.has_value()) return false; @@ -308,7 +308,7 @@ tvl::value_t parents_filter::match(const diagram &d, const element &e) const clanguml::common::reference_set parents; for (const auto &child : children_) { - auto child_ref = cd.get_class(child); + auto child_ref = cd.find(child); if (!child_ref.has_value()) continue; parents.emplace(child_ref.value()); @@ -370,8 +370,8 @@ tvl::value_t context_filter::match(const diagram &d, const element &e) const return tvl::any_of(context_.begin(), context_.end(), [&e, &d](const auto &context_root_name) { const auto &context_root = - static_cast(d).get_class( - context_root_name); + static_cast(d) + .find(context_root_name); if (context_root.has_value()) { // This is a direct match to the context root diff --git a/src/common/model/element_view.h b/src/common/model/element_view.h new file mode 100644 index 00000000..3e124341 --- /dev/null +++ b/src/common/model/element_view.h @@ -0,0 +1,70 @@ +/** + * src/common/model/element_view.h + * + * Copyright (c) 2021-2023 Bartek Kryza + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +#pragma once + +#include "common/types.h" + +namespace clanguml::common::model { + +/** + * Provides type based views over elements in a diagram. + * + * @tparam T Type of diagram element + */ +template class element_view { +public: + /** + * @brief Add reference to diagram element + * + * @param element Reference to diagram element of specific type + */ + void add(std::reference_wrapper element) + { + elements_.emplace_back(std::move(element)); + } + + /** + * @brief Get collection of reference to diagram elements + * + * @return + */ + const reference_vector &view() const { return elements_; } + + /** + * @brief Get typed diagram element by id + * @param id Global id of a diagram element + * + * @return + */ + common::optional_ref get( + clanguml::common::model::diagram_element::id_t id) const + { + for (const auto &e : elements_) { + if (e.get().id() == id) { + return {e}; + } + } + + return {}; + } + +private: + reference_vector elements_; +}; + +} // namespace clanguml::common::model \ No newline at end of file diff --git a/src/include_diagram/model/diagram.cc b/src/include_diagram/model/diagram.cc index cd2e71b5..3a723898 100644 --- a/src/include_diagram/model/diagram.cc +++ b/src/include_diagram/model/diagram.cc @@ -31,19 +31,19 @@ common::model::diagram_t diagram::type() const common::optional_ref diagram::get( const std::string &full_name) const { - return get_file(full_name); + return find(full_name); } common::optional_ref diagram::get( const common::model::diagram_element::id_t id) const { - return get_file(id); + return find(id); } void diagram::add_file(std::unique_ptr &&f) { // Don't add the same file more than once - if (get_file(f->id())) + if (find(f->id())) return; LOG_DBG("Adding source file: {}, {}", f->name(), f->fs_path().string()); @@ -53,7 +53,7 @@ void diagram::add_file(std::unique_ptr &&f) assert(!ff.name().empty()); assert(ff.id() != 0); - files_.emplace_back(ff); + element_view::add(ff); auto p = ff.path(); @@ -89,34 +89,6 @@ void diagram::add_file(std::unique_ptr &&f) add_element(p, std::move(f)); } -common::optional_ref diagram::get_file( - const std::string &name) const -{ - // Convert the name to the OS preferred path - std::filesystem::path namePath{name}; - namePath.make_preferred(); - - for (const auto &p : files_) { - if (p.get().full_name(false) == namePath.string()) { - return {p}; - } - } - - return {}; -} - -common::optional_ref diagram::get_file( - const common::model::diagram_element::id_t id) const -{ - for (const auto &p : files_) { - if (p.get().id() == id) { - return {p}; - } - } - - return {}; -} - std::string diagram::to_alias(const std::string &full_name) const { LOG_DBG("Looking for alias for {}", full_name); @@ -139,7 +111,7 @@ std::string diagram::to_alias(const std::string &full_name) const const common::reference_vector & diagram::files() const { - return files_; + return element_view::view(); } common::optional_ref diff --git a/src/include_diagram/model/diagram.h b/src/include_diagram/model/diagram.h index 6aea9cc9..82d606f4 100644 --- a/src/include_diagram/model/diagram.h +++ b/src/include_diagram/model/diagram.h @@ -18,6 +18,7 @@ #pragma once #include "common/model/diagram.h" +#include "common/model/element_view.h" #include "common/model/package.h" #include "common/model/source_file.h" #include "common/types.h" @@ -27,9 +28,13 @@ namespace clanguml::include_diagram::model { +using clanguml::common::opt_ref; +using clanguml::common::model::diagram_element; +using clanguml::common::model::source_file; + class diagram : public clanguml::common::model::diagram, - public clanguml::common::model::nested_trait< - clanguml::common::model::source_file, + public clanguml::common::model::element_view, + public clanguml::common::model::nested_trait { public: diagram() = default; @@ -41,33 +46,58 @@ public: common::model::diagram_t type() const override; - common::optional_ref get( - const std::string &full_name) const override; + opt_ref get(const std::string &full_name) const override; - common::optional_ref get( - common::model::diagram_element::id_t id) const override; + opt_ref get(diagram_element::id_t id) const override; void add_file(std::unique_ptr &&f); - common::optional_ref get_file( - const std::string &name) const; + template + opt_ref find(const std::string &name) const; - common::optional_ref get_file( - common::model::diagram_element::id_t id) const; + template + opt_ref find(diagram_element::id_t id) const; std::string to_alias(const std::string &full_name) const; - const common::reference_vector &files() const; + const common::reference_vector &files() const; - common::optional_ref - get_with_namespace(const std::string &name, + opt_ref get_with_namespace(const std::string &name, const common::model::namespace_ &ns) const override; inja::json context() const override; - -private: - common::reference_vector files_; }; + +template +opt_ref diagram::find(const std::string &name) const +{ + // Convert the name to the OS preferred path + std::filesystem::path namePath{name}; + namePath.make_preferred(); + + for (const auto &element : element_view::view()) { + const auto full_name = element.get().full_name(false); + + if (full_name == namePath.string()) { + return {element}; + } + } + + return {}; +} + +template +opt_ref diagram::find(diagram_element::id_t id) const +{ + for (const auto &element : element_view::view()) { + if (element.get().id() == id) { + return {element}; + } + } + + return {}; +} + } // namespace clanguml::include_diagram::model namespace clanguml::common::model { diff --git a/src/package_diagram/model/diagram.cc b/src/package_diagram/model/diagram.cc index dfe64537..b8f25258 100644 --- a/src/package_diagram/model/diagram.cc +++ b/src/package_diagram/model/diagram.cc @@ -31,75 +31,13 @@ common::model::diagram_t diagram::type() const const common::reference_vector & diagram::packages() const { - return packages_; -} - -void diagram::add_package(std::unique_ptr &&p) -{ - LOG_DBG( - "Adding package: {}, {}, [{}]", p->name(), p->full_name(true), p->id()); - - auto ns = p->get_relative_namespace(); - - packages_.emplace_back(*p); - - add_element(ns, std::move(p)); -} - -void diagram::add_package_fs(const common::model::path &parent_path, - std::unique_ptr &&p) -{ - LOG_DBG("Adding package: {}, {}", p->name(), p->full_name(true)); - - // Make sure all parent directories are already packages in the - // model - for (auto it = parent_path.begin(); it != parent_path.end(); it++) { - auto pkg = - std::make_unique(p->using_namespace()); - pkg->set_name(*it); - auto ns = common::model::path(parent_path.begin(), it); - // ns.pop_back(); - pkg->set_namespace(ns); - pkg->set_id(common::to_id(pkg->full_name(false))); - - add_package_fs(ns, std::move(pkg)); - } - - auto pp = std::ref(*p); - if (add_element(parent_path, std::move(p))) { - packages_.emplace_back(pp); - } -} - -common::optional_ref diagram::get_package( - const std::string &name) const -{ - for (const auto &p : packages_) { - auto p_full_name = p.get().full_name(false); - if (p_full_name == name) { - return {p}; - } - } - - return {}; -} - -common::optional_ref diagram::get_package( - const clanguml::common::model::diagram_element::id_t id) const -{ - for (const auto &p : packages_) { - if (p.get().id() == id) { - return {p}; - } - } - - return {}; + return element_view::view(); } common::optional_ref diagram::get( const std::string &full_name) const { - return get_package(full_name); + return find(full_name); } common::optional_ref diagram::get( @@ -107,7 +45,7 @@ common::optional_ref diagram::get( { LOG_DBG("Looking for package with id {}", id); - return get_package(id); + return find(id); } std::string diagram::to_alias( @@ -115,10 +53,9 @@ std::string diagram::to_alias( { LOG_DBG("Looking for alias for {}", id); - for (const auto &p : packages_) { - if (p.get().id() == id) - return p.get().alias(); - } + auto p = find(id); + if (p.has_value() && p.value().id() == id) + return p.value().alias(); return {}; } diff --git a/src/package_diagram/model/diagram.h b/src/package_diagram/model/diagram.h index 4c7cf528..1a4aadd2 100644 --- a/src/package_diagram/model/diagram.h +++ b/src/package_diagram/model/diagram.h @@ -18,6 +18,7 @@ #pragma once #include "common/model/diagram.h" +#include "common/model/element_view.h" #include "common/model/package.h" #include @@ -25,7 +26,13 @@ namespace clanguml::package_diagram::model { +using clanguml::common::opt_ref; +using clanguml::common::model::diagram_element; +using clanguml::common::model::package; +using clanguml::common::model::path; + class diagram : public clanguml::common::model::diagram, + public clanguml::common::model::element_view, public clanguml::common::model::nested_trait< clanguml::common::model::element, clanguml::common::model::namespace_> { @@ -39,34 +46,109 @@ public: common::model::diagram_t type() const override; - const common::reference_vector & - packages() const; + const common::reference_vector &packages() const; - common::optional_ref get( - const std::string &full_name) const override; + opt_ref get(const std::string &full_name) const override; - common::optional_ref get( - clanguml::common::model::diagram_element::id_t id) const override; + opt_ref get(diagram_element::id_t id) const override; - common::optional_ref get_package( - const std::string &name) const; + template + opt_ref find(const std::string &name) const; - common::optional_ref get_package( - clanguml::common::model::diagram_element::id_t id) const; + template + opt_ref find(diagram_element::id_t id) const; - void add_package(std::unique_ptr &&p); + template + bool add(const path &parent_path, std::unique_ptr &&e) + { + if (parent_path.type() == common::model::path_type::kNamespace) { + return add_with_namespace_path(std::move(e)); + } - void add_package_fs(const common::model::path &parent_path, - std::unique_ptr &&p); + return add_with_filesystem_path(parent_path, std::move(e)); + } - std::string to_alias( - clanguml::common::model::diagram_element::id_t /*id*/) const; + template + bool add_with_namespace_path(std::unique_ptr &&e); + + template + bool add_with_filesystem_path( + const common::model::path &parent_path, std::unique_ptr &&e); + + std::string to_alias(diagram_element::id_t /*id*/) const; inja::json context() const override; - -private: - common::reference_vector packages_; }; + +template +opt_ref diagram::find(const std::string &name) const +{ + for (const auto &element : element_view::view()) { + const auto full_name = element.get().full_name(false); + + if (full_name == name) { + return {element}; + } + } + + return {}; +} + +template +opt_ref diagram::find(diagram_element::id_t id) const +{ + for (const auto &element : element_view::view()) { + if (element.get().id() == id) { + return {element}; + } + } + + return {}; +} + +template +bool diagram::add_with_namespace_path(std::unique_ptr &&p) +{ + LOG_DBG( + "Adding package: {}, {}, [{}]", p->name(), p->full_name(true), p->id()); + + auto ns = p->get_relative_namespace(); + auto p_ref = std::ref(*p); + + auto res = add_element(ns, std::move(p)); + if (res) + element_view::add(p_ref); + + return res; +} + +template +bool diagram::add_with_filesystem_path( + const common::model::path &parent_path, std::unique_ptr &&p) +{ + LOG_DBG("Adding package: {}, {}", p->name(), p->full_name(true)); + + // Make sure all parent directories are already packages in the + // model + for (auto it = parent_path.begin(); it != parent_path.end(); it++) { + auto pkg = + std::make_unique(p->using_namespace()); + pkg->set_name(*it); + auto ns = common::model::path(parent_path.begin(), it); + pkg->set_namespace(ns); + pkg->set_id(common::to_id(pkg->full_name(false))); + + add_with_filesystem_path(ns, std::move(pkg)); + } + + auto pp = std::ref(*p); + auto res = add_element(parent_path, std::move(p)); + if (res) + element_view::add(pp); + + return res; +} + } // namespace clanguml::package_diagram::model namespace clanguml::common::model { diff --git a/src/package_diagram/visitor/translation_unit_visitor.cc b/src/package_diagram/visitor/translation_unit_visitor.cc index 5456cbe6..ae706c92 100644 --- a/src/package_diagram/visitor/translation_unit_visitor.cc +++ b/src/package_diagram/visitor/translation_unit_visitor.cc @@ -93,7 +93,7 @@ bool translation_unit_visitor::VisitNamespaceDecl(clang::NamespaceDecl *ns) } if (!p->skip()) { - diagram().add_package(std::move(p)); + diagram().add(p->path(), std::move(p)); } } @@ -222,7 +222,7 @@ void translation_unit_visitor::add_relationships( pkg->set_name(pkg_name); pkg->set_id(get_package_id(cls)); - diagram().add_package_fs(parent_path, std::move(pkg)); + diagram().add(parent_path, std::move(pkg)); } auto current_package_id = get_package_id(cls); From 5c4a98ba79c2a914233acad7e5b98e8a4ea18e69 Mon Sep 17 00:00:00 2001 From: Bartek Kryza Date: Sat, 27 May 2023 23:41:16 +0200 Subject: [PATCH 09/14] Fixed clang-tidy warnings --- src/class_diagram/model/diagram.cc | 2 +- src/class_diagram/visitor/template_builder.cc | 6 +- .../visitor/translation_unit_visitor.cc | 2 +- src/common/model/path.h | 13 ++- .../visitor/translation_unit_visitor.cc | 93 ++++++++++--------- 5 files changed, 59 insertions(+), 57 deletions(-) diff --git a/src/class_diagram/model/diagram.cc b/src/class_diagram/model/diagram.cc index b250ca86..e5fd697c 100644 --- a/src/class_diagram/model/diagram.cc +++ b/src/class_diagram/model/diagram.cc @@ -95,7 +95,7 @@ bool diagram::add_with_namespace_path( template <> bool diagram::add_with_filesystem_path( - const common::model::path &parent_path, + const common::model::path & /*parent_path*/, std::unique_ptr &&p) { LOG_DBG("Adding filesystem package: {}, {}", p->name(), p->full_name(true)); diff --git a/src/class_diagram/visitor/template_builder.cc b/src/class_diagram/visitor/template_builder.cc index a7375d7f..46be21b3 100644 --- a/src/class_diagram/visitor/template_builder.cc +++ b/src/class_diagram/visitor/template_builder.cc @@ -935,9 +935,9 @@ std::optional template_builder::try_as_decl_type( std::optional template_builder::try_as_typedef_type( std::optional &parent, - const clang::NamedDecl *cls, const clang::TemplateDecl *template_decl, - clang::QualType &type, class_ &template_instantiation, - size_t argument_index) + const clang::NamedDecl * /*cls*/, + const clang::TemplateDecl * /*template_decl*/, clang::QualType &type, + class_ & /*template_instantiation*/, size_t /*argument_index*/) { const auto *typedef_type = common::dereference(type)->getAs(); diff --git a/src/class_diagram/visitor/translation_unit_visitor.cc b/src/class_diagram/visitor/translation_unit_visitor.cc index 05c89c08..0d9dfd4a 100644 --- a/src/class_diagram/visitor/translation_unit_visitor.cc +++ b/src/class_diagram/visitor/translation_unit_visitor.cc @@ -1308,7 +1308,7 @@ void translation_unit_visitor::process_method( .getUnqualifiedType() ->getAs(); templ != nullptr) { - auto *unaliased_type = templ; + const auto *unaliased_type = templ; if (unaliased_type->isTypeAlias()) unaliased_type = unaliased_type->getAliasedType() ->getAs(); diff --git a/src/common/model/path.h b/src/common/model/path.h index 577b24f0..f182f141 100644 --- a/src/common/model/path.h +++ b/src/common/model/path.h @@ -75,14 +75,13 @@ public: std::copy(begin, end, std::back_inserter(path_)); } - path(const path &right) - : path_type_{right.path_type_} - , path_{right.path_} - { - } + path(const path &right) = default; path &operator=(const path &right) { + if (&right == this) + return *this; + if (path_type_ != right.path_type_) throw std::runtime_error(""); @@ -161,9 +160,9 @@ public: void operator|=(const std::string &right) { append(right); } - std::string &operator[](const int index) { return path_[index]; } + std::string &operator[](const unsigned int index) { return path_[index]; } - const std::string &operator[](const int index) const + const std::string &operator[](const unsigned int index) const { return path_[index]; } diff --git a/src/package_diagram/visitor/translation_unit_visitor.cc b/src/package_diagram/visitor/translation_unit_visitor.cc index ae706c92..3f3a77d2 100644 --- a/src/package_diagram/visitor/translation_unit_visitor.cc +++ b/src/package_diagram/visitor/translation_unit_visitor.cc @@ -258,18 +258,15 @@ common::model::diagram_element::id_t translation_unit_visitor::get_package_id( return {}; } - else { - auto file = source_manager() - .getFilename(cls->getSourceRange().getBegin()) - .str(); - auto relative_file = - util::path_to_url(config().make_path_relative(file)); - common::model::path parent_path{ - relative_file, common::model::path_type::kFilesystem}; - parent_path.pop_back(); - return common::to_id(parent_path.to_string()); - } + auto file = + source_manager().getFilename(cls->getSourceRange().getBegin()).str(); + auto relative_file = util::path_to_url(config().make_path_relative(file)); + common::model::path parent_path{ + relative_file, common::model::path_type::kFilesystem}; + parent_path.pop_back(); + + return common::to_id(parent_path.to_string()); } void translation_unit_visitor::process_class_declaration( @@ -469,10 +466,12 @@ bool translation_unit_visitor::find_relationships(const clang::QualType &type, relationships, relationship_t::kAggregation); } else if (type->isEnumeralType()) { - if (const auto *enum_decl = type->getAs()->getDecl(); - enum_decl != nullptr) { - relationships.emplace_back( - get_package_id(enum_decl), relationship_hint); + if (const auto *enum_type = type->getAs(); + enum_type != nullptr) { + if (const auto *enum_decl = enum_type->getDecl(); + enum_decl != nullptr) + relationships.emplace_back( + get_package_id(enum_decl), relationship_hint); } } else if (const auto *template_specialization_type = @@ -530,18 +529,30 @@ bool translation_unit_visitor::find_relationships(const clang::QualType &type, } } } - else if (type->isRecordType() && type->getAsCXXRecordDecl()) { - if (config().package_type() == config::package_type_t::kNamespace) { - const auto *namespace_context = - type->getAsCXXRecordDecl()->getEnclosingNamespaceContext(); - if (namespace_context != nullptr && - namespace_context->isNamespace()) { - const auto *namespace_declaration = - clang::cast(namespace_context); + else if (type->isRecordType()) { + if (const auto *cxxrecord_decl = type->getAsCXXRecordDecl(); + cxxrecord_decl != nullptr) { + if (config().package_type() == config::package_type_t::kNamespace) { + const auto *namespace_context = + cxxrecord_decl->getEnclosingNamespaceContext(); + if (namespace_context != nullptr && + namespace_context->isNamespace()) { + const auto *namespace_declaration = + clang::cast(namespace_context); - if (namespace_declaration != nullptr && - diagram().should_include( - common::get_qualified_name(*namespace_declaration))) { + if (namespace_declaration != nullptr && + diagram().should_include(common::get_qualified_name( + *namespace_declaration))) { + const auto target_id = get_package_id(cxxrecord_decl); + relationships.emplace_back( + target_id, relationship_hint); + result = true; + } + } + } + else { + if (diagram().should_include(common::get_qualified_name( + *type->getAsCXXRecordDecl()))) { const auto target_id = get_package_id(type->getAsCXXRecordDecl()); relationships.emplace_back(target_id, relationship_hint); @@ -549,25 +560,17 @@ bool translation_unit_visitor::find_relationships(const clang::QualType &type, } } } - else { - if (diagram().should_include( - common::get_qualified_name(*type->getAsCXXRecordDecl()))) { - const auto target_id = - get_package_id(type->getAsCXXRecordDecl()); - relationships.emplace_back(target_id, relationship_hint); - result = true; - } - } - } - else if (type->isRecordType() && type->getAsRecordDecl()) { - // This is only possible for plain C translation unit, so we don't - // need to consider namespaces here - if (config().package_type() == config::package_type_t::kDirectory) { - if (diagram().should_include( - common::get_qualified_name(*type->getAsRecordDecl()))) { - const auto target_id = get_package_id(type->getAsRecordDecl()); - relationships.emplace_back(target_id, relationship_hint); - result = true; + else if (const auto *record_decl = type->getAsRecordDecl(); + record_decl != nullptr) { + // This is only possible for plain C translation unit, so we don't + // need to consider namespaces here + if (config().package_type() == config::package_type_t::kDirectory) { + if (diagram().should_include( + common::get_qualified_name(*record_decl))) { + const auto target_id = get_package_id(record_decl); + relationships.emplace_back(target_id, relationship_hint); + result = true; + } } } } From 81c7ce71df127267f3c56571e7dd3dd3b8159f4e Mon Sep 17 00:00:00 2001 From: Bartek Kryza Date: Sun, 28 May 2023 18:09:01 +0200 Subject: [PATCH 10/14] Improved skipping of empty packages in class diagrams --- .clang-uml | 2 + .../plantuml/class_diagram_generator.cc | 14 +++++-- src/class_diagram/model/diagram.h | 4 -- src/class_diagram/visitor/template_builder.cc | 4 +- src/common/clang_utils.cc | 15 +++++++ src/common/clang_utils.h | 3 ++ src/common/model/nested_trait.h | 28 ++++++++++++- .../visitor/translation_unit_visitor.cc | 34 +++++++++++++--- src/main.cc | 9 +++-- tests/t00036/.clang-uml | 5 ++- tests/t00036/t00036.cc | 10 +++++ tests/t00036/test_case.h | 3 ++ tests/t00065/module2/module2.h | 1 + tests/t00065/test_case.h | 40 +++++-------------- uml/diagram_element_hierarchy_diagram.yml | 2 - 15 files changed, 121 insertions(+), 53 deletions(-) diff --git a/.clang-uml b/.clang-uml index 964717a0..f1ef7d47 100644 --- a/.clang-uml +++ b/.clang-uml @@ -14,6 +14,8 @@ diagrams: include!: uml/common_model_class_diagram.yml class_model_class: include!: uml/class_model_class_diagram.yml + diagram_element_hierarchy_class: + include!: uml/diagram_element_hierarchy_diagram.yml sequence_model_class: include!: uml/sequence_model_class_diagram.yml main_sequence: diff --git a/src/class_diagram/generators/plantuml/class_diagram_generator.cc b/src/class_diagram/generators/plantuml/class_diagram_generator.cc index 34f5ff37..59f831b5 100644 --- a/src/class_diagram/generators/plantuml/class_diagram_generator.cc +++ b/src/class_diagram/generators/plantuml/class_diagram_generator.cc @@ -721,9 +721,14 @@ void generator::generate_relationships( { for (const auto &subpackage : p) { if (dynamic_cast(subpackage.get()) != nullptr) { - // TODO: add option - generate_empty_packages + // TODO: add option - generate_empty_packages, currently + // packages which do not contain anything but other packages + // are skipped const auto &sp = dynamic_cast(*subpackage); - if (!sp.is_empty()) + if (!sp.is_empty() && + !sp.all_of([this](const common::model::element &e) { + return !m_model.should_include(e); + })) generate_relationships(sp, ostr); } else if (dynamic_cast(subpackage.get()) != nullptr) { @@ -774,7 +779,10 @@ void generator::generate_top_level_elements(std::ostream &ostr) const { for (const auto &p : m_model) { if (auto *pkg = dynamic_cast(p.get()); pkg) { - if (!pkg->is_empty()) + if (!pkg->is_empty() && + !pkg->all_of([this](const common::model::element &e) { + return !m_model.should_include(e); + })) generate(*pkg, ostr); } else if (auto *cls = dynamic_cast(p.get()); cls) { diff --git a/src/class_diagram/model/diagram.h b/src/class_diagram/model/diagram.h index 47b42602..e8a999ac 100644 --- a/src/class_diagram/model/diagram.h +++ b/src/class_diagram/model/diagram.h @@ -187,7 +187,6 @@ bool diagram::add_with_filesystem_path( const auto base_name = e->name(); const auto full_name = e->full_name(false); - const auto id = e->id(); auto &e_ref = *e; if (add_element(parent_path, std::move(e))) { @@ -195,9 +194,6 @@ bool diagram::add_with_filesystem_path( return true; } - LOG_WARN( - "Cannot add {} {} with id {} due to: {}", element_type, base_name, id); - return false; } diff --git a/src/class_diagram/visitor/template_builder.cc b/src/class_diagram/visitor/template_builder.cc index 46be21b3..13e57ee2 100644 --- a/src/class_diagram/visitor/template_builder.cc +++ b/src/class_diagram/visitor/template_builder.cc @@ -1044,6 +1044,8 @@ template_builder::try_as_template_specialization_type( } if (diagram().should_include(nested_template_instantiation_full_name)) { + visitor_.set_source_location( + *template_decl, *nested_template_instantiation); visitor_.add_class(std::move(nested_template_instantiation)); } @@ -1155,7 +1157,7 @@ std::optional template_builder::try_as_record_type( if (parent.has_value()) parent.value()->add_relationship( {relationship_t::kDependency, tag_argument->id()}); - + visitor_.set_source_location(*template_decl, *tag_argument); visitor_.add_class(std::move(tag_argument)); } } diff --git a/src/common/clang_utils.cc b/src/common/clang_utils.cc index 8e44133d..4e0e87f6 100644 --- a/src/common/clang_utils.cc +++ b/src/common/clang_utils.cc @@ -736,4 +736,19 @@ std::vector tokenize_unexposed_template_parameter( return result; } +bool parse_source_location(const std::string &location_str, std::string &file, + unsigned &line, unsigned &column) +{ + auto tokens = util::split(location_str, ":"); + + if (tokens.size() < 3) + return false; + + file = tokens.at(0); + line = std::stoi(tokens.at(1)); + column = std::stoi(tokens.at(2)); + + return true; +} + } // namespace clanguml::common diff --git a/src/common/clang_utils.h b/src/common/clang_utils.h index 1aa906a4..59bd1782 100644 --- a/src/common/clang_utils.h +++ b/src/common/clang_utils.h @@ -170,6 +170,9 @@ void if_dyn_cast(P pointer, F &&func) } } +bool parse_source_location(const std::string &location_str, std::string &file, + unsigned &line, unsigned &column); + bool is_type_parameter(const std::string &t); bool is_qualifier(const std::string &q); diff --git a/src/common/model/nested_trait.h b/src/common/model/nested_trait.h index 6433b8d0..c4949e39 100644 --- a/src/common/model/nested_trait.h +++ b/src/common/model/nested_trait.h @@ -70,7 +70,9 @@ public: if (parent && dynamic_cast *>(&parent.value())) return dynamic_cast &>(parent.value()) .template add_element(std::move(p)); - spdlog::info("No parent element found at: {}", path.to_string()); + + LOG_INFO("No parent element found at: {}", path.to_string()); + throw std::runtime_error( "No parent element found for " + path.to_string()); } @@ -135,7 +137,29 @@ public: elements_.end(); } - bool is_empty() const { return elements_.empty(); } + template bool all_of(F &&f) const + { + return std::all_of( + elements_.cbegin(), elements_.cend(), [f](const auto &e) { + const auto *package_ptr = + dynamic_cast *>(e.get()); + + if (package_ptr != nullptr) + return package_ptr->all_of(f); + + return f(*e); + }); + } + + bool is_empty() const + { + return elements_.empty() || + std::all_of(elements_.cbegin(), elements_.cend(), [](auto &e) { + const auto *package_ptr = + dynamic_cast *>(e.get()); + return package_ptr != nullptr && package_ptr->is_empty(); + }); + } auto begin() { return elements_.begin(); } auto end() { return elements_.end(); } diff --git a/src/common/visitor/translation_unit_visitor.cc b/src/common/visitor/translation_unit_visitor.cc index d786db7e..82014933 100644 --- a/src/common/visitor/translation_unit_visitor.cc +++ b/src/common/visitor/translation_unit_visitor.cc @@ -85,14 +85,36 @@ void translation_unit_visitor::set_source_location( const clang::SourceLocation &location, clanguml::common::model::source_location &element) { + std::string file; + unsigned line{}; + [[maybe_unused]] unsigned column{}; + if (location.isValid()) { - element.set_file(source_manager_.getFilename(location).str()); - element.set_file_relative(util::path_to_url( - std::filesystem::relative(element.file(), relative_to_path_) - .string())); - element.set_line(source_manager_.getSpellingLineNumber(location)); - element.set_location_id(location.getHashValue()); + file = source_manager_.getFilename(location).str(); + line = source_manager_.getSpellingLineNumber(location); + column = source_manager_.getSpellingColumnNumber(location); + + if (file.empty()) { + // Why do I have to do this? + parse_source_location( + location.printToString(source_manager()), file, line, column); + } } + else { + auto success = parse_source_location( + location.printToString(source_manager()), file, line, column); + if (!success) { + LOG_DBG("Failed to extract source location for element from {}", + location.printToString(source_manager_)); + return; + } + } + + element.set_file(file); + element.set_file_relative(util::path_to_url( + std::filesystem::relative(element.file(), relative_to_path_).string())); + element.set_line(line); + element.set_location_id(location.getHashValue()); } } // namespace clanguml::common::visitor \ No newline at end of file diff --git a/src/main.cc b/src/main.cc index 5ffb49e8..7ddb7609 100644 --- a/src/main.cc +++ b/src/main.cc @@ -19,7 +19,6 @@ #include "cli/cli_handler.h" #include "common/compilation_database.h" #include "common/generators/generators.h" -#include "include_diagram/generators/plantuml/include_diagram_generator.h" #include "util/query_driver_output_extractor.h" #include "util/util.h" @@ -33,8 +32,6 @@ #include #include -#include -#include #ifdef ENABLE_BACKWARD_CPP namespace backward { @@ -55,6 +52,12 @@ int main(int argc, const char *argv[]) if (res == cli::cli_flow_t::kError) return 1; +#if !defined(NDEBUG) + // Catch invalid logger message formats, e.g. missing arguments + spdlog::set_error_handler( + [](const std::string & /*msg*/) { assert(0 == 1); }); +#endif + try { const auto db = clanguml::common::compilation_database::auto_detect_from_directory( diff --git a/tests/t00036/.clang-uml b/tests/t00036/.clang-uml index 7d6d5449..0c09a1c0 100644 --- a/tests/t00036/.clang-uml +++ b/tests/t00036/.clang-uml @@ -10,4 +10,7 @@ diagrams: - clanguml::t00036 include: namespaces: - - clanguml::t00036 \ No newline at end of file + - clanguml::t00036 + exclude: + subclasses: + - clanguml::t00036::ns2::ns22::D \ No newline at end of file diff --git a/tests/t00036/t00036.cc b/tests/t00036/t00036.cc index cb0ec2fa..7fa9131c 100644 --- a/tests/t00036/t00036.cc +++ b/tests/t00036/t00036.cc @@ -27,8 +27,18 @@ namespace ns22 { // TODO: Fix for incomplete struct C declaration "struct C;" struct C { }; +struct D { }; + } } +namespace ns3 { +namespace ns33 { +namespace detail { +struct DImpl : public ns2::ns22::D { }; +} +} // namespace ns33 +} // namespace ns3 + } // namespace t00036 } // namespace clanguml diff --git a/tests/t00036/test_case.h b/tests/t00036/test_case.h index 4f04dda3..385ff0e4 100644 --- a/tests/t00036/test_case.h +++ b/tests/t00036/test_case.h @@ -40,8 +40,11 @@ TEST_CASE("t00036", "[test-case][class]") REQUIRE_THAT(puml, IsEnum(_A("E"))); REQUIRE_THAT(puml, IsClass(_A("B"))); REQUIRE_THAT(puml, IsClass(_A("C"))); + REQUIRE_THAT(puml, !IsClass(_A("DImpl"))); REQUIRE_THAT(puml, IsPackage("ns111")); REQUIRE_THAT(puml, IsPackage("ns22")); + REQUIRE_THAT(puml, !IsPackage("ns3")); + REQUIRE_THAT(puml, !IsPackage("ns33")); REQUIRE_THAT(puml, IsAggregation(_A("B"), _A("A"), "+a_int")); diff --git a/tests/t00065/module2/module2.h b/tests/t00065/module2/module2.h index bca56d84..2aeb2b27 100644 --- a/tests/t00065/module2/module2.h +++ b/tests/t00065/module2/module2.h @@ -15,6 +15,7 @@ template struct C { template struct D { T t; + C c; }; } diff --git a/tests/t00065/test_case.h b/tests/t00065/test_case.h index a90d050e..d8004889 100644 --- a/tests/t00065/test_case.h +++ b/tests/t00065/test_case.h @@ -36,38 +36,16 @@ TEST_CASE("t00065", "[test-case][class]") REQUIRE_THAT(puml, EndsWith("@enduml\n")); // Check if all classes exist - // REQUIRE_THAT(puml, IsClass(_A("AAA"))); + REQUIRE_THAT(puml, IsClass(_A("R"))); + REQUIRE_THAT(puml, IsClass(_A("A"))); + REQUIRE_THAT(puml, IsClass(_A("AImpl"))); + REQUIRE_THAT(puml, IsEnum(_A("XYZ"))); + REQUIRE_THAT(puml, IsEnum(_A("ABC"))); - // Check if class templates exist - // REQUIRE_THAT(puml, IsClassTemplate("A", "T,P,CMP,int N")); - - // Check concepts - // REQUIRE_THAT(puml, IsConcept(_A("AConcept"))); - // REQUIRE_THAT(puml, - // IsConceptRequirement( - // _A("AConcept"), "sizeof (T) > sizeof (P)")); - - // Check if all enums exist - // REQUIRE_THAT(puml, IsEnum(_A("Lights"))); - - // Check if all inner classes exist - // REQUIRE_THAT(puml, IsInnerClass(_A("A"), _A("AA"))); - - // Check if all inheritance relationships exist - // REQUIRE_THAT(puml, IsBaseClass(_A("Base"), _A("Child"))); - - // Check if all methods exist - // REQUIRE_THAT(puml, (IsMethod("foo"))); - - // Check if all fields exist - // REQUIRE_THAT(puml, (IsField("private_member", "int"))); - - // Check if all relationships exist - // REQUIRE_THAT(puml, IsAssociation(_A("D"), _A("A"), "-as")); - // REQUIRE_THAT(puml, IsDependency(_A("R"), _A("B"))); - // REQUIRE_THAT(puml, IsAggregation(_A("R"), _A("D"), "-ag")); - // REQUIRE_THAT(puml, IsComposition(_A("R"), _A("D"), "-ac")); - // REQUIRE_THAT(puml, IsInstantiation(_A("ABCD::F"), _A("F"))); + REQUIRE_THAT(puml, IsPackage("module1")); + REQUIRE_THAT(puml, IsPackage("module2")); + REQUIRE_THAT(puml, IsPackage("submodule1a")); + REQUIRE_THAT(puml, IsPackage("concepts")); save_puml( config.output_directory() + "/" + diagram->name + ".puml", puml); diff --git a/uml/diagram_element_hierarchy_diagram.yml b/uml/diagram_element_hierarchy_diagram.yml index ca6df6bc..60d1792c 100644 --- a/uml/diagram_element_hierarchy_diagram.yml +++ b/uml/diagram_element_hierarchy_diagram.yml @@ -1,6 +1,4 @@ type: class -#include_relations_also_as_members: false -#generate_method_arguments: none generate_packages: true glob: - src/common/model/*.cc From 3e97a37c5f21f26d475180c52fed37add5734f6b Mon Sep 17 00:00:00 2001 From: Bartek Kryza Date: Sun, 28 May 2023 19:08:10 +0200 Subject: [PATCH 11/14] Updated docs --- CHANGELOG.md | 2 + README.md | 8 +- docs/class_diagrams.md | 23 +- docs/configuration_file.md | 6 +- docs/package_diagrams.md | 11 + docs/test_cases.md | 3 + docs/test_cases/t00002.md | 2 +- docs/test_cases/t00002_class.svg | 36 +- docs/test_cases/t00003.md | 2 +- docs/test_cases/t00003_class.svg | 46 +-- docs/test_cases/t00004.md | 6 +- docs/test_cases/t00004_class.svg | 92 ++--- docs/test_cases/t00005.md | 2 +- docs/test_cases/t00005_class.svg | 110 +++--- docs/test_cases/t00006.md | 6 +- docs/test_cases/t00006_class.svg | 148 ++++---- docs/test_cases/t00007.md | 2 +- docs/test_cases/t00007_class.svg | 30 +- docs/test_cases/t00008.md | 6 +- docs/test_cases/t00008_class.svg | 84 +++-- docs/test_cases/t00009.md | 14 +- docs/test_cases/t00009_class.svg | 80 ++-- docs/test_cases/t00010.md | 10 +- docs/test_cases/t00010_class.svg | 66 ++-- docs/test_cases/t00011.md | 2 +- docs/test_cases/t00011_class.svg | 22 +- docs/test_cases/t00012.md | 22 +- docs/test_cases/t00012_class.svg | 146 ++++---- docs/test_cases/t00013.md | 18 +- docs/test_cases/t00013_class.svg | 146 ++++---- docs/test_cases/t00014.md | 62 +++- docs/test_cases/t00014_class.svg | 360 +++++++++--------- docs/test_cases/t00015.md | 2 +- docs/test_cases/t00015_class.svg | 22 +- docs/test_cases/t00016.md | 2 +- docs/test_cases/t00016_class.svg | 26 +- docs/test_cases/t00017.md | 2 +- docs/test_cases/t00017_class.svg | 66 ++-- docs/test_cases/t00018.md | 2 +- docs/test_cases/t00018_class.svg | 18 +- docs/test_cases/t00019.md | 14 +- docs/test_cases/t00019_class.svg | 88 +++-- docs/test_cases/t00020.md | 2 +- docs/test_cases/t00020_class.svg | 38 +- docs/test_cases/t00021.md | 2 +- docs/test_cases/t00021_class.svg | 30 +- docs/test_cases/t00022.md | 2 +- docs/test_cases/t00022_class.svg | 14 +- docs/test_cases/t00023.md | 2 +- docs/test_cases/t00023_class.svg | 26 +- docs/test_cases/t00024.md | 2 +- docs/test_cases/t00024_class.svg | 22 +- docs/test_cases/t00025.md | 10 +- docs/test_cases/t00025_class.svg | 66 ++-- docs/test_cases/t00026.md | 10 +- docs/test_cases/t00026_class.svg | 74 ++-- docs/test_cases/t00027.md | 26 +- docs/test_cases/t00027_class.svg | 146 ++++---- docs/test_cases/t00028.md | 6 +- docs/test_cases/t00028_class.svg | 98 ++--- docs/test_cases/t00029.md | 2 +- docs/test_cases/t00029_class.svg | 50 +-- docs/test_cases/t00030.md | 2 +- docs/test_cases/t00030_class.svg | 46 +-- docs/test_cases/t00031.md | 6 +- docs/test_cases/t00031_class.svg | 66 ++-- docs/test_cases/t00032.md | 6 +- docs/test_cases/t00032_class.svg | 56 +-- docs/test_cases/t00033.md | 14 +- docs/test_cases/t00033_class.svg | 96 ++--- docs/test_cases/t00034.md | 2 +- docs/test_cases/t00034_class.svg | 38 +- docs/test_cases/t00035.md | 2 +- docs/test_cases/t00035_class.svg | 22 +- docs/test_cases/t00036.md | 38 +- docs/test_cases/t00036_class.svg | 54 +-- docs/test_cases/t00037.md | 2 +- docs/test_cases/t00037_class.svg | 54 +-- docs/test_cases/t00038.md | 2 +- docs/test_cases/t00038_class.svg | 54 +-- docs/test_cases/t00039.md | 2 +- docs/test_cases/t00039_class.svg | 78 ++-- docs/test_cases/t00040.md | 2 +- docs/test_cases/t00040_class.svg | 26 +- docs/test_cases/t00041.md | 2 +- docs/test_cases/t00041_class.svg | 54 +-- docs/test_cases/t00042.md | 14 +- docs/test_cases/t00042_class.svg | 84 +++-- docs/test_cases/t00043.md | 2 +- docs/test_cases/t00043_class.svg | 50 +-- docs/test_cases/t00044.md | 14 +- docs/test_cases/t00044_class.svg | 80 ++-- docs/test_cases/t00045.md | 2 +- docs/test_cases/t00045_class.svg | 70 ++-- docs/test_cases/t00046.md | 7 +- docs/test_cases/t00046_class.svg | 249 ++++++------- docs/test_cases/t00047.md | 2 +- docs/test_cases/t00047_class.svg | 18 +- docs/test_cases/t00048.md | 2 +- docs/test_cases/t00048_class.svg | 50 +-- docs/test_cases/t00049.md | 14 +- docs/test_cases/t00049_class.svg | 80 ++-- docs/test_cases/t00050.md | 2 +- docs/test_cases/t00050_class.svg | 72 ++-- docs/test_cases/t00051.md | 2 +- docs/test_cases/t00051_class.svg | 38 +- docs/test_cases/t00052.md | 10 +- docs/test_cases/t00052_class.svg | 66 ++-- docs/test_cases/t00053.md | 2 +- docs/test_cases/t00053_class.svg | 70 ++-- docs/test_cases/t00054.md | 2 +- docs/test_cases/t00054_class.svg | 78 ++-- docs/test_cases/t00055.md | 2 +- docs/test_cases/t00055_class.svg | 42 +-- docs/test_cases/t00056.md | 2 +- docs/test_cases/t00056_class.svg | 94 ++--- docs/test_cases/t00057.md | 2 +- docs/test_cases/t00057_class.svg | 126 +++---- docs/test_cases/t00058.md | 14 +- docs/test_cases/t00058_class.svg | 96 ++--- docs/test_cases/t00059.md | 10 +- docs/test_cases/t00059_class.svg | 82 ++-- docs/test_cases/t00060.md | 2 +- docs/test_cases/t00060_class.svg | 38 +- docs/test_cases/t00061.md | 6 +- docs/test_cases/t00061_class.svg | 6 +- docs/test_cases/t00062.md | 2 +- docs/test_cases/t00062_class.svg | 198 +++++----- docs/test_cases/t00063.md | 2 +- docs/test_cases/t00063_class.svg | 6 +- docs/test_cases/t00064.md | 38 +- docs/test_cases/t00064_class.svg | 232 ++++++------ docs/test_cases/t00065.md | 556 ++++++++++++++++++++++++++++ docs/test_cases/t00065_class.svg | 245 ++++++++++++ docs/test_cases/t20001.md | 2 +- docs/test_cases/t20001_sequence.svg | 62 ++-- docs/test_cases/t20002.md | 2 +- docs/test_cases/t20002_sequence.svg | 48 +-- docs/test_cases/t20003.md | 2 +- docs/test_cases/t20003_sequence.svg | 48 +-- docs/test_cases/t20004.md | 2 +- docs/test_cases/t20004_sequence.svg | 120 +++--- docs/test_cases/t20005.md | 2 +- docs/test_cases/t20005_sequence.svg | 36 +- docs/test_cases/t20006.md | 2 +- docs/test_cases/t20006_sequence.svg | 150 ++++---- docs/test_cases/t20007.md | 2 +- docs/test_cases/t20007_sequence.svg | 48 +-- docs/test_cases/t20008.md | 2 +- docs/test_cases/t20008_sequence.svg | 84 ++--- docs/test_cases/t20009.md | 2 +- docs/test_cases/t20009_sequence.svg | 84 ++--- docs/test_cases/t20010.md | 2 +- docs/test_cases/t20010_sequence.svg | 72 ++-- docs/test_cases/t20011.md | 2 +- docs/test_cases/t20011_sequence.svg | 72 ++-- docs/test_cases/t20012.md | 2 +- docs/test_cases/t20012_sequence.svg | 204 +++++----- docs/test_cases/t20013.md | 2 +- docs/test_cases/t20013_sequence.svg | 60 +-- docs/test_cases/t20014.md | 2 +- docs/test_cases/t20014_sequence.svg | 72 ++-- docs/test_cases/t20015.md | 2 +- docs/test_cases/t20015_sequence.svg | 24 +- docs/test_cases/t20016.md | 2 +- docs/test_cases/t20016_sequence.svg | 48 +-- docs/test_cases/t20017.md | 48 +-- docs/test_cases/t20017_sequence.svg | 48 +-- docs/test_cases/t20018.md | 2 +- docs/test_cases/t20018_sequence.svg | 96 ++--- docs/test_cases/t20019.md | 2 +- docs/test_cases/t20019_sequence.svg | 84 ++--- docs/test_cases/t20020.md | 2 +- docs/test_cases/t20020_sequence.svg | 118 +++--- docs/test_cases/t20021.md | 2 +- docs/test_cases/t20021_sequence.svg | 106 +++--- docs/test_cases/t20022.md | 2 +- docs/test_cases/t20022_sequence.svg | 36 +- docs/test_cases/t20023.md | 2 +- docs/test_cases/t20023_sequence.svg | 50 +-- docs/test_cases/t20024.md | 2 +- docs/test_cases/t20024_sequence.svg | 88 ++--- docs/test_cases/t20025.md | 2 +- docs/test_cases/t20025_sequence.svg | 42 +-- docs/test_cases/t20026.md | 2 +- docs/test_cases/t20026_sequence.svg | 24 +- docs/test_cases/t20027.md | 2 +- docs/test_cases/t20027_sequence.svg | 24 +- docs/test_cases/t20028.md | 2 +- docs/test_cases/t20028_sequence.svg | 44 +-- docs/test_cases/t20029.md | 2 +- docs/test_cases/t20029_sequence.svg | 80 ++-- docs/test_cases/t30001.md | 2 +- docs/test_cases/t30001_package.svg | 54 +-- docs/test_cases/t30002.md | 97 +++-- docs/test_cases/t30002_package.svg | 231 ++++++------ docs/test_cases/t30003.md | 2 +- docs/test_cases/t30003_package.svg | 26 +- docs/test_cases/t30004.md | 2 +- docs/test_cases/t30004_package.svg | 38 +- docs/test_cases/t30005.md | 2 +- docs/test_cases/t30005_package.svg | 38 +- docs/test_cases/t30006.md | 2 +- docs/test_cases/t30006_package.svg | 18 +- docs/test_cases/t30007.md | 2 +- docs/test_cases/t30007_package.svg | 22 +- docs/test_cases/t30008.md | 2 +- docs/test_cases/t30008_package.svg | 34 +- docs/test_cases/t30009.md | 2 +- docs/test_cases/t30009_package.svg | 42 +-- docs/test_cases/t30010.md | 118 ++++++ docs/test_cases/t30010_package.svg | 39 ++ docs/test_cases/t30011.md | 106 ++++++ docs/test_cases/t30011_package.svg | 39 ++ docs/test_cases/t40001.md | 2 +- docs/test_cases/t40001_include.svg | 34 +- docs/test_cases/t40002.md | 2 +- docs/test_cases/t40002_include.svg | 34 +- docs/test_cases/t40003.md | 2 +- docs/test_cases/t40003_include.svg | 50 +-- 220 files changed, 5466 insertions(+), 3800 deletions(-) create mode 100644 docs/test_cases/t00065.md create mode 100644 docs/test_cases/t00065_class.svg create mode 100644 docs/test_cases/t30010.md create mode 100644 docs/test_cases/t30010_package.svg create mode 100644 docs/test_cases/t30011.md create mode 100644 docs/test_cases/t30011_package.svg diff --git a/CHANGELOG.md b/CHANGELOG.md index cc4f7c91..5d8ded35 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,7 @@ # CHANGELOG + * Added generation of packages in class and package diagrams from + filesystem directories (#144) * Improved handling of class template specializations and their relationships (#140) * Fixed handling of C99 typedef structs (#138) diff --git a/README.md b/README.md index 0e23cea0..6388f686 100644 --- a/README.md +++ b/README.md @@ -31,7 +31,8 @@ Main features supported so far include: * Relationship inference from C++ containers and smart pointers - [_example_](docs/test_cases/t00007.md) * Diagram content filtering based on namespaces, elements and relationships - [_example_](docs/test_cases/t00040.md) * Optional package generation from namespaces - [_example_](docs/test_cases/t00036.md) - * Interactive links to online code to classes, methods and class fields in SVG diagrams + * Optional package generation from subdirectories - [_example_](docs/test_cases/t00065.md) + * Interactive links to online code to classes, methods and class fields in SVG diagrams [_example_](docs/test_cases/t00002_class.svg) * Support for plain C99/C11 code (struct and units relationships) - [_example_](docs/test_cases/t00057.md) * C++20 concept constraints - [_example_](docs/test_cases/t00059.md) * **Sequence diagram generation** @@ -41,11 +42,12 @@ Main features supported so far include: * Generation of try/catch blocks - [_example_](docs/test_cases/t20023.md) * Handling of template code including constexpr conditionals - [_example_](docs/test_cases/t20018.md) * Handling of lambda expressions - [_example_](docs/test_cases/t20012.md) - * Interactive links to online code to classes and call expressions + * Interactive links to online code to classes and call expressions [_example_](docs/test_cases/t20021_sequence.svg) * **Package diagram generation** * Generation of package diagram based on C++ namespaces - [_example_](docs/test_cases/t30001.md) + * Generation of package diagram based on subdirectories - [_example_](docs/test_cases/t30010.md) * Dependencies between packages based on symbols used in the code - [_example_](docs/test_cases/t30002.md) - * Interactive links to online code to packages + * Interactive links to online code to packages - [_example_](docs/test_cases/t30002_package.svg) * **Include graph diagram generation** * Show include graph for selected files - [_example_](docs/test_cases/t40001.md) diff --git a/docs/class_diagrams.md b/docs/class_diagrams.md index 99bca57e..2a98a4a9 100644 --- a/docs/class_diagrams.md +++ b/docs/class_diagrams.md @@ -7,7 +7,7 @@ * [Relationships](#relationships) * [Relationships to classes in containers or smart pointers](#relationships-to-classes-in-containers-or-smart-pointers) * [Inheritance diagrams](#inheritance-diagrams) -* [Namespaces as packages](#namespaces-as-packages) +* [Including packages in the diagram](#including-packages-in-the-diagram) * [Class context diagram](#class-context-diagram) * [Disabling dependency relationships](#disabling-dependency-relationships) @@ -126,7 +126,7 @@ inclusion filters: - inheritance ``` -## Namespaces as packages +## Including packages in the diagram By default, `clang-uml` will render all element names including a namespace (relative to `using_namespace` property), e.g. `ns1::ns2::MyClass`. In order to generate packages in the diagram for each namespace instead, the following option must be set to `true`: @@ -137,7 +137,22 @@ generate_packages: true which results in the following diagram: -![extension](test_cases/t00036_class.svg) +![t00036_class](test_cases/t00036_class.svg) + +In case the code base is structured based on subdirectory instead of namespaces, packages can be generated +based on the location of a given declaration in the filesystem tree, by adding also the following option: + +```yaml +package_type: directory +``` + +which results in the following diagram: + +![t00065_class](test_cases/t00065_class.svg) + +> In this case make sure that the root path of the configuration file is properly configured +> for your project, if necessary add `relative_to` option to denote the root path +> against which all relative paths in the config file are calculated. ## Class context diagram Sometimes it's helpful to generate a class diagram depicting only direct relationships of a given class, e.g. @@ -153,7 +168,7 @@ within the classes' documentation page, this can be easily achieved using `conte In many cases, dependency relationships between classes can clutter the diagram too much, for instance consider this diagram: -![extension](test_cases/t00019_class.svg) +![t00019_class](test_cases/t00019_class.svg) where the dependency relationships do not bring much information into the diagram. In such cases it might be useful to disable dependency relationships for this diagram completely using the following exclusion filter: diff --git a/docs/configuration_file.md b/docs/configuration_file.md index 2ba15f19..1b0fe40a 100644 --- a/docs/configuration_file.md +++ b/docs/configuration_file.md @@ -26,6 +26,8 @@ * `include_relations_also_as_members` - when set to `false`, class members for relationships are rendered in UML are skipped from class definition (default: `true`) * `generate_method_arguments` - determines whether the class diagrams methods contain full arguments (`full`), are abbreviated (`abbreviated`) or skipped (`none`) * `using_namespace` - similar to C++ `using namespace`, a `A::B` value here will render a class `A::B::C::MyClass` in the diagram as `C::MyClass`, at most 1 value is supported +* `generate_packages` - whether or not the class diagram should contain packages generated from namespaces or subdirectories +* `package_type` - determines how the packages are inferred: `namespace` - use C++ namespaces, `directory` - use project's directory structure * `include` - definition of inclusion patterns: * `namespaces` - list of namespaces to include * `relationships` - list of relationships to include @@ -86,8 +88,10 @@ diagrams: type: class # Do not include rendered relations in the class box include_relations_also_as_members: false + # Generate packages from the namespaces + generate_packages: true + package_type: namespace # or 'directory' to generate from projects subdirectories # Limiting the number of files to include can significantly - # improve the generation time glob: - src/common/model/*.h - src/common/model/*.cc diff --git a/docs/package_diagrams.md b/docs/package_diagrams.md index bf900a22..55ff0a6d 100644 --- a/docs/package_diagrams.md +++ b/docs/package_diagrams.md @@ -155,3 +155,14 @@ template std::map> cm() generates the following diagram: ![package_deps](./test_cases/t30002_package.svg) + +By default, packages are generated from C++ namespaces in the code. However +they can also be generated from the subdirectories in the filesystem tree by +adding the following option to the configuration file: + +```yaml +package_type: directory +``` + +for example checkout this diagram +![t30011_package](./test_cases/t30011_package.svg) \ No newline at end of file diff --git a/docs/test_cases.md b/docs/test_cases.md index 5e1034aa..35c1755a 100644 --- a/docs/test_cases.md +++ b/docs/test_cases.md @@ -63,6 +63,7 @@ * [t00062](./test_cases/t00062.md) - Template specialization matching based on deduced context * [t00063](./test_cases/t00063.md) - Element types diagram filter test case * [t00064](./test_cases/t00064.md) - Template type list test case + * [t00065](./test_cases/t00065.md) - Class diagram with packages from directory structure ## Sequence diagrams * [t20001](./test_cases/t20001.md) - Basic sequence diagram test case * [t20002](./test_cases/t20002.md) - Free function sequence diagram test case @@ -103,6 +104,8 @@ * [t30007](./test_cases/t30007.md) - Package diagram layout hints test case * [t30008](./test_cases/t30008.md) - Dependants and dependencies package diagram filter test * [t30009](./test_cases/t30009.md) - Together layout hint test + * [t30010](./test_cases/t30010.md) - Package diagram with packages from directory structure + * [t30011](./test_cases/t30011.md) - Package diagram with packages from directory structure for plain C ## Include diagrams * [t40001](./test_cases/t40001.md) - Basic include graph diagram test case * [t40002](./test_cases/t40002.md) - Cyclic include graph diagram test case diff --git a/docs/test_cases/t00002.md b/docs/test_cases/t00002.md index a224564e..848f2ac8 100644 --- a/docs/test_cases/t00002.md +++ b/docs/test_cases/t00002.md @@ -500,7 +500,7 @@ private: } ], "metadata": { - "clang_uml_version": "0.3.5-13-g57aa174", + "clang_uml_version": "0.3.5-27-g81c7ce7", "llvm_version": "Ubuntu clang version 15.0.6", "schema_version": 1 }, diff --git a/docs/test_cases/t00002_class.svg b/docs/test_cases/t00002_class.svg index 5a4b329a..22b9853d 100644 --- a/docs/test_cases/t00002_class.svg +++ b/docs/test_cases/t00002_class.svg @@ -1,6 +1,6 @@ - + @@ -9,8 +9,8 @@ - - + + A @@ -21,8 +21,8 @@ foo_c() = 0 : void - - + + B @@ -31,8 +31,8 @@ foo_a() : void - - + + C @@ -41,18 +41,18 @@ foo_c() : void - - + + D - + - + as : std::vector<A *> @@ -60,18 +60,18 @@ foo_a() : void foo_c() : void - - + + E - + - + as : std::vector<A *> @@ -79,13 +79,13 @@ foo_a() : void foo_c() : void - + This is class A - + This is class B - + This is class D diff --git a/docs/test_cases/t00003.md b/docs/test_cases/t00003.md index adb57a8f..536bb8b8 100644 --- a/docs/test_cases/t00003.md +++ b/docs/test_cases/t00003.md @@ -450,7 +450,7 @@ int A::static_int = 1; } ], "metadata": { - "clang_uml_version": "0.3.5-13-g57aa174", + "clang_uml_version": "0.3.5-27-g81c7ce7", "llvm_version": "Ubuntu clang version 15.0.6", "schema_version": 1 }, diff --git a/docs/test_cases/t00003_class.svg b/docs/test_cases/t00003_class.svg index 3d9809f9..a76f7ae3 100644 --- a/docs/test_cases/t00003_class.svg +++ b/docs/test_cases/t00003_class.svg @@ -1,6 +1,6 @@ - + @@ -9,74 +9,74 @@ - - + + A - + - + public_member : int - + - + protected_member : int - + - + private_member : int - + - + a_ : int - + - + b_ : int - + - + c_ : int - + - + static_int : int - + - + static_const_int : const int - + - + auto_member : const unsigned long @@ -112,11 +112,11 @@ protected_method() : void private_method() : void - + - + compare : std::function<bool (const int)> diff --git a/docs/test_cases/t00004.md b/docs/test_cases/t00004.md index a231d41e..6404d1dd 100644 --- a/docs/test_cases/t00004.md +++ b/docs/test_cases/t00004.md @@ -233,6 +233,10 @@ public: "methods": [], "name": "C::B", "namespace": "clanguml::t00004", + "source_location": { + "file": "../../tests/t00004/t00004.cc", + "line": 33 + }, "template_parameters": [ { "is_variadic": false, @@ -460,7 +464,7 @@ public: } ], "metadata": { - "clang_uml_version": "0.3.5-13-g57aa174", + "clang_uml_version": "0.3.5-27-g81c7ce7", "llvm_version": "Ubuntu clang version 15.0.6", "schema_version": 1 }, diff --git a/docs/test_cases/t00004_class.svg b/docs/test_cases/t00004_class.svg index 874c71db..a9addc98 100644 --- a/docs/test_cases/t00004_class.svg +++ b/docs/test_cases/t00004_class.svg @@ -1,6 +1,6 @@ - + @@ -9,16 +9,16 @@ - - + + B - - + + B::AA @@ -28,8 +28,8 @@ AA_3 - - + + A @@ -40,16 +40,16 @@ foo2() const : void - - + + A::AA - - + + A::AA::Lights @@ -59,24 +59,26 @@ Red - - + + A::AA::AAA - - - - C::B - - int - - - - + + + + + C::B + + int + + + + + C @@ -84,39 +86,39 @@ T - + - + t : T - + - + b_int : B<int> - - + + C::AA - - + + C::AA::AAA - - + + C::AA::CCC @@ -125,8 +127,8 @@ CCC_2 - - + + C::B @@ -134,16 +136,16 @@ V - + - + b : V - - + + C::CC @@ -152,16 +154,16 @@ CC_2 - - + + detail::D - - + + detail::D::AA @@ -171,8 +173,8 @@ AA_3 - - + + detail::D::DD diff --git a/docs/test_cases/t00005.md b/docs/test_cases/t00005.md index 15c9d4e7..fdb33504 100644 --- a/docs/test_cases/t00005.md +++ b/docs/test_cases/t00005.md @@ -464,7 +464,7 @@ public: } ], "metadata": { - "clang_uml_version": "0.3.5-13-g57aa174", + "clang_uml_version": "0.3.5-27-g81c7ce7", "llvm_version": "Ubuntu clang version 15.0.6", "schema_version": 1 }, diff --git a/docs/test_cases/t00005_class.svg b/docs/test_cases/t00005_class.svg index 497a90d1..0a64db19 100644 --- a/docs/test_cases/t00005_class.svg +++ b/docs/test_cases/t00005_class.svg @@ -1,6 +1,6 @@ - + @@ -9,204 +9,204 @@ - - + + A - - + + B - - + + C - - + + D - - + + E - - + + F - - + + G - - + + H - - + + I - - + + J - - + + K - - + + R - + - + some_int : int - + - + some_int_pointer : int * - + - + some_int_pointer_pointer : int ** - + - + some_int_reference : int & - + - + a : A - + - + b : B * - + - + c : C & - + - + d : const D * - + - + e : const E & - + - + f : F && - + - + g : G ** - + - + h : H *** - + - + i : I *& - + - + j : volatile J * - + - + k : K * diff --git a/docs/test_cases/t00006.md b/docs/test_cases/t00006.md index 65f9ff4a..64d37a28 100644 --- a/docs/test_cases/t00006.md +++ b/docs/test_cases/t00006.md @@ -466,6 +466,10 @@ public: "methods": [], "name": "custom_container", "namespace": "clanguml::t00006", + "source_location": { + "file": "../../tests/t00006/t00006.cc", + "line": 39 + }, "template_parameters": [ { "is_variadic": false, @@ -629,7 +633,7 @@ public: } ], "metadata": { - "clang_uml_version": "0.3.5-13-g57aa174", + "clang_uml_version": "0.3.5-27-g81c7ce7", "llvm_version": "Ubuntu clang version 15.0.6", "schema_version": 1 }, diff --git a/docs/test_cases/t00006_class.svg b/docs/test_cases/t00006_class.svg index 728adab6..39c414bc 100644 --- a/docs/test_cases/t00006_class.svg +++ b/docs/test_cases/t00006_class.svg @@ -1,6 +1,6 @@ - + @@ -9,136 +9,136 @@ - - + + A - - + + B - - + + C - - + + D - - + + E - - + + F - - + + G - - + + H - - + + I - - + + J - - + + K - - + + L - - + + M - - + + N - - + + NN - - + + NNN - - + + custom_container @@ -146,118 +146,120 @@ T - + - + data : std::vector<T> - - - - custom_container - - E - - - - + + + + + custom_container + + E + + + + + R - + - + a : std::vector<A> - + - + b : std::vector<B *> - + - + c : std::map<int,C> - + - + d : std::map<int,D *> - + - + e : custom_container<E> - + - + f : std::vector<std::vector<F>> - + - + g : std::map<int,std::vector<G *>> - + - + h : std::array<H,10> - + - + i : std::array<I *,5> - + - + j : J[10] - + - + k : K *[20] - + - + lm : std::vector<std::pair<L,M>> - + - + ns : std::tuple<N,NN,NNN> diff --git a/docs/test_cases/t00007.md b/docs/test_cases/t00007.md index 6f75a29a..564cf9ec 100644 --- a/docs/test_cases/t00007.md +++ b/docs/test_cases/t00007.md @@ -158,7 +158,7 @@ public: } ], "metadata": { - "clang_uml_version": "0.3.5-13-g57aa174", + "clang_uml_version": "0.3.5-27-g81c7ce7", "llvm_version": "Ubuntu clang version 15.0.6", "schema_version": 1 }, diff --git a/docs/test_cases/t00007_class.svg b/docs/test_cases/t00007_class.svg index f18019da..ff981cd6 100644 --- a/docs/test_cases/t00007_class.svg +++ b/docs/test_cases/t00007_class.svg @@ -1,6 +1,6 @@ - + @@ -9,56 +9,56 @@ - - + + A - - + + B - - + + C - - + + R - + - + a : std::unique_ptr<A> - + - + b : std::shared_ptr<B> - + - + c : std::weak_ptr<C> diff --git a/docs/test_cases/t00008.md b/docs/test_cases/t00008.md index 1602d6e2..7dab367a 100644 --- a/docs/test_cases/t00008.md +++ b/docs/test_cases/t00008.md @@ -283,6 +283,10 @@ template <> struct E::nested_template { "methods": [], "name": "B", "namespace": "clanguml::t00008", + "source_location": { + "file": "../../tests/t00008/t00008.cc", + "line": 24 + }, "template_parameters": [ { "is_variadic": false, @@ -477,7 +481,7 @@ template <> struct E::nested_template { } ], "metadata": { - "clang_uml_version": "0.3.5-13-g57aa174", + "clang_uml_version": "0.3.5-27-g81c7ce7", "llvm_version": "Ubuntu clang version 15.0.6", "schema_version": 1 }, diff --git a/docs/test_cases/t00008_class.svg b/docs/test_cases/t00008_class.svg index f0ce9cb9..f5f4ac51 100644 --- a/docs/test_cases/t00008_class.svg +++ b/docs/test_cases/t00008_class.svg @@ -1,6 +1,6 @@ - + @@ -9,8 +9,8 @@ - - + + A @@ -18,51 +18,51 @@ T,P=T,CMP=nullptr,int N=3 - + - + value : T - + - + pointer : T * - + - + reference : T & - + - + values : std::vector<P> - + - + ints : std::array<int,N> - + - + comparator : CMP - - + + Vector @@ -70,16 +70,16 @@ T - + - + values : std::vector<T> - - + + B @@ -87,34 +87,36 @@ T,C<> - + - + template_template : C<T> - - - - B - - int,Vector - - - - + + + + + B + + int,Vector + + + + + D - + - + ints : B<int,Vector> @@ -122,16 +124,16 @@ add(int i) : void D<Items...>(std::tuple<Items...> * ) : void - - + + E - - + + E::nested_template @@ -142,8 +144,8 @@ get(ET * d) : E::nested_template::DT * - - + + E::nested_template diff --git a/docs/test_cases/t00009.md b/docs/test_cases/t00009.md index efdbd04b..192c23c8 100644 --- a/docs/test_cases/t00009.md +++ b/docs/test_cases/t00009.md @@ -97,6 +97,10 @@ public: "methods": [], "name": "A", "namespace": "clanguml::t00009", + "source_location": { + "file": "../../tests/t00009/t00009.cc", + "line": 7 + }, "template_parameters": [ { "is_variadic": false, @@ -120,6 +124,10 @@ public: "methods": [], "name": "A", "namespace": "clanguml::t00009", + "source_location": { + "file": "../../tests/t00009/t00009.cc", + "line": 7 + }, "template_parameters": [ { "is_variadic": false, @@ -143,6 +151,10 @@ public: "methods": [], "name": "A", "namespace": "clanguml::t00009", + "source_location": { + "file": "../../tests/t00009/t00009.cc", + "line": 7 + }, "template_parameters": [ { "is_variadic": false, @@ -213,7 +225,7 @@ public: } ], "metadata": { - "clang_uml_version": "0.3.5-13-g57aa174", + "clang_uml_version": "0.3.5-27-g81c7ce7", "llvm_version": "Ubuntu clang version 15.0.6", "schema_version": 1 }, diff --git a/docs/test_cases/t00009_class.svg b/docs/test_cases/t00009_class.svg index a4c95777..f66ad2de 100644 --- a/docs/test_cases/t00009_class.svg +++ b/docs/test_cases/t00009_class.svg @@ -1,6 +1,6 @@ - + @@ -9,8 +9,8 @@ - - + + A @@ -18,64 +18,70 @@ T - + - + value : T - - - - A - - int - - - - - - A - - std::string - - - - - - A - - std::vector<std::string> - - - - + + + + + A + + int + + + + + + + + A + + std::string + + + + + + + + A + + std::vector<std::string> + + + + + B - + - + aint : A<int> - + - + astring : A<std::string> * - + - + avector : A<std::vector<std::string>> & diff --git a/docs/test_cases/t00010.md b/docs/test_cases/t00010.md index 9a512a46..506355ee 100644 --- a/docs/test_cases/t00010.md +++ b/docs/test_cases/t00010.md @@ -117,6 +117,10 @@ public: "methods": [], "name": "A", "namespace": "clanguml::t00010", + "source_location": { + "file": "../../tests/t00010/t00010.cc", + "line": 7 + }, "template_parameters": [ { "is_variadic": false, @@ -184,6 +188,10 @@ public: "methods": [], "name": "B", "namespace": "clanguml::t00010", + "source_location": { + "file": "../../tests/t00010/t00010.cc", + "line": 13 + }, "template_parameters": [ { "is_variadic": false, @@ -227,7 +235,7 @@ public: } ], "metadata": { - "clang_uml_version": "0.3.5-13-g57aa174", + "clang_uml_version": "0.3.5-27-g81c7ce7", "llvm_version": "Ubuntu clang version 15.0.6", "schema_version": 1 }, diff --git a/docs/test_cases/t00010_class.svg b/docs/test_cases/t00010_class.svg index b8e4a943..0fa28584 100644 --- a/docs/test_cases/t00010_class.svg +++ b/docs/test_cases/t00010_class.svg @@ -1,6 +1,6 @@ - + @@ -9,8 +9,8 @@ - - + + A @@ -18,31 +18,33 @@ T,P - + - + first : T - + - + second : P - - - - A - - T,std::string - - - - + + + + + A + + T,std::string + + + + + B @@ -50,34 +52,36 @@ T - + - + astring : A<T,std::string> - - - - B - - int - - - - + + + + + B + + int + + + + + C - + - + aintstring : B<int> diff --git a/docs/test_cases/t00011.md b/docs/test_cases/t00011.md index caef2dff..55d17294 100644 --- a/docs/test_cases/t00011.md +++ b/docs/test_cases/t00011.md @@ -176,7 +176,7 @@ public: } ], "metadata": { - "clang_uml_version": "0.3.5-13-g57aa174", + "clang_uml_version": "0.3.5-27-g81c7ce7", "llvm_version": "Ubuntu clang version 15.0.6", "schema_version": 1 }, diff --git a/docs/test_cases/t00011_class.svg b/docs/test_cases/t00011_class.svg index ceebd7f5..2589db5c 100644 --- a/docs/test_cases/t00011_class.svg +++ b/docs/test_cases/t00011_class.svg @@ -1,6 +1,6 @@ - + @@ -9,8 +9,8 @@ - - + + D @@ -18,16 +18,16 @@ T - + - + value : T - - + + A @@ -36,18 +36,18 @@ foo() : void - - + + B - + - + m_a : A * diff --git a/docs/test_cases/t00012.md b/docs/test_cases/t00012.md index 99f9637a..16bf27f2 100644 --- a/docs/test_cases/t00012.md +++ b/docs/test_cases/t00012.md @@ -217,6 +217,10 @@ class R { "methods": [], "name": "A", "namespace": "clanguml::t00012", + "source_location": { + "file": "../../tests/t00012/t00012.cc", + "line": 11 + }, "template_parameters": [ { "is_variadic": false, @@ -252,6 +256,10 @@ class R { "methods": [], "name": "A", "namespace": "clanguml::t00012", + "source_location": { + "file": "../../tests/t00012/t00012.cc", + "line": 11 + }, "template_parameters": [ { "is_variadic": false, @@ -287,6 +295,10 @@ class R { "methods": [], "name": "B", "namespace": "clanguml::t00012", + "source_location": { + "file": "../../tests/t00012/t00012.cc", + "line": 16 + }, "template_parameters": [ { "is_variadic": false, @@ -322,6 +334,10 @@ class R { "methods": [], "name": "B", "namespace": "clanguml::t00012", + "source_location": { + "file": "../../tests/t00012/t00012.cc", + "line": 16 + }, "template_parameters": [ { "is_variadic": false, @@ -363,6 +379,10 @@ class R { "methods": [], "name": "C", "namespace": "clanguml::t00012", + "source_location": { + "file": "../../tests/t00012/t00012.cc", + "line": 20 + }, "template_parameters": [ { "is_variadic": false, @@ -498,7 +518,7 @@ class R { } ], "metadata": { - "clang_uml_version": "0.3.5-13-g57aa174", + "clang_uml_version": "0.3.5-27-g81c7ce7", "llvm_version": "Ubuntu clang version 15.0.6", "schema_version": 1 }, diff --git a/docs/test_cases/t00012_class.svg b/docs/test_cases/t00012_class.svg index d0194788..0f3aa642 100644 --- a/docs/test_cases/t00012_class.svg +++ b/docs/test_cases/t00012_class.svg @@ -1,6 +1,6 @@ - + @@ -9,8 +9,8 @@ - - + + A @@ -18,23 +18,23 @@ T,Ts... - + - + value : T - + - + values : std::variant<Ts...> - - + + B @@ -43,15 +43,15 @@ - + - + ints : std::array<int,sizeof...(Is)> - - + + C @@ -60,97 +60,107 @@ - + - + ints : std::array<T,sizeof...(Is)> - - - - A - - int,std::string,float - - - - - - A - - int,std::string,bool - - - - - - B - - 3,2,1 - - - - - - B - - 1,1,1,1 - - - - - - C - - std::map<int,std::vector<std::vector<std::vector<std::string>>>>,3,3,3 - - - - + + + + + A + + int,std::string,float + + + + + + + + A + + int,std::string,bool + + + + + + + + B + + 3,2,1 + + + + + + + + B + + 1,1,1,1 + + + + + + + + C + + std::map<int,std::vector<std::vector<std::vector<std::string>>>>,3,3,3 + + + + + R - + - + a1 : A<int,std::string,float> - + - + a2 : A<int,std::string,bool> - + - + b1 : B<3,2,1> - + - + b2 : B<1,1,1,1> - + - + c1 : C<std::map<int,std::vector<std::vector<std::vector<std::string>>>>,3,3,3> - + Long template annotation diff --git a/docs/test_cases/t00013.md b/docs/test_cases/t00013.md index e0e4f482..e8d4ab94 100644 --- a/docs/test_cases/t00013.md +++ b/docs/test_cases/t00013.md @@ -145,6 +145,10 @@ private: "methods": [], "name": "F", "namespace": "ABCD", + "source_location": { + "file": "../../tests/t00013/t00013.cc", + "line": 7 + }, "template_parameters": [ { "is_variadic": false, @@ -402,6 +406,10 @@ private: "methods": [], "name": "E", "namespace": "clanguml::t00013", + "source_location": { + "file": "../../tests/t00013/t00013.cc", + "line": 33 + }, "template_parameters": [ { "is_variadic": false, @@ -425,6 +433,10 @@ private: "methods": [], "name": "G", "namespace": "clanguml::t00013", + "source_location": { + "file": "../../tests/t00013/t00013.cc", + "line": 37 + }, "template_parameters": [ { "is_variadic": false, @@ -460,6 +472,10 @@ private: "methods": [], "name": "E", "namespace": "clanguml::t00013", + "source_location": { + "file": "../../tests/t00013/t00013.cc", + "line": 33 + }, "template_parameters": [ { "is_variadic": false, @@ -701,7 +717,7 @@ private: } ], "metadata": { - "clang_uml_version": "0.3.5-13-g57aa174", + "clang_uml_version": "0.3.5-27-g81c7ce7", "llvm_version": "Ubuntu clang version 15.0.6", "schema_version": 1 }, diff --git a/docs/test_cases/t00013_class.svg b/docs/test_cases/t00013_class.svg index 5e2ce949..d25a0d58 100644 --- a/docs/test_cases/t00013_class.svg +++ b/docs/test_cases/t00013_class.svg @@ -1,6 +1,6 @@ - + @@ -9,8 +9,8 @@ - - + + ABCD::F @@ -18,86 +18,88 @@ T - + - + f : T - - - - ABCD::F - - int - - - - + + + + + ABCD::F + + int + + + + + A - + - + a : int - - + + B - + - + b : int - - + + C - + - + c : int - - + + D - + - + d : int print(R * r) : void - - + + E @@ -105,16 +107,16 @@ T - + - + e : T - - + + G @@ -122,64 +124,70 @@ T,Args... - + - + g : T - + - + args : std::tuple<Args...> - - - - E - - int - - - - - - G - - int,float,std::string - - - - - - E - - std::string - - - - + + + + + E + + int + + + + + + + + G + + int,float,std::string + + + + + + + + E + + std::string + + + + + R - + - + gintstring : G<int,float,std::string> - + - + estring : E<std::string> diff --git a/docs/test_cases/t00014.md b/docs/test_cases/t00014.md index 8d74bfd8..294a0db3 100644 --- a/docs/test_cases/t00014.md +++ b/docs/test_cases/t00014.md @@ -209,6 +209,10 @@ public: "methods": [], "name": "A", "namespace": "clanguml::t00014", + "source_location": { + "file": "../../tests/t00014/t00014.cc", + "line": 21 + }, "template_parameters": [ { "is_variadic": false, @@ -238,6 +242,10 @@ public: "methods": [], "name": "A", "namespace": "clanguml::t00014", + "source_location": { + "file": "../../tests/t00014/t00014.cc", + "line": 21 + }, "template_parameters": [ { "is_variadic": false, @@ -274,6 +282,10 @@ public: "methods": [], "name": "A", "namespace": "clanguml::t00014", + "source_location": { + "file": "../../../../../../usr/include/c++/12/bits/stl_iterator.h", + "line": 2547 + }, "template_parameters": [ { "is_variadic": false, @@ -303,6 +315,10 @@ public: "methods": [], "name": "A", "namespace": "clanguml::t00014", + "source_location": { + "file": "../../../../../../usr/include/c++/12/bits/unique_ptr.h", + "line": 269 + }, "template_parameters": [ { "is_variadic": false, @@ -332,6 +348,10 @@ public: "methods": [], "name": "A", "namespace": "clanguml::t00014", + "source_location": { + "file": "../../../../../../usr/include/c++/12/bits/stl_iterator.h", + "line": 2547 + }, "template_parameters": [ { "is_variadic": false, @@ -361,6 +381,10 @@ public: "methods": [], "name": "A", "namespace": "clanguml::t00014", + "source_location": { + "file": "../../../../../../usr/include/c++/12/bits/stl_iterator.h", + "line": 2547 + }, "template_parameters": [ { "is_variadic": false, @@ -390,6 +414,10 @@ public: "methods": [], "name": "A", "namespace": "clanguml::t00014", + "source_location": { + "file": "../../../../../../usr/include/c++/12/bits/unique_ptr.h", + "line": 269 + }, "template_parameters": [ { "is_variadic": false, @@ -419,6 +447,10 @@ public: "methods": [], "name": "A", "namespace": "clanguml::t00014", + "source_location": { + "file": "../../../../../../usr/include/c++/12/bits/stl_iterator.h", + "line": 2547 + }, "template_parameters": [ { "is_variadic": false, @@ -448,6 +480,10 @@ public: "methods": [], "name": "A", "namespace": "clanguml::t00014", + "source_location": { + "file": "../../../../../../usr/include/c++/12/bits/shared_ptr.h", + "line": 175 + }, "template_parameters": [ { "is_variadic": false, @@ -477,6 +513,10 @@ public: "methods": [], "name": "A", "namespace": "clanguml::t00014", + "source_location": { + "file": "../../tests/t00014/t00014.cc", + "line": 21 + }, "template_parameters": [ { "is_variadic": false, @@ -506,6 +546,10 @@ public: "methods": [], "name": "A", "namespace": "clanguml::t00014", + "source_location": { + "file": "../../tests/t00014/t00014.cc", + "line": 21 + }, "template_parameters": [ { "is_variadic": false, @@ -542,6 +586,10 @@ public: "methods": [], "name": "A", "namespace": "clanguml::t00014", + "source_location": { + "file": "../../tests/t00014/t00014.cc", + "line": 21 + }, "template_parameters": [ { "is_variadic": false, @@ -571,6 +619,10 @@ public: "methods": [], "name": "A", "namespace": "clanguml::t00014", + "source_location": { + "file": "../../tests/t00014/t00014.cc", + "line": 21 + }, "template_parameters": [ { "is_variadic": false, @@ -600,6 +652,10 @@ public: "methods": [], "name": "A", "namespace": "clanguml::t00014", + "source_location": { + "file": "../../../../../../usr/include/c++/12/bits/std_function.h", + "line": 111 + }, "template_parameters": [ { "is_variadic": false, @@ -629,6 +685,10 @@ public: "methods": [], "name": "A", "namespace": "clanguml::t00014", + "source_location": { + "file": "../../../../../../usr/include/c++/12/bits/std_function.h", + "line": 111 + }, "template_parameters": [ { "is_variadic": false, @@ -835,7 +895,7 @@ public: } ], "metadata": { - "clang_uml_version": "0.3.5-13-g57aa174", + "clang_uml_version": "0.3.5-27-g81c7ce7", "llvm_version": "Ubuntu clang version 15.0.6", "schema_version": 1 }, diff --git a/docs/test_cases/t00014_class.svg b/docs/test_cases/t00014_class.svg index 6b0088ea..f1776804 100644 --- a/docs/test_cases/t00014_class.svg +++ b/docs/test_cases/t00014_class.svg @@ -1,6 +1,6 @@ - + @@ -9,8 +9,8 @@ - - + + A @@ -18,158 +18,188 @@ T,P - + - + t : T - + - + p : P - - + + B - + - + value : std::string - - - - A - - T,std::string - - - - - - A - - T,std::unique_ptr<std::string> - - - - - - A - - long,T - - - - - - A - - double,T - - - - - - A - - long,U - - - - - - A - - long,bool - - - - - - A - - double,bool - - - - - - A - - long,float - - - - - - A - - double,float - - - - - - A - - bool,std::string - - - - - - A - - float,std::unique_ptr<std::string> - - - - - - A - - int,std::string - - - - - - A - - std::string,std::string - - - - - - A - - char,std::string - - - - - - A - - wchar_t,std::string - - - - + + + + + A + + T,std::string + + + + + + + + A + + T,std::unique_ptr<std::string> + + + + + + + + A + + long,T + + + + + + + + A + + double,T + + + + + + + + A + + long,U + + + + + + + + A + + long,bool + + + + + + + + A + + double,bool + + + + + + + + A + + long,float + + + + + + + + A + + double,float + + + + + + + + A + + bool,std::string + + + + + + + + A + + float,std::unique_ptr<std::string> + + + + + + + + A + + int,std::string + + + + + + + + A + + std::string,std::string + + + + + + + + A + + char,std::string + + + + + + + + A + + wchar_t,std::string + + + + + R @@ -177,116 +207,116 @@ T - + - + bapair : PairPairBA<bool> - + - + abool : APtr<bool> - + - + aboolfloat : AAPtr<bool,float> - + - + afloat : ASharedPtr<float> - + - + boolstring : A<bool,std::string> - + - + floatstring : AStringPtr<float> - + - + intstring : AIntString - + - + stringstring : AStringString - + - + bstringstring : BStringString - + - + atfloat : AAPtr<T,float> - + - + bs : BVector - + - + bs2 : BVector2 - + - + cb : SimpleCallback<ACharString> - + - + gcb : GenericCallback<R::AWCharString> - + - + vcb : VoidCallback - + - + vps : VectorPtr<B> diff --git a/docs/test_cases/t00015.md b/docs/test_cases/t00015.md index ab7de950..fbd4cdab 100644 --- a/docs/test_cases/t00015.md +++ b/docs/test_cases/t00015.md @@ -177,7 +177,7 @@ class B : public ns1::ns2::Anon { }; } ], "metadata": { - "clang_uml_version": "0.3.5-13-g57aa174", + "clang_uml_version": "0.3.5-27-g81c7ce7", "llvm_version": "Ubuntu clang version 15.0.6", "schema_version": 1 }, diff --git a/docs/test_cases/t00015_class.svg b/docs/test_cases/t00015_class.svg index dfffc6ad..271d9141 100644 --- a/docs/test_cases/t00015_class.svg +++ b/docs/test_cases/t00015_class.svg @@ -1,6 +1,6 @@ - + @@ -9,40 +9,40 @@ - - + + ns1::A - - + + ns1::ns2_v0_9_0::A - - + + ns1::Anon - - + + ns3::ns1::ns2::Anon - - + + ns3::B diff --git a/docs/test_cases/t00016.md b/docs/test_cases/t00016.md index 491a03b6..ed7a7568 100644 --- a/docs/test_cases/t00016.md +++ b/docs/test_cases/t00016.md @@ -261,7 +261,7 @@ template <> struct is_numeric { } ], "metadata": { - "clang_uml_version": "0.3.5-13-g57aa174", + "clang_uml_version": "0.3.5-27-g81c7ce7", "llvm_version": "Ubuntu clang version 15.0.6", "schema_version": 1 }, diff --git a/docs/test_cases/t00016_class.svg b/docs/test_cases/t00016_class.svg index f37f2d38..22672f19 100644 --- a/docs/test_cases/t00016_class.svg +++ b/docs/test_cases/t00016_class.svg @@ -1,6 +1,6 @@ - + @@ -9,8 +9,8 @@ - - + + is_numeric @@ -21,8 +21,8 @@ value : enum - - + + is_numeric @@ -33,8 +33,8 @@ value : enum - - + + is_numeric @@ -45,8 +45,8 @@ value : enum - - + + is_numeric @@ -57,8 +57,8 @@ value : enum - - + + is_numeric @@ -69,8 +69,8 @@ value : enum - - + + is_numeric diff --git a/docs/test_cases/t00017.md b/docs/test_cases/t00017.md index 21aefe1e..ce165d61 100644 --- a/docs/test_cases/t00017.md +++ b/docs/test_cases/t00017.md @@ -510,7 +510,7 @@ private: } ], "metadata": { - "clang_uml_version": "0.3.5-13-g57aa174", + "clang_uml_version": "0.3.5-27-g81c7ce7", "llvm_version": "Ubuntu clang version 15.0.6", "schema_version": 1 }, diff --git a/docs/test_cases/t00017_class.svg b/docs/test_cases/t00017_class.svg index 9849985d..bfffcc28 100644 --- a/docs/test_cases/t00017_class.svg +++ b/docs/test_cases/t00017_class.svg @@ -1,6 +1,6 @@ - + @@ -9,127 +9,127 @@ - - + + A - - + + B - - + + C - - + + D - - + + E - - + + F - - + + G - - + + H - - + + I - - + + J - - + + K - - + + R - + - + some_int : int - + - + some_int_pointer : int * - + - + some_int_pointer_pointer : int ** - + - + some_int_reference : int & diff --git a/docs/test_cases/t00018.md b/docs/test_cases/t00018.md index 9755f4c6..e48ea21c 100644 --- a/docs/test_cases/t00018.md +++ b/docs/test_cases/t00018.md @@ -390,7 +390,7 @@ void widget::draw(const clanguml::t00018::widget &w) } ], "metadata": { - "clang_uml_version": "0.3.5-13-g57aa174", + "clang_uml_version": "0.3.5-27-g81c7ce7", "llvm_version": "Ubuntu clang version 15.0.6", "schema_version": 1 }, diff --git a/docs/test_cases/t00018_class.svg b/docs/test_cases/t00018_class.svg index 38a508c4..9b5fe3f1 100644 --- a/docs/test_cases/t00018_class.svg +++ b/docs/test_cases/t00018_class.svg @@ -1,6 +1,6 @@ - + @@ -9,18 +9,18 @@ - - + + impl::widget - + - + n : int @@ -30,18 +30,18 @@ draw(const widget & w) : void widget(int n) : void - - + + widget - + - + pImpl : std::unique_ptr<impl::widget> diff --git a/docs/test_cases/t00019.md b/docs/test_cases/t00019.md index bf84662f..cf2e07a4 100644 --- a/docs/test_cases/t00019.md +++ b/docs/test_cases/t00019.md @@ -435,6 +435,10 @@ class Base { "methods": [], "name": "Layer3", "namespace": "clanguml::t00019", + "source_location": { + "file": "../../tests/t00019/t00019_layer2.h", + "line": 6 + }, "template_parameters": [ { "is_variadic": false, @@ -465,6 +469,10 @@ class Base { "methods": [], "name": "Layer2", "namespace": "clanguml::t00019", + "source_location": { + "file": "../../tests/t00019/t00019_layer1.h", + "line": 9 + }, "template_parameters": [ { "is_variadic": false, @@ -502,6 +510,10 @@ class Base { "methods": [], "name": "Layer1", "namespace": "clanguml::t00019", + "source_location": { + "file": "../../../../../../usr/include/c++/12/bits/unique_ptr.h", + "line": 269 + }, "template_parameters": [ { "is_variadic": false, @@ -559,7 +571,7 @@ class Base { } ], "metadata": { - "clang_uml_version": "0.3.5-13-g57aa174", + "clang_uml_version": "0.3.5-27-g81c7ce7", "llvm_version": "Ubuntu clang version 15.0.6", "schema_version": 1 }, diff --git a/docs/test_cases/t00019_class.svg b/docs/test_cases/t00019_class.svg index 626c9109..3d0d6bff 100644 --- a/docs/test_cases/t00019_class.svg +++ b/docs/test_cases/t00019_class.svg @@ -1,6 +1,6 @@ - + @@ -9,8 +9,8 @@ - - + + Base @@ -25,8 +25,8 @@ m2() : std::string - - + + Layer1 @@ -39,8 +39,8 @@ m2() : std::string - - + + Layer2 @@ -51,8 +51,8 @@ all_calls_count() const : int - - + + Layer3 @@ -60,18 +60,18 @@ LowerLayer - + - + m_m1_calls : int - + - + m_m2_calls : int @@ -83,42 +83,48 @@ m1_calls() const : int m2_calls() const : int - - - - Layer3 - - Base - - - - - - Layer2 - - Layer3<Base> - - - - - - Layer1 - - Layer2<Layer3<Base>> - - - - + + + + + Layer3 + + Base + + + + + + + + Layer2 + + Layer3<Base> + + + + + + + + Layer1 + + Layer2<Layer3<Base>> + + + + + A - + - + layers : std::unique_ptr<Layer1<Layer2<Layer3<Base>>>> diff --git a/docs/test_cases/t00020.md b/docs/test_cases/t00020.md index 5b5e3e0b..c8a0002e 100644 --- a/docs/test_cases/t00020.md +++ b/docs/test_cases/t00020.md @@ -534,7 +534,7 @@ public: } ], "metadata": { - "clang_uml_version": "0.3.5-13-g57aa174", + "clang_uml_version": "0.3.5-27-g81c7ce7", "llvm_version": "Ubuntu clang version 15.0.6", "schema_version": 1 }, diff --git a/docs/test_cases/t00020_class.svg b/docs/test_cases/t00020_class.svg index 8cd2754a..7012b669 100644 --- a/docs/test_cases/t00020_class.svg +++ b/docs/test_cases/t00020_class.svg @@ -1,6 +1,6 @@ - + @@ -9,8 +9,8 @@ - - + + ProductA @@ -21,8 +21,8 @@ sell(int price) const = 0 : bool - - + + ProductA1 @@ -31,8 +31,8 @@ sell(int price) const : bool - - + + ProductA2 @@ -41,8 +41,8 @@ sell(int price) const : bool - - + + ProductB @@ -53,8 +53,8 @@ buy(int price) const = 0 : bool - - + + ProductB1 @@ -63,8 +63,8 @@ buy(int price) const : bool - - + + ProductB2 @@ -73,8 +73,8 @@ buy(int price) const : bool - - + + AbstractFactory @@ -85,8 +85,8 @@ make_b() const = 0 : std::unique_ptr<ProductB> - - + + Factory1 @@ -97,8 +97,8 @@ make_b() const : std::unique_ptr<ProductB> - - + + Factory2 diff --git a/docs/test_cases/t00021.md b/docs/test_cases/t00021.md index 3d93837a..1284b808 100644 --- a/docs/test_cases/t00021.md +++ b/docs/test_cases/t00021.md @@ -472,7 +472,7 @@ public: } ], "metadata": { - "clang_uml_version": "0.3.5-13-g57aa174", + "clang_uml_version": "0.3.5-27-g81c7ce7", "llvm_version": "Ubuntu clang version 15.0.6", "schema_version": 1 }, diff --git a/docs/test_cases/t00021_class.svg b/docs/test_cases/t00021_class.svg index 78967dae..092fd7b4 100644 --- a/docs/test_cases/t00021_class.svg +++ b/docs/test_cases/t00021_class.svg @@ -1,6 +1,6 @@ - + @@ -9,8 +9,8 @@ - - + + Visitor @@ -23,8 +23,8 @@ visit_B(const B & item) const = 0 : void - - + + Visitor1 @@ -35,8 +35,8 @@ visit_B(const B & item) const : void - - + + Visitor2 @@ -47,8 +47,8 @@ visit_B(const B & item) const : void - - + + Visitor3 @@ -59,8 +59,8 @@ visit_B(const B & item) const : void - - + + Item @@ -71,8 +71,8 @@ accept(const Visitor & visitor) const = 0 : void - - + + A @@ -81,8 +81,8 @@ accept(const Visitor & visitor) const : void - - + + B diff --git a/docs/test_cases/t00022.md b/docs/test_cases/t00022.md index a43c383b..e110be76 100644 --- a/docs/test_cases/t00022.md +++ b/docs/test_cases/t00022.md @@ -221,7 +221,7 @@ protected: } ], "metadata": { - "clang_uml_version": "0.3.5-13-g57aa174", + "clang_uml_version": "0.3.5-27-g81c7ce7", "llvm_version": "Ubuntu clang version 15.0.6", "schema_version": 1 }, diff --git a/docs/test_cases/t00022_class.svg b/docs/test_cases/t00022_class.svg index a13204a4..608091b7 100644 --- a/docs/test_cases/t00022_class.svg +++ b/docs/test_cases/t00022_class.svg @@ -1,6 +1,6 @@ - + @@ -9,8 +9,8 @@ - - + + A @@ -23,8 +23,8 @@ method2() = 0 : void - - + + A1 @@ -35,8 +35,8 @@ method2() : void - - + + A2 diff --git a/docs/test_cases/t00023.md b/docs/test_cases/t00023.md index 1c94678a..471f8ad0 100644 --- a/docs/test_cases/t00023.md +++ b/docs/test_cases/t00023.md @@ -295,7 +295,7 @@ private: } ], "metadata": { - "clang_uml_version": "0.3.5-13-g57aa174", + "clang_uml_version": "0.3.5-27-g81c7ce7", "llvm_version": "Ubuntu clang version 15.0.6", "schema_version": 1 }, diff --git a/docs/test_cases/t00023_class.svg b/docs/test_cases/t00023_class.svg index 538ad218..4545f39f 100644 --- a/docs/test_cases/t00023_class.svg +++ b/docs/test_cases/t00023_class.svg @@ -1,6 +1,6 @@ - + @@ -9,8 +9,8 @@ - - + + Strategy @@ -21,8 +21,8 @@ algorithm() = 0 : void - - + + StrategyA @@ -31,8 +31,8 @@ algorithm() : void - - + + StrategyB @@ -41,8 +41,8 @@ algorithm() : void - - + + StrategyC @@ -51,18 +51,18 @@ algorithm() : void - - + + Context - + - + m_strategy : std::unique_ptr<Strategy> diff --git a/docs/test_cases/t00024.md b/docs/test_cases/t00024.md index 026a3eb9..69def9fe 100644 --- a/docs/test_cases/t00024.md +++ b/docs/test_cases/t00024.md @@ -309,7 +309,7 @@ private: } ], "metadata": { - "clang_uml_version": "0.3.5-13-g57aa174", + "clang_uml_version": "0.3.5-27-g81c7ce7", "llvm_version": "Ubuntu clang version 15.0.6", "schema_version": 1 }, diff --git a/docs/test_cases/t00024_class.svg b/docs/test_cases/t00024_class.svg index 358a5d27..c06d0444 100644 --- a/docs/test_cases/t00024_class.svg +++ b/docs/test_cases/t00024_class.svg @@ -1,6 +1,6 @@ - + @@ -9,8 +9,8 @@ - - + + Target @@ -23,8 +23,8 @@ m2() = 0 : void - - + + Target1 @@ -35,8 +35,8 @@ m2() : void - - + + Target2 @@ -47,18 +47,18 @@ m2() : void - - + + Proxy - + - + m_target : std::shared_ptr<Target> diff --git a/docs/test_cases/t00025.md b/docs/test_cases/t00025.md index f6f5dd7d..e99a7569 100644 --- a/docs/test_cases/t00025.md +++ b/docs/test_cases/t00025.md @@ -247,6 +247,10 @@ public: "methods": [], "name": "Proxy", "namespace": "clanguml::t00025", + "source_location": { + "file": "../../tests/t00025/t00025.cc", + "line": 18 + }, "template_parameters": [ { "is_variadic": false, @@ -270,6 +274,10 @@ public: "methods": [], "name": "Proxy", "namespace": "clanguml::t00025", + "source_location": { + "file": "../../tests/t00025/t00025.cc", + "line": 18 + }, "template_parameters": [ { "is_variadic": false, @@ -323,7 +331,7 @@ public: } ], "metadata": { - "clang_uml_version": "0.3.5-13-g57aa174", + "clang_uml_version": "0.3.5-27-g81c7ce7", "llvm_version": "Ubuntu clang version 15.0.6", "schema_version": 1 }, diff --git a/docs/test_cases/t00025_class.svg b/docs/test_cases/t00025_class.svg index 49ce4ad4..7b62c9ae 100644 --- a/docs/test_cases/t00025_class.svg +++ b/docs/test_cases/t00025_class.svg @@ -1,6 +1,6 @@ - + @@ -9,8 +9,8 @@ - - + + Target1 @@ -21,8 +21,8 @@ m2() : void - - + + Target2 @@ -33,8 +33,8 @@ m2() : void - - + + Proxy @@ -42,11 +42,11 @@ T - + - + m_target : std::shared_ptr<T> @@ -56,41 +56,45 @@ m1() : void m2() : void - - - - Proxy - - Target1 - - - - - - Proxy - - Target2 - - - - + + + + + Proxy + + Target1 + + + + + + + + Proxy + + Target2 + + + + + ProxyHolder - + - + proxy1 : Proxy<Target1> - + - + proxy2 : Proxy<Target2> diff --git a/docs/test_cases/t00026.md b/docs/test_cases/t00026.md index 1627d7ed..07002854 100644 --- a/docs/test_cases/t00026.md +++ b/docs/test_cases/t00026.md @@ -357,6 +357,10 @@ struct StringMemento { "methods": [], "name": "Caretaker", "namespace": "clanguml::t00026", + "source_location": { + "file": "../../tests/t00026/t00026.cc", + "line": 40 + }, "template_parameters": [ { "is_variadic": false, @@ -380,6 +384,10 @@ struct StringMemento { "methods": [], "name": "Originator", "namespace": "clanguml::t00026", + "source_location": { + "file": "../../tests/t00026/t00026.cc", + "line": 21 + }, "template_parameters": [ { "is_variadic": false, @@ -433,7 +441,7 @@ struct StringMemento { } ], "metadata": { - "clang_uml_version": "0.3.5-13-g57aa174", + "clang_uml_version": "0.3.5-27-g81c7ce7", "llvm_version": "Ubuntu clang version 15.0.6", "schema_version": 1 }, diff --git a/docs/test_cases/t00026_class.svg b/docs/test_cases/t00026_class.svg index 3676c338..b23447a1 100644 --- a/docs/test_cases/t00026_class.svg +++ b/docs/test_cases/t00026_class.svg @@ -1,6 +1,6 @@ - + @@ -9,8 +9,8 @@ - - + + Memento @@ -18,11 +18,11 @@ T - + - + m_value : T @@ -30,8 +30,8 @@ Memento(T && v) : void value() const : T - - + + Originator @@ -39,11 +39,11 @@ T - + - + m_value : T @@ -57,8 +57,8 @@ print() const : void set(T && v) : void - - + + Caretaker @@ -66,11 +66,11 @@ T - + - + m_mementos : std::unordered_map<std::string,Memento<T>> @@ -78,41 +78,45 @@ state(const std::string & n) : Memento<T> & set_state(const std::string & s, Memento<T> && m) : void - - - - Caretaker - - std::string - - - - - - Originator - - std::string - - - - + + + + + Caretaker + + std::string + + + + + + + + Originator + + std::string + + + + + StringMemento - + - + caretaker : Caretaker<std::string> - + - + originator : Originator<std::string> diff --git a/docs/test_cases/t00027.md b/docs/test_cases/t00027.md index 5a73decb..b4b60c51 100644 --- a/docs/test_cases/t00027.md +++ b/docs/test_cases/t00027.md @@ -140,6 +140,10 @@ struct Window { "methods": [], "name": "Line", "namespace": "clanguml::t00027", + "source_location": { + "file": "../../tests/t00027/t00027.cc", + "line": 14 + }, "template_parameters": [], "type": "class" }, @@ -209,6 +213,10 @@ struct Window { "methods": [], "name": "Text", "namespace": "clanguml::t00027", + "source_location": { + "file": "../../tests/t00027/t00027.cc", + "line": 24 + }, "template_parameters": [], "type": "class" }, @@ -405,6 +413,10 @@ struct Window { "methods": [], "name": "Line", "namespace": "clanguml::t00027", + "source_location": { + "file": "../../tests/t00027/t00027.cc", + "line": 15 + }, "template_parameters": [ { "is_variadic": false, @@ -434,6 +446,10 @@ struct Window { "methods": [], "name": "Line", "namespace": "clanguml::t00027", + "source_location": { + "file": "../../tests/t00027/t00027.cc", + "line": 15 + }, "template_parameters": [ { "is_variadic": false, @@ -457,6 +473,10 @@ struct Window { "methods": [], "name": "Text", "namespace": "clanguml::t00027", + "source_location": { + "file": "../../tests/t00027/t00027.cc", + "line": 25 + }, "template_parameters": [ { "is_variadic": false, @@ -486,6 +506,10 @@ struct Window { "methods": [], "name": "Text", "namespace": "clanguml::t00027", + "source_location": { + "file": "../../tests/t00027/t00027.cc", + "line": 25 + }, "template_parameters": [ { "is_variadic": false, @@ -559,7 +583,7 @@ struct Window { } ], "metadata": { - "clang_uml_version": "0.3.5-13-g57aa174", + "clang_uml_version": "0.3.5-27-g81c7ce7", "llvm_version": "Ubuntu clang version 15.0.6", "schema_version": 1 }, diff --git a/docs/test_cases/t00027_class.svg b/docs/test_cases/t00027_class.svg index 90819359..558a197c 100644 --- a/docs/test_cases/t00027_class.svg +++ b/docs/test_cases/t00027_class.svg @@ -1,6 +1,6 @@ - + @@ -9,8 +9,8 @@ - - + + Shape @@ -21,14 +21,16 @@ ~Shape() = default : void - - - - Line - - - - + + + + + Line + + + + + Line @@ -39,14 +41,16 @@ display() : void - - - - Text - - - - + + + + + Text + + + + + Text @@ -57,8 +61,8 @@ display() : void - - + + ShapeDecorator @@ -67,8 +71,8 @@ display() = 0 : void - - + + Color @@ -79,8 +83,8 @@ display() : void - - + + Weight @@ -91,71 +95,79 @@ display() : void - - - - Line - - Color,Weight - - - - - - Line - - Color - - - - - - Text - - Color,Weight - - - - - - Text - - Color - - - - + + + + + Line + + Color,Weight + + + + + + + + Line + + Color + + + + + + + + Text + + Color,Weight + + + + + + + + Text + + Color + + + + + Window - + - + border : Line<Color,Weight> - + - + divider : Line<Color> - + - + title : Text<Color,Weight> - + - + description : Text<Color> diff --git a/docs/test_cases/t00028.md b/docs/test_cases/t00028.md index 478bd81f..aae1a182 100644 --- a/docs/test_cases/t00028.md +++ b/docs/test_cases/t00028.md @@ -287,6 +287,10 @@ class R { "methods": [], "name": "E", "namespace": "clanguml::t00028", + "source_location": { + "file": "../../tests/t00028/t00028.cc", + "line": 25 + }, "template_parameters": [ { "is_variadic": false, @@ -410,7 +414,7 @@ class R { } ], "metadata": { - "clang_uml_version": "0.3.5-13-g57aa174", + "clang_uml_version": "0.3.5-27-g81c7ce7", "llvm_version": "Ubuntu clang version 15.0.6", "schema_version": 1 }, diff --git a/docs/test_cases/t00028_class.svg b/docs/test_cases/t00028_class.svg index f47acbce..dff9e7c7 100644 --- a/docs/test_cases/t00028_class.svg +++ b/docs/test_cases/t00028_class.svg @@ -1,6 +1,6 @@ - + @@ -9,54 +9,54 @@ - - + + A - + A class note. - - + + B - + B class note. - - + + C - + C class note. - - + + D - + D class note. - - + + E @@ -64,27 +64,27 @@ T - + - + param : T - + E template class note. - - + + G - - + + F @@ -94,76 +94,78 @@ three - + F enum note. - - - - E - - int - - - - + + + + + E + + int + + + + + R - + - + aaa : A - + - + bbb : B * - + - + ccc : C & - + - + ddd : std::vector<std::shared_ptr<D>> - + - + eee : E<int> - + - + ggg : G ** R(C & c) : void - + R class note. - + R contains an instance of A. - + Reference to C. diff --git a/docs/test_cases/t00029.md b/docs/test_cases/t00029.md index 3bc69fbe..3f8ed961 100644 --- a/docs/test_cases/t00029.md +++ b/docs/test_cases/t00029.md @@ -286,7 +286,7 @@ struct R { } ], "metadata": { - "clang_uml_version": "0.3.5-13-g57aa174", + "clang_uml_version": "0.3.5-27-g81c7ce7", "llvm_version": "Ubuntu clang version 15.0.6", "schema_version": 1 }, diff --git a/docs/test_cases/t00029_class.svg b/docs/test_cases/t00029_class.svg index 2172d85a..1461d94c 100644 --- a/docs/test_cases/t00029_class.svg +++ b/docs/test_cases/t00029_class.svg @@ -1,6 +1,6 @@ - + @@ -9,16 +9,16 @@ - - + + A - - + + C @@ -26,16 +26,16 @@ T - + - + param : T - - + + E @@ -45,64 +45,64 @@ three - - + + G1 - - + + G2 - - + + G3 - - + + G4 - - + + R - + - + g1 : G1 - + - + g3 : G3 & - + - + g4 : std::shared_ptr<G4> diff --git a/docs/test_cases/t00030.md b/docs/test_cases/t00030.md index 045a281c..17ad619d 100644 --- a/docs/test_cases/t00030.md +++ b/docs/test_cases/t00030.md @@ -255,7 +255,7 @@ struct R { } ], "metadata": { - "clang_uml_version": "0.3.5-13-g57aa174", + "clang_uml_version": "0.3.5-27-g81c7ce7", "llvm_version": "Ubuntu clang version 15.0.6", "schema_version": 1 }, diff --git a/docs/test_cases/t00030_class.svg b/docs/test_cases/t00030_class.svg index 5fb8be7d..a43abc1c 100644 --- a/docs/test_cases/t00030_class.svg +++ b/docs/test_cases/t00030_class.svg @@ -1,6 +1,6 @@ - + @@ -9,86 +9,86 @@ - - + + A - - + + B - - + + C - - + + D - - + + E - - + + R - + - + aaa : A - + - + bbb : std::vector<B> - + - + ccc : std::vector<C> - + - + ddd : D - + - + eee : E * diff --git a/docs/test_cases/t00031.md b/docs/test_cases/t00031.md index eb1db3be..ff0699a6 100644 --- a/docs/test_cases/t00031.md +++ b/docs/test_cases/t00031.md @@ -183,6 +183,10 @@ struct R { "methods": [], "name": "C", "namespace": "clanguml::t00031", + "source_location": { + "file": "../../tests/t00031/t00031.cc", + "line": 14 + }, "template_parameters": [ { "is_variadic": false, @@ -272,7 +276,7 @@ struct R { } ], "metadata": { - "clang_uml_version": "0.3.5-13-g57aa174", + "clang_uml_version": "0.3.5-27-g81c7ce7", "llvm_version": "Ubuntu clang version 15.0.6", "schema_version": 1 }, diff --git a/docs/test_cases/t00031_class.svg b/docs/test_cases/t00031_class.svg index 66b24c0b..ae7c7c46 100644 --- a/docs/test_cases/t00031_class.svg +++ b/docs/test_cases/t00031_class.svg @@ -1,33 +1,33 @@ - + - + - + - - - + + + A - - + + B @@ -37,8 +37,8 @@ three - - + + @@ -47,63 +47,65 @@ T - + - + ttt : T - - + + D - - - - C - - int - - - - + + + + + C + + int + + + + + R - + - + aaa : A * - + - + bbb : std::vector<B> - + - + ccc : C<int> - + - + ddd : D * diff --git a/docs/test_cases/t00032.md b/docs/test_cases/t00032.md index 216a976f..d6f83ad7 100644 --- a/docs/test_cases/t00032.md +++ b/docs/test_cases/t00032.md @@ -297,6 +297,10 @@ struct R { "methods": [], "name": "Overload", "namespace": "clanguml::t00032", + "source_location": { + "file": "../../tests/t00032/t00032.cc", + "line": 24 + }, "template_parameters": [ { "is_variadic": false, @@ -364,7 +368,7 @@ struct R { } ], "metadata": { - "clang_uml_version": "0.3.5-13-g57aa174", + "clang_uml_version": "0.3.5-27-g81c7ce7", "llvm_version": "Ubuntu clang version 15.0.6", "schema_version": 1 }, diff --git a/docs/test_cases/t00032_class.svg b/docs/test_cases/t00032_class.svg index b9c20337..e71b3100 100644 --- a/docs/test_cases/t00032_class.svg +++ b/docs/test_cases/t00032_class.svg @@ -1,6 +1,6 @@ - + @@ -9,24 +9,24 @@ - - + + Base - - + + TBase - - + + A @@ -35,8 +35,8 @@ operator()() : void - - + + B @@ -45,8 +45,8 @@ operator()() : void - - + + C @@ -55,8 +55,8 @@ operator()() : void - - + + Overload @@ -64,34 +64,36 @@ T,L,Ts... - + - + counter : L - - - - Overload - - TBase,int,A,B,C - - - - + + + + + Overload + + TBase,int,A,B,C + + + + + R - + - + overload : Overload<TBase,int,A,B,C> diff --git a/docs/test_cases/t00033.md b/docs/test_cases/t00033.md index 94d194b1..8de890f2 100644 --- a/docs/test_cases/t00033.md +++ b/docs/test_cases/t00033.md @@ -213,6 +213,10 @@ struct R { "methods": [], "name": "C", "namespace": "clanguml::t00033", + "source_location": { + "file": "../../../../../../usr/include/c++/12/bits/unique_ptr.h", + "line": 269 + }, "template_parameters": [ { "is_variadic": false, @@ -236,6 +240,10 @@ struct R { "methods": [], "name": "B", "namespace": "clanguml::t00033", + "source_location": { + "file": "../../tests/t00033/t00033.cc", + "line": 7 + }, "template_parameters": [ { "is_variadic": false, @@ -273,6 +281,10 @@ struct R { "methods": [], "name": "A", "namespace": "clanguml::t00033", + "source_location": { + "file": "../../tests/t00033/t00033.cc", + "line": 7 + }, "template_parameters": [ { "is_variadic": false, @@ -337,7 +349,7 @@ struct R { } ], "metadata": { - "clang_uml_version": "0.3.5-13-g57aa174", + "clang_uml_version": "0.3.5-27-g81c7ce7", "llvm_version": "Ubuntu clang version 15.0.6", "schema_version": 1 }, diff --git a/docs/test_cases/t00033_class.svg b/docs/test_cases/t00033_class.svg index 5c9553fd..dd03db05 100644 --- a/docs/test_cases/t00033_class.svg +++ b/docs/test_cases/t00033_class.svg @@ -1,6 +1,6 @@ - + @@ -9,8 +9,8 @@ - - + + A @@ -18,16 +18,16 @@ T - + - + aaa : T - - + + B @@ -35,16 +35,16 @@ T - + - + bbb : T - - + + C @@ -52,65 +52,71 @@ T - + - + ccc : T - - + + D - + - + ddd : int - - - - C - - D - - - - - - B - - std::unique_ptr<C<D>> - - - - - - A - - B<std::unique_ptr<C<D>>> - - - - + + + + + C + + D + + + + + + + + B + + std::unique_ptr<C<D>> + + + + + + + + A + + B<std::unique_ptr<C<D>>> + + + + + R - + - + abc : A<B<std::unique_ptr<C<D>>>> diff --git a/docs/test_cases/t00034.md b/docs/test_cases/t00034.md index 522e2cf7..a4d06718 100644 --- a/docs/test_cases/t00034.md +++ b/docs/test_cases/t00034.md @@ -307,7 +307,7 @@ struct R { } ], "metadata": { - "clang_uml_version": "0.3.5-13-g57aa174", + "clang_uml_version": "0.3.5-27-g81c7ce7", "llvm_version": "Ubuntu clang version 15.0.6", "schema_version": 1 }, diff --git a/docs/test_cases/t00034_class.svg b/docs/test_cases/t00034_class.svg index 0f1518d9..b0daa7e6 100644 --- a/docs/test_cases/t00034_class.svg +++ b/docs/test_cases/t00034_class.svg @@ -1,6 +1,6 @@ - + @@ -9,8 +9,8 @@ - - + + Void @@ -21,8 +21,8 @@ operator!=(const Void & ) const : bool - - + + lift_void @@ -31,8 +31,8 @@ - - + + lift_void @@ -41,8 +41,8 @@ - - + + drop_void @@ -51,8 +51,8 @@ - - + + drop_void @@ -61,33 +61,33 @@ - - + + A - - + + R - + - + la : lift_void_t<A> * - + - + lv : lift_void_t<void> * diff --git a/docs/test_cases/t00035.md b/docs/test_cases/t00035.md index b3ea97c4..7372e9d9 100644 --- a/docs/test_cases/t00035.md +++ b/docs/test_cases/t00035.md @@ -150,7 +150,7 @@ struct Right { }; } ], "metadata": { - "clang_uml_version": "0.3.5-13-g57aa174", + "clang_uml_version": "0.3.5-27-g81c7ce7", "llvm_version": "Ubuntu clang version 15.0.6", "schema_version": 1 }, diff --git a/docs/test_cases/t00035_class.svg b/docs/test_cases/t00035_class.svg index 8e60faa6..2944c98a 100644 --- a/docs/test_cases/t00035_class.svg +++ b/docs/test_cases/t00035_class.svg @@ -1,6 +1,6 @@ - + @@ -9,40 +9,40 @@ - - + + Top - - + + Left - - + + Center - - + + Bottom - - + + Right diff --git a/docs/test_cases/t00036.md b/docs/test_cases/t00036.md index f5c8c6bf..fee3aa8b 100644 --- a/docs/test_cases/t00036.md +++ b/docs/test_cases/t00036.md @@ -14,6 +14,9 @@ diagrams: include: namespaces: - clanguml::t00036 + exclude: + subclasses: + - clanguml::t00036::ns2::ns22::D ``` ## Source code File t00036.cc @@ -47,9 +50,19 @@ namespace ns22 { // TODO: Fix for incomplete struct C declaration "struct C;" struct C { }; +struct D { }; + } } +namespace ns3 { +namespace ns33 { +namespace detail { +struct DImpl : public ns2::ns22::D { }; +} +} // namespace ns33 +} // namespace ns3 + } // namespace t00036 } // namespace clanguml @@ -172,6 +185,10 @@ struct C { }; "methods": [], "name": "A", "namespace": "clanguml::t00036::ns1::ns11", + "source_location": { + "file": "../../tests/t00036/t00036.cc", + "line": 10 + }, "template_parameters": [ { "is_variadic": false, @@ -223,10 +240,29 @@ struct C { }; ], "name": "ns2", "type": "namespace" + }, + { + "display_name": "clanguml::t00036::ns3", + "elements": [ + { + "display_name": "clanguml::t00036::ns3::ns33", + "elements": [ + { + "display_name": "clanguml::t00036::ns3::ns33::detail", + "name": "detail", + "type": "namespace" + } + ], + "name": "ns33", + "type": "namespace" + } + ], + "name": "ns3", + "type": "namespace" } ], "metadata": { - "clang_uml_version": "0.3.5-13-g57aa174", + "clang_uml_version": "0.3.5-27-g81c7ce7", "llvm_version": "Ubuntu clang version 15.0.6", "schema_version": 1 }, diff --git a/docs/test_cases/t00036_class.svg b/docs/test_cases/t00036_class.svg index a583a99c..d1be20a5 100644 --- a/docs/test_cases/t00036_class.svg +++ b/docs/test_cases/t00036_class.svg @@ -1,6 +1,6 @@ - + @@ -9,23 +9,23 @@ - + ns1 - + ns11 - + ns111 - + ns2 - + ns22 - - + + E @@ -34,8 +34,8 @@ yellow - - + + A @@ -43,39 +43,41 @@ T - + - + a : T - - - - A - - int - - - - + + + + + A + + int + + + + + B - + - + a_int : A<int> - - + + C diff --git a/docs/test_cases/t00037.md b/docs/test_cases/t00037.md index ab99b46b..b8fed24c 100644 --- a/docs/test_cases/t00037.md +++ b/docs/test_cases/t00037.md @@ -249,7 +249,7 @@ struct A { } ], "metadata": { - "clang_uml_version": "0.3.5-13-g57aa174", + "clang_uml_version": "0.3.5-27-g81c7ce7", "llvm_version": "Ubuntu clang version 15.0.6", "schema_version": 1 }, diff --git a/docs/test_cases/t00037_class.svg b/docs/test_cases/t00037_class.svg index 49f06702..63c8f380 100644 --- a/docs/test_cases/t00037_class.svg +++ b/docs/test_cases/t00037_class.svg @@ -1,6 +1,6 @@ - + @@ -9,98 +9,98 @@ - - + + ST - + - + dimensions : ST::(anonymous_662) - + - + units : ST::(anonymous_792) - - + + ST::(dimensions) - + - + t : double - + - + x : double - + - + y : double - + - + z : double - - + + ST::(units) - + - + c : double - + - + h : double - - + + A - + - + st : ST diff --git a/docs/test_cases/t00038.md b/docs/test_cases/t00038.md index b4c43493..9577e63a 100644 --- a/docs/test_cases/t00038.md +++ b/docs/test_cases/t00038.md @@ -468,7 +468,7 @@ struct map - + @@ -9,8 +9,8 @@ - - + + thirdparty::ns1::color_t @@ -20,16 +20,16 @@ blue - - + + thirdparty::ns1::E - - + + property_t @@ -39,47 +39,47 @@ property_c - - + + A - - + + B - - + + C - - + + key_t - + - + key : std::string - - + + map @@ -88,8 +88,8 @@ - - + + map @@ -98,8 +98,8 @@ - - + + map @@ -108,8 +108,8 @@ - - + + map @@ -118,8 +118,8 @@ - - + + map diff --git a/docs/test_cases/t00039.md b/docs/test_cases/t00039.md index 97f88f9d..4129e265 100644 --- a/docs/test_cases/t00039.md +++ b/docs/test_cases/t00039.md @@ -570,7 +570,7 @@ template struct FFF : public FF { } ], "metadata": { - "clang_uml_version": "0.3.5-13-g57aa174", + "clang_uml_version": "0.3.5-27-g81c7ce7", "llvm_version": "Ubuntu clang version 15.0.6", "schema_version": 1 }, diff --git a/docs/test_cases/t00039_class.svg b/docs/test_cases/t00039_class.svg index 0cbb8cc9..b926854b 100644 --- a/docs/test_cases/t00039_class.svg +++ b/docs/test_cases/t00039_class.svg @@ -1,6 +1,6 @@ - + @@ -9,95 +9,95 @@ - - + + C - - + + D - - + + E - - + + CD - - + + DE - - + + CDE - - + + A - - + + AA - - + + AAA - + - + b : B * - - + + ns2::AAAA - - + + ns3::F @@ -105,16 +105,16 @@ T - + - + t : T * - - + + ns3::FF @@ -122,16 +122,16 @@ T,M - + - + m : M * - - + + ns3::FE @@ -139,16 +139,16 @@ T,M - + - + m : M * - - + + ns3::FFF @@ -156,11 +156,11 @@ T,M,N - + - + n : N * diff --git a/docs/test_cases/t00040.md b/docs/test_cases/t00040.md index a40a4387..4450a8a2 100644 --- a/docs/test_cases/t00040.md +++ b/docs/test_cases/t00040.md @@ -264,7 +264,7 @@ struct R { } ], "metadata": { - "clang_uml_version": "0.3.5-13-g57aa174", + "clang_uml_version": "0.3.5-27-g81c7ce7", "llvm_version": "Ubuntu clang version 15.0.6", "schema_version": 1 }, diff --git a/docs/test_cases/t00040_class.svg b/docs/test_cases/t00040_class.svg index f5d88031..db97da45 100644 --- a/docs/test_cases/t00040_class.svg +++ b/docs/test_cases/t00040_class.svg @@ -1,6 +1,6 @@ - + @@ -9,50 +9,50 @@ - - + + A - + - + ii_ : int get_a() : int - - + + AA - - + + AAA - + - + b : B * get_aaa() : int - - + + R diff --git a/docs/test_cases/t00041.md b/docs/test_cases/t00041.md index 0b612572..3fd62237 100644 --- a/docs/test_cases/t00041.md +++ b/docs/test_cases/t00041.md @@ -351,7 +351,7 @@ struct NM : public N { }; } ], "metadata": { - "clang_uml_version": "0.3.5-13-g57aa174", + "clang_uml_version": "0.3.5-27-g81c7ce7", "llvm_version": "Ubuntu clang version 15.0.6", "schema_version": 1 }, diff --git a/docs/test_cases/t00041_class.svg b/docs/test_cases/t00041_class.svg index 5ec2efcd..1a523143 100644 --- a/docs/test_cases/t00041_class.svg +++ b/docs/test_cases/t00041_class.svg @@ -1,6 +1,6 @@ - + @@ -9,102 +9,102 @@ - - + + R - - + + D - + - + rr : RR * - - + + E - - + + F - - + + RR - + - + e : E * - + - + f : F * - + - + g : detail::G * foo(H * h) : void - - + + RRR - - + + ns1::N - - + + ns1::NN - - + + ns1::NM diff --git a/docs/test_cases/t00042.md b/docs/test_cases/t00042.md index 45f70b9e..bae57d5d 100644 --- a/docs/test_cases/t00042.md +++ b/docs/test_cases/t00042.md @@ -209,6 +209,10 @@ struct R { "methods": [], "name": "A", "namespace": "clanguml::t00042", + "source_location": { + "file": "../../tests/t00042/t00042.cc", + "line": 5 + }, "template_parameters": [ { "is_variadic": false, @@ -232,6 +236,10 @@ struct R { "methods": [], "name": "A", "namespace": "clanguml::t00042", + "source_location": { + "file": "../../tests/t00042/t00042.cc", + "line": 5 + }, "template_parameters": [ { "is_variadic": false, @@ -255,6 +263,10 @@ struct R { "methods": [], "name": "B", "namespace": "clanguml::t00042", + "source_location": { + "file": "../../tests/t00042/t00042.cc", + "line": 13 + }, "template_parameters": [ { "is_variadic": false, @@ -273,7 +285,7 @@ struct R { } ], "metadata": { - "clang_uml_version": "0.3.5-13-g57aa174", + "clang_uml_version": "0.3.5-27-g81c7ce7", "llvm_version": "Ubuntu clang version 15.0.6", "schema_version": 1 }, diff --git a/docs/test_cases/t00042_class.svg b/docs/test_cases/t00042_class.svg index d0996a71..9c6d25bb 100644 --- a/docs/test_cases/t00042_class.svg +++ b/docs/test_cases/t00042_class.svg @@ -1,6 +1,6 @@ - + @@ -9,8 +9,8 @@ - - + + A @@ -18,16 +18,16 @@ T - + - + a : T - - + + A @@ -35,16 +35,16 @@ void - + - + a : void * - - + + B @@ -52,45 +52,51 @@ T,K - + - + b : T - + - + bb : K - - - - A - - double - - - - - - A - - std::string - - - - - - B - - int,float - - + + + + + A + + double + + + + + + + + A + + std::string + + + + + + + + B + + int,float + + + diff --git a/docs/test_cases/t00043.md b/docs/test_cases/t00043.md index 9a79adf1..24bfe153 100644 --- a/docs/test_cases/t00043.md +++ b/docs/test_cases/t00043.md @@ -499,7 +499,7 @@ struct J { } ], "metadata": { - "clang_uml_version": "0.3.5-13-g57aa174", + "clang_uml_version": "0.3.5-27-g81c7ce7", "llvm_version": "Ubuntu clang version 15.0.6", "schema_version": 1 }, diff --git a/docs/test_cases/t00043_class.svg b/docs/test_cases/t00043_class.svg index f7ef741d..d9352208 100644 --- a/docs/test_cases/t00043_class.svg +++ b/docs/test_cases/t00043_class.svg @@ -1,6 +1,6 @@ - + @@ -9,22 +9,22 @@ - + dependants - + dependencies - - + + A - - + + B @@ -33,8 +33,8 @@ b(dependants::A * a) : void - - + + BB @@ -43,8 +43,8 @@ bb(dependants::A * a) : void - - + + C @@ -53,8 +53,8 @@ c(dependants::B * b) : void - - + + D @@ -65,8 +65,8 @@ dd(dependants::BB * bb) : void - - + + E @@ -75,24 +75,24 @@ e(dependants::D * d) : void - - + + G - - + + GG - - + + H @@ -103,8 +103,8 @@ hh(dependencies::GG * gg) : void - - + + I @@ -113,8 +113,8 @@ i(dependencies::H * h) : void - - + + J diff --git a/docs/test_cases/t00044.md b/docs/test_cases/t00044.md index f89cd737..f1968f76 100644 --- a/docs/test_cases/t00044.md +++ b/docs/test_cases/t00044.md @@ -77,6 +77,10 @@ struct R { "methods": [], "name": "signal_handler", "namespace": "clanguml::t00044", + "source_location": { + "file": "../../tests/t00044/t00044.cc", + "line": 4 + }, "template_parameters": [ { "is_variadic": false, @@ -211,6 +215,10 @@ struct R { "methods": [], "name": "signal_handler", "namespace": "clanguml::t00044", + "source_location": { + "file": "../../tests/t00044/t00044.cc", + "line": 4 + }, "template_parameters": [ { "is_variadic": false, @@ -252,6 +260,10 @@ struct R { "methods": [], "name": "sink", "namespace": "clanguml::t00044", + "source_location": { + "file": "../../tests/t00044/t00044.cc", + "line": 4 + }, "template_parameters": [ { "is_variadic": false, @@ -380,7 +392,7 @@ struct R { } ], "metadata": { - "clang_uml_version": "0.3.5-13-g57aa174", + "clang_uml_version": "0.3.5-27-g81c7ce7", "llvm_version": "Ubuntu clang version 15.0.6", "schema_version": 1 }, diff --git a/docs/test_cases/t00044_class.svg b/docs/test_cases/t00044_class.svg index e0075f8a..3fa40f85 100644 --- a/docs/test_cases/t00044_class.svg +++ b/docs/test_cases/t00044_class.svg @@ -1,6 +1,6 @@ - + @@ -9,16 +9,18 @@ - - - - signal_handler - - Ret(Args...),A - - - - + + + + + signal_handler + + Ret(Args...),A + + + + + sink @@ -26,11 +28,11 @@ signal_handler<Ret(Args...),A> - + - + signal : signal_t * @@ -38,39 +40,43 @@ sink(signal_t & sh) : void get_signal<CastTo>() : CastTo * - - - - signal_handler - - void(int),bool - - - - - - sink - - signal_handler<void(int),bool> - - - - + + + + + signal_handler + + void(int),bool + + + + + + + + sink + + signal_handler<void(int),bool> + + + + + R - + - + sink1 : sink<signal_handler<void (int),bool>> - - + + signal_handler @@ -79,8 +85,8 @@ - - + + sink diff --git a/docs/test_cases/t00045.md b/docs/test_cases/t00045.md index 34ba2084..15ee56aa 100644 --- a/docs/test_cases/t00045.md +++ b/docs/test_cases/t00045.md @@ -414,7 +414,7 @@ public: } ], "metadata": { - "clang_uml_version": "0.3.5-13-g57aa174", + "clang_uml_version": "0.3.5-27-g81c7ce7", "llvm_version": "Ubuntu clang version 15.0.6", "schema_version": 1 }, diff --git a/docs/test_cases/t00045_class.svg b/docs/test_cases/t00045_class.svg index 4d467040..b323eac7 100644 --- a/docs/test_cases/t00045_class.svg +++ b/docs/test_cases/t00045_class.svg @@ -1,6 +1,6 @@ - + @@ -9,32 +9,32 @@ - - + + A - - + + AA - - + + AAA - - + + AAAA @@ -42,103 +42,103 @@ T - + - + t : T - - + + ns1::A - - + + ns1::ns2::A - - + + ns1::ns2::B - - + + ns1::ns2::C - - + + ns1::ns2::D - - + + ns1::ns2::E - - + + ns1::ns2::AAA - - + + ns1::ns2::R - + - + a : ns1::ns2::A * - + - + ns1_a : ns1::A * - + - + ns1_ns2_a : ns1::ns2::A * - + - + root_a : ::A * diff --git a/docs/test_cases/t00046.md b/docs/test_cases/t00046.md index 1c685800..f58357d6 100644 --- a/docs/test_cases/t00046.md +++ b/docs/test_cases/t00046.md @@ -60,11 +60,6 @@ public: { "diagram_type": "class", "elements": [ - { - "display_name": "__gnu_cxx", - "name": "__gnu_cxx", - "type": "namespace" - }, { "bases": [], "display_name": "A", @@ -358,7 +353,7 @@ public: } ], "metadata": { - "clang_uml_version": "0.3.5-13-g57aa174", + "clang_uml_version": "0.3.5-27-g81c7ce7", "llvm_version": "Ubuntu clang version 15.0.6", "schema_version": 1 }, diff --git a/docs/test_cases/t00046_class.svg b/docs/test_cases/t00046_class.svg index 2ea05322..39ab2542 100644 --- a/docs/test_cases/t00046_class.svg +++ b/docs/test_cases/t00046_class.svg @@ -1,6 +1,6 @@ - + - + @@ -9,148 +9,145 @@ - - - ns1 - - - ns2 - - - __gnu_cxx - - - - - A - - + + + ns1 + + + ns2 + + + + + A + + - - - - - A - - + + + + + A + + - - - - - B - - + + + + + B + + - - - - - C - - + + + + + C + + - - - - - D - - + + + + + D + + - - - - - E - - + + + + + E + + - - - - - R - + + + + + R + - - - + + + - - a : ns1::ns2::A * + + a : ns1::ns2::A * - - - + + + - - ns1_a : ns1::A * + + ns1_a : ns1::A * - - - + + + - - ns1_ns2_a : ns1::ns2::A * + + ns1_ns2_a : ns1::ns2::A * - - - + + + - - root_a : ::A * + + root_a : ::A * - - - + + + - - i : std::vector<std::uint8_t> + + i : std::vector<std::uint8_t> - - - foo(AA & aa) : void - - - - - A - - + + + foo(AA & aa) : void + + + + + A + + - - - - - AA - - + + + + + AA + + - - - - - - - - - - - - - +a - - - - ns1_ns2_a - - - - ns1_a - - - - root_a + + + + + + + + + + + + + +a + + + + ns1_ns2_a + + + + ns1_a + + + + root_a diff --git a/docs/test_cases/t00047.md b/docs/test_cases/t00047.md index 2a72fd39..559d1d14 100644 --- a/docs/test_cases/t00047.md +++ b/docs/test_cases/t00047.md @@ -184,7 +184,7 @@ using conditional = typename conditional_t::type; } ], "metadata": { - "clang_uml_version": "0.3.5-13-g57aa174", + "clang_uml_version": "0.3.5-27-g81c7ce7", "llvm_version": "Ubuntu clang version 15.0.6", "schema_version": 1 }, diff --git a/docs/test_cases/t00047_class.svg b/docs/test_cases/t00047_class.svg index d81f25e4..cd92735c 100644 --- a/docs/test_cases/t00047_class.svg +++ b/docs/test_cases/t00047_class.svg @@ -1,6 +1,6 @@ - + @@ -9,8 +9,8 @@ - - + + conditional_t @@ -19,8 +19,8 @@ - - + + conditional_t @@ -29,8 +29,8 @@ - - + + conditional_t @@ -39,8 +39,8 @@ - - + + conditional_t diff --git a/docs/test_cases/t00048.md b/docs/test_cases/t00048.md index 9e668abc..a4292f77 100644 --- a/docs/test_cases/t00048.md +++ b/docs/test_cases/t00048.md @@ -442,7 +442,7 @@ template struct BaseTemplate { } ], "metadata": { - "clang_uml_version": "0.3.5-13-g57aa174", + "clang_uml_version": "0.3.5-27-g81c7ce7", "llvm_version": "Ubuntu clang version 15.0.6", "schema_version": 1 }, diff --git a/docs/test_cases/t00048_class.svg b/docs/test_cases/t00048_class.svg index 6c24b0fb..c22196b7 100644 --- a/docs/test_cases/t00048_class.svg +++ b/docs/test_cases/t00048_class.svg @@ -1,6 +1,6 @@ - + @@ -9,25 +9,25 @@ - - + + Base - + - + base : int foo() = 0 : void - - + + BaseTemplate @@ -35,35 +35,35 @@ T - + - + base : T foo() = 0 : void - - + + B - + - + b : int foo() : void - - + + BTemplate @@ -71,35 +71,35 @@ T - + - + b : T foo() : void - - + + A - + - + a : int foo() : void - - + + ATemplate @@ -107,11 +107,11 @@ T - + - + a : T diff --git a/docs/test_cases/t00049.md b/docs/test_cases/t00049.md index b4860558..384acfbe 100644 --- a/docs/test_cases/t00049.md +++ b/docs/test_cases/t00049.md @@ -117,6 +117,10 @@ struct R { "methods": [], "name": "A", "namespace": "clanguml::t00049", + "source_location": { + "file": "../../tests/t00049/t00049.cc", + "line": 7 + }, "template_parameters": [ { "is_variadic": false, @@ -140,6 +144,10 @@ struct R { "methods": [], "name": "A", "namespace": "clanguml::t00049", + "source_location": { + "file": "../../tests/t00049/t00049.cc", + "line": 7 + }, "template_parameters": [ { "is_variadic": false, @@ -163,6 +171,10 @@ struct R { "methods": [], "name": "A", "namespace": "clanguml::t00049", + "source_location": { + "file": "../../tests/t00049/t00049.cc", + "line": 7 + }, "template_parameters": [ { "is_variadic": false, @@ -256,7 +268,7 @@ struct R { } ], "metadata": { - "clang_uml_version": "0.3.5-13-g57aa174", + "clang_uml_version": "0.3.5-27-g81c7ce7", "llvm_version": "Ubuntu clang version 15.0.6", "schema_version": 1 }, diff --git a/docs/test_cases/t00049_class.svg b/docs/test_cases/t00049_class.svg index 49cac2c5..ea83bd03 100644 --- a/docs/test_cases/t00049_class.svg +++ b/docs/test_cases/t00049_class.svg @@ -1,6 +1,6 @@ - + @@ -9,8 +9,8 @@ - - + + A @@ -18,66 +18,72 @@ T - + - + a : T get_a() : T & - - - - A - - intmap - - - - - - A - - thestring - - - - - - A - - string_vector - - - - + + + + + A + + intmap + + + + + + + + A + + thestring + + + + + + + + A + + string_vector + + + + + R - + - + a_string : A<thestring> - + - + a_vector_string : A<string_vector> - + - + a_int_map : A<intmap> diff --git a/docs/test_cases/t00050.md b/docs/test_cases/t00050.md index 1c4ccbce..16bafbfc 100644 --- a/docs/test_cases/t00050.md +++ b/docs/test_cases/t00050.md @@ -484,7 +484,7 @@ class NoComment { }; } ], "metadata": { - "clang_uml_version": "0.3.5-13-g57aa174", + "clang_uml_version": "0.3.5-27-g81c7ce7", "llvm_version": "Ubuntu clang version 15.0.6", "schema_version": 1 }, diff --git a/docs/test_cases/t00050_class.svg b/docs/test_cases/t00050_class.svg index 6a6fee44..4a281769 100644 --- a/docs/test_cases/t00050_class.svg +++ b/docs/test_cases/t00050_class.svg @@ -1,6 +1,6 @@ - + @@ -9,40 +9,40 @@ - - + + A - - + + B - - + + C - - + + utils::D - - + + E @@ -52,8 +52,8 @@ E3 - - + + F @@ -61,44 +61,44 @@ T,V,int N - + - + t : T[N] - + - + v : V - - + + G - - + + NoComment - + Lorem ipsum dolor sit - + Lorem ipsum dolor sit - + Lorem ipsum dolor sit amet consectetur adipiscing elit, urna consequat felis vehicula class ultricies mollis dictumst, aenean non a in donec nulla. @@ -125,50 +125,50 @@ imperdiet praesent magnis ridiculus congue gravida curabitur dictum sagittis, enim et magna sit inceptos sodales parturient pharetra mollis, aenean vel nostra tellus commodo pretium sapien sociosqu. - + This is a short description of class G. - + This is an intermediate description of class G. - + This is a long description of class G. - + Lorem ipsum - + TODO 1. Write meaningful comment - + TODO 2. Write tests - + TODO 3. Implement - + Long comment example - + TODO Implement... - + Simple array wrapper. - + Template parameters @@ -181,6 +181,6 @@ N Size of T array. - + diff --git a/docs/test_cases/t00051.md b/docs/test_cases/t00051.md index 31c61d12..30f4cedf 100644 --- a/docs/test_cases/t00051.md +++ b/docs/test_cases/t00051.md @@ -469,7 +469,7 @@ A::custom_thread2 A::start_thread2() } ], "metadata": { - "clang_uml_version": "0.3.5-13-g57aa174", + "clang_uml_version": "0.3.5-27-g81c7ce7", "llvm_version": "Ubuntu clang version 15.0.6", "schema_version": 1 }, diff --git a/docs/test_cases/t00051_class.svg b/docs/test_cases/t00051_class.svg index 71bdbe4a..ad8c843a 100644 --- a/docs/test_cases/t00051_class.svg +++ b/docs/test_cases/t00051_class.svg @@ -1,6 +1,6 @@ - + @@ -9,8 +9,8 @@ - - + + B @@ -18,18 +18,18 @@ F,FF=F - + - + f_ : F - + - + ff_ : FF @@ -39,8 +39,8 @@ f() : void ff() : void - - + + B<(lambda at ../../tests/t00051/t00051.cc:43:18),(lambda at ../../tests/t00051/t00051.cc:43:27)> @@ -53,22 +53,22 @@ ff() : void - + - + f_ : (lambda at ../../tests/t00051/t00051.cc:43:18) - + - + ff_ : (lambda at ../../tests/t00051/t00051.cc:43:27) - - + + A @@ -83,8 +83,8 @@ get_function() : (lambda at ../../tests/t00051/t00051.cc:48:16) - - + + A::custom_thread1 @@ -93,8 +93,8 @@ custom_thread1<Function,Args...>(Function && f, Args &&... args) : void - - + + A::custom_thread2 diff --git a/docs/test_cases/t00052.md b/docs/test_cases/t00052.md index ecd7fb83..ef63f962 100644 --- a/docs/test_cases/t00052.md +++ b/docs/test_cases/t00052.md @@ -243,6 +243,10 @@ struct R { "methods": [], "name": "B", "namespace": "clanguml::t00052", + "source_location": { + "file": "../../tests/t00052/t00052.cc", + "line": 13 + }, "template_parameters": [ { "is_variadic": false, @@ -266,6 +270,10 @@ struct R { "methods": [], "name": "C", "namespace": "clanguml::t00052", + "source_location": { + "file": "../../tests/t00052/t00052.cc", + "line": 20 + }, "template_parameters": [ { "is_variadic": false, @@ -329,7 +337,7 @@ struct R { } ], "metadata": { - "clang_uml_version": "0.3.5-13-g57aa174", + "clang_uml_version": "0.3.5-27-g81c7ce7", "llvm_version": "Ubuntu clang version 15.0.6", "schema_version": 1 }, diff --git a/docs/test_cases/t00052_class.svg b/docs/test_cases/t00052_class.svg index b50567d7..fd9fdaf4 100644 --- a/docs/test_cases/t00052_class.svg +++ b/docs/test_cases/t00052_class.svg @@ -1,6 +1,6 @@ - + @@ -9,8 +9,8 @@ - - + + A @@ -21,8 +21,8 @@ aa<F,Q>(F && f, Q q) : void - - + + B @@ -35,8 +35,8 @@ bb<F>(F && f, T t) : T - - + + C @@ -47,48 +47,52 @@ c<P>(P p) : T - - - - B - - int - - - - - - C - - int - - - - + + + + + B + + int + + + + + + + + C + + int + + + + + R - + - + a : A - + - + b : B<int> - + - + c : C<int> diff --git a/docs/test_cases/t00053.md b/docs/test_cases/t00053.md index 7981544b..82d1c794 100644 --- a/docs/test_cases/t00053.md +++ b/docs/test_cases/t00053.md @@ -384,7 +384,7 @@ enum class j { jjj }; } ], "metadata": { - "clang_uml_version": "0.3.5-13-g57aa174", + "clang_uml_version": "0.3.5-27-g81c7ce7", "llvm_version": "Ubuntu clang version 15.0.6", "schema_version": 1 }, diff --git a/docs/test_cases/t00053_class.svg b/docs/test_cases/t00053_class.svg index bb092054..10991a29 100644 --- a/docs/test_cases/t00053_class.svg +++ b/docs/test_cases/t00053_class.svg @@ -1,6 +1,6 @@ - + @@ -9,72 +9,72 @@ - - + + A - - + + C - - + + E - - + + F - - + + a - - + + c - - + + e - - + + f - - + + h @@ -82,8 +82,8 @@ hhh - - + + j @@ -91,56 +91,56 @@ jjj - - + + b - - + + d - - + + g - - + + B - - + + D - - + + G - - + + i diff --git a/docs/test_cases/t00054.md b/docs/test_cases/t00054.md index 0d7dc702..33e5812a 100644 --- a/docs/test_cases/t00054.md +++ b/docs/test_cases/t00054.md @@ -426,7 +426,7 @@ enum class j { jjj }; } ], "metadata": { - "clang_uml_version": "0.3.5-13-g57aa174", + "clang_uml_version": "0.3.5-27-g81c7ce7", "llvm_version": "Ubuntu clang version 15.0.6", "schema_version": 1 }, diff --git a/docs/test_cases/t00054_class.svg b/docs/test_cases/t00054_class.svg index 4c2fe03e..33bf9296 100644 --- a/docs/test_cases/t00054_class.svg +++ b/docs/test_cases/t00054_class.svg @@ -1,6 +1,6 @@ - + @@ -9,116 +9,116 @@ - + detail - + detail2 - + detail3 - + detail4 - - + + d - - + + a - - + + c - - + + e - - + + C - - + + F - - + + D - - + + E - - + + A - - + + B - - + + f - - + + G - - + + h @@ -127,8 +127,8 @@ hhh - - + + i @@ -137,8 +137,8 @@ iii - - + + j @@ -147,16 +147,16 @@ jjj - - + + b - - + + g diff --git a/docs/test_cases/t00055.md b/docs/test_cases/t00055.md index b75fe787..6e3b4c16 100644 --- a/docs/test_cases/t00055.md +++ b/docs/test_cases/t00055.md @@ -246,7 +246,7 @@ struct J { }; } ], "metadata": { - "clang_uml_version": "0.3.5-13-g57aa174", + "clang_uml_version": "0.3.5-27-g81c7ce7", "llvm_version": "Ubuntu clang version 15.0.6", "schema_version": 1 }, diff --git a/docs/test_cases/t00055_class.svg b/docs/test_cases/t00055_class.svg index f0a9ffe5..d9198c0c 100644 --- a/docs/test_cases/t00055_class.svg +++ b/docs/test_cases/t00055_class.svg @@ -1,6 +1,6 @@ - + @@ -9,80 +9,80 @@ - - + + A - - + + B - - + + C - - + + D - - + + E - - + + F - - + + G - - + + H - - + + I - - + + J diff --git a/docs/test_cases/t00056.md b/docs/test_cases/t00056.md index d62f25cd..9bb2a2fe 100644 --- a/docs/test_cases/t00056.md +++ b/docs/test_cases/t00056.md @@ -559,7 +559,7 @@ struct F { } ], "metadata": { - "clang_uml_version": "0.3.5-13-g57aa174", + "clang_uml_version": "0.3.5-27-g81c7ce7", "llvm_version": "Ubuntu clang version 15.0.6", "schema_version": 1 }, diff --git a/docs/test_cases/t00056_class.svg b/docs/test_cases/t00056_class.svg index 609a7a22..1673c9ed 100644 --- a/docs/test_cases/t00056_class.svg +++ b/docs/test_cases/t00056_class.svg @@ -1,6 +1,6 @@ - + @@ -9,8 +9,8 @@ - - + + «concept» @@ -20,8 +20,8 @@ - - + + «concept» @@ -33,8 +33,8 @@ sizeof (l) > sizeof (r) - - + + «concept» @@ -44,8 +44,8 @@ - - + + «concept» @@ -58,8 +58,8 @@ container.begin() container.end() - - + + «concept» @@ -71,8 +71,8 @@ typename T::value_type - - + + «concept» @@ -86,8 +86,8 @@ {std::to_string(s)} noexcept {std::to_string(s)} -> std::same_as<std::string> - - + + «concept» @@ -97,8 +97,8 @@ - - + + «concept» @@ -108,8 +108,8 @@ - - + + A @@ -117,16 +117,16 @@ max_four_bytes T - + - + a : T - - + + B @@ -134,16 +134,16 @@ T - + - + b : T - - + + C @@ -151,16 +151,16 @@ convertible_to_string T - + - + c : T - - + + D @@ -169,8 +169,8 @@ - - + + E @@ -178,30 +178,30 @@ T1,T2,T3 - + - + e1 : T1 - + - + e2 : T2 - + - + e3 : T3 - - + + F @@ -209,25 +209,25 @@ T1,T2,T3 - + - + f1 : T1 - + - + f2 : T2 - + - + f3 : T3 diff --git a/docs/test_cases/t00057.md b/docs/test_cases/t00057.md index f922fc87..7bc2739b 100644 --- a/docs/test_cases/t00057.md +++ b/docs/test_cases/t00057.md @@ -488,7 +488,7 @@ struct t00057_R { } ], "metadata": { - "clang_uml_version": "0.3.5-13-g57aa174", + "clang_uml_version": "0.3.5-27-g81c7ce7", "llvm_version": "Ubuntu clang version 15.0.6", "schema_version": 1 }, diff --git a/docs/test_cases/t00057_class.svg b/docs/test_cases/t00057_class.svg index dac17961..243dd5f7 100644 --- a/docs/test_cases/t00057_class.svg +++ b/docs/test_cases/t00057_class.svg @@ -1,6 +1,6 @@ - + @@ -9,232 +9,232 @@ - - + + t00057_A - + - + a1 : int - - + + t00057_B - + - + b1 : int - - + + t00057_C - + - + c1 : int - - + + «union» t00057_D - + - + d1 : int - + - + d2 : float - - + + t00057_E - + - + e : int - + - + coordinates : t00057_E::(anonymous_739) - + - + height : t00057_E::(anonymous_807) - - + + t00057_E::(coordinates) - + - + x : int - + - + y : int - - + + «union» t00057_E::(height) - + - + z : int - + - + t : double - - + + t00057_G - + - + g1 : int - - + + t00057_R - + - + a : struct t00057_A - + - + b : t00057_B - + - + c : struct t00057_C * - + - + d : union t00057_D - + - + e : struct t00057_E * - + - + f : struct t00057_F * - + - + g : struct t00057_G * - - + + t00057_F - + - + f1 : int diff --git a/docs/test_cases/t00058.md b/docs/test_cases/t00058.md index a113828a..00238b19 100644 --- a/docs/test_cases/t00058.md +++ b/docs/test_cases/t00058.md @@ -235,6 +235,10 @@ struct R { "methods": [], "name": "A", "namespace": "clanguml::t00058", + "source_location": { + "file": "../../tests/t00058/t00058.cc", + "line": 27 + }, "template_parameters": [ { "is_variadic": false, @@ -276,6 +280,10 @@ struct R { "methods": [], "name": "A", "namespace": "clanguml::t00058", + "source_location": { + "file": "../../tests/t00058/t00058.cc", + "line": 33 + }, "template_parameters": [ { "is_variadic": false, @@ -305,6 +313,10 @@ struct R { "methods": [], "name": "B", "namespace": "clanguml::t00058", + "source_location": { + "file": "../../tests/t00058/t00058.cc", + "line": 33 + }, "template_parameters": [ { "is_variadic": false, @@ -395,7 +407,7 @@ struct R { } ], "metadata": { - "clang_uml_version": "0.3.5-13-g57aa174", + "clang_uml_version": "0.3.5-27-g81c7ce7", "llvm_version": "Ubuntu clang version 15.0.6", "schema_version": 1 }, diff --git a/docs/test_cases/t00058_class.svg b/docs/test_cases/t00058_class.svg index db85080f..3d066322 100644 --- a/docs/test_cases/t00058_class.svg +++ b/docs/test_cases/t00058_class.svg @@ -1,6 +1,6 @@ - + @@ -9,8 +9,8 @@ - - + + first_type @@ -19,8 +19,8 @@ - - + + «concept» @@ -30,8 +30,8 @@ - - + + A @@ -39,16 +39,16 @@ T,Args... - + - + a : std::vector<T> - - + + B @@ -56,64 +56,70 @@ T,P,Args... - + - + b : std::vector<T> - + - + bb : P - - - - A - - int,int,double,std::string - - - - - - A - - int,int - - - - - - B - - int,std::string,int,double,A<int,int> - - - - + + + + + A + + int,int,double,std::string + + + + + + + + A + + int,int + + + + + + + + B + + int,std::string,int,double,A<int,int> + + + + + R - + - + aa : A<int,int,double,std::string> - + - + bb : B<int,std::string,int,double,A<int,int>> diff --git a/docs/test_cases/t00059.md b/docs/test_cases/t00059.md index c3c94ed0..976a2ff5 100644 --- a/docs/test_cases/t00059.md +++ b/docs/test_cases/t00059.md @@ -393,6 +393,10 @@ struct R { "methods": [], "name": "fruit_factory", "namespace": "clanguml::t00059", + "source_location": { + "file": "../../tests/t00059/t00059.cc", + "line": 42 + }, "template_parameters": [ { "is_variadic": false, @@ -422,6 +426,10 @@ struct R { "methods": [], "name": "fruit_factory", "namespace": "clanguml::t00059", + "source_location": { + "file": "../../tests/t00059/t00059.cc", + "line": 42 + }, "template_parameters": [ { "is_variadic": false, @@ -481,7 +489,7 @@ struct R { } ], "metadata": { - "clang_uml_version": "0.3.5-13-g57aa174", + "clang_uml_version": "0.3.5-27-g81c7ce7", "llvm_version": "Ubuntu clang version 15.0.6", "schema_version": 1 }, diff --git a/docs/test_cases/t00059_class.svg b/docs/test_cases/t00059_class.svg index 7f36ed0a..555fe191 100644 --- a/docs/test_cases/t00059_class.svg +++ b/docs/test_cases/t00059_class.svg @@ -1,6 +1,6 @@ - + @@ -9,8 +9,8 @@ - - + + «concept» @@ -23,8 +23,8 @@ T{} t.get_name() - - + + «concept» @@ -36,8 +36,8 @@ t.get_sweetness() - - + + «concept» @@ -49,8 +49,8 @@ t.get_bitterness() - - + + gala_apple @@ -61,8 +61,8 @@ get_sweetness() const : float - - + + empire_apple @@ -73,8 +73,8 @@ get_sweetness() const : float - - + + lima_orange @@ -85,8 +85,8 @@ get_bitterness() const : float - - + + valencia_orange @@ -97,8 +97,8 @@ get_bitterness() const : float - - + + fruit_factory @@ -111,41 +111,45 @@ create_orange() const : TO - - - - fruit_factory - - gala_apple,valencia_orange - - - - - - fruit_factory - - empire_apple,lima_orange - - - - + + + + + fruit_factory + + gala_apple,valencia_orange + + + + + + + + fruit_factory + + empire_apple,lima_orange + + + + + R - + - + factory_1 : fruit_factory_1 - + - + factory_2 : fruit_factory_2 diff --git a/docs/test_cases/t00060.md b/docs/test_cases/t00060.md index 5c6f7ca7..b00de732 100644 --- a/docs/test_cases/t00060.md +++ b/docs/test_cases/t00060.md @@ -256,7 +256,7 @@ template struct H : public G { } ], "metadata": { - "clang_uml_version": "0.3.5-13-g57aa174", + "clang_uml_version": "0.3.5-27-g81c7ce7", "llvm_version": "Ubuntu clang version 15.0.6", "schema_version": 1 }, diff --git a/docs/test_cases/t00060_class.svg b/docs/test_cases/t00060_class.svg index c8a8cfa6..4be7f3d2 100644 --- a/docs/test_cases/t00060_class.svg +++ b/docs/test_cases/t00060_class.svg @@ -1,6 +1,6 @@ - + @@ -9,40 +9,40 @@ - - + + A - - + + B - - + + C - - + + D - - + + G @@ -50,16 +50,16 @@ T - + - + g : T - - + + H @@ -67,18 +67,18 @@ T,P - + - + h : G<T> - + - + hh : P diff --git a/docs/test_cases/t00061.md b/docs/test_cases/t00061.md index adaaa992..5728555b 100644 --- a/docs/test_cases/t00061.md +++ b/docs/test_cases/t00061.md @@ -6,7 +6,7 @@ output_directory: puml diagrams: t00061_class: type: class - relative_to: ../../tests/t00061 + relative_to: ../../../tests/t00061 glob: - t00061.cc include: @@ -53,7 +53,7 @@ struct C { "name": "A", "namespace": "clanguml::t00061", "source_location": { - "file": "include/t00061_a.h", + "file": "../../clang-uml/tests/t00061/include/t00061_a.h", "line": 3 }, "template_parameters": [], @@ -61,7 +61,7 @@ struct C { } ], "metadata": { - "clang_uml_version": "0.3.5-13-g57aa174", + "clang_uml_version": "0.3.5-27-g81c7ce7", "llvm_version": "Ubuntu clang version 15.0.6", "schema_version": 1 }, diff --git a/docs/test_cases/t00061_class.svg b/docs/test_cases/t00061_class.svg index e0c98189..d07a4fa2 100644 --- a/docs/test_cases/t00061_class.svg +++ b/docs/test_cases/t00061_class.svg @@ -1,6 +1,6 @@ - + @@ -9,8 +9,8 @@ - - + + A diff --git a/docs/test_cases/t00062.md b/docs/test_cases/t00062.md index a8432544..897c64f2 100644 --- a/docs/test_cases/t00062.md +++ b/docs/test_cases/t00062.md @@ -1272,7 +1272,7 @@ struct A> { } ], "metadata": { - "clang_uml_version": "0.3.5-13-g57aa174", + "clang_uml_version": "0.3.5-27-g81c7ce7", "llvm_version": "Ubuntu clang version 15.0.6", "schema_version": 1 }, diff --git a/docs/test_cases/t00062_class.svg b/docs/test_cases/t00062_class.svg index b57d2f87..ea2fdd20 100644 --- a/docs/test_cases/t00062_class.svg +++ b/docs/test_cases/t00062_class.svg @@ -1,6 +1,6 @@ - + @@ -9,8 +9,8 @@ - - + + A @@ -18,16 +18,16 @@ U & - + - + u : U & - - + + A @@ -35,16 +35,16 @@ std::map<std::string,U> & - + - + u : U & - - + + A @@ -53,8 +53,8 @@ - - + + A @@ -62,16 +62,16 @@ U * * - + - + u : U ** - - + + A @@ -79,16 +79,16 @@ U * * const* - + - + u : U *** - - + + A @@ -96,16 +96,16 @@ U const volatile* const volatile - + - + u : U *** - - + + A @@ -113,16 +113,16 @@ U && - + - + u : U && - - + + A @@ -130,16 +130,16 @@ U const& - + - + u : const U & - - + + A @@ -147,23 +147,23 @@ M C::* - + - + c : C & - + - + m : M C::* - - + + A @@ -171,23 +171,23 @@ M C::* && - + - + c : C && - + - + m : M C::* - - + + A @@ -195,23 +195,23 @@ M (C::*)(Arg) - + - + c : C & - + - + m : M C::* - - + + A @@ -219,16 +219,16 @@ int (C::*)(bool) - + - + c : C & - - + + A @@ -236,23 +236,23 @@ M (C::*)(Arg) && - + - + c : C && - + - + m : M C::* - - + + A @@ -260,23 +260,23 @@ float (C::*)(int) && - + - + c : C && - + - + mf : float C::* - - + + A @@ -284,23 +284,23 @@ M (C::*)(Arg1,Arg2,Arg3) - + - + c : C & - + - + m : M C::* - - + + A @@ -308,16 +308,16 @@ char[N] - + - + n : char[N] - - + + A @@ -325,16 +325,16 @@ char[1000] - + - + n : std::vector<char> - - + + A @@ -342,16 +342,16 @@ char[M][L][K] - + - + klm : char[K][L][M] - - + + A @@ -359,16 +359,16 @@ U(...) - + - + u : bool - - + + A @@ -376,16 +376,16 @@ C<T> - + - + c : C<T> - - + + A @@ -393,23 +393,23 @@ C<T,Args...> - + - + c : C<T> - + - + args : std::tuple<Args...> - - + + A diff --git a/docs/test_cases/t00063.md b/docs/test_cases/t00063.md index 993ccbc9..502bc889 100644 --- a/docs/test_cases/t00063.md +++ b/docs/test_cases/t00063.md @@ -59,7 +59,7 @@ enum class C { c1, c2, c3 }; } ], "metadata": { - "clang_uml_version": "0.3.5-13-g57aa174", + "clang_uml_version": "0.3.5-27-g81c7ce7", "llvm_version": "Ubuntu clang version 15.0.6", "schema_version": 1 }, diff --git a/docs/test_cases/t00063_class.svg b/docs/test_cases/t00063_class.svg index 84e89f9f..35ac7781 100644 --- a/docs/test_cases/t00063_class.svg +++ b/docs/test_cases/t00063_class.svg @@ -1,6 +1,6 @@ - + @@ -9,8 +9,8 @@ - - + + A diff --git a/docs/test_cases/t00064.md b/docs/test_cases/t00064.md index 85432121..8b1bac21 100644 --- a/docs/test_cases/t00064.md +++ b/docs/test_cases/t00064.md @@ -207,6 +207,10 @@ public: "methods": [], "name": "type_list", "namespace": "clanguml::t00064", + "source_location": { + "file": "../../tests/t00064/t00064.cc", + "line": 15 + }, "template_parameters": [ { "is_variadic": false, @@ -276,6 +280,10 @@ public: "methods": [], "name": "type_list", "namespace": "clanguml::t00064", + "source_location": { + "file": "../../tests/t00064/t00064.cc", + "line": 8 + }, "template_parameters": [ { "is_variadic": true, @@ -299,6 +307,10 @@ public: "methods": [], "name": "type_list", "namespace": "clanguml::t00064", + "source_location": { + "file": "../../tests/t00064/t00064.cc", + "line": 25 + }, "template_parameters": [ { "is_variadic": true, @@ -322,6 +334,10 @@ public: "methods": [], "name": "type_list", "namespace": "clanguml::t00064", + "source_location": { + "file": "../../tests/t00064/t00064.cc", + "line": 25 + }, "template_parameters": [ { "is_variadic": true, @@ -430,6 +446,10 @@ public: "methods": [], "name": "optional_ref", "namespace": "clanguml::t00064", + "source_location": { + "file": "../../tests/t00064/t00064.cc", + "line": 31 + }, "template_parameters": [ { "is_variadic": false, @@ -618,6 +638,10 @@ public: "methods": [], "name": "type_list", "namespace": "clanguml::t00064", + "source_location": { + "file": "../../tests/t00064/t00064.cc", + "line": 8 + }, "template_parameters": [ { "is_variadic": false, @@ -653,6 +677,10 @@ public: "methods": [], "name": "type_list", "namespace": "clanguml::t00064", + "source_location": { + "file": "../../tests/t00064/t00064.cc", + "line": 25 + }, "template_parameters": [ { "is_variadic": false, @@ -682,6 +710,10 @@ public: "methods": [], "name": "type_list", "namespace": "clanguml::t00064", + "source_location": { + "file": "../../tests/t00064/t00064.cc", + "line": 25 + }, "template_parameters": [ { "is_variadic": false, @@ -717,6 +749,10 @@ public: "methods": [], "name": "type_group_pair", "namespace": "clanguml::t00064", + "source_location": { + "file": "../../tests/t00064/t00064.cc", + "line": 25 + }, "template_parameters": [ { "is_variadic": false, @@ -907,7 +943,7 @@ public: } ], "metadata": { - "clang_uml_version": "0.3.5-13-g57aa174", + "clang_uml_version": "0.3.5-27-g81c7ce7", "llvm_version": "Ubuntu clang version 15.0.6", "schema_version": 1 }, diff --git a/docs/test_cases/t00064_class.svg b/docs/test_cases/t00064_class.svg index 771a0730..56c16745 100644 --- a/docs/test_cases/t00064_class.svg +++ b/docs/test_cases/t00064_class.svg @@ -1,6 +1,6 @@ - + @@ -9,8 +9,8 @@ - - + + type_list @@ -19,8 +19,8 @@ - - + + type_list @@ -29,8 +29,8 @@ - - + + type_list @@ -39,16 +39,18 @@ - - - - type_list - - Head,Tail... - - - - + + + + + type_list + + Head,Tail... + + + + + head @@ -57,32 +59,38 @@ - - - - type_list - - Type... - - - - - - type_list - - First... - - - - - - type_list - - Second... - - - - + + + + + type_list + + Type... + + + + + + + + type_list + + First... + + + + + + + + type_list + + Second... + + + + + type_group_pair @@ -90,16 +98,16 @@ type_list<First...>,type_list<Second...> - + - + size : const size_t - - + + optional_ref @@ -108,16 +116,18 @@ - - - - optional_ref - - type_group_pair_it<It,type_list<First...>,type_list<Second...>>::value_type - - - - + + + + + optional_ref + + type_group_pair_it<It,type_list<First...>,type_list<Second...>>::value_type + + + + + type_group_pair_it @@ -132,86 +142,94 @@ find(value_type const& v) : unsigned int - - + + A - - + + B - - + + C - - - - type_list - - A,bool,int - - - - - - type_list - - float,double - - - - - - type_list - - A,B,C - - - - - - type_group_pair - - type_list<float,double>,type_list<A,B,C> - - - - + + + + + type_list + + A,bool,int + + + + + + + + type_list + + float,double + + + + + + + + type_list + + A,B,C + + + + + + + + type_group_pair + + type_list<float,double>,type_list<A,B,C> + + + + + R - + - + aboolint : type_list<A,bool,int> - + - + abc : type_group_pair<type_list<float,double>,type_list<A,B,C>> - - + + type_group_pair @@ -220,8 +238,8 @@ - - + + type_group_pair_it @@ -230,8 +248,8 @@ - - + + head diff --git a/docs/test_cases/t00065.md b/docs/test_cases/t00065.md new file mode 100644 index 00000000..5c17eb57 --- /dev/null +++ b/docs/test_cases/t00065.md @@ -0,0 +1,556 @@ +# t00065 - Class diagram with packages from directory structure +## Config +```yaml +compilation_database_dir: .. +output_directory: puml +diagrams: + t00065_class: + type: class + glob: + - t00065.cc + relative_to: ../../../tests/t00065 + generate_packages: true + package_type: directory + include: + namespaces: + - clanguml::t00065 + using_namespace: + - clanguml::t00065 +``` +## Source code +File t00065.cc +```cpp +#include "module1/module1.h" +#include "module2/module2.h" + +namespace clanguml { +namespace t00065 { +struct R { + A *a; + C c; + D d; +}; +} +} +``` +## Generated UML diagrams +![t00065_class](./t00065_class.svg "Class diagram with packages from directory structure") +## Generated JSON models +```json +{ + "diagram_type": "class", + "elements": [ + { + "display_name": "module1", + "elements": [ + { + "display_name": "module1::submodule1a", + "elements": [ + { + "bases": [], + "display_name": "clanguml::t00065::detail::AImpl", + "id": "674757414308736755", + "is_abstract": false, + "is_nested": false, + "is_struct": true, + "is_template": false, + "is_union": false, + "members": [], + "methods": [], + "name": "AImpl", + "namespace": "clanguml::t00065::detail", + "source_location": { + "file": "../../clang-uml/tests/t00065/module1/submodule1a/submodule1a.h", + "line": 6 + }, + "template_parameters": [], + "type": "class" + } + ], + "name": "submodule1a", + "type": "directory" + }, + { + "constants": [ + "a", + "b", + "c" + ], + "display_name": "clanguml::t00065::ABC", + "id": "2145362985538918973", + "is_nested": false, + "name": "ABC", + "namespace": "clanguml::t00065", + "source_location": { + "file": "../../clang-uml/tests/t00065/module1/module1.h", + "line": 8 + }, + "type": "enum" + }, + { + "constants": [ + "x", + "y", + "z" + ], + "display_name": "clanguml::t00065::XYZ", + "id": "1435940218810141944", + "is_nested": false, + "name": "XYZ", + "namespace": "clanguml::t00065", + "source_location": { + "file": "../../clang-uml/tests/t00065/module1/module1.h", + "line": 10 + }, + "type": "enum" + }, + { + "bases": [], + "display_name": "clanguml::t00065::A", + "id": "1178194542408300737", + "is_abstract": false, + "is_nested": false, + "is_struct": true, + "is_template": false, + "is_union": false, + "members": [ + { + "access": "public", + "is_static": false, + "name": "abc", + "source_location": { + "file": "../../clang-uml/tests/t00065/module1/module1.h", + "line": 13 + }, + "type": "clanguml::t00065::ABC" + }, + { + "access": "public", + "is_static": false, + "name": "xyz", + "source_location": { + "file": "../../clang-uml/tests/t00065/module1/module1.h", + "line": 14 + }, + "type": "clanguml::t00065::XYZ" + }, + { + "access": "public", + "is_static": false, + "name": "pimpl", + "source_location": { + "file": "../../clang-uml/tests/t00065/module1/module1.h", + "line": 15 + }, + "type": "detail::AImpl *" + } + ], + "methods": [], + "name": "A", + "namespace": "clanguml::t00065", + "source_location": { + "file": "../../clang-uml/tests/t00065/module1/module1.h", + "line": 12 + }, + "template_parameters": [], + "type": "class" + } + ], + "name": "module1", + "type": "directory" + }, + { + "display_name": "module2", + "elements": [ + { + "display_name": "module2::concepts", + "elements": [ + { + "display_name": "clanguml::t00065::bconcept", + "id": "1325475407133721370", + "name": "bconcept", + "namespace": "clanguml::t00065", + "parameters": [ + { + "name": "clanguml::t00065::t", + "type": "T" + } + ], + "source_location": { + "file": "../../clang-uml/tests/t00065/module2/concepts/concepts.h", + "line": 7 + }, + "statements": [ + "T{}", + "t.b()" + ], + "type": "concept" + } + ], + "name": "concepts", + "type": "directory" + }, + { + "bases": [], + "display_name": "clanguml::t00065::B", + "id": "1651810571114530033", + "is_abstract": false, + "is_nested": false, + "is_struct": true, + "is_template": false, + "is_union": false, + "members": [], + "methods": [ + { + "access": "public", + "is_const": false, + "is_defaulted": true, + "is_implicit": false, + "is_pure_virtual": false, + "is_static": false, + "is_virtual": false, + "name": "B", + "parameters": [], + "type": "void" + }, + { + "access": "public", + "is_const": false, + "is_defaulted": false, + "is_implicit": false, + "is_pure_virtual": false, + "is_static": false, + "is_virtual": false, + "name": "b", + "parameters": [], + "type": "void" + } + ], + "name": "B", + "namespace": "clanguml::t00065", + "source_location": { + "file": "../../clang-uml/tests/t00065/module2/module2.h", + "line": 7 + }, + "template_parameters": [], + "type": "class" + }, + { + "bases": [], + "display_name": "clanguml::t00065::C", + "id": "1157378014768957235", + "is_abstract": false, + "is_nested": false, + "is_struct": true, + "is_template": true, + "is_union": false, + "members": [ + { + "access": "public", + "is_static": false, + "name": "t", + "source_location": { + "file": "../../clang-uml/tests/t00065/module2/module2.h", + "line": 13 + }, + "type": "T *" + } + ], + "methods": [], + "name": "C", + "namespace": "clanguml::t00065", + "source_location": { + "file": "../../clang-uml/tests/t00065/module2/module2.h", + "line": 12 + }, + "template_parameters": [ + { + "is_variadic": false, + "kind": "template_type", + "name": "T", + "template_parameters": [] + } + ], + "type": "class" + }, + { + "bases": [], + "display_name": "clanguml::t00065::C", + "id": "580575003920044707", + "is_abstract": false, + "is_nested": false, + "is_struct": false, + "is_template": true, + "is_union": false, + "members": [], + "methods": [], + "name": "C", + "namespace": "clanguml::t00065", + "source_location": { + "file": "../../clang-uml/tests/t00065/module2/module2.h", + "line": 12 + }, + "template_parameters": [ + { + "is_variadic": false, + "kind": "argument", + "template_parameters": [], + "type": "int" + } + ], + "type": "class" + }, + { + "bases": [], + "display_name": "clanguml::t00065::D", + "id": "1719752929087851944", + "is_abstract": false, + "is_nested": false, + "is_struct": true, + "is_template": true, + "is_union": false, + "members": [ + { + "access": "public", + "is_static": false, + "name": "t", + "source_location": { + "file": "../../clang-uml/tests/t00065/module2/module2.h", + "line": 17 + }, + "type": "T" + }, + { + "access": "public", + "is_static": false, + "name": "c", + "source_location": { + "file": "../../clang-uml/tests/t00065/module2/module2.h", + "line": 18 + }, + "type": "C" + } + ], + "methods": [], + "name": "D", + "namespace": "clanguml::t00065", + "source_location": { + "file": "../../clang-uml/tests/t00065/module2/module2.h", + "line": 16 + }, + "template_parameters": [ + { + "is_variadic": false, + "kind": "template_type", + "name": "T", + "template_parameters": [] + } + ], + "type": "class" + }, + { + "bases": [], + "display_name": "clanguml::t00065::C", + "id": "1373403346245688670", + "is_abstract": false, + "is_nested": false, + "is_struct": false, + "is_template": true, + "is_union": false, + "members": [], + "methods": [], + "name": "C", + "namespace": "clanguml::t00065", + "source_location": { + "file": "../../clang-uml/tests/t00065/module2/module2.h", + "line": 12 + }, + "template_parameters": [ + { + "is_variadic": false, + "kind": "argument", + "template_parameters": [], + "type": "clanguml::t00065::B" + } + ], + "type": "class" + }, + { + "bases": [], + "display_name": "clanguml::t00065::D", + "id": "2024276012622729482", + "is_abstract": false, + "is_nested": false, + "is_struct": false, + "is_template": true, + "is_union": false, + "members": [], + "methods": [], + "name": "D", + "namespace": "clanguml::t00065", + "source_location": { + "file": "../../clang-uml/tests/t00065/module2/module2.h", + "line": 16 + }, + "template_parameters": [ + { + "is_variadic": false, + "kind": "argument", + "template_parameters": [], + "type": "clanguml::t00065::B" + } + ], + "type": "class" + } + ], + "name": "module2", + "type": "directory" + }, + { + "bases": [], + "display_name": "clanguml::t00065::R", + "id": "1082111961413727438", + "is_abstract": false, + "is_nested": false, + "is_struct": true, + "is_template": false, + "is_union": false, + "members": [ + { + "access": "public", + "is_static": false, + "name": "a", + "source_location": { + "file": "../../clang-uml/tests/t00065/t00065.cc", + "line": 7 + }, + "type": "clanguml::t00065::A *" + }, + { + "access": "public", + "is_static": false, + "name": "c", + "source_location": { + "file": "../../clang-uml/tests/t00065/t00065.cc", + "line": 8 + }, + "type": "C" + }, + { + "access": "public", + "is_static": false, + "name": "d", + "source_location": { + "file": "../../clang-uml/tests/t00065/t00065.cc", + "line": 9 + }, + "type": "D" + } + ], + "methods": [], + "name": "R", + "namespace": "clanguml::t00065", + "source_location": { + "file": "../../clang-uml/tests/t00065/t00065.cc", + "line": 6 + }, + "template_parameters": [], + "type": "class" + } + ], + "metadata": { + "clang_uml_version": "0.3.5-27-g81c7ce7", + "llvm_version": "Ubuntu clang version 15.0.6", + "schema_version": 1 + }, + "name": "t00065_class", + "relationships": [ + { + "access": "public", + "destination": "2145362985538918973", + "label": "abc", + "source": "1178194542408300737", + "type": "aggregation" + }, + { + "access": "public", + "destination": "1435940218810141944", + "label": "xyz", + "source": "1178194542408300737", + "type": "aggregation" + }, + { + "access": "public", + "destination": "674757414308736755", + "label": "pimpl", + "source": "1178194542408300737", + "type": "association" + }, + { + "access": "public", + "destination": "1157378014768957235", + "source": "580575003920044707", + "type": "instantiation" + }, + { + "destination": "1325475407133721370", + "label": "T", + "source": "1719752929087851944", + "type": "constraint" + }, + { + "access": "public", + "destination": "580575003920044707", + "label": "c", + "source": "1719752929087851944", + "type": "aggregation" + }, + { + "access": "public", + "destination": "1651810571114530033", + "source": "1373403346245688670", + "type": "dependency" + }, + { + "access": "public", + "destination": "1157378014768957235", + "source": "1373403346245688670", + "type": "instantiation" + }, + { + "access": "public", + "destination": "1651810571114530033", + "source": "2024276012622729482", + "type": "dependency" + }, + { + "access": "public", + "destination": "1719752929087851944", + "source": "2024276012622729482", + "type": "instantiation" + }, + { + "access": "public", + "destination": "1178194542408300737", + "label": "a", + "source": "1082111961413727438", + "type": "association" + }, + { + "access": "public", + "destination": "1373403346245688670", + "label": "c", + "source": "1082111961413727438", + "type": "aggregation" + }, + { + "access": "public", + "destination": "2024276012622729482", + "label": "d", + "source": "1082111961413727438", + "type": "aggregation" + } + ], + "using_namespace": "clanguml::t00065" +} +``` diff --git a/docs/test_cases/t00065_class.svg b/docs/test_cases/t00065_class.svg new file mode 100644 index 00000000..73d8576b --- /dev/null +++ b/docs/test_cases/t00065_class.svg @@ -0,0 +1,245 @@ + + + + + + + + + + + + + + module1 + + + submodule1a + + + module2 + + + concepts + + + + + ABC + + a + b + c + + + + + + + XYZ + + x + y + z + + + + + + + A + + + + + + + + abc : ABC + + + + + + + xyz : XYZ + + + + + + + pimpl : detail::AImpl * + + + + + + + AImpl + + + + + + + + B + + + + B() = default : void + + b() : void + + + + + + C + + T + + + + + + + + t : T * + + + + + + + C + + int + + + + + + + + D + + bconcept T + + + + + + + + t : T + + + + + + + c : C<int> + + + + + + + C + + B + + + + + + + + D + + B + + + + + + + + «concept» + bconcept + + (T t) + + T{} + t.b() + + + + + + R + + + + + + + + a : A * + + + + + + + c : C<B> + + + + + + + d : D<B> + + + + + + abc + + + + xyz + + + + pimpl + + + + + T + + + +c + + + + + + + + + + + +a + + + +c + + + +d + + diff --git a/docs/test_cases/t20001.md b/docs/test_cases/t20001.md index 4b29851f..2886269b 100644 --- a/docs/test_cases/t20001.md +++ b/docs/test_cases/t20001.md @@ -108,7 +108,7 @@ int tmain() { "diagram_type": "sequence", "metadata": { - "clang_uml_version": "0.3.5-13-g57aa174", + "clang_uml_version": "0.3.5-27-g81c7ce7", "llvm_version": "Ubuntu clang version 15.0.6", "schema_version": 1 }, diff --git a/docs/test_cases/t20001_sequence.svg b/docs/test_cases/t20001_sequence.svg index 99dab809..d7ddd955 100644 --- a/docs/test_cases/t20001_sequence.svg +++ b/docs/test_cases/t20001_sequence.svg @@ -1,6 +1,6 @@ - + @@ -9,59 +9,59 @@ - - - - - - - + + + + + + + - - + + tmain() - + tmain() - - + + A - + A - - + + B - + B - - - - - - - - + + + + + + + + add(int,int) - + wrap_add3(int,int,int) - + add3(int,int,int) - + @@ -72,7 +72,7 @@ - + @@ -81,14 +81,14 @@ - + log_result(int) - + Main test function diff --git a/docs/test_cases/t20002.md b/docs/test_cases/t20002.md index 3b8045e6..88c533a4 100644 --- a/docs/test_cases/t20002.md +++ b/docs/test_cases/t20002.md @@ -45,7 +45,7 @@ void m1() { m2(); } { "diagram_type": "sequence", "metadata": { - "clang_uml_version": "0.3.5-13-g57aa174", + "clang_uml_version": "0.3.5-27-g81c7ce7", "llvm_version": "Ubuntu clang version 15.0.6", "schema_version": 1 }, diff --git a/docs/test_cases/t20002_sequence.svg b/docs/test_cases/t20002_sequence.svg index 0ff1f11c..e0cd014e 100644 --- a/docs/test_cases/t20002_sequence.svg +++ b/docs/test_cases/t20002_sequence.svg @@ -1,6 +1,6 @@ - + @@ -9,51 +9,51 @@ - - - - + + + + - - + + m1() - + m1() - - + + m2() - + m2() - - + + m3() - + m3() - - + + m4() - + m4() - - - - - + + + + + - + - + diff --git a/docs/test_cases/t20003.md b/docs/test_cases/t20003.md index 5996640e..f376f61e 100644 --- a/docs/test_cases/t20003.md +++ b/docs/test_cases/t20003.md @@ -41,7 +41,7 @@ template void m1(T p) { m2(p); } { "diagram_type": "sequence", "metadata": { - "clang_uml_version": "0.3.5-13-g57aa174", + "clang_uml_version": "0.3.5-27-g81c7ce7", "llvm_version": "Ubuntu clang version 15.0.6", "schema_version": 1 }, diff --git a/docs/test_cases/t20003_sequence.svg b/docs/test_cases/t20003_sequence.svg index fb47ccd2..9bcef4b3 100644 --- a/docs/test_cases/t20003_sequence.svg +++ b/docs/test_cases/t20003_sequence.svg @@ -1,6 +1,6 @@ - + @@ -9,51 +9,51 @@ - - - - + + + + - - + + m1<T>(T) - + m1<T>(T) - - + + m2<T>(T) - + m2<T>(T) - - + + m3<T>(T) - + m3<T>(T) - - + + m4<T>(T) - + m4<T>(T) - - - - - + + + + + - + - + diff --git a/docs/test_cases/t20004.md b/docs/test_cases/t20004.md index e7a04d4e..2f953746 100644 --- a/docs/test_cases/t20004.md +++ b/docs/test_cases/t20004.md @@ -77,7 +77,7 @@ int main() { "diagram_type": "sequence", "metadata": { - "clang_uml_version": "0.3.5-13-g57aa174", + "clang_uml_version": "0.3.5-27-g81c7ce7", "llvm_version": "Ubuntu clang version 15.0.6", "schema_version": 1 }, diff --git a/docs/test_cases/t20004_sequence.svg b/docs/test_cases/t20004_sequence.svg index 46b06e9f..864d8312 100644 --- a/docs/test_cases/t20004_sequence.svg +++ b/docs/test_cases/t20004_sequence.svg @@ -1,6 +1,6 @@ - + @@ -9,16 +9,16 @@ - - - - - - - - - - + + + + + + + + + + @@ -29,87 +29,87 @@ - - + + main() - + main() - - + + m1<float>(float) - + m1<float>(float) - - + + m1<unsigned long>(unsigned long) - + m1<unsigned long>(unsigned long) - - + + m4<unsigned long>(unsigned long) - + m4<unsigned long>(unsigned long) - - + + m1<std::string>(std::string) - + m1<std::string>(std::string) - - + + m2<std::string>(std::string) - + m2<std::string>(std::string) - - + + m1<int>(int) - + m1<int>(int) - - + + m2<int>(int) - + m2<int>(int) - - + + m3<int>(int) - + m3<int>(int) - - + + m4<int>(int) - + m4<int>(int) - - - - - - - - - - - + + + + + + + + + + + - + - + @@ -117,11 +117,11 @@ - + - + @@ -129,19 +129,19 @@ - + - + - + - + diff --git a/docs/test_cases/t20005.md b/docs/test_cases/t20005.md index b2c9a08d..634f6451 100644 --- a/docs/test_cases/t20005.md +++ b/docs/test_cases/t20005.md @@ -48,7 +48,7 @@ template struct C { { "diagram_type": "sequence", "metadata": { - "clang_uml_version": "0.3.5-13-g57aa174", + "clang_uml_version": "0.3.5-27-g81c7ce7", "llvm_version": "Ubuntu clang version 15.0.6", "schema_version": 1 }, diff --git a/docs/test_cases/t20005_sequence.svg b/docs/test_cases/t20005_sequence.svg index c0c54d1f..2e7a98fa 100644 --- a/docs/test_cases/t20005_sequence.svg +++ b/docs/test_cases/t20005_sequence.svg @@ -1,6 +1,6 @@ - + @@ -9,42 +9,42 @@ - - - + + + - - + + C<T> - + C<T> - - + + B<T> - + B<T> - - + + A<T> - + A<T> - - - + + + c(T) - + b(T) - + a(T) diff --git a/docs/test_cases/t20006.md b/docs/test_cases/t20006.md index bfdadecb..ebd7bebd 100644 --- a/docs/test_cases/t20006.md +++ b/docs/test_cases/t20006.md @@ -106,7 +106,7 @@ void tmain() { "diagram_type": "sequence", "metadata": { - "clang_uml_version": "0.3.5-13-g57aa174", + "clang_uml_version": "0.3.5-27-g81c7ce7", "llvm_version": "Ubuntu clang version 15.0.6", "schema_version": 1 }, diff --git a/docs/test_cases/t20006_sequence.svg b/docs/test_cases/t20006_sequence.svg index 3c913b36..b4e81bb1 100644 --- a/docs/test_cases/t20006_sequence.svg +++ b/docs/test_cases/t20006_sequence.svg @@ -1,6 +1,6 @@ - + @@ -9,22 +9,22 @@ - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + @@ -34,82 +34,82 @@ - - + + tmain() - + tmain() - - + + B<int> - + B<int> - - + + A<int> - + A<int> - - + + B<std::string> - + B<std::string> - - + + A<std::string> - + A<std::string> - - + + BB<int,int> - + BB<int,int> - - + + AA<int> - + AA<int> - - + + BB<int,std::string> - + BB<int,std::string> - - + + BB<int,float> - + BB<int,float> - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + b(int) - + a1(int) @@ -118,12 +118,12 @@ - + b(std::string) - + a2(std::string) @@ -132,59 +132,59 @@ - + bb1(int,int) - + aa1(int) - + bb2(int,int) - + aa2(int) - + bb1(int,std::string) - + aa2(int) - + bb2(int,std::string) - + aa1(int) - + bb1(int,float) - + bb2(int,float) - + aa2(int) diff --git a/docs/test_cases/t20007.md b/docs/test_cases/t20007.md index d9bf430d..d0252d3f 100644 --- a/docs/test_cases/t20007.md +++ b/docs/test_cases/t20007.md @@ -52,7 +52,7 @@ void tmain() { "diagram_type": "sequence", "metadata": { - "clang_uml_version": "0.3.5-13-g57aa174", + "clang_uml_version": "0.3.5-27-g81c7ce7", "llvm_version": "Ubuntu clang version 15.0.6", "schema_version": 1 }, diff --git a/docs/test_cases/t20007_sequence.svg b/docs/test_cases/t20007_sequence.svg index dbfe7d8a..46f8a00a 100644 --- a/docs/test_cases/t20007_sequence.svg +++ b/docs/test_cases/t20007_sequence.svg @@ -1,6 +1,6 @@ - + @@ -9,57 +9,57 @@ - - - - + + + + - - + + tmain() - + tmain() - - + + Adder<int,int> - + Adder<int,int> - - + + Adder<int,float,double> - + Adder<int,float,double> - - + + Adder<std::string,std::string,std::string> - + Adder<std::string,std::string,std::string> - - - - - + + + + + add(int &&,int &&) - + add(int &&,float &&,double &&) - + add(std::string &&,std::string &&,std::string &&) diff --git a/docs/test_cases/t20008.md b/docs/test_cases/t20008.md index 7512c07b..35da77ed 100644 --- a/docs/test_cases/t20008.md +++ b/docs/test_cases/t20008.md @@ -70,7 +70,7 @@ void tmain() { "diagram_type": "sequence", "metadata": { - "clang_uml_version": "0.3.5-13-g57aa174", + "clang_uml_version": "0.3.5-27-g81c7ce7", "llvm_version": "Ubuntu clang version 15.0.6", "schema_version": 1 }, diff --git a/docs/test_cases/t20008_sequence.svg b/docs/test_cases/t20008_sequence.svg index fdbf6189..47f8e691 100644 --- a/docs/test_cases/t20008_sequence.svg +++ b/docs/test_cases/t20008_sequence.svg @@ -1,6 +1,6 @@ - + @@ -9,13 +9,13 @@ - - - - - - - + + + + + + + @@ -23,81 +23,81 @@ - - + + tmain() - + tmain() - - + + B<int> - + B<int> - - + + A<int> - + A<int> - - + + B<const char *> - + B<const char *> - - + + A<const char *> - + A<const char *> - - + + B<std::string> - + B<std::string> - - + + A<std::string> - + A<std::string> - - - - - - - - + + + + + + + + b(int) - + a1(int) - + b(const char *) - + a2(const char *) - + b(std::string) - + a3(std::string) diff --git a/docs/test_cases/t20009.md b/docs/test_cases/t20009.md index 564c52a6..a763ba1d 100644 --- a/docs/test_cases/t20009.md +++ b/docs/test_cases/t20009.md @@ -56,7 +56,7 @@ void tmain() { "diagram_type": "sequence", "metadata": { - "clang_uml_version": "0.3.5-13-g57aa174", + "clang_uml_version": "0.3.5-27-g81c7ce7", "llvm_version": "Ubuntu clang version 15.0.6", "schema_version": 1 }, diff --git a/docs/test_cases/t20009_sequence.svg b/docs/test_cases/t20009_sequence.svg index ab7ccccc..f90334bc 100644 --- a/docs/test_cases/t20009_sequence.svg +++ b/docs/test_cases/t20009_sequence.svg @@ -1,6 +1,6 @@ - + @@ -9,13 +9,13 @@ - - - - - - - + + + + + + + @@ -23,81 +23,81 @@ - - + + tmain() - + tmain() - - + + B<std::string> - + B<std::string> - - + + A<std::string> - + A<std::string> - - + + B<int> - + B<int> - - + + A<int> - + A<int> - - + + B<float> - + B<float> - - + + A<float> - + A<float> - - - - - - - - + + + + + + + + b(std::string) - + a(std::string) - + b(int) - + a(int) - + b(float) - + a(float) diff --git a/docs/test_cases/t20010.md b/docs/test_cases/t20010.md index d7387cea..8a33def9 100644 --- a/docs/test_cases/t20010.md +++ b/docs/test_cases/t20010.md @@ -66,7 +66,7 @@ void tmain() { "diagram_type": "sequence", "metadata": { - "clang_uml_version": "0.3.5-13-g57aa174", + "clang_uml_version": "0.3.5-27-g81c7ce7", "llvm_version": "Ubuntu clang version 15.0.6", "schema_version": 1 }, diff --git a/docs/test_cases/t20010_sequence.svg b/docs/test_cases/t20010_sequence.svg index cde277b4..109f8f7a 100644 --- a/docs/test_cases/t20010_sequence.svg +++ b/docs/test_cases/t20010_sequence.svg @@ -1,6 +1,6 @@ - + @@ -9,81 +9,81 @@ - - - - - - - - - + + + + + + + + + - - + + tmain() - + tmain() - - + + B<int> - + B<int> - - + + A - + A - - - - - - - - - - + + + + + + + + + + b1() - + a1() - + b2() - + a2() - + b3() - + a3() - + b4() - + a4() diff --git a/docs/test_cases/t20011.md b/docs/test_cases/t20011.md index 46cabcf6..7f8a76c2 100644 --- a/docs/test_cases/t20011.md +++ b/docs/test_cases/t20011.md @@ -58,7 +58,7 @@ void tmain() { "diagram_type": "sequence", "metadata": { - "clang_uml_version": "0.3.5-13-g57aa174", + "clang_uml_version": "0.3.5-27-g81c7ce7", "llvm_version": "Ubuntu clang version 15.0.6", "schema_version": 1 }, diff --git a/docs/test_cases/t20011_sequence.svg b/docs/test_cases/t20011_sequence.svg index be0b86b3..f1470f47 100644 --- a/docs/test_cases/t20011_sequence.svg +++ b/docs/test_cases/t20011_sequence.svg @@ -1,6 +1,6 @@ - + @@ -9,42 +9,42 @@ - - - - - - - - - - - - + + + + + + + + + + + + - - + + tmain() - + tmain() - - + + A - + A - - - - - - - - - - + + + + + + + + + + a(int) @@ -52,26 +52,26 @@ alt - + a(int) - + b(int) - + c(int) - + @@ -81,14 +81,14 @@ alt - + b(int) - + @@ -98,7 +98,7 @@ alt - + diff --git a/docs/test_cases/t20012.md b/docs/test_cases/t20012.md index f5457530..41f4e050 100644 --- a/docs/test_cases/t20012.md +++ b/docs/test_cases/t20012.md @@ -131,7 +131,7 @@ void tmain() { "diagram_type": "sequence", "metadata": { - "clang_uml_version": "0.3.5-13-g57aa174", + "clang_uml_version": "0.3.5-27-g81c7ce7", "llvm_version": "Ubuntu clang version 15.0.6", "schema_version": 1 }, diff --git a/docs/test_cases/t20012_sequence.svg b/docs/test_cases/t20012_sequence.svg index 3a69ca03..5465098a 100644 --- a/docs/test_cases/t20012_sequence.svg +++ b/docs/test_cases/t20012_sequence.svg @@ -1,6 +1,6 @@ - + @@ -9,31 +9,31 @@ - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + @@ -43,122 +43,122 @@ - - + + tmain() - + tmain() - - + + tmain()::(lambda ../../tests/t20012/t20012.cc:66:20) - + tmain()::(lambda ../../tests/t20012/t20012.cc:66:20) - - + + A - + A - - + + B - + B - - + + tmain()::(lambda ../../tests/t20012/t20012.cc:79:20) - + tmain()::(lambda ../../tests/t20012/t20012.cc:79:20) - - + + C - + C - - + + R<R::(lambda ../../tests/t20012/t20012.cc:85:9)> - + R<R::(lambda ../../tests/t20012/t20012.cc:85:9)> - - + + tmain()::(lambda ../../tests/t20012/t20012.cc:85:9) - + tmain()::(lambda ../../tests/t20012/t20012.cc:85:9) - - + + D - + D - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + operator()() - + a() - + aa() - + aaa() - + b() - + bb() - + @@ -167,67 +167,67 @@ - + operator()() - + c() - + cc() - + ccc() - + operator()() - + a() - + aa() - + aaa() - + b() - + bb() - + @@ -238,29 +238,29 @@ - + r() - + operator()() - + c() - + cc() - + @@ -269,7 +269,7 @@ - + add5(int) diff --git a/docs/test_cases/t20013.md b/docs/test_cases/t20013.md index 74c0b7dc..90ed4ea9 100644 --- a/docs/test_cases/t20013.md +++ b/docs/test_cases/t20013.md @@ -54,7 +54,7 @@ void tmain(int argc, char **argv) { "diagram_type": "sequence", "metadata": { - "clang_uml_version": "0.3.5-13-g57aa174", + "clang_uml_version": "0.3.5-27-g81c7ce7", "llvm_version": "Ubuntu clang version 15.0.6", "schema_version": 1 }, diff --git a/docs/test_cases/t20013_sequence.svg b/docs/test_cases/t20013_sequence.svg index de4366c1..23530d47 100644 --- a/docs/test_cases/t20013_sequence.svg +++ b/docs/test_cases/t20013_sequence.svg @@ -1,6 +1,6 @@ - + @@ -9,47 +9,47 @@ - - - - - - - + + + + + + + - - + + tmain(int,char **) - + tmain(int,char **) - - + + B - + B - - + + A - + A - - - - - - - - + + + + + + + + b(int) - + a1(int) @@ -58,12 +58,12 @@ - + b(double) - + a2(double) @@ -72,12 +72,12 @@ - + b(const char *) - + a3(const char *) diff --git a/docs/test_cases/t20014.md b/docs/test_cases/t20014.md index 09986593..2676be4d 100644 --- a/docs/test_cases/t20014.md +++ b/docs/test_cases/t20014.md @@ -89,7 +89,7 @@ namespace t20014 { { "diagram_type": "sequence", "metadata": { - "clang_uml_version": "0.3.5-13-g57aa174", + "clang_uml_version": "0.3.5-27-g81c7ce7", "llvm_version": "Ubuntu clang version 15.0.6", "schema_version": 1 }, diff --git a/docs/test_cases/t20014_sequence.svg b/docs/test_cases/t20014_sequence.svg index 3fa8fed9..c44aff6a 100644 --- a/docs/test_cases/t20014_sequence.svg +++ b/docs/test_cases/t20014_sequence.svg @@ -1,6 +1,6 @@ - + @@ -9,56 +9,56 @@ - - - - - - - - + + + + + + + + - - + + tmain() - + tmain() - - + + B - + B - - + + A - + A - - + + C<B,int> - + C<B,int> - - - - - - - - - + + + + + + + + + b1(int,int) - + a1(int,int) @@ -67,12 +67,12 @@ - + b2(int,int) - + a2(int,int) @@ -81,17 +81,17 @@ - + c1(int,int) - + b1(int,int) - + a1(int,int) diff --git a/docs/test_cases/t20015.md b/docs/test_cases/t20015.md index b5316e11..27b49dca 100644 --- a/docs/test_cases/t20015.md +++ b/docs/test_cases/t20015.md @@ -70,7 +70,7 @@ void tmain() { "diagram_type": "sequence", "metadata": { - "clang_uml_version": "0.3.5-13-g57aa174", + "clang_uml_version": "0.3.5-27-g81c7ce7", "llvm_version": "Ubuntu clang version 15.0.6", "schema_version": 1 }, diff --git a/docs/test_cases/t20015_sequence.svg b/docs/test_cases/t20015_sequence.svg index 364fec0b..3911d2af 100644 --- a/docs/test_cases/t20015_sequence.svg +++ b/docs/test_cases/t20015_sequence.svg @@ -1,6 +1,6 @@ - + @@ -9,25 +9,25 @@ - - + + - - + + tmain() - + tmain() - - + + B - + B - - - + + + setup_a(std::shared_ptr<detail::A> &) diff --git a/docs/test_cases/t20016.md b/docs/test_cases/t20016.md index 5e97c7d4..0cec7634 100644 --- a/docs/test_cases/t20016.md +++ b/docs/test_cases/t20016.md @@ -52,7 +52,7 @@ void tmain() { "diagram_type": "sequence", "metadata": { - "clang_uml_version": "0.3.5-13-g57aa174", + "clang_uml_version": "0.3.5-27-g81c7ce7", "llvm_version": "Ubuntu clang version 15.0.6", "schema_version": 1 }, diff --git a/docs/test_cases/t20016_sequence.svg b/docs/test_cases/t20016_sequence.svg index c67f049a..bf5d47da 100644 --- a/docs/test_cases/t20016_sequence.svg +++ b/docs/test_cases/t20016_sequence.svg @@ -1,6 +1,6 @@ - + @@ -9,53 +9,53 @@ - - - - - + + + + + - - + + tmain() - + tmain() - - + + B<long> - + B<long> - - + + A - + A - - - - - - + + + + + + b1(long) - + a1(int) - + b2(long) - + a2(const long &) diff --git a/docs/test_cases/t20017.md b/docs/test_cases/t20017.md index 11fe8455..89f4609e 100644 --- a/docs/test_cases/t20017.md +++ b/docs/test_cases/t20017.md @@ -7,9 +7,9 @@ diagrams: t20017_sequence: type: sequence combine_free_functions_into_file_participants: true - relative_to: ../../tests/t20017 + relative_to: ../../../tests/t20017 glob: - - ../../tests/t20017/t20017.cc + - t20017.cc include: namespaces: - clanguml::t20017 @@ -49,35 +49,35 @@ int tmain() { return b2(a1(a2(a3(1, 2), b1(3, 4)), 5), 6); } { "diagram_type": "sequence", "metadata": { - "clang_uml_version": "0.3.5-13-g57aa174", + "clang_uml_version": "0.3.5-27-g81c7ce7", "llvm_version": "Ubuntu clang version 15.0.6", "schema_version": 1 }, "name": "t20017_sequence", "participants": [ { - "id": "294332401323799021", + "id": "800083058974241273", "name": "t20017.cc", "source_location": { - "file": "t20017.cc", + "file": "../../clang-uml/tests/t20017/t20017.cc", "line": 6 }, "type": "function" }, { - "id": "1591222867263639510", + "id": "446029693370832411", "name": "include/t20017_a.h", "source_location": { - "file": "include/t20017_a.h", + "file": "../../clang-uml/tests/t20017/include/t20017_a.h", "line": 7 }, "type": "function" }, { - "id": "1113611539183189365", + "id": "1893799013101029871", "name": "include/t20017_b.h", "source_location": { - "file": "include/t20017_b.h", + "file": "../../clang-uml/tests/t20017/include/t20017_b.h", "line": 5 }, "type": "function" @@ -90,19 +90,19 @@ int tmain() { return b2(a1(a2(a3(1, 2), b1(3, 4)), 5), 6); } "from": { "activity_id": "1484746432546296115", "activity_name": "clanguml::t20017::tmain()", - "participant_id": "294332401323799021" + "participant_id": "800083058974241273" }, "name": "a3(int,int)", "return_type": "", "scope": "normal", "source_location": { - "file": "t20017.cc", + "file": "../../clang-uml/tests/t20017/t20017.cc", "line": 6 }, "to": { "activity_id": "1681392050252260928", "activity_name": "clanguml::t20017::a3(int,int)", - "participant_id": "1591222867263639510" + "participant_id": "446029693370832411" }, "type": "message" }, @@ -110,19 +110,19 @@ int tmain() { return b2(a1(a2(a3(1, 2), b1(3, 4)), 5), 6); } "from": { "activity_id": "1484746432546296115", "activity_name": "clanguml::t20017::tmain()", - "participant_id": "294332401323799021" + "participant_id": "800083058974241273" }, "name": "b1(int,int)", "return_type": "", "scope": "normal", "source_location": { - "file": "t20017.cc", + "file": "../../clang-uml/tests/t20017/t20017.cc", "line": 6 }, "to": { "activity_id": "1714277838806105702", "activity_name": "clanguml::t20017::b1(int,int)", - "participant_id": "1113611539183189365" + "participant_id": "1893799013101029871" }, "type": "message" }, @@ -130,19 +130,19 @@ int tmain() { return b2(a1(a2(a3(1, 2), b1(3, 4)), 5), 6); } "from": { "activity_id": "1484746432546296115", "activity_name": "clanguml::t20017::tmain()", - "participant_id": "294332401323799021" + "participant_id": "800083058974241273" }, "name": "a2(int,int)", "return_type": "", "scope": "normal", "source_location": { - "file": "t20017.cc", + "file": "../../clang-uml/tests/t20017/t20017.cc", "line": 6 }, "to": { "activity_id": "291553542743365259", "activity_name": "clanguml::t20017::a2(int,int)", - "participant_id": "1591222867263639510" + "participant_id": "446029693370832411" }, "type": "message" }, @@ -150,19 +150,19 @@ int tmain() { return b2(a1(a2(a3(1, 2), b1(3, 4)), 5), 6); } "from": { "activity_id": "1484746432546296115", "activity_name": "clanguml::t20017::tmain()", - "participant_id": "294332401323799021" + "participant_id": "800083058974241273" }, "name": "a1(int,int)", "return_type": "", "scope": "normal", "source_location": { - "file": "t20017.cc", + "file": "../../clang-uml/tests/t20017/t20017.cc", "line": 6 }, "to": { "activity_id": "113759676939330212", "activity_name": "clanguml::t20017::a1(int,int)", - "participant_id": "1591222867263639510" + "participant_id": "446029693370832411" }, "type": "message" }, @@ -170,19 +170,19 @@ int tmain() { return b2(a1(a2(a3(1, 2), b1(3, 4)), 5), 6); } "from": { "activity_id": "1484746432546296115", "activity_name": "clanguml::t20017::tmain()", - "participant_id": "294332401323799021" + "participant_id": "800083058974241273" }, "name": "b2(int,int)", "return_type": "", "scope": "normal", "source_location": { - "file": "t20017.cc", + "file": "../../clang-uml/tests/t20017/t20017.cc", "line": 6 }, "to": { "activity_id": "775081116464505528", "activity_name": "clanguml::t20017::b2(int,int)", - "participant_id": "1113611539183189365" + "participant_id": "1893799013101029871" }, "type": "message" } diff --git a/docs/test_cases/t20017_sequence.svg b/docs/test_cases/t20017_sequence.svg index 7bb4a29e..05c39eab 100644 --- a/docs/test_cases/t20017_sequence.svg +++ b/docs/test_cases/t20017_sequence.svg @@ -1,6 +1,6 @@ - + @@ -9,65 +9,65 @@ - - - - - - + + + + + + - + t20017.cc - + t20017.cc - + include/t20017_a.h - + include/t20017_a.h - + include/t20017_b.h - + include/t20017_b.h - - - - - - + + + + + + tmain() - + a3(int,int) - + b1(int,int) - + a2(int,int) - + a1(int,int) - + b2<int>(int,int) diff --git a/docs/test_cases/t20018.md b/docs/test_cases/t20018.md index cb7aa523..7d51c651 100644 --- a/docs/test_cases/t20018.md +++ b/docs/test_cases/t20018.md @@ -54,7 +54,7 @@ void tmain() { Answer>::print(); } { "diagram_type": "sequence", "metadata": { - "clang_uml_version": "0.3.5-13-g57aa174", + "clang_uml_version": "0.3.5-27-g81c7ce7", "llvm_version": "Ubuntu clang version 15.0.6", "schema_version": 1 }, diff --git a/docs/test_cases/t20018_sequence.svg b/docs/test_cases/t20018_sequence.svg index 39253a16..f41fedb9 100644 --- a/docs/test_cases/t20018_sequence.svg +++ b/docs/test_cases/t20018_sequence.svg @@ -1,6 +1,6 @@ - + @@ -9,14 +9,14 @@ - - - - - - - - + + + + + + + + @@ -25,93 +25,93 @@ - - + + tmain() - + tmain() - - + + Answer<Factorial<5>,120> - + Answer<Factorial<5>,120> - - + + Factorial<5> - + Factorial<5> - - + + Factorial<4> - + Factorial<4> - - + + Factorial<3> - + Factorial<3> - - + + Factorial<2> - + Factorial<2> - - + + Factorial<1> - + Factorial<1> - - + + Factorial<0> - + Factorial<0> - - - - - - - - - + + + + + + + + + print() - + print(int) - + print(int) - + print(int) - + print(int) - + print(int) - + print(int) diff --git a/docs/test_cases/t20019.md b/docs/test_cases/t20019.md index e2eee307..322fc674 100644 --- a/docs/test_cases/t20019.md +++ b/docs/test_cases/t20019.md @@ -61,7 +61,7 @@ void tmain() { "diagram_type": "sequence", "metadata": { - "clang_uml_version": "0.3.5-13-g57aa174", + "clang_uml_version": "0.3.5-27-g81c7ce7", "llvm_version": "Ubuntu clang version 15.0.6", "schema_version": 1 }, diff --git a/docs/test_cases/t20019_sequence.svg b/docs/test_cases/t20019_sequence.svg index 60f99352..54dd6cab 100644 --- a/docs/test_cases/t20019_sequence.svg +++ b/docs/test_cases/t20019_sequence.svg @@ -1,6 +1,6 @@ - + @@ -9,95 +9,95 @@ - - - - - - - - - + + + + + + + + + - - + + tmain() - + tmain() - - + + Base<D1> - + Base<D1> - - + + D1 - + D1 - - + + Base<D2> - + Base<D2> - - + + D2 - + D2 - - - - - - - - - - + + + + + + + + + + name() - + impl() - + name() - + impl() - + name() - + impl() - + name() - + impl() diff --git a/docs/test_cases/t20020.md b/docs/test_cases/t20020.md index 556b337b..134aff71 100644 --- a/docs/test_cases/t20020.md +++ b/docs/test_cases/t20020.md @@ -113,7 +113,7 @@ int tmain() { "diagram_type": "sequence", "metadata": { - "clang_uml_version": "0.3.5-13-g57aa174", + "clang_uml_version": "0.3.5-27-g81c7ce7", "llvm_version": "Ubuntu clang version 15.0.6", "schema_version": 1 }, diff --git a/docs/test_cases/t20020_sequence.svg b/docs/test_cases/t20020_sequence.svg index 9af2fbc3..1503d4e7 100644 --- a/docs/test_cases/t20020_sequence.svg +++ b/docs/test_cases/t20020_sequence.svg @@ -1,6 +1,6 @@ - + @@ -9,78 +9,78 @@ - - - - - - - - - - - - - - + + + + + + + + + + + + + + - + - - - + + + - - + + tmain() - + tmain() - - + + A - + A - - + + C - + C - - + + B - + B - - + + D<int> - + D<int> - - - - - - - - - - - - - + + + + + + + + + + + + + alt - + a1() @@ -91,7 +91,7 @@ alt - + [ @@ -100,7 +100,7 @@ - + [ @@ -109,7 +109,7 @@ - + b1() @@ -117,7 +117,7 @@ - + [ @@ -126,21 +126,21 @@ - + b2() - + a4() - + log() @@ -148,7 +148,7 @@ alt - + c1() @@ -156,7 +156,7 @@ alt - + @@ -169,7 +169,7 @@ - + @@ -179,7 +179,7 @@ alt - + d1(int,int) diff --git a/docs/test_cases/t20021.md b/docs/test_cases/t20021.md index 0407d41b..8d1bc037 100644 --- a/docs/test_cases/t20021.md +++ b/docs/test_cases/t20021.md @@ -84,7 +84,7 @@ int tmain() { "diagram_type": "sequence", "metadata": { - "clang_uml_version": "0.3.5-13-g57aa174", + "clang_uml_version": "0.3.5-27-g81c7ce7", "llvm_version": "Ubuntu clang version 15.0.6", "schema_version": 1 }, diff --git a/docs/test_cases/t20021_sequence.svg b/docs/test_cases/t20021_sequence.svg index ab641a3e..d5283d4b 100644 --- a/docs/test_cases/t20021_sequence.svg +++ b/docs/test_cases/t20021_sequence.svg @@ -1,6 +1,6 @@ - + @@ -9,74 +9,74 @@ - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + - - + + tmain() - + tmain() - - + + C - + C - - + + A - + A - - + + B - + B - - - - - - - - - - - - + + + + + + + + + + + + loop - + [ c4() ] - + @@ -89,7 +89,7 @@ - + a3() @@ -102,7 +102,7 @@ loop - + [ @@ -111,7 +111,7 @@ - + [ @@ -120,7 +120,7 @@ - + [ @@ -129,14 +129,14 @@ - + a1() - + [ @@ -148,7 +148,7 @@ loop - + b2() @@ -158,7 +158,7 @@ loop - + [ @@ -167,7 +167,7 @@ - + b2() diff --git a/docs/test_cases/t20022.md b/docs/test_cases/t20022.md index 324cfab1..0e88af64 100644 --- a/docs/test_cases/t20022.md +++ b/docs/test_cases/t20022.md @@ -64,7 +64,7 @@ int tmain() { "diagram_type": "sequence", "metadata": { - "clang_uml_version": "0.3.5-13-g57aa174", + "clang_uml_version": "0.3.5-27-g81c7ce7", "llvm_version": "Ubuntu clang version 15.0.6", "schema_version": 1 }, diff --git a/docs/test_cases/t20022_sequence.svg b/docs/test_cases/t20022_sequence.svg index 52060294..0b0877d4 100644 --- a/docs/test_cases/t20022_sequence.svg +++ b/docs/test_cases/t20022_sequence.svg @@ -1,6 +1,6 @@ - + @@ -9,39 +9,39 @@ - - - + + + - - + + tmain() - + tmain() - - + + A - + A - - + + B - + B - - - - + + + + a() - + b() diff --git a/docs/test_cases/t20023.md b/docs/test_cases/t20023.md index a4f1e891..b08cecf3 100644 --- a/docs/test_cases/t20023.md +++ b/docs/test_cases/t20023.md @@ -67,7 +67,7 @@ int tmain() { "diagram_type": "sequence", "metadata": { - "clang_uml_version": "0.3.5-13-g57aa174", + "clang_uml_version": "0.3.5-27-g81c7ce7", "llvm_version": "Ubuntu clang version 15.0.6", "schema_version": 1 }, diff --git a/docs/test_cases/t20023_sequence.svg b/docs/test_cases/t20023_sequence.svg index 253fbe47..d6872f78 100644 --- a/docs/test_cases/t20023_sequence.svg +++ b/docs/test_cases/t20023_sequence.svg @@ -1,6 +1,6 @@ - + @@ -9,37 +9,37 @@ - - - - - - - + + + + + + + - - + + tmain() - + tmain() - - + + A - + A - - - - - - - + + + + + + + a() @@ -47,7 +47,7 @@ try - + @@ -60,7 +60,7 @@ [std::runtime_error &] - + @@ -73,7 +73,7 @@ [std::logic_error &] - + @@ -86,7 +86,7 @@ [...] - + diff --git a/docs/test_cases/t20024.md b/docs/test_cases/t20024.md index 8e403cc5..1865e654 100644 --- a/docs/test_cases/t20024.md +++ b/docs/test_cases/t20024.md @@ -92,7 +92,7 @@ int tmain() { "diagram_type": "sequence", "metadata": { - "clang_uml_version": "0.3.5-13-g57aa174", + "clang_uml_version": "0.3.5-27-g81c7ce7", "llvm_version": "Ubuntu clang version 15.0.6", "schema_version": 1 }, diff --git a/docs/test_cases/t20024_sequence.svg b/docs/test_cases/t20024_sequence.svg index a0012a1c..f9410605 100644 --- a/docs/test_cases/t20024_sequence.svg +++ b/docs/test_cases/t20024_sequence.svg @@ -1,6 +1,6 @@ - + @@ -9,23 +9,23 @@ - - - - - - - - - - - - + + + + + + + + + + + + - + @@ -33,36 +33,36 @@ - - + + tmain() - + tmain() - - + + A - + A - - + + B - + B - - - - - - - - - - - - + + + + + + + + + + + + select(enum_a) @@ -72,7 +72,7 @@ switch [zero] - + @@ -85,7 +85,7 @@ [one] - + @@ -98,7 +98,7 @@ [two] - + @@ -111,7 +111,7 @@ [default] - + @@ -124,7 +124,7 @@ - + select(colors) @@ -134,7 +134,7 @@ switch [enum colors::red] - + @@ -143,7 +143,7 @@ [enum colors::orange] - + @@ -152,7 +152,7 @@ [enum colors::green] - + @@ -161,7 +161,7 @@ [default] - + diff --git a/docs/test_cases/t20025.md b/docs/test_cases/t20025.md index c2c11dc4..2680d9e3 100644 --- a/docs/test_cases/t20025.md +++ b/docs/test_cases/t20025.md @@ -72,7 +72,7 @@ int tmain() { "diagram_type": "sequence", "metadata": { - "clang_uml_version": "0.3.5-13-g57aa174", + "clang_uml_version": "0.3.5-27-g81c7ce7", "llvm_version": "Ubuntu clang version 15.0.6", "schema_version": 1 }, diff --git a/docs/test_cases/t20025_sequence.svg b/docs/test_cases/t20025_sequence.svg index 64cd95da..64005edb 100644 --- a/docs/test_cases/t20025_sequence.svg +++ b/docs/test_cases/t20025_sequence.svg @@ -1,6 +1,6 @@ - + @@ -9,41 +9,41 @@ - - - - + + + + - - + + tmain() - + tmain() - - + + A - + A - - + + add(int,int) - + add(int,int) - - - - - + + + + + a() - + @@ -52,7 +52,7 @@ - + diff --git a/docs/test_cases/t20026.md b/docs/test_cases/t20026.md index 86da42d8..69c7f6fd 100644 --- a/docs/test_cases/t20026.md +++ b/docs/test_cases/t20026.md @@ -52,7 +52,7 @@ int tmain() { "diagram_type": "sequence", "metadata": { - "clang_uml_version": "0.3.5-13-g57aa174", + "clang_uml_version": "0.3.5-27-g81c7ce7", "llvm_version": "Ubuntu clang version 15.0.6", "schema_version": 1 }, diff --git a/docs/test_cases/t20026_sequence.svg b/docs/test_cases/t20026_sequence.svg index 9c89c87f..81cf9138 100644 --- a/docs/test_cases/t20026_sequence.svg +++ b/docs/test_cases/t20026_sequence.svg @@ -1,6 +1,6 @@ - + @@ -9,25 +9,25 @@ - - + + - - + + tmain() - + tmain() - - + + A - + A - - - + + + a() diff --git a/docs/test_cases/t20027.md b/docs/test_cases/t20027.md index 4a4123fe..0245d660 100644 --- a/docs/test_cases/t20027.md +++ b/docs/test_cases/t20027.md @@ -51,7 +51,7 @@ void tmain() { "diagram_type": "sequence", "metadata": { - "clang_uml_version": "0.3.5-13-g57aa174", + "clang_uml_version": "0.3.5-27-g81c7ce7", "llvm_version": "Ubuntu clang version 15.0.6", "schema_version": 1 }, diff --git a/docs/test_cases/t20027_sequence.svg b/docs/test_cases/t20027_sequence.svg index 651338da..531f91d8 100644 --- a/docs/test_cases/t20027_sequence.svg +++ b/docs/test_cases/t20027_sequence.svg @@ -1,6 +1,6 @@ - + @@ -9,25 +9,25 @@ - - + + - - + + tmain() - + tmain() - - + + A - + A - - - + + + a() diff --git a/docs/test_cases/t20028.md b/docs/test_cases/t20028.md index 796dff8d..7941e0a6 100644 --- a/docs/test_cases/t20028.md +++ b/docs/test_cases/t20028.md @@ -61,7 +61,7 @@ int tmain() { "diagram_type": "sequence", "metadata": { - "clang_uml_version": "0.3.5-13-g57aa174", + "clang_uml_version": "0.3.5-27-g81c7ce7", "llvm_version": "Ubuntu clang version 15.0.6", "schema_version": 1 }, diff --git a/docs/test_cases/t20028_sequence.svg b/docs/test_cases/t20028_sequence.svg index bf265c92..06a9bf66 100644 --- a/docs/test_cases/t20028_sequence.svg +++ b/docs/test_cases/t20028_sequence.svg @@ -1,6 +1,6 @@ - + @@ -9,50 +9,50 @@ - - - - - - + + + + + + - - + + tmain() - + tmain() - - + + A - + A - - - - - + + + + + alt - + a() - + b() - + c() @@ -60,7 +60,7 @@ - + d() diff --git a/docs/test_cases/t20029.md b/docs/test_cases/t20029.md index 13081957..b3a8b4ca 100644 --- a/docs/test_cases/t20029.md +++ b/docs/test_cases/t20029.md @@ -105,7 +105,7 @@ int tmain() { "diagram_type": "sequence", "metadata": { - "clang_uml_version": "0.3.5-13-g57aa174", + "clang_uml_version": "0.3.5-27-g81c7ce7", "llvm_version": "Ubuntu clang version 15.0.6", "schema_version": 1 }, diff --git a/docs/test_cases/t20029_sequence.svg b/docs/test_cases/t20029_sequence.svg index aa57ae8b..7f838df8 100644 --- a/docs/test_cases/t20029_sequence.svg +++ b/docs/test_cases/t20029_sequence.svg @@ -1,6 +1,6 @@ - + @@ -9,60 +9,60 @@ - - - - - - - - - - - + + + + + + + + + + + - - + + tmain() - + tmain() - - + + Encoder<Retrier<ConnectionPool>> - + Encoder<Retrier<ConnectionPool>> - - + + Retrier<ConnectionPool> - + Retrier<ConnectionPool> - - + + ConnectionPool - + ConnectionPool - - + + encode_b64(std::string &&) - + encode_b64(std::string &&) - - - - - - - - + + + + + + + + connect() @@ -73,21 +73,21 @@ alt - + [ send(std::string &&) ] - + encode(std::string &&) - + @@ -97,7 +97,7 @@ - + send(std::string &&) @@ -108,7 +108,7 @@ alt - + [ diff --git a/docs/test_cases/t30001.md b/docs/test_cases/t30001.md index bc35f63d..d9050ea4 100644 --- a/docs/test_cases/t30001.md +++ b/docs/test_cases/t30001.md @@ -191,7 +191,7 @@ namespace BB { } ], "metadata": { - "clang_uml_version": "0.3.5-13-g57aa174", + "clang_uml_version": "0.3.5-27-g81c7ce7", "llvm_version": "Ubuntu clang version 15.0.6", "schema_version": 1 }, diff --git a/docs/test_cases/t30001_package.svg b/docs/test_cases/t30001_package.svg index abc3a195..5511761b 100644 --- a/docs/test_cases/t30001_package.svg +++ b/docs/test_cases/t30001_package.svg @@ -1,6 +1,6 @@ - + @@ -9,67 +9,67 @@ - - + + A - - + + AA - - + + B - - + + AA - - + + AAA - - + + BBB - - + + BB - - + + AAA - - + + BBB - - + + BB - + A AAA note... - + This is namespace AA in namespace A - + This is namespace AA in namespace B - - - + + + diff --git a/docs/test_cases/t30002.md b/docs/test_cases/t30002.md index b40e66ec..6e6e6692 100644 --- a/docs/test_cases/t30002.md +++ b/docs/test_cases/t30002.md @@ -36,7 +36,9 @@ namespace A1 { struct CA { }; } namespace A2 { -struct CB { }; +template struct CB { + T cb; +}; } namespace A3 { struct CC { }; @@ -83,12 +85,15 @@ struct CP { }; namespace A17 { struct CR { }; } +namespace A18 { +enum class S { s1, s2, s3 }; +} } namespace B::BB::BBB { class CBA : public A::AA::A6::CF { public: A::AA::A1::CA *ca_; - A::AA::A2::CB cb_; + A::AA::A2::CB cb_; std::shared_ptr cc_; std::map> *cd_; std::array co_; @@ -116,6 +121,8 @@ public: { return {}; } + + A::AA::A18::S s; }; void cj(std::unique_ptr /*cj_*/) { } @@ -178,7 +185,7 @@ template std::map> cm() "name": "A3", "source_location": { "file": "../../tests/t30002/t30002.cc", - "line": 16 + "line": 18 }, "type": "namespace" }, @@ -189,7 +196,7 @@ template std::map> cm() "name": "A4", "source_location": { "file": "../../tests/t30002/t30002.cc", - "line": 19 + "line": 21 }, "type": "namespace" }, @@ -200,7 +207,7 @@ template std::map> cm() "name": "A5", "source_location": { "file": "../../tests/t30002/t30002.cc", - "line": 22 + "line": 24 }, "type": "namespace" }, @@ -211,7 +218,7 @@ template std::map> cm() "name": "A6", "source_location": { "file": "../../tests/t30002/t30002.cc", - "line": 25 + "line": 27 }, "type": "namespace" }, @@ -222,7 +229,7 @@ template std::map> cm() "name": "A7", "source_location": { "file": "../../tests/t30002/t30002.cc", - "line": 28 + "line": 30 }, "type": "namespace" }, @@ -233,7 +240,7 @@ template std::map> cm() "name": "A8", "source_location": { "file": "../../tests/t30002/t30002.cc", - "line": 31 + "line": 33 }, "type": "namespace" }, @@ -244,7 +251,7 @@ template std::map> cm() "name": "A9", "source_location": { "file": "../../tests/t30002/t30002.cc", - "line": 34 + "line": 36 }, "type": "namespace" }, @@ -255,7 +262,7 @@ template std::map> cm() "name": "A10", "source_location": { "file": "../../tests/t30002/t30002.cc", - "line": 37 + "line": 39 }, "type": "namespace" }, @@ -266,7 +273,7 @@ template std::map> cm() "name": "A11", "source_location": { "file": "../../tests/t30002/t30002.cc", - "line": 40 + "line": 42 }, "type": "namespace" }, @@ -277,7 +284,7 @@ template std::map> cm() "name": "A12", "source_location": { "file": "../../tests/t30002/t30002.cc", - "line": 43 + "line": 45 }, "type": "namespace" }, @@ -288,7 +295,7 @@ template std::map> cm() "name": "A13", "source_location": { "file": "../../tests/t30002/t30002.cc", - "line": 46 + "line": 48 }, "type": "namespace" }, @@ -299,7 +306,7 @@ template std::map> cm() "name": "A14", "source_location": { "file": "../../tests/t30002/t30002.cc", - "line": 49 + "line": 51 }, "type": "namespace" }, @@ -310,7 +317,7 @@ template std::map> cm() "name": "A15", "source_location": { "file": "../../tests/t30002/t30002.cc", - "line": 52 + "line": 54 }, "type": "namespace" }, @@ -321,7 +328,7 @@ template std::map> cm() "name": "A16", "source_location": { "file": "../../tests/t30002/t30002.cc", - "line": 55 + "line": 57 }, "type": "namespace" }, @@ -332,7 +339,18 @@ template std::map> cm() "name": "A17", "source_location": { "file": "../../tests/t30002/t30002.cc", - "line": 58 + "line": 60 + }, + "type": "namespace" + }, + { + "display_name": "clanguml::t30002::A::AA::A18", + "id": "405712335116487393", + "is_deprecated": false, + "name": "A18", + "source_location": { + "file": "../../tests/t30002/t30002.cc", + "line": 63 }, "type": "namespace" } @@ -369,7 +387,7 @@ template std::map> cm() "name": "BBB", "source_location": { "file": "../../tests/t30002/t30002.cc", - "line": 62 + "line": 67 }, "type": "namespace" } @@ -379,7 +397,7 @@ template std::map> cm() "name": "BB", "source_location": { "file": "../../tests/t30002/t30002.cc", - "line": 62 + "line": 67 }, "type": "namespace" } @@ -389,30 +407,20 @@ template std::map> cm() "name": "B", "source_location": { "file": "../../tests/t30002/t30002.cc", - "line": 62 + "line": 67 }, "type": "namespace" } ], "metadata": { - "clang_uml_version": "0.3.5-13-g57aa174", + "clang_uml_version": "0.3.5-27-g81c7ce7", "llvm_version": "Ubuntu clang version 15.0.6", "schema_version": 1 }, "name": "t30002_package", "relationships": [ { - "destination": "301858476377711436", - "source": "2255521339657425355", - "type": "dependency" - }, - { - "destination": "1207764290216680521", - "source": "2255521339657425355", - "type": "dependency" - }, - { - "destination": "563861734550555261", + "destination": "1246394833900790496", "source": "2255521339657425355", "type": "dependency" }, @@ -441,6 +449,11 @@ template std::map> cm() "source": "2255521339657425355", "type": "dependency" }, + { + "destination": "1116163804866368736", + "source": "2255521339657425355", + "type": "dependency" + }, { "destination": "299262817531370604", "source": "2255521339657425355", @@ -451,11 +464,31 @@ template std::map> cm() "source": "2255521339657425355", "type": "dependency" }, + { + "destination": "405712335116487393", + "source": "2255521339657425355", + "type": "dependency" + }, { "destination": "1415398383158410524", "source": "2255521339657425355", "type": "dependency" }, + { + "destination": "301858476377711436", + "source": "2255521339657425355", + "type": "dependency" + }, + { + "destination": "1207764290216680521", + "source": "2255521339657425355", + "type": "dependency" + }, + { + "destination": "563861734550555261", + "source": "2255521339657425355", + "type": "dependency" + }, { "destination": "532437874530119999", "source": "2255521339657425355", diff --git a/docs/test_cases/t30002_package.svg b/docs/test_cases/t30002_package.svg index 2ccd2c59..396260dc 100644 --- a/docs/test_cases/t30002_package.svg +++ b/docs/test_cases/t30002_package.svg @@ -1,6 +1,6 @@ - + - + @@ -9,149 +9,156 @@ - - + + A - - + + AA - - - - B + + + + B - - - - BB + + + + BB - - - - A1 + + + + A1 - - - - A2 + + + + A2 - - - - A3 + + + + A3 - - - - A4 + + + + A4 - - - - A5 + + + + A5 - - - - A6 + + + + A6 - - - - A7 + + + + A7 - - - - A8 + + + + A8 - - - - A9 + + + + A9 - - + + + + A10 + + + - A10 + A11 - - + + - A11 + A12 - - + + - A12 + A13 - - + + - A13 + A14 - - + + - A14 + A15 - - + + - A15 + A16 - - + + - A16 + A17 - - + + - A17 + A18 - - - - BBB + + + + BBB - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/docs/test_cases/t30003.md b/docs/test_cases/t30003.md index 6191963e..407d58b1 100644 --- a/docs/test_cases/t30003.md +++ b/docs/test_cases/t30003.md @@ -129,7 +129,7 @@ class B : public ns1::ns2::Anon { }; } ], "metadata": { - "clang_uml_version": "0.3.5-13-g57aa174", + "clang_uml_version": "0.3.5-27-g81c7ce7", "llvm_version": "Ubuntu clang version 15.0.6", "schema_version": 1 }, diff --git a/docs/test_cases/t30003_package.svg b/docs/test_cases/t30003_package.svg index a4f97c20..4ec42dda 100644 --- a/docs/test_cases/t30003_package.svg +++ b/docs/test_cases/t30003_package.svg @@ -1,6 +1,6 @@ - + @@ -9,35 +9,35 @@ - - + + ns1 - - + + ns3 «deprecated» - - + + ns1 - - + + ns2_v1_0_0 - - + + ns2_v0_9_0 «deprecated» - - + + ns2 diff --git a/docs/test_cases/t30004.md b/docs/test_cases/t30004.md index 4de99845..9a212228 100644 --- a/docs/test_cases/t30004.md +++ b/docs/test_cases/t30004.md @@ -142,7 +142,7 @@ namespace CCC { } ], "metadata": { - "clang_uml_version": "0.3.5-13-g57aa174", + "clang_uml_version": "0.3.5-27-g81c7ce7", "llvm_version": "Ubuntu clang version 15.0.6", "schema_version": 1 }, diff --git a/docs/test_cases/t30004_package.svg b/docs/test_cases/t30004_package.svg index 58cfce65..3f1d5fde 100644 --- a/docs/test_cases/t30004_package.svg +++ b/docs/test_cases/t30004_package.svg @@ -1,6 +1,6 @@ - + @@ -9,46 +9,46 @@ - - + + A - + Package AAA. - + Package BBB. - + CCCC package note. - + We skipped DDD. - - + + AAA - - + + BBB - - + + CCC - - + + EEE - - - - + + + + diff --git a/docs/test_cases/t30005.md b/docs/test_cases/t30005.md index 807e60ab..decc601e 100644 --- a/docs/test_cases/t30005.md +++ b/docs/test_cases/t30005.md @@ -168,7 +168,7 @@ struct C2 { } ], "metadata": { - "clang_uml_version": "0.3.5-13-g57aa174", + "clang_uml_version": "0.3.5-27-g81c7ce7", "llvm_version": "Ubuntu clang version 15.0.6", "schema_version": 1 }, diff --git a/docs/test_cases/t30005_package.svg b/docs/test_cases/t30005_package.svg index e289cd72..2a3abc8b 100644 --- a/docs/test_cases/t30005_package.svg +++ b/docs/test_cases/t30005_package.svg @@ -1,6 +1,6 @@ - + @@ -9,48 +9,48 @@ - - + + A - - + + AA - - + + B - - + + BB - - + + C - - + + CC - - + + AAA - - + + BBB - - + + CCC diff --git a/docs/test_cases/t30006.md b/docs/test_cases/t30006.md index f62ab14a..e676b6db 100644 --- a/docs/test_cases/t30006.md +++ b/docs/test_cases/t30006.md @@ -94,7 +94,7 @@ struct A2 { } ], "metadata": { - "clang_uml_version": "0.3.5-13-g57aa174", + "clang_uml_version": "0.3.5-27-g81c7ce7", "llvm_version": "Ubuntu clang version 15.0.6", "schema_version": 1 }, diff --git a/docs/test_cases/t30006_package.svg b/docs/test_cases/t30006_package.svg index 59e66d63..db8b6e76 100644 --- a/docs/test_cases/t30006_package.svg +++ b/docs/test_cases/t30006_package.svg @@ -1,6 +1,6 @@ - + @@ -9,25 +9,25 @@ - - + + B - - + + A - - + + C - + Top A note. - + diff --git a/docs/test_cases/t30007.md b/docs/test_cases/t30007.md index 2d4e5ca1..8be0029c 100644 --- a/docs/test_cases/t30007.md +++ b/docs/test_cases/t30007.md @@ -115,7 +115,7 @@ struct A2 { } ], "metadata": { - "clang_uml_version": "0.3.5-13-g57aa174", + "clang_uml_version": "0.3.5-27-g81c7ce7", "llvm_version": "Ubuntu clang version 15.0.6", "schema_version": 1 }, diff --git a/docs/test_cases/t30007_package.svg b/docs/test_cases/t30007_package.svg index b8a07c60..a8b3b47a 100644 --- a/docs/test_cases/t30007_package.svg +++ b/docs/test_cases/t30007_package.svg @@ -1,6 +1,6 @@ - + @@ -9,30 +9,30 @@ - - + + A - - + + B - - + + AA - - + + C - + Compare layout with t30006. - + diff --git a/docs/test_cases/t30008.md b/docs/test_cases/t30008.md index 1bfd3f0e..f9032389 100644 --- a/docs/test_cases/t30008.md +++ b/docs/test_cases/t30008.md @@ -191,7 +191,7 @@ struct FF { } ], "metadata": { - "clang_uml_version": "0.3.5-13-g57aa174", + "clang_uml_version": "0.3.5-27-g81c7ce7", "llvm_version": "Ubuntu clang version 15.0.6", "schema_version": 1 }, diff --git a/docs/test_cases/t30008_package.svg b/docs/test_cases/t30008_package.svg index 5f4b2446..1d600cf5 100644 --- a/docs/test_cases/t30008_package.svg +++ b/docs/test_cases/t30008_package.svg @@ -1,6 +1,6 @@ - + @@ -9,43 +9,43 @@ - - + + dependants - - + + dependencies - - + + A - - + + B - - + + C - - + + D - - + + E - - + + F diff --git a/docs/test_cases/t30009.md b/docs/test_cases/t30009.md index f798908f..00fcadc3 100644 --- a/docs/test_cases/t30009.md +++ b/docs/test_cases/t30009.md @@ -169,7 +169,7 @@ namespace D { } ], "metadata": { - "clang_uml_version": "0.3.5-13-g57aa174", + "clang_uml_version": "0.3.5-27-g81c7ce7", "llvm_version": "Ubuntu clang version 15.0.6", "schema_version": 1 }, diff --git a/docs/test_cases/t30009_package.svg b/docs/test_cases/t30009_package.svg index 623791a8..55f64270 100644 --- a/docs/test_cases/t30009_package.svg +++ b/docs/test_cases/t30009_package.svg @@ -1,6 +1,6 @@ - + @@ -9,53 +9,53 @@ - - + + One - - + + Two - - + + B - - + + D - - + + A - - + + C - - + + A - - + + B - - + + C - - + + D diff --git a/docs/test_cases/t30010.md b/docs/test_cases/t30010.md new file mode 100644 index 00000000..44fa5219 --- /dev/null +++ b/docs/test_cases/t30010.md @@ -0,0 +1,118 @@ +# t30010 - Package diagram with packages from directory structure +## Config +```yaml +compilation_database_dir: .. +output_directory: puml +diagrams: + t30010_package: + type: package + generate_packages: true + package_type: directory + glob: + - t30010.cc + relative_to: ../../../tests/t30010 + include: + namespaces: + - clanguml::t30010 +# paths: +# - . + using_namespace: + - clanguml::t30010 +``` +## Source code +File t30010.cc +```cpp +#include "app/app.h" + +namespace clanguml { +namespace t30010 { + +App app; + +} // namespace t30002 +} // namespace clanguml + +``` +## Generated UML diagrams +![t30010_package](./t30010_package.svg "Package diagram with packages from directory structure") +## Generated JSON models +```json +{ + "diagram_type": "package", + "elements": [ + { + "display_name": "libraries", + "elements": [ + { + "display_name": "lib1", + "id": "879212264535378961", + "is_deprecated": false, + "name": "lib1", + "type": "namespace" + }, + { + "display_name": "lib2", + "id": "1522606219626203424", + "is_deprecated": false, + "name": "lib2", + "type": "namespace" + }, + { + "display_name": "lib3", + "id": "2263709579652581325", + "is_deprecated": false, + "name": "lib3", + "type": "namespace" + }, + { + "display_name": "lib4", + "id": "1103453030023410219", + "is_deprecated": false, + "name": "lib4", + "type": "namespace" + } + ], + "id": "879401191375500756", + "is_deprecated": false, + "name": "libraries", + "type": "namespace" + }, + { + "display_name": "app", + "id": "2001320261642080149", + "is_deprecated": false, + "name": "app", + "type": "namespace" + } + ], + "metadata": { + "clang_uml_version": "0.3.5-27-g81c7ce7", + "llvm_version": "Ubuntu clang version 15.0.6", + "schema_version": 1 + }, + "name": "t30010_package", + "relationships": [ + { + "destination": "879212264535378961", + "source": "2001320261642080149", + "type": "dependency" + }, + { + "destination": "1522606219626203424", + "source": "2001320261642080149", + "type": "dependency" + }, + { + "destination": "2263709579652581325", + "source": "2001320261642080149", + "type": "dependency" + }, + { + "destination": "1103453030023410219", + "source": "2001320261642080149", + "type": "dependency" + } + ], + "using_namespace": "clanguml::t30010" +} +``` diff --git a/docs/test_cases/t30010_package.svg b/docs/test_cases/t30010_package.svg new file mode 100644 index 00000000..13b850a7 --- /dev/null +++ b/docs/test_cases/t30010_package.svg @@ -0,0 +1,39 @@ + + + + + + + + + + + + + + libraries + + + lib1 + + + lib2 + + + lib3 + + + lib4 + + + app + + + + + + + + + + diff --git a/docs/test_cases/t30011.md b/docs/test_cases/t30011.md new file mode 100644 index 00000000..fc0b2bb7 --- /dev/null +++ b/docs/test_cases/t30011.md @@ -0,0 +1,106 @@ +# t30011 - Package diagram with packages from directory structure for plain C +## Config +```yaml +compilation_database_dir: .. +output_directory: puml +diagrams: + t30011_package: + type: package + package_type: directory + glob: + - t30011.c + relative_to: ../../../tests/t30011 + include: + paths: + - . +``` +## Source code +File t30011.c +```cpp +#include "app/app.h" + +struct t30011_App app; + +``` +## Generated UML diagrams +![t30011_package](./t30011_package.svg "Package diagram with packages from directory structure for plain C") +## Generated JSON models +```json +{ + "diagram_type": "package", + "elements": [ + { + "display_name": "libraries", + "elements": [ + { + "display_name": "lib1", + "id": "879212264535378961", + "is_deprecated": false, + "name": "lib1", + "type": "namespace" + }, + { + "display_name": "lib2", + "id": "1522606219626203424", + "is_deprecated": false, + "name": "lib2", + "type": "namespace" + }, + { + "display_name": "lib3", + "id": "2263709579652581325", + "is_deprecated": false, + "name": "lib3", + "type": "namespace" + }, + { + "display_name": "lib4", + "id": "1103453030023410219", + "is_deprecated": false, + "name": "lib4", + "type": "namespace" + } + ], + "id": "879401191375500756", + "is_deprecated": false, + "name": "libraries", + "type": "namespace" + }, + { + "display_name": "app", + "id": "2001320261642080149", + "is_deprecated": false, + "name": "app", + "type": "namespace" + } + ], + "metadata": { + "clang_uml_version": "0.3.5-27-g81c7ce7", + "llvm_version": "Ubuntu clang version 15.0.6", + "schema_version": 1 + }, + "name": "t30011_package", + "relationships": [ + { + "destination": "879212264535378961", + "source": "2001320261642080149", + "type": "dependency" + }, + { + "destination": "1522606219626203424", + "source": "2001320261642080149", + "type": "dependency" + }, + { + "destination": "2263709579652581325", + "source": "2001320261642080149", + "type": "dependency" + }, + { + "destination": "1103453030023410219", + "source": "2001320261642080149", + "type": "dependency" + } + ] +} +``` diff --git a/docs/test_cases/t30011_package.svg b/docs/test_cases/t30011_package.svg new file mode 100644 index 00000000..13b850a7 --- /dev/null +++ b/docs/test_cases/t30011_package.svg @@ -0,0 +1,39 @@ + + + + + + + + + + + + + + libraries + + + lib1 + + + lib2 + + + lib3 + + + lib4 + + + app + + + + + + + + + + diff --git a/docs/test_cases/t40001.md b/docs/test_cases/t40001.md index c9c0794b..69536a74 100644 --- a/docs/test_cases/t40001.md +++ b/docs/test_cases/t40001.md @@ -101,7 +101,7 @@ diagrams: } ], "metadata": { - "clang_uml_version": "0.3.5-13-g57aa174", + "clang_uml_version": "0.3.5-27-g81c7ce7", "llvm_version": "Ubuntu clang version 15.0.6", "schema_version": 1 }, diff --git a/docs/test_cases/t40001_include.svg b/docs/test_cases/t40001_include.svg index 8eb45d52..6d3035aa 100644 --- a/docs/test_cases/t40001_include.svg +++ b/docs/test_cases/t40001_include.svg @@ -1,6 +1,6 @@ - + @@ -9,43 +9,43 @@ - + src - + include - + lib1 - - + + t40001.cc - - + + t40001_include1.h - - + + lib1.h - + string - + vector - + yaml-cpp/yaml.h - + This is a lib1 include dir - + This is a t40001_include1.h include file @@ -60,7 +60,7 @@ - - + + diff --git a/docs/test_cases/t40002.md b/docs/test_cases/t40002.md index 58db0af5..963380b6 100644 --- a/docs/test_cases/t40002.md +++ b/docs/test_cases/t40002.md @@ -119,7 +119,7 @@ diagrams: } ], "metadata": { - "clang_uml_version": "0.3.5-13-g57aa174", + "clang_uml_version": "0.3.5-27-g81c7ce7", "llvm_version": "Ubuntu clang version 15.0.6", "schema_version": 1 }, diff --git a/docs/test_cases/t40002_include.svg b/docs/test_cases/t40002_include.svg index 27791df9..2f721d25 100644 --- a/docs/test_cases/t40002_include.svg +++ b/docs/test_cases/t40002_include.svg @@ -1,6 +1,6 @@ - + @@ -9,46 +9,46 @@ - + src - + lib1 - + lib2 - + include - + lib1 - + lib2 - - + + t40002.cc - - + + lib1.cc - - + + lib2.cc - - + + lib1.h - - + + lib2.h diff --git a/docs/test_cases/t40003.md b/docs/test_cases/t40003.md index 24a52f57..0549c80a 100644 --- a/docs/test_cases/t40003.md +++ b/docs/test_cases/t40003.md @@ -145,7 +145,7 @@ diagrams: } ], "metadata": { - "clang_uml_version": "0.3.5-13-g57aa174", + "clang_uml_version": "0.3.5-27-g81c7ce7", "llvm_version": "Ubuntu clang version 15.0.6", "schema_version": 1 }, diff --git a/docs/test_cases/t40003_include.svg b/docs/test_cases/t40003_include.svg index 83cc928e..ece2b068 100644 --- a/docs/test_cases/t40003_include.svg +++ b/docs/test_cases/t40003_include.svg @@ -1,6 +1,6 @@ - + @@ -9,66 +9,66 @@ - + src - + dependants - + dependencies - + include - + dependants - + dependencies - - + + t1.cc - - + + t2.cc - - + + t3.h - - + + t2.h - - + + t1.h - - + + t3.h - - + + t2.h - - + + t1.h - - + + t5.h From 0028cf6f3d278d890699e1fedb2f48e5fb09211c Mon Sep 17 00:00:00 2001 From: Bartek Kryza Date: Sun, 28 May 2023 19:59:58 +0200 Subject: [PATCH 12/14] Fixed building on macos --- tests/t20012/t20012.cc | 3 ++- tests/t20012/test_case.h | 42 ++++++++++++++++++++-------------------- 2 files changed, 23 insertions(+), 22 deletions(-) diff --git a/tests/t20012/t20012.cc b/tests/t20012/t20012.cc index 49e58a84..7471fa4a 100644 --- a/tests/t20012/t20012.cc +++ b/tests/t20012/t20012.cc @@ -3,6 +3,7 @@ #include #include #include +#include namespace clanguml { namespace t20012 { @@ -101,4 +102,4 @@ void tmain() // }); } } -} \ No newline at end of file +} diff --git a/tests/t20012/test_case.h b/tests/t20012/test_case.h index 374d9a6d..78879afb 100644 --- a/tests/t20012/test_case.h +++ b/tests/t20012/test_case.h @@ -37,41 +37,41 @@ TEST_CASE("t20012", "[test-case][sequence]") // Check if all calls exist REQUIRE_THAT(puml, HasCall(_A("tmain()"), - _A("tmain()::(lambda ../../tests/t20012/t20012.cc:66:20)"), + _A("tmain()::(lambda ../../tests/t20012/t20012.cc:67:20)"), "operator()()")); REQUIRE_THAT(puml, - HasCall(_A("tmain()::(lambda ../../tests/t20012/t20012.cc:66:20)"), + HasCall(_A("tmain()::(lambda ../../tests/t20012/t20012.cc:67:20)"), _A("A"), "a()")); REQUIRE_THAT(puml, HasCall(_A("A"), _A("A"), "aa()")); REQUIRE_THAT(puml, HasCall(_A("A"), _A("A"), "aaa()")); REQUIRE_THAT(puml, - HasCall(_A("tmain()::(lambda ../../tests/t20012/t20012.cc:66:20)"), + HasCall(_A("tmain()::(lambda ../../tests/t20012/t20012.cc:67:20)"), _A("B"), "b()")); REQUIRE_THAT(puml, HasCall(_A("B"), _A("B"), "bb()")); REQUIRE_THAT(puml, HasCall(_A("B"), _A("B"), "bbb()")); REQUIRE_THAT(puml, - HasCall(_A("tmain()::(lambda ../../tests/t20012/t20012.cc:79:20)"), + HasCall(_A("tmain()::(lambda ../../tests/t20012/t20012.cc:80:20)"), _A("C"), "c()")); REQUIRE_THAT(puml, HasCall(_A("C"), _A("C"), "cc()")); REQUIRE_THAT(puml, HasCall(_A("C"), _A("C"), "ccc()")); REQUIRE_THAT(puml, - HasCall(_A("tmain()::(lambda ../../tests/t20012/t20012.cc:79:20)"), - _A("tmain()::(lambda ../../tests/t20012/t20012.cc:66:20)"), + HasCall(_A("tmain()::(lambda ../../tests/t20012/t20012.cc:80:20)"), + _A("tmain()::(lambda ../../tests/t20012/t20012.cc:67:20)"), "operator()()")); REQUIRE_THAT(puml, HasCall(_A("C"), _A("C"), "ccc()")); REQUIRE_THAT(puml, HasCall(_A("tmain()"), - _A("R"), "r()")); + _A("R"), "r()")); REQUIRE_THAT(puml, - HasCall(_A("R"), - _A("tmain()::(lambda ../../tests/t20012/t20012.cc:85:9)"), + HasCall(_A("R"), + _A("tmain()::(lambda ../../tests/t20012/t20012.cc:86:9)"), "operator()()")); REQUIRE_THAT(puml, - HasCall(_A("tmain()::(lambda ../../tests/t20012/t20012.cc:85:9)"), + HasCall(_A("tmain()::(lambda ../../tests/t20012/t20012.cc:86:9)"), _A("C"), "c()")); REQUIRE_THAT(puml, HasCall(_A("tmain()"), _A("D"), "add5(int)")); @@ -87,31 +87,31 @@ TEST_CASE("t20012", "[test-case][sequence]") std::vector messages = { FindMessage(j, "tmain()", - "tmain()::(lambda ../../tests/t20012/t20012.cc:66:20)", + "tmain()::(lambda ../../tests/t20012/t20012.cc:67:20)", "operator()()"), FindMessage(j, - "tmain()::(lambda ../../tests/t20012/t20012.cc:66:20)", "A", + "tmain()::(lambda ../../tests/t20012/t20012.cc:67:20)", "A", "a()"), FindMessage(j, "A", "A", "aa()"), FindMessage(j, "A", "A", "aaa()"), FindMessage(j, - "tmain()::(lambda ../../tests/t20012/t20012.cc:66:20)", "B", + "tmain()::(lambda ../../tests/t20012/t20012.cc:67:20)", "B", "b()"), FindMessage(j, "B", "B", "bb()"), FindMessage(j, "B", "B", "bbb()"), FindMessage(j, - "tmain()::(lambda ../../tests/t20012/t20012.cc:79:20)", "C", + "tmain()::(lambda ../../tests/t20012/t20012.cc:80:20)", "C", "c()"), FindMessage(j, "C", "C", "cc()"), FindMessage(j, "C", "C", "ccc()"), FindMessage(j, - "tmain()::(lambda ../../tests/t20012/t20012.cc:79:20)", - "tmain()::(lambda ../../tests/t20012/t20012.cc:66:20)", + "tmain()::(lambda ../../tests/t20012/t20012.cc:80:20)", + "tmain()::(lambda ../../tests/t20012/t20012.cc:67:20)", "operator()()"), FindMessage(j, "tmain()", - "R", "r()"), - FindMessage(j, "R", - "tmain()::(lambda ../../tests/t20012/t20012.cc:85:9)", + "R", "r()"), + FindMessage(j, "R", + "tmain()::(lambda ../../tests/t20012/t20012.cc:86:9)", "operator()()"), FindMessage(j, - "tmain()::(lambda ../../tests/t20012/t20012.cc:85:9)", "C", + "tmain()::(lambda ../../tests/t20012/t20012.cc:86:9)", "C", "c()"), FindMessage(j, "tmain()", "D", "add5(int)")}; @@ -119,4 +119,4 @@ TEST_CASE("t20012", "[test-case][sequence]") save_json(config.output_directory() + "/" + diagram->name + ".json", j); } -} \ No newline at end of file +} From 8e801fe31d5d06eb756a3cf70278651258ffcbc4 Mon Sep 17 00:00:00 2001 From: Bartek Kryza Date: Sun, 28 May 2023 22:17:21 +0200 Subject: [PATCH 13/14] Fixed building on MSVC --- src/class_diagram/model/diagram.h | 2 +- src/class_diagram/visitor/template_builder.cc | 40 +------------------ src/class_diagram/visitor/template_builder.h | 2 - .../visitor/translation_unit_visitor.cc | 24 +++++------ .../visitor/translation_unit_visitor.h | 4 +- src/common/clang_utils.cc | 15 ++++++- .../visitor/translation_unit_visitor.cc | 12 +++--- tests/CMakeLists.txt | 2 +- tests/t30011/libraries/lib1/lib1.h | 4 +- tests/t30011/libraries/lib2/lib2.h | 4 +- tests/t30011/libraries/lib4/lib4.h | 4 +- 11 files changed, 47 insertions(+), 66 deletions(-) diff --git a/src/class_diagram/model/diagram.h b/src/class_diagram/model/diagram.h index e8a999ac..74c9192e 100644 --- a/src/class_diagram/model/diagram.h +++ b/src/class_diagram/model/diagram.h @@ -43,7 +43,7 @@ using nested_trait_ns = clanguml::common::model::nested_trait; -class diagram : public common::model::diagram::diagram, +class diagram : public common::model::diagram, public element_view, public element_view, public element_view, diff --git a/src/class_diagram/visitor/template_builder.cc b/src/class_diagram/visitor/template_builder.cc index 13e57ee2..c823a3f5 100644 --- a/src/class_diagram/visitor/template_builder.cc +++ b/src/class_diagram/visitor/template_builder.cc @@ -1090,7 +1090,7 @@ std::optional template_builder::try_as_template_parm_type( argument.is_variadic(is_variadic); - ensure_lambda_type_is_relative(type_parameter_name); + visitor_.ensure_lambda_type_is_relative(type_parameter_name); return argument; } @@ -1109,7 +1109,7 @@ std::optional template_builder::try_as_lambda( auto argument = template_parameter::make_argument(""); type = consume_context(type, argument); - ensure_lambda_type_is_relative(type_name); + visitor_.ensure_lambda_type_is_relative(type_name); argument.set_type(type_name); return argument; @@ -1257,40 +1257,4 @@ bool template_builder::add_base_classes(class_ &tinst, return variadic_params; } -void template_builder::ensure_lambda_type_is_relative( - std::string ¶meter_type) const -{ -#ifdef _MSC_VER - auto root_name = fmt::format( - "{}\\", std::filesystem::current_path().root_name().string()); - if (root_name.back() == '\\') { - root_name.pop_back(); - root_name.push_back('/'); - } -#else - auto root_name = std::string{"/"}; -#endif - - std::string lambda_prefix{fmt::format("(lambda at {}", root_name)}; - - while (parameter_type.find(lambda_prefix) != std::string::npos) { - auto lambda_begin = parameter_type.find(lambda_prefix); - - auto absolute_lambda_path_end = - parameter_type.find(':', lambda_begin + lambda_prefix.size()); - auto absolute_lambda_path = - parameter_type.substr(lambda_begin + lambda_prefix.size() - 1, - absolute_lambda_path_end - - (lambda_begin + lambda_prefix.size() - 1)); - - auto relative_lambda_path = util::path_to_url(std::filesystem::relative( - absolute_lambda_path, config().relative_to()) - .string()); - - parameter_type = fmt::format("{}(lambda at {}{}", - parameter_type.substr(0, lambda_begin), relative_lambda_path, - parameter_type.substr(absolute_lambda_path_end)); - } -} - } // namespace clanguml::class_diagram::visitor diff --git a/src/class_diagram/visitor/template_builder.h b/src/class_diagram/visitor/template_builder.h index 177f3a93..a214122a 100644 --- a/src/class_diagram/visitor/template_builder.h +++ b/src/class_diagram/visitor/template_builder.h @@ -181,8 +181,6 @@ public: clang::SourceManager &source_manager() const; private: - void ensure_lambda_type_is_relative(std::string ¶meter_type) const; - // Reference to the output diagram model clanguml::class_diagram::model::diagram &diagram_; diff --git a/src/class_diagram/visitor/translation_unit_visitor.cc b/src/class_diagram/visitor/translation_unit_visitor.cc index 0d9dfd4a..50bef538 100644 --- a/src/class_diagram/visitor/translation_unit_visitor.cc +++ b/src/class_diagram/visitor/translation_unit_visitor.cc @@ -1690,11 +1690,7 @@ void translation_unit_visitor::ensure_lambda_type_is_relative( { #ifdef _MSC_VER auto root_name = fmt::format( - "{}\\", std::filesystem::current_path().root_name().string()); - if (root_name.back() == '\\') { - root_name.pop_back(); - root_name.push_back('/'); - } + "{}", std::filesystem::current_path().root_name().string()); #else auto root_name = std::string{"/"}; #endif @@ -1703,13 +1699,17 @@ void translation_unit_visitor::ensure_lambda_type_is_relative( while (parameter_type.find(lambda_prefix) != std::string::npos) { auto lambda_begin = parameter_type.find(lambda_prefix); - + auto lambda_prefix_size = lambda_prefix.size(); +#ifdef _MSC_VER + // Skip the `\` or `/` after drive letter and semicolon + lambda_prefix_size++; +#endif auto absolute_lambda_path_end = - parameter_type.find(':', lambda_begin + lambda_prefix.size()); + parameter_type.find(':', lambda_begin + lambda_prefix_size); auto absolute_lambda_path = - parameter_type.substr(lambda_begin + lambda_prefix.size() - 1, + parameter_type.substr(lambda_begin + lambda_prefix_size - 1, absolute_lambda_path_end - - (lambda_begin + lambda_prefix.size() - 1)); + (lambda_begin + lambda_prefix_size - 1)); auto relative_lambda_path = util::path_to_url( config().make_path_relative(absolute_lambda_path).string()); @@ -2102,7 +2102,7 @@ void translation_unit_visitor::add_class(std::unique_ptr &&c) const auto file = config().make_path_relative(c->file()); - common::model::path p{file, common::model::path_type::kFilesystem}; + common::model::path p{file.string(), common::model::path_type::kFilesystem}; p.pop_back(); diagram().add(p, std::move(c)); @@ -2120,7 +2120,7 @@ void translation_unit_visitor::add_enum(std::unique_ptr &&e) const auto file = config().make_path_relative(e->file()); - common::model::path p{file, common::model::path_type::kFilesystem}; + common::model::path p{file.string(), common::model::path_type::kFilesystem}; p.pop_back(); diagram().add(p, std::move(e)); @@ -2138,7 +2138,7 @@ void translation_unit_visitor::add_concept(std::unique_ptr &&c) const auto file = config().make_path_relative(c->file()); - common::model::path p{file, common::model::path_type::kFilesystem}; + common::model::path p{file.string(), common::model::path_type::kFilesystem}; p.pop_back(); diagram().add(p, std::move(c)); diff --git a/src/class_diagram/visitor/translation_unit_visitor.h b/src/class_diagram/visitor/translation_unit_visitor.h index 943943e7..671766e2 100644 --- a/src/class_diagram/visitor/translation_unit_visitor.h +++ b/src/class_diagram/visitor/translation_unit_visitor.h @@ -125,6 +125,8 @@ public: void add_enum(std::unique_ptr &&e); void add_concept(std::unique_ptr &&c); + void ensure_lambda_type_is_relative(std::string ¶meter_type) const; + private: bool should_include(const clang::NamedDecl *decl); @@ -189,8 +191,6 @@ private: const found_relationships_t &relationships, bool break_on_first_aggregation = false); - void ensure_lambda_type_is_relative(std::string ¶meter_type) const; - void process_record_parent( clang::RecordDecl *cls, class_ &c, const namespace_ &ns); diff --git a/src/common/clang_utils.cc b/src/common/clang_utils.cc index 4e0e87f6..31d45682 100644 --- a/src/common/clang_utils.cc +++ b/src/common/clang_utils.cc @@ -745,8 +745,19 @@ bool parse_source_location(const std::string &location_str, std::string &file, return false; file = tokens.at(0); - line = std::stoi(tokens.at(1)); - column = std::stoi(tokens.at(2)); + try { + line = std::stoi(tokens.at(1)); + } + catch(std::invalid_argument &e) { + line = 0; + } + + try { + column = std::stoi(tokens.at(2)); + } + catch(std::invalid_argument &e) { + column = 0; + } return true; } diff --git a/src/package_diagram/visitor/translation_unit_visitor.cc b/src/package_diagram/visitor/translation_unit_visitor.cc index 3f3a77d2..861fbc68 100644 --- a/src/package_diagram/visitor/translation_unit_visitor.cc +++ b/src/package_diagram/visitor/translation_unit_visitor.cc @@ -207,11 +207,12 @@ void translation_unit_visitor::add_relationships( // package for current directory is already in the model if (config().package_type() == config::package_type_t::kDirectory) { auto file = source_manager().getFilename(cls->getLocation()).str(); - auto relative_file = - util::path_to_url(config().make_path_relative(file)); + + auto relative_file = config().make_path_relative(file); + relative_file.make_preferred(); common::model::path parent_path{ - relative_file, common::model::path_type::kFilesystem}; + relative_file.string(), common::model::path_type::kFilesystem}; parent_path.pop_back(); auto pkg_name = parent_path.name(); parent_path.pop_back(); @@ -261,9 +262,10 @@ common::model::diagram_element::id_t translation_unit_visitor::get_package_id( auto file = source_manager().getFilename(cls->getSourceRange().getBegin()).str(); - auto relative_file = util::path_to_url(config().make_path_relative(file)); + auto relative_file = config().make_path_relative(file); + relative_file.make_preferred(); common::model::path parent_path{ - relative_file, common::model::path_type::kFilesystem}; + relative_file.string(), common::model::path_type::kFilesystem}; parent_path.pop_back(); return common::to_id(parent_path.to_string()); diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index 9265d456..a2f8b649 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -60,7 +60,7 @@ foreach(TEST_NAME ${TEST_CASES}) $<$,$>: -Wno-unused-parameter -Wno-unused-private-field -Wno-unused-variable -Wno-attributes -Wno-nonnull -Wno-deprecated-enum-enum-conversion> - $<$:/MP /W1 /bigobj /wd4624>>) + $<$:/W1 /bigobj /wd4624>>) target_link_libraries(${TEST_NAME} PRIVATE ${CLANG_UML_TEST_LIBRARIES}) endforeach() diff --git a/tests/t30011/libraries/lib1/lib1.h b/tests/t30011/libraries/lib1/lib1.h index 0b82d65b..46156a10 100644 --- a/tests/t30011/libraries/lib1/lib1.h +++ b/tests/t30011/libraries/lib1/lib1.h @@ -1,3 +1,5 @@ #pragma once -struct t30011_A { }; +struct t30011_A { + int a; +}; diff --git a/tests/t30011/libraries/lib2/lib2.h b/tests/t30011/libraries/lib2/lib2.h index ebc93b2d..51a3033a 100644 --- a/tests/t30011/libraries/lib2/lib2.h +++ b/tests/t30011/libraries/lib2/lib2.h @@ -1,3 +1,5 @@ #pragma once -struct t30011_B { }; +struct t30011_B { + int b; +}; diff --git a/tests/t30011/libraries/lib4/lib4.h b/tests/t30011/libraries/lib4/lib4.h index 408898b0..fb252050 100644 --- a/tests/t30011/libraries/lib4/lib4.h +++ b/tests/t30011/libraries/lib4/lib4.h @@ -1,3 +1,5 @@ #pragma once -struct t30011_C { }; +struct t30011_C { + int c; +}; From f273f6b2f7a5699a6b651c18dd6853e4a1d6e354 Mon Sep 17 00:00:00 2001 From: Bartek Kryza Date: Sun, 28 May 2023 22:20:40 +0200 Subject: [PATCH 14/14] Fixed formatting --- .../visitor/translation_unit_visitor.cc | 20 ++++++++++--------- src/common/clang_utils.cc | 4 ++-- 2 files changed, 13 insertions(+), 11 deletions(-) diff --git a/src/class_diagram/visitor/translation_unit_visitor.cc b/src/class_diagram/visitor/translation_unit_visitor.cc index 50bef538..348858c0 100644 --- a/src/class_diagram/visitor/translation_unit_visitor.cc +++ b/src/class_diagram/visitor/translation_unit_visitor.cc @@ -1689,8 +1689,8 @@ void translation_unit_visitor::ensure_lambda_type_is_relative( std::string ¶meter_type) const { #ifdef _MSC_VER - auto root_name = fmt::format( - "{}", std::filesystem::current_path().root_name().string()); + auto root_name = + fmt::format("{}", std::filesystem::current_path().root_name().string()); #else auto root_name = std::string{"/"}; #endif @@ -1706,10 +1706,9 @@ void translation_unit_visitor::ensure_lambda_type_is_relative( #endif auto absolute_lambda_path_end = parameter_type.find(':', lambda_begin + lambda_prefix_size); - auto absolute_lambda_path = - parameter_type.substr(lambda_begin + lambda_prefix_size - 1, - absolute_lambda_path_end - - (lambda_begin + lambda_prefix_size - 1)); + auto absolute_lambda_path = parameter_type.substr( + lambda_begin + lambda_prefix_size - 1, + absolute_lambda_path_end - (lambda_begin + lambda_prefix_size - 1)); auto relative_lambda_path = util::path_to_url( config().make_path_relative(absolute_lambda_path).string()); @@ -2102,7 +2101,8 @@ void translation_unit_visitor::add_class(std::unique_ptr &&c) const auto file = config().make_path_relative(c->file()); - common::model::path p{file.string(), common::model::path_type::kFilesystem}; + common::model::path p{ + file.string(), common::model::path_type::kFilesystem}; p.pop_back(); diagram().add(p, std::move(c)); @@ -2120,7 +2120,8 @@ void translation_unit_visitor::add_enum(std::unique_ptr &&e) const auto file = config().make_path_relative(e->file()); - common::model::path p{file.string(), common::model::path_type::kFilesystem}; + common::model::path p{ + file.string(), common::model::path_type::kFilesystem}; p.pop_back(); diagram().add(p, std::move(e)); @@ -2138,7 +2139,8 @@ void translation_unit_visitor::add_concept(std::unique_ptr &&c) const auto file = config().make_path_relative(c->file()); - common::model::path p{file.string(), common::model::path_type::kFilesystem}; + common::model::path p{ + file.string(), common::model::path_type::kFilesystem}; p.pop_back(); diagram().add(p, std::move(c)); diff --git a/src/common/clang_utils.cc b/src/common/clang_utils.cc index 31d45682..b45eef0a 100644 --- a/src/common/clang_utils.cc +++ b/src/common/clang_utils.cc @@ -748,14 +748,14 @@ bool parse_source_location(const std::string &location_str, std::string &file, try { line = std::stoi(tokens.at(1)); } - catch(std::invalid_argument &e) { + catch (std::invalid_argument &e) { line = 0; } try { column = std::stoi(tokens.at(2)); } - catch(std::invalid_argument &e) { + catch (std::invalid_argument &e) { column = 0; }