From 511c8d0f658a098eacdb285334494b90dc9b613b Mon Sep 17 00:00:00 2001 From: Bartek Kryza Date: Mon, 5 Sep 2022 21:24:41 +0200 Subject: [PATCH 01/77] WIP --- .../visitor/translation_unit_visitor.cc | 25 ++++++++++- .../visitor/translation_unit_visitor.h | 5 +++ tests/t20003/.clang-uml | 14 +++++++ tests/t20003/t20003.cc | 16 +++++++ tests/t20003/test_case.h | 42 +++++++++++++++++++ tests/test_cases.cc | 1 + 6 files changed, 102 insertions(+), 1 deletion(-) create mode 100644 tests/t20003/.clang-uml create mode 100644 tests/t20003/t20003.cc create mode 100644 tests/t20003/test_case.h diff --git a/src/sequence_diagram/visitor/translation_unit_visitor.cc b/src/sequence_diagram/visitor/translation_unit_visitor.cc index a6db6454..4370c998 100644 --- a/src/sequence_diagram/visitor/translation_unit_visitor.cc +++ b/src/sequence_diagram/visitor/translation_unit_visitor.cc @@ -71,6 +71,17 @@ bool translation_unit_visitor::VisitFunctionDecl( return true; } +bool translation_unit_visitor::VisitFunctionTemplateDecl( + clang::FunctionTemplateDecl *function_declaration) +{ + if (!function_declaration->isCXXClassMember()) + current_class_decl_ = nullptr; + + current_function_template_decl_ = function_declaration; + + return true; +} + bool translation_unit_visitor::VisitCallExpr(clang::CallExpr *expr) { using clanguml::common::model::message_t; @@ -109,11 +120,20 @@ bool translation_unit_visitor::VisitCallExpr(clang::CallExpr *expr) m.from = current_class_decl_->getQualifiedNameAsString(); m.from_usr = current_method_decl_->getID(); } - else { + else if (current_function_decl_ != nullptr) { // Handle call expression within free function m.from = current_function_decl_->getQualifiedNameAsString() + "()"; m.from_usr = current_function_decl_->getID(); } + else { + m.from = current_function_template_decl_->getQualifiedNameAsString(); + std::vector params; + for (const auto &template_parameter : + *current_function_template_decl_->getTemplateParameters()) { + params.push_back(template_parameter->getNameAsString()); + } + m.from += fmt::format("<{}>", fmt::join(params, ",")); + } const auto ¤t_ast_context = current_class_decl_ ? current_class_decl_->getASTContext() @@ -153,6 +173,9 @@ bool translation_unit_visitor::VisitCallExpr(clang::CallExpr *expr) if (!callee_decl) return true; + if (callee_decl->isTemplateDecl()) + LOG_DBG("Call to template function!!!!"); + const auto *callee_function = callee_decl->getAsFunction(); if (!callee_function) diff --git a/src/sequence_diagram/visitor/translation_unit_visitor.h b/src/sequence_diagram/visitor/translation_unit_visitor.h index a5e3fbf5..f8e72885 100644 --- a/src/sequence_diagram/visitor/translation_unit_visitor.h +++ b/src/sequence_diagram/visitor/translation_unit_visitor.h @@ -41,6 +41,9 @@ public: virtual bool VisitFunctionDecl(clang::FunctionDecl *function_declaration); + bool VisitFunctionTemplateDecl( + clang::FunctionTemplateDecl *function_declaration); + clanguml::sequence_diagram::model::diagram &diagram(); const clanguml::config::sequence_diagram &config() const; @@ -59,6 +62,8 @@ private: clang::CXXRecordDecl *current_class_decl_; clang::CXXMethodDecl *current_method_decl_; clang::FunctionDecl *current_function_decl_; + clang::FunctionTemplateDecl *current_function_template_decl_; + }; } diff --git a/tests/t20003/.clang-uml b/tests/t20003/.clang-uml new file mode 100644 index 00000000..d592e566 --- /dev/null +++ b/tests/t20003/.clang-uml @@ -0,0 +1,14 @@ +compilation_database_dir: .. +output_directory: puml +diagrams: + t20003_sequence: + type: sequence + glob: + - ../../tests/t20003/t20003.cc + include: + namespaces: + - clanguml::t20003 + using_namespace: + - clanguml::t20003 + start_from: + - function: "clanguml::t20003::m1()" diff --git a/tests/t20003/t20003.cc b/tests/t20003/t20003.cc new file mode 100644 index 00000000..3518b174 --- /dev/null +++ b/tests/t20003/t20003.cc @@ -0,0 +1,16 @@ +#include +#include +#include + +namespace clanguml { +namespace t20003 { + +template void m4(T p) { } + +template void m3(T p) { m4(); } + +template void m2(T p) { m3(p); } + +template void m1(T p) { m2(p); } +} +} diff --git a/tests/t20003/test_case.h b/tests/t20003/test_case.h new file mode 100644 index 00000000..eb8aecf5 --- /dev/null +++ b/tests/t20003/test_case.h @@ -0,0 +1,42 @@ +/** + * tests/t20003/test_case.cc + * + * Copyright (c) 2021-2022 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("t20003", "[test-case][sequence]") +{ + auto [config, db] = load_config("t20003"); + + auto diagram = config.diagrams["t20003_sequence"]; + + REQUIRE(diagram->name == "t20003_sequence"); + + auto model = generate_sequence_diagram(*db, diagram); + + REQUIRE(model->name() == "t20003_sequence"); + + auto puml = generate_sequence_puml(diagram, *model); + + REQUIRE_THAT(puml, StartsWith("@startuml")); + REQUIRE_THAT(puml, EndsWith("@enduml\n")); + + REQUIRE_THAT(puml, HasFunctionCall("m1", "m2")); + REQUIRE_THAT(puml, HasFunctionCall("m2", "m3")); + REQUIRE_THAT(puml, HasFunctionCall("m3", "m4")); + + save_puml( + "./" + config.output_directory() + "/" + diagram->name + ".puml", puml); +} diff --git a/tests/test_cases.cc b/tests/test_cases.cc index 5f5381b1..a95557f9 100644 --- a/tests/test_cases.cc +++ b/tests/test_cases.cc @@ -249,6 +249,7 @@ using namespace clanguml::test::matchers; /// #include "t20001/test_case.h" #include "t20002/test_case.h" +#include "t20003/test_case.h" /// /// Package diagram tests From a2705b10d979f19f309a370b7a58ae61760b8f52 Mon Sep 17 00:00:00 2001 From: Bartek Kryza Date: Tue, 27 Sep 2022 23:12:27 +0200 Subject: [PATCH 02/77] Added template function sequence diagram test case --- .../plantuml/sequence_diagram_generator.cc | 7 +- src/sequence_diagram/model/message.h | 4 +- .../visitor/translation_unit_visitor.cc | 120 +++++++++++++++--- .../visitor/translation_unit_visitor.h | 1 - tests/t20003/t20003.cc | 2 +- 5 files changed, 109 insertions(+), 25 deletions(-) diff --git a/src/sequence_diagram/generators/plantuml/sequence_diagram_generator.cc b/src/sequence_diagram/generators/plantuml/sequence_diagram_generator.cc index fb45c5d2..f04ed517 100644 --- a/src/sequence_diagram/generators/plantuml/sequence_diagram_generator.cc +++ b/src/sequence_diagram/generators/plantuml/sequence_diagram_generator.cc @@ -47,8 +47,10 @@ void generator::generate_call(const message &m, std::ostream &ostr) const } auto message = m.message; - if (!message.empty()) + if (!message.empty()) { + message = m_config.using_namespace().relative(message); message += "()"; + } ostr << '"' << from << "\" " << common::generators::plantuml::to_plantuml(message_t::kCall) << " \"" @@ -103,7 +105,8 @@ void generator::generate(std::ostream &ostr) const if (sf.location_type == source_location::location_t::function) { std::int64_t start_from; for (const auto &[k, v] : m_model.sequences) { - if (v.from == sf.location) { + std::string vfrom = v.from; + if (vfrom == sf.location) { start_from = k; break; } diff --git a/src/sequence_diagram/model/message.h b/src/sequence_diagram/model/message.h index bb0b3212..f092dc23 100644 --- a/src/sequence_diagram/model/message.h +++ b/src/sequence_diagram/model/message.h @@ -27,9 +27,9 @@ namespace clanguml::sequence_diagram::model { struct message { common::model::message_t type; std::string from; - std::uint_least64_t from_usr; + std::uint_least64_t from_usr{}; std::string to; - std::int64_t to_usr; + std::int64_t to_usr{}; std::string message; std::string return_type; unsigned int line; diff --git a/src/sequence_diagram/visitor/translation_unit_visitor.cc b/src/sequence_diagram/visitor/translation_unit_visitor.cc index 4370c998..fde34e68 100644 --- a/src/sequence_diagram/visitor/translation_unit_visitor.cc +++ b/src/sequence_diagram/visitor/translation_unit_visitor.cc @@ -23,6 +23,31 @@ namespace clanguml::sequence_diagram::visitor { +std::string to_string(const clang::FunctionTemplateDecl *decl) +{ + std::vector template_parameters; + // Handle template function + for (const auto *parameter : *decl->getTemplateParameters()) { + if (clang::dyn_cast_or_null(parameter)) { + const auto *template_type_parameter = + clang::dyn_cast_or_null(parameter); + + std::string template_parameter{ + template_type_parameter->getNameAsString()}; + + if (template_type_parameter->isParameterPack()) + template_parameter += "..."; + + template_parameters.emplace_back(std::move(template_parameter)); + } + else { + // TODO + } + } + return fmt::format("{}<{}>({})", decl->getQualifiedNameAsString(), + fmt::join(template_parameters, ","), ""); +} + translation_unit_visitor::translation_unit_visitor(clang::SourceManager &sm, clanguml::sequence_diagram::model::diagram &diagram, const clanguml::config::sequence_diagram &config) @@ -32,6 +57,8 @@ translation_unit_visitor::translation_unit_visitor(clang::SourceManager &sm, , current_class_decl_{nullptr} , current_method_decl_{nullptr} , current_function_decl_{nullptr} + , current_function_template_decl_{nullptr} + { } @@ -68,6 +95,16 @@ bool translation_unit_visitor::VisitFunctionDecl( current_function_decl_ = function_declaration; + // Check if this function is a part of template function declaration, + // If no - reset the current_function_template_decl_ + if (current_function_template_decl_ && + current_function_template_decl_->getQualifiedNameAsString() != + function_declaration->getQualifiedNameAsString()) + current_function_template_decl_ = nullptr; + + LOG_DBG("Visiting function {}", + current_function_decl_->getQualifiedNameAsString()); + return true; } @@ -79,6 +116,9 @@ bool translation_unit_visitor::VisitFunctionTemplateDecl( current_function_template_decl_ = function_declaration; + LOG_DBG("Visiting template function {}", + current_function_template_decl_->getQualifiedNameAsString()); + return true; } @@ -100,16 +140,21 @@ bool translation_unit_visitor::VisitCallExpr(clang::CallExpr *expr) return true; // Skip if current class was excluded in the config - if (current_class_decl_ && - !diagram().should_include( - current_class_decl_->getQualifiedNameAsString())) - return true; + + if (current_class_decl_) { + std::string current_class_qualified_name = + current_class_decl_->getQualifiedNameAsString(); + if (!diagram().should_include(current_class_qualified_name)) + return true; + } // Skip if current function was excluded in the config - if (current_function_decl_ && - !diagram().should_include( - current_function_decl_->getQualifiedNameAsString())) - return true; + if (current_function_decl_) { + std::string current_function_qualified_name = + current_function_decl_->getQualifiedNameAsString(); + if (!diagram().should_include(current_function_qualified_name)) + return true; + } message m; m.type = message_t::kCall; @@ -120,6 +165,12 @@ bool translation_unit_visitor::VisitCallExpr(clang::CallExpr *expr) m.from = current_class_decl_->getQualifiedNameAsString(); m.from_usr = current_method_decl_->getID(); } + else if (current_function_template_decl_ != nullptr && + current_function_decl_ != nullptr) { + + m.from = to_string(current_function_template_decl_); + m.from_usr = current_function_template_decl_->getID(); + } else if (current_function_decl_ != nullptr) { // Handle call expression within free function m.from = current_function_decl_->getQualifiedNameAsString() + "()"; @@ -167,23 +218,54 @@ bool translation_unit_visitor::VisitCallExpr(clang::CallExpr *expr) else if (const auto *function_call_expr = clang::dyn_cast_or_null(expr); function_call_expr != nullptr) { + auto *callee_decl = function_call_expr->getCalleeDecl(); - const auto *callee_decl = function_call_expr->getCalleeDecl(); + if (callee_decl == nullptr) { + LOG_DBG("Cannot get callee declaration - trying direct callee..."); + callee_decl = function_call_expr->getDirectCallee(); + } - if (!callee_decl) - return true; + if (!callee_decl) { + if (clang::dyn_cast_or_null( + function_call_expr->getCallee())) { + // This is probably a template + auto *unresolved_expr = + clang::dyn_cast_or_null( + function_call_expr->getCallee()); - if (callee_decl->isTemplateDecl()) - LOG_DBG("Call to template function!!!!"); + if (unresolved_expr) { + for (const auto *decl : unresolved_expr->decls()) { + if (clang::dyn_cast_or_null< + clang::FunctionTemplateDecl>(decl)) { - const auto *callee_function = callee_decl->getAsFunction(); + auto *ftd = clang::dyn_cast_or_null< + clang::FunctionTemplateDecl>(decl); - if (!callee_function) - return true; + m.to = to_string(ftd); + m.message = to_string(ftd); + m.to_usr = ftd->getID(); + break; + } + } + } + } + } + else { + if (!callee_decl) + return true; - m.to = callee_function->getQualifiedNameAsString() + "()"; - m.message = callee_function->getNameAsString(); - m.to_usr = callee_function->getID(); + if (callee_decl->isTemplateDecl()) + LOG_DBG("Call to template function!!!!"); + + const auto *callee_function = callee_decl->getAsFunction(); + + if (!callee_function) + return true; + + m.to = callee_function->getQualifiedNameAsString() + "()"; + m.message = callee_function->getNameAsString(); + m.to_usr = callee_function->getID(); + } m.return_type = function_call_expr->getCallReturnType(current_ast_context) .getAsString(); diff --git a/src/sequence_diagram/visitor/translation_unit_visitor.h b/src/sequence_diagram/visitor/translation_unit_visitor.h index f8e72885..811868ed 100644 --- a/src/sequence_diagram/visitor/translation_unit_visitor.h +++ b/src/sequence_diagram/visitor/translation_unit_visitor.h @@ -63,7 +63,6 @@ private: clang::CXXMethodDecl *current_method_decl_; clang::FunctionDecl *current_function_decl_; clang::FunctionTemplateDecl *current_function_template_decl_; - }; } diff --git a/tests/t20003/t20003.cc b/tests/t20003/t20003.cc index 3518b174..af9b75ba 100644 --- a/tests/t20003/t20003.cc +++ b/tests/t20003/t20003.cc @@ -7,7 +7,7 @@ namespace t20003 { template void m4(T p) { } -template void m3(T p) { m4(); } +template void m3(T p) { m4(p); } template void m2(T p) { m3(p); } From 1fe9918c1aa10505622272c9c64dac3c6febf2e3 Mon Sep 17 00:00:00 2001 From: Bartek Kryza Date: Sun, 23 Oct 2022 22:36:53 +0200 Subject: [PATCH 03/77] Initial refactoring of sequence diagram visitor to include participants --- src/common/types.h | 4 + .../plantuml/sequence_diagram_generator.cc | 29 +- src/sequence_diagram/model/diagram.cc | 14 + src/sequence_diagram/model/diagram.h | 35 +- src/sequence_diagram/model/message.h | 31 +- src/sequence_diagram/model/participant.cc | 131 +++++ src/sequence_diagram/model/participant.h | 177 +++++++ .../visitor/translation_unit_visitor.cc | 493 ++++++++++++++---- .../visitor/translation_unit_visitor.h | 211 +++++++- tests/t20004/.clang-uml | 14 + tests/t20004/t20004.cc | 18 + tests/t20004/test_case.h | 47 ++ tests/test_cases.cc | 1 + 13 files changed, 1089 insertions(+), 116 deletions(-) create mode 100644 src/sequence_diagram/model/participant.cc create mode 100644 src/sequence_diagram/model/participant.h create mode 100644 tests/t20004/.clang-uml create mode 100644 tests/t20004/t20004.cc create mode 100644 tests/t20004/test_case.h diff --git a/src/common/types.h b/src/common/types.h index 9a6b6ef0..0cb38440 100644 --- a/src/common/types.h +++ b/src/common/types.h @@ -36,6 +36,10 @@ public: { } + optional_ref(T *value) { value_ = value; } + + optional_ref(const T *value) { value_ = value; } + optional_ref(T &value) { value_ = &value; } optional_ref(const T &value) { value_ = &value; } diff --git a/src/sequence_diagram/generators/plantuml/sequence_diagram_generator.cc b/src/sequence_diagram/generators/plantuml/sequence_diagram_generator.cc index f04ed517..6a7912b7 100644 --- a/src/sequence_diagram/generators/plantuml/sequence_diagram_generator.cc +++ b/src/sequence_diagram/generators/plantuml/sequence_diagram_generator.cc @@ -38,15 +38,15 @@ generator::generator( void generator::generate_call(const message &m, std::ostream &ostr) const { - const auto from = m_config.using_namespace().relative(m.from); - const auto to = m_config.using_namespace().relative(m.to); + const auto from = m_config.using_namespace().relative(m.from_name); + const auto to = m_config.using_namespace().relative(m.to_name); if (from.empty() || to.empty()) { LOG_DBG("Skipping empty call from '{}' to '{}'", from, to); return; } - auto message = m.message; + auto message = m.message_name; if (!message.empty()) { message = m_config.using_namespace().relative(message); message += "()"; @@ -57,7 +57,7 @@ void generator::generate_call(const message &m, std::ostream &ostr) const << to << "\" : " << message << std::endl; LOG_DBG("Generated call '{}' from {} [{}] to {} [{}]", message, from, - m.from_usr, to, m.to_usr); + m.from_name, to, m.to_name); } void generator::generate_return(const message &m, std::ostream &ostr) const @@ -65,8 +65,8 @@ void generator::generate_return(const message &m, std::ostream &ostr) const // Add return activity only for messages between different actors and // only if the return type is different than void if ((m.from != m.to) && (m.return_type != "void")) { - const auto from = m_config.using_namespace().relative(m.from); - const auto to = m_config.using_namespace().relative(m.to); + const auto from = m_config.using_namespace().relative(m.from_name); + const auto to = m_config.using_namespace().relative(m.to_name); ostr << '"' << to << "\" " << common::generators::plantuml::to_plantuml(message_t::kReturn) @@ -77,17 +77,25 @@ void generator::generate_return(const message &m, std::ostream &ostr) const void generator::generate_activity(const activity &a, std::ostream &ostr) const { for (const auto &m : a.messages) { - const auto to = m_config.using_namespace().relative(m.to); + const auto to = m_config.using_namespace().relative(m.to_name); if (to.empty()) continue; + LOG_DBG("Generating message {} --> {}", + m.from_name, m.to_name); generate_call(m, ostr); ostr << "activate " << '"' << to << '"' << std::endl; - if (m_model.sequences.find(m.to_usr) != m_model.sequences.end()) - generate_activity(m_model.sequences[m.to_usr], ostr); + if (m_model.sequences.find(m.to) != m_model.sequences.end()) { + LOG_DBG("Creating activity {} --> {} - missing sequence {}", + m.from_name, m.to_name, m.to); + generate_activity(m_model.sequences[m.to], ostr); + } + else + LOG_DBG("Skipping activity {} --> {} - missing sequence {}", + m.from_name, m.to_name, m.to); generate_return(m, ostr); @@ -97,6 +105,8 @@ void generator::generate_activity(const activity &a, std::ostream &ostr) const void generator::generate(std::ostream &ostr) const { + m_model.print(); + ostr << "@startuml" << std::endl; generate_plantuml_directives(ostr, m_config.puml().before); @@ -107,6 +117,7 @@ void generator::generate(std::ostream &ostr) const for (const auto &[k, v] : m_model.sequences) { std::string vfrom = v.from; if (vfrom == sf.location) { + LOG_DBG("Found sequence diagram start point: {}", k); start_from = k; break; } diff --git a/src/sequence_diagram/model/diagram.cc b/src/sequence_diagram/model/diagram.cc index 510e7d63..0d42987b 100644 --- a/src/sequence_diagram/model/diagram.cc +++ b/src/sequence_diagram/model/diagram.cc @@ -58,6 +58,20 @@ inja::json diagram::context() const return ctx; } +void diagram::print() const +{ + for (const auto &[from_id, act] : sequences) { + LOG_DBG("Sequence id={}:", from_id); + LOG_DBG(" Activity id={}, from={}:", act.usr, act.from); + for (const auto &message : act.messages) { + LOG_DBG( + " Message from={}, from_id={}, to={}, to_id={}, name={}", + message.from_name, message.from, message.to_name, message.to, + message.message_name); + } + } +} + } namespace clanguml::common::model { diff --git a/src/sequence_diagram/model/diagram.h b/src/sequence_diagram/model/diagram.h index 9190b12e..4579917a 100644 --- a/src/sequence_diagram/model/diagram.h +++ b/src/sequence_diagram/model/diagram.h @@ -20,6 +20,7 @@ #include "activity.h" #include "common/model/diagram.h" #include "common/types.h" +#include "participant.h" #include #include @@ -47,9 +48,41 @@ public: inja::json context() const override; + void print() const; + bool started{false}; - std::map sequences; + template + common::optional_ref get_participant( + common::model::diagram_element::id_t id) + { + if (participants.find(id) == participants.end()) { + return {}; + } + + return common::optional_ref( + static_cast(participants.at(id).get())); + } + + void add_participant(std::unique_ptr p) + { + LOG_DBG("Adding {} participant: {}, {} [{}]", p->type_name(), + p->full_name(false), p->id(), + p->type_name() == "method" + ? dynamic_cast(p.get())->method_name() + : ""); + + const auto pid = p->id(); + + if (participants.find(pid) == participants.end()) { + participants.emplace(pid, std::move(p)); + } + } + + std::map sequences; + + std::map> + participants; }; } diff --git a/src/sequence_diagram/model/message.h b/src/sequence_diagram/model/message.h index f092dc23..606fa95a 100644 --- a/src/sequence_diagram/model/message.h +++ b/src/sequence_diagram/model/message.h @@ -25,13 +25,34 @@ namespace clanguml::sequence_diagram::model { struct message { + message() + : from{} + , from_name{} + , to{} + , to_name{} + , message_name{} + , return_type{} + , line{} + { + } + common::model::message_t type; - std::string from; - std::uint_least64_t from_usr{}; - std::string to; - std::int64_t to_usr{}; - std::string message; + + /// Source participant id + std::uint_least64_t from; + std::string from_name; + // std::uint_least64_t from_usr{}; + + /// Target participant id + std::uint_least64_t to; + std::string to_name; + + // std::int64_t to_usr{}; + + std::string message_name; + std::string return_type; + unsigned int line; }; diff --git a/src/sequence_diagram/model/participant.cc b/src/sequence_diagram/model/participant.cc new file mode 100644 index 00000000..e4a28399 --- /dev/null +++ b/src/sequence_diagram/model/participant.cc @@ -0,0 +1,131 @@ +/** + * src/sequence_diagram/model/participant.cc + * + * Copyright (c) 2021-2022 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. + */ + +#include "participant.h" + +namespace clanguml::sequence_diagram::model { +class_::class_(const common::model::namespace_ &using_namespace) + : participant{using_namespace} +{ +} + +bool class_::is_struct() const { return is_struct_; } + +void class_::is_struct(bool is_struct) { is_struct_ = is_struct; } + +bool class_::is_template() const { return is_template_; } + +void class_::is_template(bool is_template) { is_template_ = is_template; } + +bool class_::is_template_instantiation() const +{ + return is_template_instantiation_; +} + +void class_::is_template_instantiation(bool is_template_instantiation) +{ + is_template_instantiation_ = is_template_instantiation; +} + +void class_::add_template(class_diagram::model::template_parameter tmplt) +{ + templates_.emplace_back(std::move(tmplt)); +} + +const std::vector & +class_::templates() const +{ + return templates_; +} + +std::string class_::full_name_no_ns() const +{ + using namespace clanguml::util; + + std::ostringstream ostr; + + ostr << name(); + + render_template_params(ostr, false); + + return ostr.str(); +} + +std::string class_::full_name(bool relative) const +{ + using namespace clanguml::util; + using clanguml::common::model::namespace_; + + std::ostringstream ostr; + + ostr << name_and_ns(); + render_template_params(ostr, relative); + + std::string res; + + if (relative) + res = using_namespace().relative(ostr.str()); + else + res = ostr.str(); + + if (res.empty()) + return "<>"; + + return res; +} + +std::ostringstream &class_::render_template_params( + std::ostringstream &ostr, bool relative) const +{ + using clanguml::common::model::namespace_; + + if (!templates_.empty()) { + std::vector tnames; + std::vector tnames_simplified; + + std::transform(templates_.cbegin(), templates_.cend(), + std::back_inserter(tnames), + [ns = using_namespace(), relative]( + const auto &tmplt) { return tmplt.to_string(ns, relative); }); + + ostr << fmt::format("<{}>", fmt::join(tnames, ",")); + } + + return ostr; +} + +function::function(const common::model::namespace_ &using_namespace) + : participant{using_namespace} +{ +} + +std::string function::full_name(bool relative) const +{ + return element::full_name(relative) + "()"; +} + +std::string function::full_name_no_ns() const +{ + return element::full_name_no_ns() + "()"; +} + +method::method(const common::model::namespace_ &using_namespace) + : participant{using_namespace} +{ +} +} \ No newline at end of file diff --git a/src/sequence_diagram/model/participant.h b/src/sequence_diagram/model/participant.h new file mode 100644 index 00000000..31c3f525 --- /dev/null +++ b/src/sequence_diagram/model/participant.h @@ -0,0 +1,177 @@ +/** + * src/sequence_diagram/model/participant.h + * + * Copyright (c) 2021-2022 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 "class_diagram/model/template_parameter.h" +#include "class_diagram/model/type_alias.h" +#include "common/model/element.h" + +#include +#include + +namespace clanguml::sequence_diagram::model { + +struct participant : public common::model::element, + public common::model::stylable_element { + enum class stereotype_t { + participant = 0, + actor, + boundary, + control, + entity, + database, + collections, + queue + }; + + using common::model::element::element; + + participant(const participant &) = delete; + participant(participant &&) noexcept = delete; + participant &operator=(const participant &) = delete; + participant &operator=(participant &&) = delete; + + std::string type_name() const override { return "participant"; } + + stereotype_t stereotype_{stereotype_t::participant}; +}; +// +// struct template_trait { +// void set_base_template(const std::string &full_name) +// { +// base_template_full_name_ = full_name; +// } +// std::string base_template() const { return base_template_full_name_; } +// +// void add_template(class_diagram::model::template_parameter tmplt) +// { +// templates_.push_back(std::move(tmplt)); +// } +// +// const std::vector & +// templates() const +// { +// return templates_; +// } +// +// std::vector templates_; +// std::string base_template_full_name_; +//}; + +struct class_ : public participant { +public: + class_(const common::model::namespace_ &using_namespace); + + class_(const class_ &) = delete; + class_(class_ &&) noexcept = delete; + class_ &operator=(const class_ &) = delete; + class_ &operator=(class_ &&) = delete; + + std::string type_name() const override { return "class"; } + + bool is_struct() const; + void is_struct(bool is_struct); + + bool is_template() const; + void is_template(bool is_template); + + bool is_template_instantiation() const; + void is_template_instantiation(bool is_template_instantiation); + + void add_template(class_diagram::model::template_parameter tmplt); + + const std::vector & + templates() const; + + void set_base_template(const std::string &full_name); + std::string base_template() const; + + friend bool operator==(const class_ &l, const class_ &r); + + std::string full_name(bool relative = true) const override; + + std::string full_name_no_ns() const override; + + bool is_abstract() const; + + bool is_alias() const { return is_alias_; } + + void is_alias(bool alias) { is_alias_ = alias; } + + int calculate_template_specialization_match( + const class_ &other, const std::string &full_name) const; + +private: + std::ostringstream &render_template_params( + std::ostringstream &ostr, bool relative) const; + + bool is_struct_{false}; + bool is_template_{false}; + bool is_template_instantiation_{false}; + bool is_alias_{false}; + std::vector templates_; + std::string base_template_full_name_; + std::map + type_aliases_; + + std::string full_name_; +}; + +struct function : public participant { + function(const common::model::namespace_ &using_namespace); + + function(const function &) = delete; + function(function &&) noexcept = delete; + function &operator=(const function &) = delete; + function &operator=(function &&) = delete; + + std::string type_name() const override { return "function"; } + + std::string full_name(bool relative = true) const override; + + std::string full_name_no_ns() const override; +}; + +struct method : public participant { + method(const common::model::namespace_ &using_namespace); + + method(const function &) = delete; + method(method &&) noexcept = delete; + method &operator=(const method &) = delete; + method &operator=(method &&) = delete; + + std::string type_name() const override { return "method"; } + + const std::string method_name() const { + return method_name_; + } + + void set_method_name(const std::string& name) { method_name_ = name; } + + void set_class_id(diagram_element::id_t id) { class_id_ = id; } + + diagram_element::id_t class_id() const { return class_id_; } + +private: + diagram_element::id_t class_id_; + std::string method_name_; +}; + +struct function_template : public participant { }; + +} diff --git a/src/sequence_diagram/visitor/translation_unit_visitor.cc b/src/sequence_diagram/visitor/translation_unit_visitor.cc index fde34e68..e7082a8c 100644 --- a/src/sequence_diagram/visitor/translation_unit_visitor.cc +++ b/src/sequence_diagram/visitor/translation_unit_visitor.cc @@ -51,14 +51,10 @@ std::string to_string(const clang::FunctionTemplateDecl *decl) translation_unit_visitor::translation_unit_visitor(clang::SourceManager &sm, clanguml::sequence_diagram::model::diagram &diagram, const clanguml::config::sequence_diagram &config) - : source_manager_{sm} + : common::visitor::translation_unit_visitor{sm, config} , diagram_{diagram} , config_{config} - , current_class_decl_{nullptr} - , current_method_decl_{nullptr} - , current_function_decl_{nullptr} - , current_function_template_decl_{nullptr} - + , call_expression_context_{} { } @@ -75,49 +71,210 @@ translation_unit_visitor::config() const bool translation_unit_visitor::VisitCXXRecordDecl(clang::CXXRecordDecl *cls) { - current_class_decl_ = cls; + // Skip system headers + if (source_manager().isInSystemHeader(cls->getSourceRange().getBegin())) + return true; + + if (!diagram().should_include(cls->getQualifiedNameAsString())) + return true; + + call_expression_context_.reset(); + + if (!diagram().should_include(cls->getQualifiedNameAsString())) { + return true; + } + + if (cls->isTemplated() && cls->getDescribedTemplate()) { + // If the described templated of this class is already in the model + // skip it: + if (get_ast_local_id(cls->getDescribedTemplate()->getID())) + return true; + } + + // TODO: Add support for classes defined in function/method bodies + if (cls->isLocalClass()) + return true; + + // Build the class declaration and store it in the diagram, even + // if we don't need it for any of the participants of this diagram + auto c_ptr = create_class_declaration(cls); + + if (!c_ptr) + return true; + + const auto cls_id = c_ptr->id(); + + set_ast_local_id(cls->getID(), cls_id); + + auto &class_model = + diagram() + .get_participant(cls_id) + .has_value() + ? *diagram() + .get_participant(cls_id) + .get() + : *c_ptr; + + auto id = class_model.id(); + if (!cls->isCompleteDefinition()) { + forward_declarations_.emplace(id, std::move(c_ptr)); + return true; + } + else { + forward_declarations_.erase(id); + } + + if (diagram_.should_include(class_model)) { + LOG_DBG("Adding class {} with id {}", class_model.full_name(false), + class_model.id()); + + assert(class_model.id() == cls_id); + + call_expression_context_.set_caller_id(cls_id); + call_expression_context_.update(cls); + + diagram_.add_participant(std::move(c_ptr)); + } + else { + LOG_DBG("Skipping class {} with id {}", class_model.full_name(), + class_model.id()); + } + + // call_expression_context_.current_class_decl_ = cls; + // call_expression_context_.current_class_ = process_class(cls); return true; } -bool translation_unit_visitor::VisitCXXMethodDecl(clang::CXXMethodDecl *method) +bool translation_unit_visitor::VisitClassTemplateDecl( + clang::ClassTemplateDecl *cls) { - current_method_decl_ = method; + if (source_manager().isInSystemHeader(cls->getSourceRange().getBegin())) + return true; + + if (!diagram().should_include(cls->getQualifiedNameAsString())) + return true; + + LOG_DBG("= Visiting class template declaration {} at {}", + cls->getQualifiedNameAsString(), + cls->getLocation().printToString(source_manager())); + + auto c_ptr = create_class_declaration(cls->getTemplatedDecl()); + + if (!c_ptr) + return true; + + // Override the id with the template id, for now we don't care about the + // underlying templated class id + + process_template_parameters(*cls, *c_ptr); + + const auto cls_full_name = c_ptr->full_name(false); + const auto id = common::to_id(cls_full_name); + + c_ptr->set_id(id); + + set_ast_local_id(cls->getID(), id); + + if (!cls->getTemplatedDecl()->isCompleteDefinition()) { + forward_declarations_.emplace(id, std::move(c_ptr)); + return true; + } + else { + forward_declarations_.erase(id); + } + + if (diagram_.should_include(*c_ptr)) { + const auto name = c_ptr->full_name(); + LOG_DBG("Adding class template {} with id {}", name, id); + + call_expression_context_.set_caller_id(id); + call_expression_context_.update(cls); + + diagram_.add_participant(std::move(c_ptr)); + } return true; } -bool translation_unit_visitor::VisitFunctionDecl( - clang::FunctionDecl *function_declaration) +bool translation_unit_visitor::VisitCXXMethodDecl(clang::CXXMethodDecl *m) { - if (!function_declaration->isCXXClassMember()) - current_class_decl_ = nullptr; + if (call_expression_context_.current_class_decl_ == nullptr || + call_expression_context_.current_class_template_decl_ == nullptr) + return true; - current_function_decl_ = function_declaration; + call_expression_context_.update(m); - // Check if this function is a part of template function declaration, - // If no - reset the current_function_template_decl_ - if (current_function_template_decl_ && - current_function_template_decl_->getQualifiedNameAsString() != - function_declaration->getQualifiedNameAsString()) - current_function_template_decl_ = nullptr; + auto m_ptr = std::make_unique( + config().using_namespace()); - LOG_DBG("Visiting function {}", - current_function_decl_->getQualifiedNameAsString()); + common::model::namespace_ ns{m->getQualifiedNameAsString()}; + m_ptr->set_method_name(ns.name()); + ns.pop_back(); + m_ptr->set_name(ns.name()); + ns.pop_back(); + m_ptr->set_namespace(ns); + m_ptr->set_id(common::to_id(m->getQualifiedNameAsString())); + + m_ptr->set_class_id( + get_ast_local_id(call_expression_context_.current_class_decl_->getID()) + .value()); + + call_expression_context_.update(m); + + call_expression_context_.set_caller_id(m_ptr->id()); + + set_ast_local_id(m->getID(), m_ptr->id()); + + diagram().add_participant(std::move(m_ptr)); + + return true; +} + +bool translation_unit_visitor::VisitFunctionDecl(clang::FunctionDecl *f) +{ + if (f->isCXXClassMember()) + return true; + + const auto function_name = f->getQualifiedNameAsString(); + + if (!diagram().should_include(function_name)) + return true; + + LOG_DBG("Visiting function declaration {}", function_name); + + auto f_ptr = std::make_unique( + config().using_namespace()); + + common::model::namespace_ ns{function_name}; + f_ptr->set_name(ns.name()); + ns.pop_back(); + f_ptr->set_namespace(ns); + f_ptr->set_id(common::to_id(function_name)); + + call_expression_context_.update(f); + + call_expression_context_.set_caller_id(f_ptr->id()); + + set_ast_local_id(f->getID(), f_ptr->id()); + + // TODO: Handle overloaded functions with different arguments + diagram().add_participant(std::move(f_ptr)); return true; } bool translation_unit_visitor::VisitFunctionTemplateDecl( - clang::FunctionTemplateDecl *function_declaration) + clang::FunctionTemplateDecl *function_template) { - if (!function_declaration->isCXXClassMember()) - current_class_decl_ = nullptr; + const auto function_name = function_template->getQualifiedNameAsString(); - current_function_template_decl_ = function_declaration; + if (!diagram().should_include(function_name)) + return true; - LOG_DBG("Visiting template function {}", - current_function_template_decl_->getQualifiedNameAsString()); + LOG_DBG("Visiting function template declaration {}", function_name); + + call_expression_context_.update(function_template); return true; } @@ -139,68 +296,33 @@ bool translation_unit_visitor::VisitCallExpr(clang::CallExpr *expr) if (clang::dyn_cast_or_null(expr)) return true; - // Skip if current class was excluded in the config - - if (current_class_decl_) { - std::string current_class_qualified_name = - current_class_decl_->getQualifiedNameAsString(); - if (!diagram().should_include(current_class_qualified_name)) - return true; - } - - // Skip if current function was excluded in the config - if (current_function_decl_) { - std::string current_function_qualified_name = - current_function_decl_->getQualifiedNameAsString(); - if (!diagram().should_include(current_function_qualified_name)) - return true; - } + if (!call_expression_context_.valid()) + return true; message m; m.type = message_t::kCall; + m.from = call_expression_context_.caller_id(); + m.from_name = diagram().participants.at(m.from)->full_name(false); - if (current_class_decl_ != nullptr) { - // Handle call expression within some class method - assert(current_method_decl_ != nullptr); - m.from = current_class_decl_->getQualifiedNameAsString(); - m.from_usr = current_method_decl_->getID(); - } - else if (current_function_template_decl_ != nullptr && - current_function_decl_ != nullptr) { - - m.from = to_string(current_function_template_decl_); - m.from_usr = current_function_template_decl_->getID(); - } - else if (current_function_decl_ != nullptr) { - // Handle call expression within free function - m.from = current_function_decl_->getQualifiedNameAsString() + "()"; - m.from_usr = current_function_decl_->getID(); - } - else { - m.from = current_function_template_decl_->getQualifiedNameAsString(); - std::vector params; - for (const auto &template_parameter : - *current_function_template_decl_->getTemplateParameters()) { - params.push_back(template_parameter->getNameAsString()); - } - m.from += fmt::format("<{}>", fmt::join(params, ",")); - } - - const auto ¤t_ast_context = current_class_decl_ - ? current_class_decl_->getASTContext() - : current_function_decl_->getASTContext(); + const auto ¤t_ast_context = + call_expression_context_.get_ast_context(); if (const auto *operator_call_expr = clang::dyn_cast_or_null(expr); operator_call_expr != nullptr) { // TODO: Handle C++ operator calls } + // + // class method + // else if (const auto *method_call_expr = clang::dyn_cast_or_null(expr); method_call_expr != nullptr) { // Get callee declaration as methods parent const auto *method_decl = method_call_expr->getMethodDecl(); + std::string method_name = method_decl->getQualifiedNameAsString(); + const auto *callee_decl = method_decl ? method_decl->getParent() : nullptr; @@ -209,9 +331,12 @@ bool translation_unit_visitor::VisitCallExpr(clang::CallExpr *expr) callee_decl->getQualifiedNameAsString()))) return true; - m.to = callee_decl->getQualifiedNameAsString(); - m.to_usr = method_decl->getID(); - m.message = method_decl->getNameAsString(); + // TODO: The method can be called before it's declaration has been + // encountered by the visitor - for now it's not a problem + // as overloaded methods are not supported + m.to = common::to_id(method_decl->getQualifiedNameAsString()); + m.to_name = callee_decl->getQualifiedNameAsString(); + m.message_name = method_decl->getNameAsString(); m.return_type = method_call_expr->getCallReturnType(current_ast_context) .getAsString(); } @@ -234,6 +359,7 @@ bool translation_unit_visitor::VisitCallExpr(clang::CallExpr *expr) function_call_expr->getCallee()); if (unresolved_expr) { + unresolved_expr->dump(); for (const auto *decl : unresolved_expr->decls()) { if (clang::dyn_cast_or_null< clang::FunctionTemplateDecl>(decl)) { @@ -241,9 +367,9 @@ bool translation_unit_visitor::VisitCallExpr(clang::CallExpr *expr) auto *ftd = clang::dyn_cast_or_null< clang::FunctionTemplateDecl>(decl); - m.to = to_string(ftd); - m.message = to_string(ftd); - m.to_usr = ftd->getID(); + m.to_name = to_string(ftd); + m.message_name = to_string(ftd); + m.to = get_ast_local_id(ftd->getID()).value(); break; } } @@ -262,9 +388,9 @@ bool translation_unit_visitor::VisitCallExpr(clang::CallExpr *expr) if (!callee_function) return true; - m.to = callee_function->getQualifiedNameAsString() + "()"; - m.message = callee_function->getNameAsString(); - m.to_usr = callee_function->getID(); + m.to_name = callee_function->getQualifiedNameAsString() + "()"; + m.message_name = callee_function->getNameAsString(); + m.to = get_ast_local_id(callee_function->getID()).value(); } m.return_type = function_call_expr->getCallReturnType(current_ast_context) @@ -274,20 +400,197 @@ bool translation_unit_visitor::VisitCallExpr(clang::CallExpr *expr) return true; } - if (diagram().sequences.find(m.from_usr) == diagram().sequences.end()) { - activity a; - a.usr = m.from_usr; - a.from = m.from; - diagram().sequences.insert({m.from_usr, std::move(a)}); + if(m.from > 0 && m.to > 0) { + if (diagram().sequences.find(m.from) == diagram().sequences.end()) { + activity a; + a.usr = m.from; + a.from = m.from_name; + diagram().sequences.insert({m.from, std::move(a)}); + } + + LOG_DBG("Found call {} from {} [{}] to {} [{}] ", m.message_name, + m.from_name, m.from, m.to_name, m.to); + + diagram().sequences[m.from].messages.emplace_back(std::move(m)); + + assert(!diagram().sequences.empty()); } - LOG_DBG("Found call {} from {} [{}] to {} [{}] ", m.message, m.from, - m.from_usr, m.to, m.to_usr); - - diagram().sequences[m.from_usr].messages.emplace_back(std::move(m)); - - assert(!diagram().sequences.empty()); - return true; } + +std::unique_ptr +translation_unit_visitor::create_class_declaration(clang::CXXRecordDecl *cls) +{ + assert(cls != nullptr); + + auto c_ptr{std::make_unique( + config_.using_namespace())}; + auto &c = *c_ptr; + + // TODO: refactor to method get_qualified_name() + auto qualified_name = + cls->getQualifiedNameAsString(); // common::get_qualified_name(*cls); + + if (!diagram().should_include(qualified_name)) + return {}; + + auto ns = common::get_tag_namespace(*cls); + + const auto *parent = cls->getParent(); + + if (parent && parent->isRecord()) { + // Here we have 2 options, either: + // - the parent is a regular C++ class/struct + // - the parent is a class template declaration/specialization + std::optional id_opt; + int64_t local_id = + static_cast(parent)->getID(); + + // First check if the parent has been added to the diagram as regular + // class + id_opt = get_ast_local_id(local_id); + + // If not, check if the parent template declaration is in the model + if (!id_opt) { + local_id = static_cast(parent) + ->getDescribedTemplate() + ->getID(); + if (static_cast(parent) + ->getDescribedTemplate()) + id_opt = get_ast_local_id(local_id); + } + + assert(id_opt); + + auto parent_class = + diagram_.get_participant( + *id_opt); + + assert(parent_class); + + c.set_namespace(ns); + if (cls->getNameAsString().empty()) { + // Nested structs can be anonymous + if (anonymous_struct_relationships_.count(cls->getID()) > 0) { + const auto &[label, hint, access] = + anonymous_struct_relationships_[cls->getID()]; + + c.set_name(parent_class.value().name() + "##" + + fmt::format("({})", label)); + + parent_class.value().add_relationship( + {hint, common::to_id(c.full_name(false)), access, label}); + } + else + c.set_name(parent_class.value().name() + "##" + + fmt::format( + "(anonymous_{})", std::to_string(cls->getID()))); + } + else { + c.set_name( + parent_class.value().name() + "##" + cls->getNameAsString()); + } + + c.set_id(common::to_id(c.full_name(false))); + + c.nested(true); + } + else { + c.set_name(common::get_tag_name(*cls)); + c.set_namespace(ns); + c.set_id(common::to_id(c.full_name(false))); + } + + c.is_struct(cls->isStruct()); + + process_comment(*cls, c); + set_source_location(*cls, c); + + if (c.skip()) + return {}; + + c.set_style(c.style_spec()); + + return c_ptr; +} + +bool translation_unit_visitor::process_template_parameters( + const clang::ClassTemplateDecl &template_declaration, + sequence_diagram::model::class_ &c) +{ + using class_diagram::model::template_parameter; + + LOG_DBG("Processing class {} template parameters...", + common::get_qualified_name(template_declaration)); + + if (template_declaration.getTemplateParameters() == nullptr) + return false; + + for (const auto *parameter : + *template_declaration.getTemplateParameters()) { + if (clang::dyn_cast_or_null(parameter)) { + const auto *template_type_parameter = + clang::dyn_cast_or_null(parameter); + template_parameter ct; + ct.set_type(""); + ct.is_template_parameter(true); + ct.set_name(template_type_parameter->getNameAsString()); + ct.set_default_value(""); + ct.is_variadic(template_type_parameter->isParameterPack()); + + c.add_template(std::move(ct)); + } + else if (clang::dyn_cast_or_null( + parameter)) { + const auto *template_nontype_parameter = + clang::dyn_cast_or_null( + parameter); + template_parameter ct; + ct.set_type(template_nontype_parameter->getType().getAsString()); + ct.set_name(template_nontype_parameter->getNameAsString()); + ct.is_template_parameter(false); + ct.set_default_value(""); + ct.is_variadic(template_nontype_parameter->isParameterPack()); + + c.add_template(std::move(ct)); + } + else if (clang::dyn_cast_or_null( + parameter)) { + const auto *template_template_parameter = + clang::dyn_cast_or_null( + parameter); + template_parameter ct; + ct.set_type(""); + ct.set_name(template_template_parameter->getNameAsString() + "<>"); + ct.is_template_parameter(true); + ct.set_default_value(""); + ct.is_variadic(template_template_parameter->isParameterPack()); + + c.add_template(std::move(ct)); + } + else { + // pass + } + } + + return false; +} + +void translation_unit_visitor::set_ast_local_id( + int64_t local_id, common::model::diagram_element::id_t global_id) +{ + LOG_DBG("== Setting local element mapping {} --> {}", local_id, global_id); + + local_ast_id_map_[local_id] = global_id; +} + +std::optional +translation_unit_visitor::get_ast_local_id(int64_t local_id) const +{ + if (local_ast_id_map_.find(local_id) == local_ast_id_map_.end()) + return {}; + + return local_ast_id_map_.at(local_id); +} } diff --git a/src/sequence_diagram/visitor/translation_unit_visitor.h b/src/sequence_diagram/visitor/translation_unit_visitor.h index 811868ed..bc4dd548 100644 --- a/src/sequence_diagram/visitor/translation_unit_visitor.h +++ b/src/sequence_diagram/visitor/translation_unit_visitor.h @@ -17,6 +17,7 @@ */ #pragma once +#include "common/visitor/translation_unit_visitor.h" #include "config/config.h" #include "sequence_diagram/model/diagram.h" @@ -26,8 +27,182 @@ namespace clanguml::sequence_diagram::visitor { +std::string to_string(const clang::FunctionTemplateDecl *decl); + +struct call_expression_context { + call_expression_context() + : current_class_decl_{nullptr} + , current_method_decl_{nullptr} + , current_function_decl_{nullptr} + , current_function_template_decl_{nullptr} + { + } + + void reset() + { + current_class_decl_ = nullptr; + current_method_decl_ = nullptr; + current_function_decl_ = nullptr; + current_function_template_decl_ = nullptr; + } + + bool valid() const + { + return (current_class_decl_ != nullptr) || + (current_method_decl_ != nullptr) || + (current_function_decl_ != nullptr) || + (current_function_template_decl_ != nullptr); + } + + void update(clang::CXXRecordDecl *cls) { current_class_decl_ = cls; } + + void update(clang::ClassTemplateDecl *clst) + { + current_class_template_decl_ = clst; + } + + auto &get_ast_context() + { + return current_class_decl_ ? current_class_decl_->getASTContext() + : current_function_decl_->getASTContext(); + } + + void update(clang::CXXMethodDecl *method) { current_method_decl_ = method; } + + void update(clang::FunctionDecl *function) + { + if (!function->isCXXClassMember()) + reset(); + + current_function_decl_ = function; + + // Check if this function is a part of template function declaration, + // If no - reset the current_function_template_decl_ + if (current_function_template_decl_ && + current_function_template_decl_->getQualifiedNameAsString() != + function->getQualifiedNameAsString()) { + current_function_template_decl_ = nullptr; + } + // else { + // call_expression_context_.current_class_method_ = + // process_class_method(method); + // } + } + + void update(clang::FunctionTemplateDecl *function_template) + { + current_function_template_decl_ = function_template; + + if (!function_template->isCXXClassMember()) + current_class_decl_ = nullptr; + + current_function_template_decl_ = function_template; + } + + bool in_class_method() const { return current_class_decl_ != nullptr; } + + bool in_function() const + { + return current_class_decl_ == nullptr && + current_function_decl_ != nullptr; + } + + bool in_function_template() const + { + return current_function_decl_ != nullptr && + current_function_template_decl_ != nullptr; + } + + // std::string caller_name() const + // { + // if (in_class_method()) + // return current_class_decl_->getQualifiedNameAsString(); + // else if (in_function_template()) { + // return to_string(current_function_template_decl_); + // } + // else if (in_function()) { + // const auto function_name = + // current_function_decl_->getQualifiedNameAsString(); + // LOG_DBG("Processing function {}", function_name); + // // Handle call expression within free function + // if + // (current_function_decl_->isFunctionTemplateSpecialization()) { + // /* + // /// This template specialization was formed from a + // template-id but + // /// has not yet been declared, defined, or + // instantiated. TSK_Undeclared = 0, + // /// This template specialization was implicitly + // instantiated + // from a + // /// template. (C++ [temp.inst]). + // TSK_ImplicitInstantiation, + // /// This template specialization was declared or + // defined by + // an + // /// explicit specialization (C++ [temp.expl.spec]) or + // partial + // /// specialization (C++ [temp.class.spec]). + // TSK_ExplicitSpecialization, + // /// This template specialization was instantiated from + // a + // template + // /// due to an explicit instantiation declaration + // request + // /// (C++11 [temp.explicit]). + // TSK_ExplicitInstantiationDeclaration, + // /// This template specialization was instantiated from + // a + // template + // /// due to an explicit instantiation definition + // request + // /// (C++ [temp.explicit]). + // TSK_ExplicitInstantiationDefinition + // */ + // [[maybe_unused]] const auto specialization_kind = + // current_function_decl_->getTemplateSpecializationKind(); + // [[maybe_unused]] const auto *primary_template = + // current_function_decl_->getPrimaryTemplate(); + // + // for (const auto &arg : + // current_function_decl_->getTemplateSpecializationArgs() + // ->asArray()) { + // LOG_DBG("TEMPLATE SPECIALIZATION ARG:"); + // arg.dump(); + // } + // + // LOG_DBG("--------------"); + // } + // + // return function_name + "()"; + // } + // else + // return ""; + // } + + std::int64_t caller_id() const + { + return current_caller_id_; + } + + void set_caller_id(std::int64_t id) { + LOG_DBG("Setting current caller id to {}", id); + current_caller_id_ = id; + } + + clang::CXXRecordDecl *current_class_decl_; + clang::ClassTemplateDecl *current_class_template_decl_; + clang::CXXMethodDecl *current_method_decl_; + clang::FunctionDecl *current_function_decl_; + clang::FunctionTemplateDecl *current_function_template_decl_; + +private: + std::int64_t current_caller_id_; +}; + class translation_unit_visitor - : public clang::RecursiveASTVisitor { + : public clang::RecursiveASTVisitor, + public common::visitor::translation_unit_visitor { public: translation_unit_visitor(clang::SourceManager &sm, clanguml::sequence_diagram::model::diagram &diagram, @@ -39,6 +214,8 @@ public: virtual bool VisitCXXRecordDecl(clang::CXXRecordDecl *cls); + bool VisitClassTemplateDecl(clang::ClassTemplateDecl *cls); + virtual bool VisitFunctionDecl(clang::FunctionDecl *function_declaration); bool VisitFunctionTemplateDecl( @@ -50,8 +227,22 @@ public: void finalize() { } + /// Store the mapping from local clang entity id (obtained using + /// getID()) method to clang-uml global id + void set_ast_local_id( + int64_t local_id, common::model::diagram_element::id_t global_id); + + /// Retrieve the global clang-uml entity id based on the clang local id + std::optional get_ast_local_id( + int64_t local_id) const; + private: - clang::SourceManager &source_manager_; + std::unique_ptr + create_class_declaration(clang::CXXRecordDecl *cls); + + bool process_template_parameters( + const clang::ClassTemplateDecl &template_declaration, + sequence_diagram::model::class_ &c); // Reference to the output diagram model clanguml::sequence_diagram::model::diagram &diagram_; @@ -59,10 +250,18 @@ private: // Reference to class diagram config const clanguml::config::sequence_diagram &config_; - clang::CXXRecordDecl *current_class_decl_; - clang::CXXMethodDecl *current_method_decl_; - clang::FunctionDecl *current_function_decl_; - clang::FunctionTemplateDecl *current_function_template_decl_; + call_expression_context call_expression_context_; + + std::map> + forward_declarations_; + + std::map local_ast_id_map_; + + std::map> + anonymous_struct_relationships_; }; } diff --git a/tests/t20004/.clang-uml b/tests/t20004/.clang-uml new file mode 100644 index 00000000..de348abf --- /dev/null +++ b/tests/t20004/.clang-uml @@ -0,0 +1,14 @@ +compilation_database_dir: .. +output_directory: puml +diagrams: + t20004_sequence: + type: sequence + glob: + - ../../tests/t20004/t20004.cc + include: + namespaces: + - clanguml::t20004 + using_namespace: + - clanguml::t20004 + start_from: + - function: "clanguml::t20004::main()" \ No newline at end of file diff --git a/tests/t20004/t20004.cc b/tests/t20004/t20004.cc new file mode 100644 index 00000000..2942e101 --- /dev/null +++ b/tests/t20004/t20004.cc @@ -0,0 +1,18 @@ +namespace clanguml { +namespace t20004 { + +template T m4(T p); + +template T m3(T p) { return m4(p); } + +template T m2(T p) { return m3(p); } + +template T m1(T p) { return m2(p); } + +template<> [[maybe_unused]] int m4(int p) { return p+2; } + +int main() { + return m1(0); +} +} +} diff --git a/tests/t20004/test_case.h b/tests/t20004/test_case.h new file mode 100644 index 00000000..b6b1d9c4 --- /dev/null +++ b/tests/t20004/test_case.h @@ -0,0 +1,47 @@ +/** + * tests/t20004/test_case.h + * + * Copyright (c) 2021-2022 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("t20004", "[test-case][sequence]") +{ + auto [config, db] = load_config("t20004"); + + auto diagram = config.diagrams["t20004_sequence"]; + + REQUIRE(diagram->name == "t20004_sequence"); + + auto model = generate_sequence_diagram(*db, diagram); + + REQUIRE(model->name() == "t20004_sequence"); + + auto puml = generate_sequence_puml(diagram, *model); + AliasMatcher _A(puml); + + REQUIRE_THAT(puml, StartsWith("@startuml")); + REQUIRE_THAT(puml, HasFunctionCall("main()", "m1()")); + REQUIRE_THAT(puml, HasFunctionCall("m2", "m3")); + REQUIRE_THAT(puml, HasFunctionCall("m3", "m4")); + REQUIRE_THAT(puml, EndsWith("@enduml\n")); + + + // Check if all calls exist + REQUIRE_THAT(puml, HasCall("A", "log_result")); + //REQUIRE_THAT(puml, HasCallWithResponse("B", "A", "add3")); + + save_puml( + "./" + config.output_directory() + "/" + diagram->name + ".puml", puml); +} \ No newline at end of file diff --git a/tests/test_cases.cc b/tests/test_cases.cc index a95557f9..84ec433d 100644 --- a/tests/test_cases.cc +++ b/tests/test_cases.cc @@ -250,6 +250,7 @@ using namespace clanguml::test::matchers; #include "t20001/test_case.h" #include "t20002/test_case.h" #include "t20003/test_case.h" +#include "t20004/test_case.h" /// /// Package diagram tests From ad5ec1c973bca214e334f5c9d90b4fd7dd60d649 Mon Sep 17 00:00:00 2001 From: Bartek Kryza Date: Mon, 24 Oct 2022 01:09:40 +0200 Subject: [PATCH 04/77] Added participant generation in sequence diagrams --- src/common/model/diagram_element.h | 2 +- .../plantuml/sequence_diagram_generator.cc | 52 ++++++++++++------- .../plantuml/sequence_diagram_generator.h | 2 + src/sequence_diagram/model/diagram.h | 7 +++ src/sequence_diagram/model/participant.cc | 7 +++ src/sequence_diagram/model/participant.h | 8 +-- .../visitor/translation_unit_visitor.cc | 9 +++- 7 files changed, 63 insertions(+), 24 deletions(-) diff --git a/src/common/model/diagram_element.h b/src/common/model/diagram_element.h index 084b09e2..e303edbc 100644 --- a/src/common/model/diagram_element.h +++ b/src/common/model/diagram_element.h @@ -43,7 +43,7 @@ public: void set_id(id_t id); - std::string alias() const; + virtual std::string alias() const; void set_name(const std::string &name) { name_ = name; } diff --git a/src/sequence_diagram/generators/plantuml/sequence_diagram_generator.cc b/src/sequence_diagram/generators/plantuml/sequence_diagram_generator.cc index 6a7912b7..6c7a736e 100644 --- a/src/sequence_diagram/generators/plantuml/sequence_diagram_generator.cc +++ b/src/sequence_diagram/generators/plantuml/sequence_diagram_generator.cc @@ -38,11 +38,11 @@ generator::generator( void generator::generate_call(const message &m, std::ostream &ostr) const { - const auto from = m_config.using_namespace().relative(m.from_name); - const auto to = m_config.using_namespace().relative(m.to_name); + const auto &from = m_model.get_participant(m.from); + const auto &to = m_model.get_participant(m.to); - if (from.empty() || to.empty()) { - LOG_DBG("Skipping empty call from '{}' to '{}'", from, to); + if (!from || !to) { + LOG_DBG("Skipping empty call from '{}' to '{}'", m.from, m.to); return; } @@ -52,9 +52,9 @@ void generator::generate_call(const message &m, std::ostream &ostr) const message += "()"; } - ostr << '"' << from << "\" " - << common::generators::plantuml::to_plantuml(message_t::kCall) << " \"" - << to << "\" : " << message << std::endl; + ostr << from.value().alias() << " " + << common::generators::plantuml::to_plantuml(message_t::kCall) << " " + << to.value().alias() << " : " << message << std::endl; LOG_DBG("Generated call '{}' from {} [{}] to {} [{}]", message, from, m.from_name, to, m.to_name); @@ -65,28 +65,26 @@ void generator::generate_return(const message &m, std::ostream &ostr) const // Add return activity only for messages between different actors and // only if the return type is different than void if ((m.from != m.to) && (m.return_type != "void")) { - const auto from = m_config.using_namespace().relative(m.from_name); - const auto to = m_config.using_namespace().relative(m.to_name); + const auto &from = m_model.get_participant(m.from); + const auto &to = m_model.get_participant(m.to); - ostr << '"' << to << "\" " + ostr << to.value().alias() << " " << common::generators::plantuml::to_plantuml(message_t::kReturn) - << " \"" << from << "\"" << std::endl; + << " " << from.value().alias() << '\n'; } } void generator::generate_activity(const activity &a, std::ostream &ostr) const { for (const auto &m : a.messages) { - const auto to = m_config.using_namespace().relative(m.to_name); - - if (to.empty()) + const auto &to = m_model.get_participant(m.to); + if (!to) continue; - LOG_DBG("Generating message {} --> {}", - m.from_name, m.to_name); + LOG_DBG("Generating message {} --> {}", m.from_name, m.to_name); generate_call(m, ostr); - ostr << "activate " << '"' << to << '"' << std::endl; + ostr << "activate " << to.value().alias() << std::endl; if (m_model.sequences.find(m.to) != m_model.sequences.end()) { LOG_DBG("Creating activity {} --> {} - missing sequence {}", @@ -99,7 +97,23 @@ void generator::generate_activity(const activity &a, std::ostream &ostr) const generate_return(m, ostr); - ostr << "deactivate " << '"' << to << '"' << std::endl; + ostr << "deactivate " << to.value().alias() << std::endl; + } +} + +void generator::generate_participants(std::ostream &ostr) const +{ + for (const auto participant_id : m_model.active_participants_) { + const auto &participant = + m_model.get_participant(participant_id).value(); + + if (participant.type_name() == "method") + continue; + + ostr << "participant \"" + << m_config.using_namespace().relative( + participant.full_name(false)) + << "\" as " << participant.alias()<< '\n'; } } @@ -111,6 +125,8 @@ void generator::generate(std::ostream &ostr) const generate_plantuml_directives(ostr, m_config.puml().before); + generate_participants(ostr); + for (const auto &sf : m_config.start_from()) { if (sf.location_type == source_location::location_t::function) { std::int64_t start_from; diff --git a/src/sequence_diagram/generators/plantuml/sequence_diagram_generator.h b/src/sequence_diagram/generators/plantuml/sequence_diagram_generator.h index 30e9ef63..a5d13a34 100644 --- a/src/sequence_diagram/generators/plantuml/sequence_diagram_generator.h +++ b/src/sequence_diagram/generators/plantuml/sequence_diagram_generator.h @@ -52,6 +52,8 @@ public: void generate_return(const clanguml::sequence_diagram::model::message &m, std::ostream &ostr) const; + void generate_participants(std::ostream &ostr) const; + void generate_activity(const clanguml::sequence_diagram::model::activity &a, std::ostream &ostr) const; diff --git a/src/sequence_diagram/model/diagram.h b/src/sequence_diagram/model/diagram.h index 4579917a..4b66d149 100644 --- a/src/sequence_diagram/model/diagram.h +++ b/src/sequence_diagram/model/diagram.h @@ -79,10 +79,17 @@ public: } } + void add_active_participant(common::model::diagram_element::id_t id) + { + active_participants_.emplace(id); + } + std::map sequences; std::map> participants; + + std::set active_participants_; }; } diff --git a/src/sequence_diagram/model/participant.cc b/src/sequence_diagram/model/participant.cc index e4a28399..8b37dc6d 100644 --- a/src/sequence_diagram/model/participant.cc +++ b/src/sequence_diagram/model/participant.cc @@ -128,4 +128,11 @@ method::method(const common::model::namespace_ &using_namespace) : participant{using_namespace} { } + +std::string method::alias() const +{ + assert(class_id_ >= 0); + + return fmt::format("C_{:022}", class_id_); +} } \ No newline at end of file diff --git a/src/sequence_diagram/model/participant.h b/src/sequence_diagram/model/participant.h index 31c3f525..cb22fa3e 100644 --- a/src/sequence_diagram/model/participant.h +++ b/src/sequence_diagram/model/participant.h @@ -157,11 +157,11 @@ struct method : public participant { std::string type_name() const override { return "method"; } - const std::string method_name() const { - return method_name_; - } + const std::string method_name() const { return method_name_; } - void set_method_name(const std::string& name) { method_name_ = name; } + std::string alias() const override; + + void set_method_name(const std::string &name) { method_name_ = name; } void set_class_id(diagram_element::id_t id) { class_id_ = id; } diff --git a/src/sequence_diagram/visitor/translation_unit_visitor.cc b/src/sequence_diagram/visitor/translation_unit_visitor.cc index e7082a8c..b62a2198 100644 --- a/src/sequence_diagram/visitor/translation_unit_visitor.cc +++ b/src/sequence_diagram/visitor/translation_unit_visitor.cc @@ -339,6 +339,10 @@ bool translation_unit_visitor::VisitCallExpr(clang::CallExpr *expr) m.message_name = method_decl->getNameAsString(); m.return_type = method_call_expr->getCallReturnType(current_ast_context) .getAsString(); + + if (get_ast_local_id(callee_decl->getID())) + diagram().add_active_participant( + get_ast_local_id(callee_decl->getID()).value()); } else if (const auto *function_call_expr = clang::dyn_cast_or_null(expr); @@ -400,7 +404,7 @@ bool translation_unit_visitor::VisitCallExpr(clang::CallExpr *expr) return true; } - if(m.from > 0 && m.to > 0) { + if (m.from > 0 && m.to > 0) { if (diagram().sequences.find(m.from) == diagram().sequences.end()) { activity a; a.usr = m.from; @@ -408,6 +412,9 @@ bool translation_unit_visitor::VisitCallExpr(clang::CallExpr *expr) diagram().sequences.insert({m.from, std::move(a)}); } + diagram().add_active_participant(m.from); + diagram().add_active_participant(m.to); + LOG_DBG("Found call {} from {} [{}] to {} [{}] ", m.message_name, m.from_name, m.from, m.to_name, m.to); From 4f1a143a1b198740b2261fce7abbef2c7a910031 Mon Sep 17 00:00:00 2001 From: Bartek Kryza Date: Mon, 24 Oct 2022 23:52:54 +0200 Subject: [PATCH 05/77] Fixed base sequence diagram test cases after refactor --- src/sequence_diagram/model/diagram.cc | 17 +++++++++++++++-- src/util/util.cc | 1 - tests/t20001/.clang-uml | 2 +- tests/t20001/test_case.h | 11 ++++++----- tests/t20002/test_case.h | 7 ++++--- tests/t20003/test_case.h | 7 ++++--- tests/t20004/test_case.h | 11 +++++------ tests/test_cases.h | 24 ++++++++++-------------- 8 files changed, 45 insertions(+), 35 deletions(-) diff --git a/src/sequence_diagram/model/diagram.cc b/src/sequence_diagram/model/diagram.cc index 0d42987b..722685f6 100644 --- a/src/sequence_diagram/model/diagram.cc +++ b/src/sequence_diagram/model/diagram.cc @@ -29,14 +29,22 @@ common::model::diagram_t diagram::type() const } common::optional_ref diagram::get( - const std::string & /*full_name*/) const + const std::string & full_name) const { + for(const auto& [id, participant] : participants) { + if(participant->full_name(false) == full_name) + return {*participant}; + } + return {}; } common::optional_ref diagram::get( - const common::model::diagram_element::id_t /*id*/) const + const common::model::diagram_element::id_t id) const { + if(participants.find(id) != participants.end()) + return {*participants.at(id)}; + return {}; } @@ -53,6 +61,11 @@ inja::json diagram::context() const inja::json::array_t elements{}; + // Add classes + for (const auto &[id, p] : participants) { + elements.emplace_back(p->context()); + } + ctx["elements"] = elements; return ctx; diff --git a/src/util/util.cc b/src/util/util.cc index b6c9eecf..9a820790 100644 --- a/src/util/util.cc +++ b/src/util/util.cc @@ -201,7 +201,6 @@ std::string abbreviate(const std::string &s, const unsigned int max_length) bool find_element_alias( const std::string &input, std::tuple &result) { - std::regex alias_regex("(@A\\([^\\).]+\\))"); auto alias_it = diff --git a/tests/t20001/.clang-uml b/tests/t20001/.clang-uml index 5a2b9c8c..0e443a01 100644 --- a/tests/t20001/.clang-uml +++ b/tests/t20001/.clang-uml @@ -19,4 +19,4 @@ diagrams: before: - "' t20001 test sequence diagram" after: - - 'note over "tmain()": Main test function' + - '{% set e=element("clanguml::t20001::tmain()") %} note over {{ e.alias) }}: Main test function' diff --git a/tests/t20001/test_case.h b/tests/t20001/test_case.h index 82e44243..6ee8363a 100644 --- a/tests/t20001/test_case.h +++ b/tests/t20001/test_case.h @@ -33,15 +33,16 @@ TEST_CASE("t20001", "[test-case][sequence]") REQUIRE(!model->should_include("std::vector")); auto puml = generate_sequence_puml(diagram, *model); + AliasMatcher _A(puml); REQUIRE_THAT(puml, StartsWith("@startuml")); REQUIRE_THAT(puml, EndsWith("@enduml\n")); - REQUIRE_THAT(puml, HasCall("A", "log_result")); - REQUIRE_THAT(puml, HasCall("B", "A", "log_result")); - REQUIRE_THAT(puml, HasCallWithResponse("B", "A", "add3")); - REQUIRE_THAT(puml, HasCall("A", "add")); - REQUIRE_THAT(puml, !HasCall("A", "detail::C", "add")); + REQUIRE_THAT(puml, HasCall(_A("A"), "log_result")); + REQUIRE_THAT(puml, HasCall(_A("B"), _A("A"), "log_result")); + REQUIRE_THAT(puml, HasCallWithResponse(_A("B"), _A("A"), "add3")); + REQUIRE_THAT(puml, HasCall(_A("A"), "add")); + REQUIRE_THAT(puml, !HasCall(_A("A"), _A("detail::C"), "add")); save_puml( "./" + config.output_directory() + "/" + diagram->name + ".puml", puml); diff --git a/tests/t20002/test_case.h b/tests/t20002/test_case.h index ebefda0f..09691b06 100644 --- a/tests/t20002/test_case.h +++ b/tests/t20002/test_case.h @@ -29,13 +29,14 @@ TEST_CASE("t20002", "[test-case][sequence]") REQUIRE(model->name() == "t20002_sequence"); auto puml = generate_sequence_puml(diagram, *model); + AliasMatcher _A(puml); REQUIRE_THAT(puml, StartsWith("@startuml")); REQUIRE_THAT(puml, EndsWith("@enduml\n")); - REQUIRE_THAT(puml, HasFunctionCall("m1", "m2")); - REQUIRE_THAT(puml, HasFunctionCall("m2", "m3")); - REQUIRE_THAT(puml, HasFunctionCall("m3", "m4")); + REQUIRE_THAT(puml, HasCall(_A("m1()"), _A("m2()"), "m2")); + REQUIRE_THAT(puml, HasCall(_A("m2()"), _A("m3()"), "m3")); + REQUIRE_THAT(puml, HasCall(_A("m3()"), _A("m4()"), "m4")); save_puml( "./" + config.output_directory() + "/" + diagram->name + ".puml", puml); diff --git a/tests/t20003/test_case.h b/tests/t20003/test_case.h index eb8aecf5..efe4a4fa 100644 --- a/tests/t20003/test_case.h +++ b/tests/t20003/test_case.h @@ -29,13 +29,14 @@ TEST_CASE("t20003", "[test-case][sequence]") REQUIRE(model->name() == "t20003_sequence"); auto puml = generate_sequence_puml(diagram, *model); + AliasMatcher _A(puml); REQUIRE_THAT(puml, StartsWith("@startuml")); REQUIRE_THAT(puml, EndsWith("@enduml\n")); - REQUIRE_THAT(puml, HasFunctionCall("m1", "m2")); - REQUIRE_THAT(puml, HasFunctionCall("m2", "m3")); - REQUIRE_THAT(puml, HasFunctionCall("m3", "m4")); + REQUIRE_THAT(puml, HasCall(_A("m1()"), _A("m2()"))); + REQUIRE_THAT(puml, HasCall(_A("m2()"), _A("m3()"))); + REQUIRE_THAT(puml, HasCall(_A("m3()"), _A("m4()"))); save_puml( "./" + config.output_directory() + "/" + diagram->name + ".puml", puml); diff --git a/tests/t20004/test_case.h b/tests/t20004/test_case.h index b6b1d9c4..26f9d792 100644 --- a/tests/t20004/test_case.h +++ b/tests/t20004/test_case.h @@ -32,15 +32,14 @@ TEST_CASE("t20004", "[test-case][sequence]") AliasMatcher _A(puml); REQUIRE_THAT(puml, StartsWith("@startuml")); - REQUIRE_THAT(puml, HasFunctionCall("main()", "m1()")); - REQUIRE_THAT(puml, HasFunctionCall("m2", "m3")); - REQUIRE_THAT(puml, HasFunctionCall("m3", "m4")); + REQUIRE_THAT(puml, HasCall(_A("main()"), _A("m1()"))); + REQUIRE_THAT(puml, HasCall(_A("m2()"), _A("m3()"))); + REQUIRE_THAT(puml, HasCall(_A("m3()"), _A("m4()"))); REQUIRE_THAT(puml, EndsWith("@enduml\n")); - // Check if all calls exist - REQUIRE_THAT(puml, HasCall("A", "log_result")); - //REQUIRE_THAT(puml, HasCallWithResponse("B", "A", "add3")); + REQUIRE_THAT(puml, HasCall(_A("A"), "log_result")); + // REQUIRE_THAT(puml, HasCallWithResponse("B", "A", "add3")); save_puml( "./" + config.output_directory() + "/" + diagram->name + ".puml", puml); diff --git a/tests/test_cases.h b/tests/test_cases.h index 9fe8e489..4d6ec4be 100644 --- a/tests/test_cases.h +++ b/tests/test_cases.h @@ -123,25 +123,16 @@ ContainsMatcher HasCall(std::string const &from, std::string const &message, CaseSensitive::Choice caseSensitivity = CaseSensitive::Yes) { return ContainsMatcher( - CasedString(fmt::format("\"{}\" -> \"{}\" : {}()", from, from, message), + CasedString(fmt::format("{} -> {} : {}()", from, from, message), caseSensitivity)); } -ContainsMatcher HasFunctionCall(std::string const &from, - std::string const &message, - CaseSensitive::Choice caseSensitivity = CaseSensitive::Yes) -{ - return ContainsMatcher(CasedString( - fmt::format("\"{}()\" -> \"{}()\" : {}()", from, message, message), - caseSensitivity)); -} - ContainsMatcher HasCall(std::string const &from, std::string const &to, std::string const &message, CaseSensitive::Choice caseSensitivity = CaseSensitive::Yes) { return ContainsMatcher( - CasedString(fmt::format("\"{}\" -> \"{}\" : {}()", from, to, message), + CasedString(fmt::format("{} -> {} : {}()", from, to, message), caseSensitivity)); } @@ -150,10 +141,10 @@ auto HasCallWithResponse(std::string const &from, std::string const &to, CaseSensitive::Choice caseSensitivity = CaseSensitive::Yes) { return HasCallWithResultMatcher( - CasedString(fmt::format("\"{}\" -> \"{}\" : {}()", from, to, message), + CasedString(fmt::format("{} -> {} : {}()", from, to, message), caseSensitivity), CasedString( - fmt::format("\"{}\" --> \"{}\"", to, from), caseSensitivity)); + fmt::format("{} --> {}", to, from), caseSensitivity)); } struct AliasMatcher { @@ -162,12 +153,15 @@ struct AliasMatcher { { } - std::string operator()(const std::string &name) + std::string operator()(std::string name) { std::vector patterns; const std::string alias_regex("([A-Z]_[0-9]+)"); + util::replace_all(name, "(", "\\("); + util::replace_all(name, ")", "\\)"); + patterns.push_back( std::regex{"class\\s\"" + name + "\"\\sas\\s" + alias_regex}); patterns.push_back( @@ -182,6 +176,8 @@ struct AliasMatcher { std::regex{"file\\s\"" + name + "\"\\sas\\s" + alias_regex}); patterns.push_back( std::regex{"folder\\s\"" + name + "\"\\sas\\s" + alias_regex}); + patterns.push_back( + std::regex{"participant\\s\"" + name + "\"\\sas\\s" + alias_regex}); std::smatch base_match; From 08d0431a14de1ec07530e2728c91bf3d650b8e99 Mon Sep 17 00:00:00 2001 From: Bartek Kryza Date: Sun, 30 Oct 2022 10:17:47 +0100 Subject: [PATCH 06/77] Fixed template function sequence diagram test case --- src/sequence_diagram/model/participant.cc | 126 +++++++++++++----- src/sequence_diagram/model/participant.h | 74 +++++----- .../visitor/translation_unit_visitor.cc | 47 ++++++- .../visitor/translation_unit_visitor.h | 15 ++- tests/t20003/test_case.h | 6 +- 5 files changed, 181 insertions(+), 87 deletions(-) diff --git a/src/sequence_diagram/model/participant.cc b/src/sequence_diagram/model/participant.cc index 8b37dc6d..fe9ca514 100644 --- a/src/sequence_diagram/model/participant.cc +++ b/src/sequence_diagram/model/participant.cc @@ -19,6 +19,50 @@ #include "participant.h" namespace clanguml::sequence_diagram::model { + +std::ostringstream &template_trait::render_template_params( + std::ostringstream &ostr, const common::model::namespace_ &using_namespace, + bool relative) const +{ + using clanguml::common::model::namespace_; + + if (!templates_.empty()) { + std::vector tnames; + std::vector tnames_simplified; + + std::transform(templates_.cbegin(), templates_.cend(), + std::back_inserter(tnames), + [ns = using_namespace, relative]( + const auto &tmplt) { return tmplt.to_string(ns, relative); }); + + ostr << fmt::format("<{}>", fmt::join(tnames, ",")); + } + + return ostr; +} + +void template_trait::set_base_template(const std::string &full_name) +{ + base_template_full_name_ = full_name; +} + +std::string template_trait::base_template() const +{ + return base_template_full_name_; +} + +void template_trait::add_template( + class_diagram::model::template_parameter tmplt) +{ + templates_.push_back(std::move(tmplt)); +} + +const std::vector & +template_trait::templates() const +{ + return templates_; +} + class_::class_(const common::model::namespace_ &using_namespace) : participant{using_namespace} { @@ -42,17 +86,6 @@ void class_::is_template_instantiation(bool is_template_instantiation) is_template_instantiation_ = is_template_instantiation; } -void class_::add_template(class_diagram::model::template_parameter tmplt) -{ - templates_.emplace_back(std::move(tmplt)); -} - -const std::vector & -class_::templates() const -{ - return templates_; -} - std::string class_::full_name_no_ns() const { using namespace clanguml::util; @@ -61,7 +94,7 @@ std::string class_::full_name_no_ns() const ostr << name(); - render_template_params(ostr, false); + render_template_params(ostr, using_namespace(), false); return ostr.str(); } @@ -74,7 +107,7 @@ std::string class_::full_name(bool relative) const std::ostringstream ostr; ostr << name_and_ns(); - render_template_params(ostr, relative); + render_template_params(ostr, using_namespace(), relative); std::string res; @@ -89,26 +122,6 @@ std::string class_::full_name(bool relative) const return res; } -std::ostringstream &class_::render_template_params( - std::ostringstream &ostr, bool relative) const -{ - using clanguml::common::model::namespace_; - - if (!templates_.empty()) { - std::vector tnames; - std::vector tnames_simplified; - - std::transform(templates_.cbegin(), templates_.cend(), - std::back_inserter(tnames), - [ns = using_namespace(), relative]( - const auto &tmplt) { return tmplt.to_string(ns, relative); }); - - ostr << fmt::format("<{}>", fmt::join(tnames, ",")); - } - - return ostr; -} - function::function(const common::model::namespace_ &using_namespace) : participant{using_namespace} { @@ -135,4 +148,51 @@ std::string method::alias() const return fmt::format("C_{:022}", class_id_); } + +function_template::function_template( + const common::model::namespace_ &using_namespace) + : participant{using_namespace} +{ +} + +std::string function_template::full_name(bool relative) const +{ + using namespace clanguml::util; + using clanguml::common::model::namespace_; + + std::ostringstream ostr; + + ostr << name_and_ns(); + render_template_params(ostr, using_namespace(), relative); + + ostr << "()"; + + std::string res; + + if (relative) + res = using_namespace().relative(ostr.str()); + else + res = ostr.str(); + + if (res.empty()) + return "<>"; + + return res; +} + +std::string function_template::full_name_no_ns() const +{ + using namespace clanguml::util; + + std::ostringstream ostr; + + ostr << name(); + + render_template_params(ostr, using_namespace(), false); + + ostr << "()"; + + return ostr.str(); +} + } \ No newline at end of file diff --git a/src/sequence_diagram/model/participant.h b/src/sequence_diagram/model/participant.h index cb22fa3e..1990c7ec 100644 --- a/src/sequence_diagram/model/participant.h +++ b/src/sequence_diagram/model/participant.h @@ -26,6 +26,24 @@ namespace clanguml::sequence_diagram::model { +struct template_trait { + std::ostringstream &render_template_params(std::ostringstream &ostr, + const common::model::namespace_ &using_namespace, bool relative) const; + + void set_base_template(const std::string &full_name); + + std::string base_template() const; + + void add_template(class_diagram::model::template_parameter tmplt); + + const std::vector & + templates() const; + +private: + std::vector templates_; + std::string base_template_full_name_; +}; + struct participant : public common::model::element, public common::model::stylable_element { enum class stereotype_t { @@ -50,30 +68,8 @@ struct participant : public common::model::element, stereotype_t stereotype_{stereotype_t::participant}; }; -// -// struct template_trait { -// void set_base_template(const std::string &full_name) -// { -// base_template_full_name_ = full_name; -// } -// std::string base_template() const { return base_template_full_name_; } -// -// void add_template(class_diagram::model::template_parameter tmplt) -// { -// templates_.push_back(std::move(tmplt)); -// } -// -// const std::vector & -// templates() const -// { -// return templates_; -// } -// -// std::vector templates_; -// std::string base_template_full_name_; -//}; -struct class_ : public participant { +struct class_ : public participant, public template_trait { public: class_(const common::model::namespace_ &using_namespace); @@ -93,14 +89,6 @@ public: bool is_template_instantiation() const; void is_template_instantiation(bool is_template_instantiation); - void add_template(class_diagram::model::template_parameter tmplt); - - const std::vector & - templates() const; - - void set_base_template(const std::string &full_name); - std::string base_template() const; - friend bool operator==(const class_ &l, const class_ &r); std::string full_name(bool relative = true) const override; @@ -113,19 +101,12 @@ public: void is_alias(bool alias) { is_alias_ = alias; } - int calculate_template_specialization_match( - const class_ &other, const std::string &full_name) const; - private: - std::ostringstream &render_template_params( - std::ostringstream &ostr, bool relative) const; - bool is_struct_{false}; bool is_template_{false}; bool is_template_instantiation_{false}; bool is_alias_{false}; - std::vector templates_; - std::string base_template_full_name_; + std::map type_aliases_; @@ -172,6 +153,19 @@ private: std::string method_name_; }; -struct function_template : public participant { }; +struct function_template : public participant, public template_trait { + function_template(const common::model::namespace_ &using_namespace); + + function_template(const function_template &) = delete; + function_template(function_template &&) noexcept = delete; + function_template &operator=(const function_template &) = delete; + function_template &operator=(function_template &&) = delete; + + std::string type_name() const override { return "function_template"; } + + std::string full_name(bool relative = true) const override; + + std::string full_name_no_ns() const override; +}; } diff --git a/src/sequence_diagram/visitor/translation_unit_visitor.cc b/src/sequence_diagram/visitor/translation_unit_visitor.cc index b62a2198..c4e6be4f 100644 --- a/src/sequence_diagram/visitor/translation_unit_visitor.cc +++ b/src/sequence_diagram/visitor/translation_unit_visitor.cc @@ -243,6 +243,13 @@ bool translation_unit_visitor::VisitFunctionDecl(clang::FunctionDecl *f) LOG_DBG("Visiting function declaration {}", function_name); + if (f->isTemplated() && f->getDescribedTemplate()) { + // If the described templated of this function is already in the model + // skip it: + if (get_ast_local_id(f->getDescribedTemplate()->getID())) + return true; + } + auto f_ptr = std::make_unique( config().using_namespace()); @@ -272,9 +279,28 @@ bool translation_unit_visitor::VisitFunctionTemplateDecl( if (!diagram().should_include(function_name)) return true; - LOG_DBG("Visiting function template declaration {}", function_name); + LOG_DBG("Visiting function template declaration {} at {}", function_name, + function_template->getLocation().printToString(source_manager())); + + auto f_ptr = std::make_unique( + config().using_namespace()); + + common::model::namespace_ ns{function_name}; + f_ptr->set_name(ns.name()); + ns.pop_back(); + f_ptr->set_namespace(ns); + + process_template_parameters(*function_template, *f_ptr); + + f_ptr->set_id(common::to_id(f_ptr->full_name(false))); call_expression_context_.update(function_template); + call_expression_context_.set_caller_id(f_ptr->id()); + + set_ast_local_id(function_template->getID(), f_ptr->id()); + + // TODO: Handle overloaded functions with different arguments + diagram().add_participant(std::move(f_ptr)); return true; } @@ -305,7 +331,7 @@ bool translation_unit_visitor::VisitCallExpr(clang::CallExpr *expr) m.from_name = diagram().participants.at(m.from)->full_name(false); const auto ¤t_ast_context = - call_expression_context_.get_ast_context(); + *call_expression_context_.get_ast_context(); if (const auto *operator_call_expr = clang::dyn_cast_or_null(expr); @@ -372,8 +398,17 @@ bool translation_unit_visitor::VisitCallExpr(clang::CallExpr *expr) clang::FunctionTemplateDecl>(decl); m.to_name = to_string(ftd); - m.message_name = to_string(ftd); m.to = get_ast_local_id(ftd->getID()).value(); + auto message_name = + diagram() + .get_participant( + m.to) + .value() + .full_name(false) + .substr(); + m.message_name = + message_name.substr(0, message_name.size() - 2); + break; } } @@ -392,7 +427,7 @@ bool translation_unit_visitor::VisitCallExpr(clang::CallExpr *expr) if (!callee_function) return true; - m.to_name = callee_function->getQualifiedNameAsString() + "()"; + m.to_name = callee_function->getQualifiedNameAsString(); m.message_name = callee_function->getNameAsString(); m.to = get_ast_local_id(callee_function->getID()).value(); } @@ -523,8 +558,8 @@ translation_unit_visitor::create_class_declaration(clang::CXXRecordDecl *cls) } bool translation_unit_visitor::process_template_parameters( - const clang::ClassTemplateDecl &template_declaration, - sequence_diagram::model::class_ &c) + const clang::TemplateDecl &template_declaration, + sequence_diagram::model::template_trait &c) { using class_diagram::model::template_parameter; diff --git a/src/sequence_diagram/visitor/translation_unit_visitor.h b/src/sequence_diagram/visitor/translation_unit_visitor.h index bc4dd548..e66b0c5c 100644 --- a/src/sequence_diagram/visitor/translation_unit_visitor.h +++ b/src/sequence_diagram/visitor/translation_unit_visitor.h @@ -61,10 +61,15 @@ struct call_expression_context { current_class_template_decl_ = clst; } - auto &get_ast_context() + clang::ASTContext *get_ast_context() { - return current_class_decl_ ? current_class_decl_->getASTContext() - : current_function_decl_->getASTContext(); + if(current_class_decl_) + return ¤t_class_decl_->getASTContext(); + + if(current_function_template_decl_) + return ¤t_function_template_decl_->getASTContext(); + + return ¤t_function_decl_->getASTContext(); } void update(clang::CXXMethodDecl *method) { current_method_decl_ = method; } @@ -241,8 +246,8 @@ private: create_class_declaration(clang::CXXRecordDecl *cls); bool process_template_parameters( - const clang::ClassTemplateDecl &template_declaration, - sequence_diagram::model::class_ &c); + const clang::TemplateDecl &template_declaration, + sequence_diagram::model::template_trait &c); // Reference to the output diagram model clanguml::sequence_diagram::model::diagram &diagram_; diff --git a/tests/t20003/test_case.h b/tests/t20003/test_case.h index efe4a4fa..557ba525 100644 --- a/tests/t20003/test_case.h +++ b/tests/t20003/test_case.h @@ -34,9 +34,9 @@ TEST_CASE("t20003", "[test-case][sequence]") REQUIRE_THAT(puml, StartsWith("@startuml")); REQUIRE_THAT(puml, EndsWith("@enduml\n")); - REQUIRE_THAT(puml, HasCall(_A("m1()"), _A("m2()"))); - REQUIRE_THAT(puml, HasCall(_A("m2()"), _A("m3()"))); - REQUIRE_THAT(puml, HasCall(_A("m3()"), _A("m4()"))); + REQUIRE_THAT(puml, HasCall(_A("m1()"), _A("m2()"), "m2")); + REQUIRE_THAT(puml, HasCall(_A("m2()"), _A("m3()"), "m3")); + REQUIRE_THAT(puml, HasCall(_A("m3()"), _A("m4()"), "m4")); save_puml( "./" + config.output_directory() + "/" + diagram->name + ".puml", puml); From c2d9596e7c9d16f9825e75da20f096dde910f316 Mon Sep 17 00:00:00 2001 From: Bartek Kryza Date: Tue, 1 Nov 2022 21:52:12 +0100 Subject: [PATCH 07/77] Fixed simple template instantiation sequence diagram test case --- .../visitor/translation_unit_visitor.cc | 277 +++++++++++++++++- .../visitor/translation_unit_visitor.h | 53 +++- tests/t20004/test_case.h | 10 +- 3 files changed, 319 insertions(+), 21 deletions(-) diff --git a/src/sequence_diagram/visitor/translation_unit_visitor.cc b/src/sequence_diagram/visitor/translation_unit_visitor.cc index c4e6be4f..29f4fdd5 100644 --- a/src/sequence_diagram/visitor/translation_unit_visitor.cc +++ b/src/sequence_diagram/visitor/translation_unit_visitor.cc @@ -140,9 +140,6 @@ bool translation_unit_visitor::VisitCXXRecordDecl(clang::CXXRecordDecl *cls) class_model.id()); } - // call_expression_context_.current_class_decl_ = cls; - // call_expression_context_.current_class_ = process_class(cls); - return true; } @@ -166,7 +163,6 @@ bool translation_unit_visitor::VisitClassTemplateDecl( // Override the id with the template id, for now we don't care about the // underlying templated class id - process_template_parameters(*cls, *c_ptr); const auto cls_full_name = c_ptr->full_name(false); @@ -389,7 +385,6 @@ bool translation_unit_visitor::VisitCallExpr(clang::CallExpr *expr) function_call_expr->getCallee()); if (unresolved_expr) { - unresolved_expr->dump(); for (const auto *decl : unresolved_expr->decls()) { if (clang::dyn_cast_or_null< clang::FunctionTemplateDecl>(decl)) { @@ -427,9 +422,49 @@ bool translation_unit_visitor::VisitCallExpr(clang::CallExpr *expr) if (!callee_function) return true; + bool is_implicit = false; + if (!get_ast_local_id(callee_function->getID()).has_value()) { + // This is implicit function template + // specialization/instantiation We have to build it + std::unique_ptr f_ptr = + build_function_template_instantiation(*callee_function); + + f_ptr->set_id(common::to_id(f_ptr->full_name(false))); + set_ast_local_id(callee_function->getID(), f_ptr->id()); + diagram().add_participant(std::move(f_ptr)); + + // This is not optimal way to check whether the callee declaration + // is implicit or explicit (we don't want implicit declarations + // as separate participants), but is there a better way? + is_implicit = true; + } + + if (is_implicit) + LOG_DBG("Processing implicit template specialization {}", + diagram() + .get_participant( + get_ast_local_id(callee_function->getID()).value()) + .value() + .full_name(false)); + m.to_name = callee_function->getQualifiedNameAsString(); - m.message_name = callee_function->getNameAsString(); - m.to = get_ast_local_id(callee_function->getID()).value(); + if (is_implicit) { + // If this is an implicit template specialization/instantiation + m.to = get_ast_local_id( + callee_function->getPrimaryTemplate()->getID()) + .value(); + } + else + m.to = get_ast_local_id(callee_function->getID()).value(); + + auto message_name = + diagram() + .get_participant( + get_ast_local_id(callee_function->getID()).value()) + .value() + .full_name(false) + .substr(); + m.message_name = message_name.substr(0, message_name.size() - 2); } m.return_type = function_call_expr->getCallReturnType(current_ast_context) @@ -635,4 +670,232 @@ translation_unit_visitor::get_ast_local_id(int64_t local_id) const return local_ast_id_map_.at(local_id); } + +std::unique_ptr +translation_unit_visitor::build_function_template_instantiation( + const clang::FunctionDecl &decl) +{ + // + // Here we'll hold the template base params to replace with the + // instantiated values + // + std::deque> + template_base_params{}; + + auto template_instantiation_ptr = + std::make_unique(config_.using_namespace()); + auto &template_instantiation = *template_instantiation_ptr; + + // + // Set function template instantiation name + // + auto template_decl_qualified_name = decl.getQualifiedNameAsString(); + common::model::namespace_ ns{template_decl_qualified_name}; + ns.pop_back(); + template_instantiation.set_name(decl.getNameAsString()); + template_instantiation.set_namespace(ns); + + // + // Instantiate the template arguments + // + std::optional parent; + build_template_instantiation_process_template_arguments(parent, + template_base_params, decl.getTemplateSpecializationArgs()->asArray(), + template_instantiation, "", decl.getPrimaryTemplate()); + + return template_instantiation_ptr; +} + +void translation_unit_visitor:: + build_template_instantiation_process_template_arguments( + std::optional &parent, + std::deque> &template_base_params, + const clang::ArrayRef &template_args, + model::template_trait &template_instantiation, + const std::string &full_template_specialization_name, + const clang::TemplateDecl *template_decl) +{ + auto arg_index = 0U; + for (const auto &arg : template_args) { + const auto argument_kind = arg.getKind(); + class_diagram::model::template_parameter argument; + if (argument_kind == clang::TemplateArgument::Template) { + build_template_instantiation_process_template_argument( + arg, argument); + } + else if (argument_kind == clang::TemplateArgument::Type) { + build_template_instantiation_process_type_argument(parent, + full_template_specialization_name, template_decl, arg, + template_instantiation, argument); + } + else if (argument_kind == clang::TemplateArgument::Integral) { + build_template_instantiation_process_integral_argument( + arg, argument); + } + else if (argument_kind == clang::TemplateArgument::Expression) { + build_template_instantiation_process_expression_argument( + arg, argument); + } + else { + LOG_ERROR("Unsupported argument type {}", arg.getKind()); + } + + simplify_system_template( + argument, argument.to_string(config().using_namespace(), false)); + + template_instantiation.add_template(std::move(argument)); + + arg_index++; + } +} + +void translation_unit_visitor:: + build_template_instantiation_process_template_argument( + const clang::TemplateArgument &arg, + class_diagram::model::template_parameter &argument) const +{ + argument.is_template_parameter(true); + auto arg_name = + arg.getAsTemplate().getAsTemplateDecl()->getQualifiedNameAsString(); + argument.set_type(arg_name); +} + +void translation_unit_visitor:: + build_template_instantiation_process_integral_argument( + const clang::TemplateArgument &arg, + class_diagram::model::template_parameter &argument) const +{ + assert(arg.getKind() == clang::TemplateArgument::Integral); + + argument.is_template_parameter(false); + argument.set_type(std::to_string(arg.getAsIntegral().getExtValue())); +} + +void translation_unit_visitor:: + build_template_instantiation_process_expression_argument( + const clang::TemplateArgument &arg, + class_diagram::model::template_parameter &argument) const +{ + assert(arg.getKind() == clang::TemplateArgument::Expression); + + argument.is_template_parameter(false); + argument.set_type(common::get_source_text( + arg.getAsExpr()->getSourceRange(), source_manager())); +} + +void translation_unit_visitor:: + build_template_instantiation_process_tag_argument( + model::template_trait &template_instantiation, + const std::string &full_template_specialization_name, + const clang::TemplateDecl *template_decl, + const clang::TemplateArgument &arg, + class_diagram::model::template_parameter &argument) const +{ + assert(arg.getKind() == clang::TemplateArgument::Type); + + argument.is_template_parameter(false); + + argument.set_name( + common::to_string(arg.getAsType(), template_decl->getASTContext())); +} + +void translation_unit_visitor:: + build_template_instantiation_process_type_argument( + std::optional &parent, + const std::string &full_template_specialization_name, + const clang::TemplateDecl *template_decl, + const clang::TemplateArgument &arg, + model::template_trait &template_instantiation, + class_diagram::model::template_parameter &argument) +{ + assert(arg.getKind() == clang::TemplateArgument::Type); + + argument.is_template_parameter(false); + + // If this is a nested template type - add nested templates as + // template arguments + if (arg.getAsType()->getAs()) { + + for (const auto ¶m_type : + arg.getAsType()->getAs()->param_types()) { + + if (!param_type->getAs()) + continue; + + // auto classTemplateSpecialization = + // llvm::dyn_cast( + // param_type->getAsRecordDecl()); + + // if (classTemplateSpecialization) { + // // Read arg info as needed. + // auto nested_template_instantiation = + // build_template_instantiation_from_class_template_specialization( + // *classTemplateSpecialization, + // *param_type->getAs(), + // diagram().should_include( + // full_template_specialization_name) + // ? + // std::make_optional(&template_instantiation) + // : parent); + // } + } + } + else if (arg.getAsType()->getAs()) { + const auto *nested_template_type = + arg.getAsType()->getAs(); + + const auto nested_template_name = + nested_template_type->getTemplateName() + .getAsTemplateDecl() + ->getQualifiedNameAsString(); + + auto [tinst_ns, tinst_name] = cx::util::split_ns(nested_template_name); + + argument.set_name(nested_template_name); + + // auto nested_template_instantiation = + // build_template_instantiation( + // *arg.getAsType()->getAs(), + // diagram().should_include(full_template_specialization_name) + // ? std::make_optional(&template_instantiation) + // : parent); + // + // argument.set_id(nested_template_instantiation->id()); + // + // for (const auto &t : + // nested_template_instantiation->templates()) + // argument.add_template_param(t); + + // Check if this template should be simplified (e.g. system + // template aliases such as 'std:basic_string' should + // be simply 'std::string') + simplify_system_template( + argument, argument.to_string(config().using_namespace(), false)); + } + else if (arg.getAsType()->getAs()) { + argument.is_template_parameter(true); + argument.set_name( + common::to_string(arg.getAsType(), template_decl->getASTContext())); + } + else { + // This is just a regular record type + build_template_instantiation_process_tag_argument( + template_instantiation, full_template_specialization_name, + template_decl, arg, argument); + } +} + +bool translation_unit_visitor::simplify_system_template( + class_diagram::model::template_parameter &ct, const std::string &full_name) +{ + if (config().type_aliases().count(full_name) > 0) { + ct.set_name(config().type_aliases().at(full_name)); + ct.clear_params(); + return true; + } + else + return false; +} + } diff --git a/src/sequence_diagram/visitor/translation_unit_visitor.h b/src/sequence_diagram/visitor/translation_unit_visitor.h index e66b0c5c..3d3e4d31 100644 --- a/src/sequence_diagram/visitor/translation_unit_visitor.h +++ b/src/sequence_diagram/visitor/translation_unit_visitor.h @@ -63,10 +63,10 @@ struct call_expression_context { clang::ASTContext *get_ast_context() { - if(current_class_decl_) + if (current_class_decl_) return ¤t_class_decl_->getASTContext(); - if(current_function_template_decl_) + if (current_function_template_decl_) return ¤t_function_template_decl_->getASTContext(); return ¤t_function_decl_->getASTContext(); @@ -185,12 +185,10 @@ struct call_expression_context { // return ""; // } - std::int64_t caller_id() const - { - return current_caller_id_; - } + std::int64_t caller_id() const { return current_caller_id_; } - void set_caller_id(std::int64_t id) { + void set_caller_id(std::int64_t id) + { LOG_DBG("Setting current caller id to {}", id); current_caller_id_ = id; } @@ -249,6 +247,47 @@ private: const clang::TemplateDecl &template_declaration, sequence_diagram::model::template_trait &c); + std::unique_ptr + build_function_template_instantiation(const clang::FunctionDecl &pDecl); + + void build_template_instantiation_process_template_arguments( + std::optional &parent, + std::deque> &template_base_params, + const clang::ArrayRef &template_args, + model::template_trait &template_instantiation, + const std::string &full_template_specialization_name, + const clang::TemplateDecl *template_decl); + + void build_template_instantiation_process_template_argument( + const clang::TemplateArgument &arg, + class_diagram::model::template_parameter &argument) const; + + void build_template_instantiation_process_integral_argument( + const clang::TemplateArgument &arg, + class_diagram::model::template_parameter &argument) const; + + void build_template_instantiation_process_expression_argument( + const clang::TemplateArgument &arg, + class_diagram::model::template_parameter &argument) const; + + void build_template_instantiation_process_tag_argument( + model::template_trait &template_instantiation, + const std::string &full_template_specialization_name, + const clang::TemplateDecl *template_decl, + const clang::TemplateArgument &arg, + class_diagram::model::template_parameter &argument) const; + + void build_template_instantiation_process_type_argument( + std::optional &parent, + const std::string &full_template_specialization_name, + const clang::TemplateDecl *template_decl, + const clang::TemplateArgument &arg, + model::template_trait &template_instantiation, + class_diagram::model::template_parameter &argument); + + bool simplify_system_template(class_diagram::model::template_parameter &ct, + const std::string &full_name); + // Reference to the output diagram model clanguml::sequence_diagram::model::diagram &diagram_; diff --git a/tests/t20004/test_case.h b/tests/t20004/test_case.h index 26f9d792..eedbf54b 100644 --- a/tests/t20004/test_case.h +++ b/tests/t20004/test_case.h @@ -32,15 +32,11 @@ TEST_CASE("t20004", "[test-case][sequence]") AliasMatcher _A(puml); REQUIRE_THAT(puml, StartsWith("@startuml")); - REQUIRE_THAT(puml, HasCall(_A("main()"), _A("m1()"))); - REQUIRE_THAT(puml, HasCall(_A("m2()"), _A("m3()"))); - REQUIRE_THAT(puml, HasCall(_A("m3()"), _A("m4()"))); + REQUIRE_THAT(puml, HasCall(_A("main()"), _A("m1()"), "m1")); + REQUIRE_THAT(puml, HasCall(_A("m2()"), _A("m3()"), "m3")); + REQUIRE_THAT(puml, HasCall(_A("m3()"), _A("m4()"), "m42")); REQUIRE_THAT(puml, EndsWith("@enduml\n")); - // Check if all calls exist - REQUIRE_THAT(puml, HasCall(_A("A"), "log_result")); - // REQUIRE_THAT(puml, HasCallWithResponse("B", "A", "add3")); - save_puml( "./" + config.output_directory() + "/" + diagram->name + ".puml", puml); } \ No newline at end of file From 6df8c790f5454be7aced925e9e2094ac49825a9b Mon Sep 17 00:00:00 2001 From: Bartek Kryza Date: Tue, 1 Nov 2022 21:52:34 +0100 Subject: [PATCH 08/77] Fixed formatting --- .../plantuml/sequence_diagram_generator.cc | 2 +- src/sequence_diagram/model/diagram.cc | 8 ++++---- .../visitor/translation_unit_visitor.cc | 7 ++++--- tests/t20004/t20004.cc | 6 ++---- tests/test_cases.h | 15 ++++++--------- 5 files changed, 17 insertions(+), 21 deletions(-) diff --git a/src/sequence_diagram/generators/plantuml/sequence_diagram_generator.cc b/src/sequence_diagram/generators/plantuml/sequence_diagram_generator.cc index 6c7a736e..4618deae 100644 --- a/src/sequence_diagram/generators/plantuml/sequence_diagram_generator.cc +++ b/src/sequence_diagram/generators/plantuml/sequence_diagram_generator.cc @@ -113,7 +113,7 @@ void generator::generate_participants(std::ostream &ostr) const ostr << "participant \"" << m_config.using_namespace().relative( participant.full_name(false)) - << "\" as " << participant.alias()<< '\n'; + << "\" as " << participant.alias() << '\n'; } } diff --git a/src/sequence_diagram/model/diagram.cc b/src/sequence_diagram/model/diagram.cc index 722685f6..e919938a 100644 --- a/src/sequence_diagram/model/diagram.cc +++ b/src/sequence_diagram/model/diagram.cc @@ -29,10 +29,10 @@ common::model::diagram_t diagram::type() const } common::optional_ref diagram::get( - const std::string & full_name) const + const std::string &full_name) const { - for(const auto& [id, participant] : participants) { - if(participant->full_name(false) == full_name) + for (const auto &[id, participant] : participants) { + if (participant->full_name(false) == full_name) return {*participant}; } @@ -42,7 +42,7 @@ common::optional_ref diagram::get( common::optional_ref diagram::get( const common::model::diagram_element::id_t id) const { - if(participants.find(id) != participants.end()) + if (participants.find(id) != participants.end()) return {*participants.at(id)}; return {}; diff --git a/src/sequence_diagram/visitor/translation_unit_visitor.cc b/src/sequence_diagram/visitor/translation_unit_visitor.cc index 29f4fdd5..a277888d 100644 --- a/src/sequence_diagram/visitor/translation_unit_visitor.cc +++ b/src/sequence_diagram/visitor/translation_unit_visitor.cc @@ -433,9 +433,10 @@ bool translation_unit_visitor::VisitCallExpr(clang::CallExpr *expr) set_ast_local_id(callee_function->getID(), f_ptr->id()); diagram().add_participant(std::move(f_ptr)); - // This is not optimal way to check whether the callee declaration - // is implicit or explicit (we don't want implicit declarations - // as separate participants), but is there a better way? + // This is not optimal way to check whether the callee + // declaration is implicit or explicit (we don't want implicit + // declarations as separate participants), but is there a better + // way? is_implicit = true; } diff --git a/tests/t20004/t20004.cc b/tests/t20004/t20004.cc index 2942e101..097c43a7 100644 --- a/tests/t20004/t20004.cc +++ b/tests/t20004/t20004.cc @@ -9,10 +9,8 @@ template T m2(T p) { return m3(p); } template T m1(T p) { return m2(p); } -template<> [[maybe_unused]] int m4(int p) { return p+2; } +template <> [[maybe_unused]] int m4(int p) { return p + 2; } -int main() { - return m1(0); -} +int main() { return m1(0); } } } diff --git a/tests/test_cases.h b/tests/test_cases.h index 4d6ec4be..90302891 100644 --- a/tests/test_cases.h +++ b/tests/test_cases.h @@ -122,18 +122,16 @@ struct HasCallWithResultMatcher : ContainsMatcher { ContainsMatcher HasCall(std::string const &from, std::string const &message, CaseSensitive::Choice caseSensitivity = CaseSensitive::Yes) { - return ContainsMatcher( - CasedString(fmt::format("{} -> {} : {}()", from, from, message), - caseSensitivity)); + return ContainsMatcher(CasedString( + fmt::format("{} -> {} : {}()", from, from, message), caseSensitivity)); } ContainsMatcher HasCall(std::string const &from, std::string const &to, std::string const &message, CaseSensitive::Choice caseSensitivity = CaseSensitive::Yes) { - return ContainsMatcher( - CasedString(fmt::format("{} -> {} : {}()", from, to, message), - caseSensitivity)); + return ContainsMatcher(CasedString( + fmt::format("{} -> {} : {}()", from, to, message), caseSensitivity)); } auto HasCallWithResponse(std::string const &from, std::string const &to, @@ -141,10 +139,9 @@ auto HasCallWithResponse(std::string const &from, std::string const &to, CaseSensitive::Choice caseSensitivity = CaseSensitive::Yes) { return HasCallWithResultMatcher( - CasedString(fmt::format("{} -> {} : {}()", from, to, message), - caseSensitivity), CasedString( - fmt::format("{} --> {}", to, from), caseSensitivity)); + fmt::format("{} -> {} : {}()", from, to, message), caseSensitivity), + CasedString(fmt::format("{} --> {}", to, from), caseSensitivity)); } struct AliasMatcher { From 17c463cebbabfd995b04545891bee25ea62682ed Mon Sep 17 00:00:00 2001 From: Bartek Kryza Date: Tue, 1 Nov 2022 22:11:48 +0100 Subject: [PATCH 09/77] Fixed simple template instantiation sequence diagram test case --- tests/t20004/test_case.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/t20004/test_case.h b/tests/t20004/test_case.h index eedbf54b..441eb808 100644 --- a/tests/t20004/test_case.h +++ b/tests/t20004/test_case.h @@ -34,7 +34,7 @@ TEST_CASE("t20004", "[test-case][sequence]") REQUIRE_THAT(puml, StartsWith("@startuml")); REQUIRE_THAT(puml, HasCall(_A("main()"), _A("m1()"), "m1")); REQUIRE_THAT(puml, HasCall(_A("m2()"), _A("m3()"), "m3")); - REQUIRE_THAT(puml, HasCall(_A("m3()"), _A("m4()"), "m42")); + REQUIRE_THAT(puml, HasCall(_A("m3()"), _A("m4()"), "m4")); REQUIRE_THAT(puml, EndsWith("@enduml\n")); save_puml( From 0d90fdc1330b7989d53efde10e0b9fe030d0249d Mon Sep 17 00:00:00 2001 From: Bartek Kryza Date: Tue, 1 Nov 2022 22:28:05 +0100 Subject: [PATCH 10/77] Updated test case t00037 with round brackets in names --- tests/t00037/test_case.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/tests/t00037/test_case.h b/tests/t00037/test_case.h index b6e0baa9..c77156fa 100644 --- a/tests/t00037/test_case.h +++ b/tests/t00037/test_case.h @@ -37,12 +37,12 @@ TEST_CASE("t00037", "[test-case][class]") REQUIRE_THAT(puml, IsClass(_A("ST"))); REQUIRE_THAT(puml, IsClass(_A("A"))); - REQUIRE_THAT(puml, IsClass(_A("ST::\\(units\\)"))); - REQUIRE_THAT(puml, IsClass(_A("ST::\\(dimensions\\)"))); + REQUIRE_THAT(puml, IsClass(_A("ST::(units)"))); + REQUIRE_THAT(puml, IsClass(_A("ST::(dimensions)"))); REQUIRE_THAT(puml, - IsAggregation(_A("ST"), _A("ST::\\(dimensions\\)"), "+dimensions")); + IsAggregation(_A("ST"), _A("ST::(dimensions)"), "+dimensions")); REQUIRE_THAT( - puml, IsAggregation(_A("ST"), _A("ST::\\(units\\)"), "-units")); + puml, IsAggregation(_A("ST"), _A("ST::(units)"), "-units")); save_puml( "./" + config.output_directory() + "/" + diagram->name + ".puml", puml); From 488dd883cc924bb5b3ba59017f6a11410be6ab53 Mon Sep 17 00:00:00 2001 From: Bartek Kryza Date: Tue, 1 Nov 2022 23:33:47 +0100 Subject: [PATCH 11/77] Fixed test case t20003 crash on LLVM 12 --- .../visitor/translation_unit_visitor.cc | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/src/sequence_diagram/visitor/translation_unit_visitor.cc b/src/sequence_diagram/visitor/translation_unit_visitor.cc index a277888d..0a8e0ff1 100644 --- a/src/sequence_diagram/visitor/translation_unit_visitor.cc +++ b/src/sequence_diagram/visitor/translation_unit_visitor.cc @@ -467,9 +467,19 @@ bool translation_unit_visitor::VisitCallExpr(clang::CallExpr *expr) .substr(); m.message_name = message_name.substr(0, message_name.size() - 2); } - m.return_type = - function_call_expr->getCallReturnType(current_ast_context) - .getAsString(); + + const auto &return_type = + function_call_expr->getCallReturnType(current_ast_context); + + // + // Without this if, this crashes test case t20003 on LLVM <= 12 + // + if (!clang::dyn_cast_or_null( + function_call_expr->getCallee())) { + m.return_type = return_type.getAsString(); + } + else + m.return_type = ""; } else { return true; From 54a66ae58bef32761b10dcf7b58173647cf1b017 Mon Sep 17 00:00:00 2001 From: Bartek Kryza Date: Tue, 1 Nov 2022 23:34:20 +0100 Subject: [PATCH 12/77] Fixed formatting --- tests/t00037/test_case.h | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/tests/t00037/test_case.h b/tests/t00037/test_case.h index c77156fa..5347e4de 100644 --- a/tests/t00037/test_case.h +++ b/tests/t00037/test_case.h @@ -39,10 +39,9 @@ TEST_CASE("t00037", "[test-case][class]") REQUIRE_THAT(puml, IsClass(_A("A"))); REQUIRE_THAT(puml, IsClass(_A("ST::(units)"))); REQUIRE_THAT(puml, IsClass(_A("ST::(dimensions)"))); - REQUIRE_THAT(puml, - IsAggregation(_A("ST"), _A("ST::(dimensions)"), "+dimensions")); REQUIRE_THAT( - puml, IsAggregation(_A("ST"), _A("ST::(units)"), "-units")); + puml, IsAggregation(_A("ST"), _A("ST::(dimensions)"), "+dimensions")); + REQUIRE_THAT(puml, IsAggregation(_A("ST"), _A("ST::(units)"), "-units")); save_puml( "./" + config.output_directory() + "/" + diagram->name + ".puml", puml); From ae235058395964f1eccf2be0c199689e55814f8c Mon Sep 17 00:00:00 2001 From: Bartek Kryza Date: Wed, 2 Nov 2022 18:07:57 +0100 Subject: [PATCH 13/77] Updated test case documentation --- docs/test_cases.md | 2 + docs/test_cases/t00002_class.svg | 36 ++++---- docs/test_cases/t00003_class.svg | 46 +++++----- docs/test_cases/t00004_class.svg | 76 ++++++++-------- docs/test_cases/t00005_class.svg | 110 +++++++++++------------ docs/test_cases/t00006_class.svg | 132 ++++++++++++++-------------- docs/test_cases/t00007_class.svg | 30 +++---- docs/test_cases/t00008_class.svg | 56 ++++++------ docs/test_cases/t00009_class.svg | 32 +++---- docs/test_cases/t00010_class.svg | 34 +++---- docs/test_cases/t00011_class.svg | 22 ++--- docs/test_cases/t00012_class.svg | 66 +++++++------- docs/test_cases/t00013_class.svg | 82 ++++++++--------- docs/test_cases/t00014_class.svg | 124 +++++++++++++------------- docs/test_cases/t00015_class.svg | 22 ++--- docs/test_cases/t00016_class.svg | 30 +++---- docs/test_cases/t00017_class.svg | 66 +++++++------- docs/test_cases/t00018_class.svg | 18 ++-- docs/test_cases/t00019_class.svg | 40 ++++----- docs/test_cases/t00020_class.svg | 38 ++++---- docs/test_cases/t00021_class.svg | 30 +++---- docs/test_cases/t00022_class.svg | 14 +-- docs/test_cases/t00023_class.svg | 26 +++--- docs/test_cases/t00024_class.svg | 22 ++--- docs/test_cases/t00025_class.svg | 34 +++---- docs/test_cases/t00026_class.svg | 42 ++++----- docs/test_cases/t00027_class.svg | 58 ++++++------ docs/test_cases/t00028_class.svg | 78 ++++++++-------- docs/test_cases/t00029_class.svg | 50 +++++------ docs/test_cases/t00030_class.svg | 46 +++++----- docs/test_cases/t00031_class.svg | 50 +++++------ docs/test_cases/t00032_class.svg | 40 ++++----- docs/test_cases/t00033_class.svg | 48 +++++----- docs/test_cases/t00034_class.svg | 46 +++++----- docs/test_cases/t00035_class.svg | 22 ++--- docs/test_cases/t00036_class.svg | 38 ++++---- docs/test_cases/t00037_class.svg | 54 ++++++------ docs/test_cases/t00038_class.svg | 58 ++++++------ docs/test_cases/t00039_class.svg | 78 ++++++++-------- docs/test_cases/t00040_class.svg | 26 +++--- docs/test_cases/t00041_class.svg | 54 ++++++------ docs/test_cases/t00042_class.svg | 36 ++++---- docs/test_cases/t00043_class.svg | 50 +++++------ docs/test_cases/t00044_class.svg | 36 ++++---- docs/test_cases/t00045_class.svg | 70 +++++++-------- docs/test_cases/t00046_class.svg | 64 +++++++------- docs/test_cases/t00047_class.svg | 22 ++--- docs/test_cases/t00048_class.svg | 50 +++++------ docs/test_cases/t00049_class.svg | 32 +++---- docs/test_cases/t00050_class.svg | 70 +++++++-------- docs/test_cases/t20001.md | 2 +- docs/test_cases/t20001_sequence.svg | 110 ++++++++++++----------- docs/test_cases/t20002_sequence.svg | 58 ++++++------ docs/test_cases/t20003.md | 42 +++++++++ docs/test_cases/t20003_sequence.svg | 54 ++++++++++++ docs/test_cases/t20004.md | 41 +++++++++ docs/test_cases/t20004_sequence.svg | 66 ++++++++++++++ docs/test_cases/t30001_package.svg | 48 +++++----- docs/test_cases/t30002_package.svg | 90 +++++++++---------- docs/test_cases/t30003_package.svg | 26 +++--- docs/test_cases/t30004_package.svg | 30 +++---- docs/test_cases/t30005_package.svg | 38 ++++---- docs/test_cases/t30006_package.svg | 16 ++-- docs/test_cases/t30007_package.svg | 20 ++--- docs/test_cases/t30008_package.svg | 34 +++---- docs/test_cases/t40001_include.svg | 30 +++---- docs/test_cases/t40002_include.svg | 34 +++---- docs/test_cases/t40003_include.svg | 50 +++++------ tests/test_cases.yaml | 6 ++ 69 files changed, 1708 insertions(+), 1493 deletions(-) create mode 100644 docs/test_cases/t20003.md create mode 100644 docs/test_cases/t20003_sequence.svg create mode 100644 docs/test_cases/t20004.md create mode 100644 docs/test_cases/t20004_sequence.svg diff --git a/docs/test_cases.md b/docs/test_cases.md index 93c8f5cd..6f9ea0d2 100644 --- a/docs/test_cases.md +++ b/docs/test_cases.md @@ -52,6 +52,8 @@ ## Sequence diagrams * [t20001](./test_cases/t20001.md) - Basic sequence diagram test case * [t20002](./test_cases/t20002.md) - Free function sequence diagram test case + * [t20003](./test_cases/t20003.md) - Function template sequence diagram test case + * [t20004](./test_cases/t20004.md) - Function template instantiation sequence diagram test case ## Package diagrams * [t30001](./test_cases/t30001.md) - Basic package diagram test case * [t30002](./test_cases/t30002.md) - Package dependency test case diff --git a/docs/test_cases/t00002_class.svg b/docs/test_cases/t00002_class.svg index 7fcfadba..fa486f1b 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_class.svg b/docs/test_cases/t00003_class.svg index 3e938744..3a7313ff 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_class.svg b/docs/test_cases/t00004_class.svg index 62a7dbf8..fd5a149f 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,15 +59,15 @@ Red - - + + A::AA::AAA - + C::B @@ -75,8 +75,8 @@ int - - + + C @@ -84,39 +84,39 @@ T - + - + t : T - + - + b_int : B<int> - - + + C::AA - - + + C::AA::AAA - - + + C::AA::CCC @@ -125,8 +125,8 @@ CCC_2 - - + + C::B @@ -134,16 +134,16 @@ V - + - + b : V - - + + C::CC @@ -152,16 +152,16 @@ CC_2 - - + + detail::D - - + + detail::D::AA @@ -171,8 +171,8 @@ AA_3 - - + + detail::D::DD diff --git a/docs/test_cases/t00005_class.svg b/docs/test_cases/t00005_class.svg index 437cc137..2e998860 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_class.svg b/docs/test_cases/t00006_class.svg index cc98f1b1..44c75717 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,15 +146,15 @@ T - + - + data : std::vector<T> - + custom_container @@ -162,102 +162,102 @@ 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_class.svg b/docs/test_cases/t00007_class.svg index 8efaa576..118707c2 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_class.svg b/docs/test_cases/t00008_class.svg index 3d37d07e..c8127dd1 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,CMP,int N - + - + 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,15 +87,15 @@ T,C<> - + - + template_template : C<T> - + B @@ -103,18 +103,18 @@ int,Vector - - + + D - + - + ints : B<int,Vector> diff --git a/docs/test_cases/t00009_class.svg b/docs/test_cases/t00009_class.svg index cbf22efa..41183b28 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,15 +18,15 @@ T - + - + value : T - + A @@ -34,7 +34,7 @@ int - + A @@ -42,7 +42,7 @@ std::string - + A @@ -50,32 +50,32 @@ 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_class.svg b/docs/test_cases/t00010_class.svg index 65b8872c..2717c743 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,22 +18,22 @@ T,P - + - + first : T - + - + second : P - + A @@ -41,8 +41,8 @@ T,std::string - - + + B @@ -50,15 +50,15 @@ T - + - + astring : A<T,std::string> - + B @@ -66,18 +66,18 @@ int - - + + C - + - + aintstring : B<int> diff --git a/docs/test_cases/t00011_class.svg b/docs/test_cases/t00011_class.svg index 1cd512a7..d2c2ddff 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_class.svg b/docs/test_cases/t00012_class.svg index c6d06850..4ec1dc64 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,14 +60,14 @@ - + - + ints : std::array<T,sizeof...(Is)> - + A @@ -75,7 +75,7 @@ int,std::string,float - + A @@ -83,7 +83,7 @@ int,std::string,bool - + B @@ -91,7 +91,7 @@ 3,2,1 - + B @@ -99,7 +99,7 @@ 1,1,1,1 - + C @@ -107,50 +107,50 @@ 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_class.svg b/docs/test_cases/t00013_class.svg index 9888703e..c739066a 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,15 +18,15 @@ T - + - + f : T - + ABCD::F @@ -34,70 +34,70 @@ int - - + + A - + - + a : int - - + + B - + - + b : int - - + + C - + - + c : int - - + + D - + - + d : int print(R * r) : void - - + + E @@ -105,16 +105,16 @@ T - + - + e : T - - + + G @@ -122,22 +122,22 @@ T,Args... - + - + g : T - + - + args : std::tuple<Args...> - + E @@ -145,7 +145,7 @@ int - + G @@ -153,7 +153,7 @@ int,float,std::string - + E @@ -161,25 +161,25 @@ std::string - - + + R - + - + gintstring : G<int,float,std::string> - + - + estring : E<std::string> diff --git a/docs/test_cases/t00014_class.svg b/docs/test_cases/t00014_class.svg index 9b919155..521dec3a 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,37 +18,37 @@ T,P - + - + t : T - + - + p : P - - + + B - + - + value : std::string - + A @@ -56,7 +56,7 @@ T,std::string - + A @@ -64,7 +64,7 @@ T,std::unique_ptr<std::string> - + A @@ -72,7 +72,7 @@ long,T - + A @@ -80,7 +80,7 @@ double,T - + A @@ -88,7 +88,7 @@ long,U - + A @@ -96,7 +96,7 @@ long,bool - + A @@ -104,7 +104,7 @@ double,bool - + A @@ -112,7 +112,7 @@ long,float - + A @@ -120,7 +120,7 @@ double,float - + A @@ -128,7 +128,7 @@ bool,std::string - + A @@ -136,7 +136,7 @@ float,std::unique_ptr<std::string> - + A @@ -144,7 +144,7 @@ int,std::string - + A @@ -152,7 +152,7 @@ std::string,std::string - + A @@ -160,7 +160,7 @@ char,std::string - + A @@ -168,116 +168,116 @@ wchar_t,std::string - - + + R - + - + 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 - + - + bs : BVector - + - + bs2 : BVector2 - + - + cb : SimpleCallback<ACharString> - + - + gcb : GenericCallback<R::AWCharString> - + - + vcb : VoidCallback - + - + vps : VectorPtr<B> @@ -307,9 +307,9 @@ - + - + @@ -375,9 +375,9 @@ bstringstring - + - + diff --git a/docs/test_cases/t00015_class.svg b/docs/test_cases/t00015_class.svg index d99fb8c3..80ff07fa 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_class.svg b/docs/test_cases/t00016_class.svg index b8343025..212f200d 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<> @@ -19,8 +19,8 @@ value : enum - - + + is_numeric @@ -29,8 +29,8 @@ value : enum - - + + is_numeric @@ -41,8 +41,8 @@ value : enum - - + + is_numeric @@ -53,8 +53,8 @@ value : enum - - + + is_numeric @@ -65,8 +65,8 @@ value : enum - - + + is_numeric @@ -77,8 +77,8 @@ value : enum - - + + is_numeric diff --git a/docs/test_cases/t00017_class.svg b/docs/test_cases/t00017_class.svg index d5c5d30e..04d6ab7e 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_class.svg b/docs/test_cases/t00018_class.svg index 78d0ad81..acafb8f3 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_class.svg b/docs/test_cases/t00019_class.svg index e0519624..1a79f31b 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,7 +83,7 @@ m1_calls() const : int m2_calls() const : int - + Layer3 @@ -91,7 +91,7 @@ Base - + Layer2 @@ -99,7 +99,7 @@ Layer3<Base> - + Layer1 @@ -107,18 +107,18 @@ Layer2<Layer3<Base>> - - + + A - + - + layers : std::unique_ptr<Layer1<Layer2<Layer3<Base>>>> diff --git a/docs/test_cases/t00020_class.svg b/docs/test_cases/t00020_class.svg index deb0cf94..b58f2bec 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_class.svg b/docs/test_cases/t00021_class.svg index f81368af..44810759 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_class.svg b/docs/test_cases/t00022_class.svg index 7a233cc7..32566e0b 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_class.svg b/docs/test_cases/t00023_class.svg index 16874b6b..c96e156f 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_class.svg b/docs/test_cases/t00024_class.svg index 843656e9..a80b2b2b 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_class.svg b/docs/test_cases/t00025_class.svg index 3dde1987..d8b06cbb 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,7 +56,7 @@ m1() : void m2() : void - + Proxy @@ -64,7 +64,7 @@ Target1 - + Proxy @@ -72,25 +72,25 @@ Target2 - - + + ProxyHolder - + - + proxy1 : Proxy<Target1> - + - + proxy2 : Proxy<Target2> diff --git a/docs/test_cases/t00026_class.svg b/docs/test_cases/t00026_class.svg index 70337c3f..4b8a9ccc 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>(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,7 +78,7 @@ state(const std::string & n) : Memento<T> & set_state(const std::string & s, Memento<T> && m) : void - + Caretaker @@ -86,7 +86,7 @@ std::string - + Originator @@ -94,25 +94,25 @@ std::string - - + + StringMemento - + - + caretaker : Caretaker<std::string> - + - + originator : Originator<std::string> diff --git a/docs/test_cases/t00027_class.svg b/docs/test_cases/t00027_class.svg index 64cb30e3..ed6cab2f 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,14 @@ ~Shape() = default : void - + Line - - + + Line @@ -39,14 +39,14 @@ display() : void - + Text - - + + Text @@ -57,8 +57,8 @@ display() : void - - + + ShapeDecorator @@ -67,8 +67,8 @@ display() = 0 : void - - + + Color @@ -79,8 +79,8 @@ display() : void - - + + Weight @@ -91,7 +91,7 @@ display() : void - + Line @@ -99,7 +99,7 @@ Color,Weight - + Line @@ -107,7 +107,7 @@ Color - + Text @@ -115,7 +115,7 @@ Color,Weight - + Text @@ -123,39 +123,39 @@ Color - - + + Window - + - + border : Line<Color,Weight> - + - + divider : Line<Color> - + - + title : Text<Color,Weight> - + - + description : Text<Color> diff --git a/docs/test_cases/t00028_class.svg b/docs/test_cases/t00028_class.svg index 325830a0..681b63e7 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,10 +94,10 @@ three - + F enum note. - + E @@ -105,59 +105,59 @@ 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. diff --git a/docs/test_cases/t00029_class.svg b/docs/test_cases/t00029_class.svg index 75e09846..ff096f47 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_class.svg b/docs/test_cases/t00030_class.svg index a362c03b..ba4a1b62 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_class.svg b/docs/test_cases/t00031_class.svg index 097c1dc3..0daaf29d 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,23 +47,23 @@ T - + - + ttt : T - - + + D - + C @@ -71,39 +71,39 @@ int - - + + R - + - + aaa : A * - + - + bbb : std::vector<B> - + - + ccc : C<int> - + - + ddd : D * diff --git a/docs/test_cases/t00032_class.svg b/docs/test_cases/t00032_class.svg index fb0a0275..f94af2a8 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,15 +64,15 @@ T,L,Ts... - + - + counter : L - + Overload @@ -80,18 +80,18 @@ TBase,int,A,B,C - - + + R - + - + overload : Overload<TBase,int,A,B,C> diff --git a/docs/test_cases/t00033_class.svg b/docs/test_cases/t00033_class.svg index ecd19d28..5960d3c1 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,30 +52,30 @@ T - + - + ccc : T - - + + D - + - + ddd : int - + C @@ -83,7 +83,7 @@ D - + B @@ -91,7 +91,7 @@ std::unique_ptr<C<D>> - + A @@ -99,18 +99,18 @@ B<std::unique_ptr<C<D>>> - - + + R - + - + abc : A<B<std::unique_ptr<C<D>>>> diff --git a/docs/test_cases/t00034_class.svg b/docs/test_cases/t00034_class.svg index 00317383..f8e766f9 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,16 +31,16 @@ - - + + lift_void - - + + lift_void @@ -49,8 +49,8 @@ - - + + drop_void @@ -59,16 +59,16 @@ - - + + drop_void - - + + drop_void @@ -77,33 +77,33 @@ - - + + A - - + + R - + - + la : lift_void_t<A> * - + - + lv : lift_void_t<void> * diff --git a/docs/test_cases/t00035_class.svg b/docs/test_cases/t00035_class.svg index fab9db13..74121034 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_class.svg b/docs/test_cases/t00036_class.svg index ed26cec5..673c4c47 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,15 +43,15 @@ T - + - + a : T - + A @@ -59,23 +59,23 @@ int - - + + B - + - + a_int : A<int> - - + + C diff --git a/docs/test_cases/t00037_class.svg b/docs/test_cases/t00037_class.svg index 072c6497..592001cf 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_620) - + - + units : ST::(anonymous_739) - - + + 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_class.svg b/docs/test_cases/t00038_class.svg index d037a570..9d076e46 100644 --- a/docs/test_cases/t00038_class.svg +++ b/docs/test_cases/t00038_class.svg @@ -1,6 +1,6 @@ - + @@ -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,16 +88,16 @@ - - + + map - - + + map @@ -106,8 +106,8 @@ - - + + map @@ -116,8 +116,8 @@ - - + + map @@ -126,8 +126,8 @@ - - + + map diff --git a/docs/test_cases/t00039_class.svg b/docs/test_cases/t00039_class.svg index 0bc3a9ef..7e08d5e6 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_class.svg b/docs/test_cases/t00040_class.svg index f34d2c66..ca73f23c 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_class.svg b/docs/test_cases/t00041_class.svg index 0aa402d1..4ffb0dc3 100644 --- a/docs/test_cases/t00041_class.svg +++ b/docs/test_cases/t00041_class.svg @@ -1,6 +1,6 @@ - + @@ -9,100 +9,100 @@ - - + + R - - + + D - + - + rr : RR * - - + + E - - + + F - - + + RR - + - + e : E * - + - + f : F * - + - + g : detail::G * - - + + RRR - - + + ns1::N - - + + ns1::NN - - + + ns1::NM diff --git a/docs/test_cases/t00042_class.svg b/docs/test_cases/t00042_class.svg index f7253a91..db09a589 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,22 +52,22 @@ T,K - + - + b : T - + - + bb : K - + A @@ -75,7 +75,7 @@ double - + A @@ -83,7 +83,7 @@ std::string - + B diff --git a/docs/test_cases/t00043_class.svg b/docs/test_cases/t00043_class.svg index fed96a77..bf228515 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_class.svg b/docs/test_cases/t00044_class.svg index 39c74bc8..af476d5f 100644 --- a/docs/test_cases/t00044_class.svg +++ b/docs/test_cases/t00044_class.svg @@ -1,6 +1,6 @@ - + @@ -9,7 +9,7 @@ - + signal_handler @@ -17,8 +17,8 @@ ,A - - + + sink @@ -27,15 +27,15 @@ sink<signal_handler<type-parameter-0-0 (type-parameter-0-1...), type-parameter-0-2> >(sink<signal_handler<type-parameter-0-0 (type-parameter-0-1...),type-parameter-0-2>>::signal_t & sh) : void - + - + signal : sink<signal_handler<type-parameter-0-0 (type-parameter-0-1...),type-parameter-0-2>>::signal_t * - - + + sink @@ -46,23 +46,23 @@ sink<signal_handler<type-parameter-0-0 (type-parameter-0-1...), type-parameter-0-2> >(sink<signal_handler<type-parameter-0-0 (type-parameter-0-1...),type-parameter-0-2>>::signal_t & sh) : void - + - + signal : sink<signal_handler<type-parameter-0-0 (type-parameter-0-1...),type-parameter-0-2>>::signal_t * - - + + signal_handler - - + + signal_handler @@ -71,8 +71,8 @@ - - + + signal_handler @@ -81,8 +81,8 @@ - - + + sink diff --git a/docs/test_cases/t00045_class.svg b/docs/test_cases/t00045_class.svg index d531d1b8..2c7a8ffa 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_class.svg b/docs/test_cases/t00046_class.svg index 78345893..9eb3dc36 100644 --- a/docs/test_cases/t00046_class.svg +++ b/docs/test_cases/t00046_class.svg @@ -1,6 +1,6 @@ - + @@ -9,118 +9,118 @@ - + ns1 - + ns2 - + __gnu_cxx - - + + A - - + + A - - + + B - - + + C - - + + D - - + + E - - + + R - + - + a : ns1::ns2::A * - + - + ns1_a : ns1::A * - + - + ns1_ns2_a : ns1::ns2::A * - + - + root_a : ::A * - + - + i : std::vector<std::uint8_t> foo(AA & aa) : void - - + + A - - + + AA diff --git a/docs/test_cases/t00047_class.svg b/docs/test_cases/t00047_class.svg index 8019990e..101ea069 100644 --- a/docs/test_cases/t00047_class.svg +++ b/docs/test_cases/t00047_class.svg @@ -1,6 +1,6 @@ - + @@ -9,16 +9,16 @@ - - + + conditional_t - - + + conditional_t @@ -27,8 +27,8 @@ - - + + conditional_t @@ -37,8 +37,8 @@ - - + + conditional_t @@ -47,8 +47,8 @@ - - + + conditional_t diff --git a/docs/test_cases/t00048_class.svg b/docs/test_cases/t00048_class.svg index 4831786f..e73bc56f 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_class.svg b/docs/test_cases/t00049_class.svg index b26e3f4e..c3c79f3d 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,17 +18,17 @@ T - + - + a : T get_a() : T & - + A @@ -36,7 +36,7 @@ intmap - + A @@ -44,7 +44,7 @@ thestring - + A @@ -52,32 +52,32 @@ std::vector<thestring> - - + + R - + - + a_string : A<thestring> - + - + a_vector_string : A<string_vector> - + - + a_int_map : A<intmap> diff --git a/docs/test_cases/t00050_class.svg b/docs/test_cases/t00050_class.svg index f1f999f0..9ffbde9b 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 diff --git a/docs/test_cases/t20001.md b/docs/test_cases/t20001.md index 0a522af6..b3d53a3b 100644 --- a/docs/test_cases/t20001.md +++ b/docs/test_cases/t20001.md @@ -22,7 +22,7 @@ diagrams: before: - "' t20001 test sequence diagram" after: - - 'note over "tmain()": Main test function' + - '{% set e=element("clanguml::t20001::tmain()") %} note over {{ e.alias) }}: Main test function' ``` ## Source code diff --git a/docs/test_cases/t20001_sequence.svg b/docs/test_cases/t20001_sequence.svg index 470e2953..127a2d8f 100644 --- a/docs/test_cases/t20001_sequence.svg +++ b/docs/test_cases/t20001_sequence.svg @@ -1,6 +1,6 @@ - + - + @@ -9,56 +9,60 @@ - - - - - - - - - - tmain() - - tmain() - - B - - B - - A - - A - - - - - - - - wrap_add3() - - - add3() - - - - - add() - - - - - log_result() - - - - - log_result() - - - - - Main test function + + + + + + + + + + B + + B + + tmain() + + tmain() + + A + + A + + + + + + + + wrap_add3() + + + add3() + + + + + add() + + + + + + + + + log_result() + + + + + log_result() + + + + + Main test function diff --git a/docs/test_cases/t20002_sequence.svg b/docs/test_cases/t20002_sequence.svg index 568a2b80..be9f5584 100644 --- a/docs/test_cases/t20002_sequence.svg +++ b/docs/test_cases/t20002_sequence.svg @@ -1,6 +1,6 @@ - + @@ -9,40 +9,40 @@ - - - + + + - - m1() - - m1() - + + m4() + + m4() + m2() - + m2() - - m3() - - m3() - - m4() - - m4() - - - - - - m2() - - + + m1() + + m1() + + m3() + + m3() + + + + + + m2() + + m3() - - - m4() + + + m4() diff --git a/docs/test_cases/t20003.md b/docs/test_cases/t20003.md new file mode 100644 index 00000000..cb8eae4c --- /dev/null +++ b/docs/test_cases/t20003.md @@ -0,0 +1,42 @@ +# t20003 - Function template sequence diagram test case +## Config +```yaml +compilation_database_dir: .. +output_directory: puml +diagrams: + t20003_sequence: + type: sequence + glob: + - ../../tests/t20003/t20003.cc + include: + namespaces: + - clanguml::t20003 + using_namespace: + - clanguml::t20003 + start_from: + - function: "clanguml::t20003::m1()" + +``` +## Source code +File t20003.cc +```cpp +#include +#include +#include + +namespace clanguml { +namespace t20003 { + +template void m4(T p) { } + +template void m3(T p) { m4(p); } + +template void m2(T p) { m3(p); } + +template void m1(T p) { m2(p); } +} +} + +``` +## Generated UML diagrams +![t20003_sequence](./t20003_sequence.svg "Function template sequence diagram test case") diff --git a/docs/test_cases/t20003_sequence.svg b/docs/test_cases/t20003_sequence.svg new file mode 100644 index 00000000..3fca83bc --- /dev/null +++ b/docs/test_cases/t20003_sequence.svg @@ -0,0 +1,54 @@ + + + + + + + + + + + + + + + + + + + + m1<T>() + + m1<T>() + + m2<T>() + + m2<T>() + + m4<T>() + + m4<T>() + + m3<T>() + + m3<T>() + + + + + + m2<T>() + + + m3<T>() + + + m4<T>() + + + + + + + + diff --git a/docs/test_cases/t20004.md b/docs/test_cases/t20004.md new file mode 100644 index 00000000..c924f5fe --- /dev/null +++ b/docs/test_cases/t20004.md @@ -0,0 +1,41 @@ +# t20004 - Function template instantiation sequence diagram test case +## Config +```yaml +compilation_database_dir: .. +output_directory: puml +diagrams: + t20004_sequence: + type: sequence + glob: + - ../../tests/t20004/t20004.cc + include: + namespaces: + - clanguml::t20004 + using_namespace: + - clanguml::t20004 + start_from: + - function: "clanguml::t20004::main()" +``` +## Source code +File t20004.cc +```cpp +namespace clanguml { +namespace t20004 { + +template T m4(T p); + +template T m3(T p) { return m4(p); } + +template T m2(T p) { return m3(p); } + +template T m1(T p) { return m2(p); } + +template <> [[maybe_unused]] int m4(int p) { return p + 2; } + +int main() { return m1(0); } +} +} + +``` +## Generated UML diagrams +![t20004_sequence](./t20004_sequence.svg "Function template instantiation sequence diagram test case") diff --git a/docs/test_cases/t20004_sequence.svg b/docs/test_cases/t20004_sequence.svg new file mode 100644 index 00000000..d2876a3f --- /dev/null +++ b/docs/test_cases/t20004_sequence.svg @@ -0,0 +1,66 @@ + + + + + + + + + + + + + + + + + + + + + + m2<T>() + + m2<T>() + + main() + + main() + + m1<T>() + + m1<T>() + + m4<T>() + + m4<T>() + + m3<T>() + + m3<T>() + + + + + + + m1<int>() + + + m2<T>() + + + m3<T>() + + + m4<T>() + + + + + + + + + + diff --git a/docs/test_cases/t30001_package.svg b/docs/test_cases/t30001_package.svg index 728dfe54..2d413863 100644 --- a/docs/test_cases/t30001_package.svg +++ b/docs/test_cases/t30001_package.svg @@ -1,6 +1,6 @@ - + @@ -9,63 +9,63 @@ - - + + 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_package.svg b/docs/test_cases/t30002_package.svg index 10ae6b88..c14315b8 100644 --- a/docs/test_cases/t30002_package.svg +++ b/docs/test_cases/t30002_package.svg @@ -1,6 +1,6 @@ - + @@ -9,113 +9,113 @@ - - + + A - - + + AA - - + + B - - + + BB - - + + A1 - - + + A2 - - + + A3 - - + + A4 - - + + A5 - - + + A6 - - + + A7 - - + + A8 - - + + A9 - - + + A10 - - + + A11 - - + + A12 - - + + A13 - - + + A14 - - + + A15 - - + + A16 - - + + A17 - - + + BBB diff --git a/docs/test_cases/t30003_package.svg b/docs/test_cases/t30003_package.svg index 09cb7b37..c5e447d9 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_package.svg b/docs/test_cases/t30004_package.svg index e55119ff..19a56288 100644 --- a/docs/test_cases/t30004_package.svg +++ b/docs/test_cases/t30004_package.svg @@ -1,6 +1,6 @@ - + @@ -9,40 +9,40 @@ - - + + A - + Package AAA. - + Package BBB. - + CCCC package note. - + We skipped DDD. - - + + AAA - - + + BBB - - + + CCC - - + + EEE diff --git a/docs/test_cases/t30005_package.svg b/docs/test_cases/t30005_package.svg index 7c8ac344..551a1ee1 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_package.svg b/docs/test_cases/t30006_package.svg index dc852ff0..f33402c9 100644 --- a/docs/test_cases/t30006_package.svg +++ b/docs/test_cases/t30006_package.svg @@ -1,6 +1,6 @@ - + @@ -9,22 +9,22 @@ - - + + B - - + + A - - + + C - + Top A note. diff --git a/docs/test_cases/t30007_package.svg b/docs/test_cases/t30007_package.svg index fe2d9213..fb339a0b 100644 --- a/docs/test_cases/t30007_package.svg +++ b/docs/test_cases/t30007_package.svg @@ -1,6 +1,6 @@ - + @@ -9,27 +9,27 @@ - - + + A - - + + B - - + + AA - - + + C - + Compare layout with t30006. diff --git a/docs/test_cases/t30008_package.svg b/docs/test_cases/t30008_package.svg index f6a010dc..e49dbbe2 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/t40001_include.svg b/docs/test_cases/t40001_include.svg index 4669f393..62ff26f0 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 diff --git a/docs/test_cases/t40002_include.svg b/docs/test_cases/t40002_include.svg index ca57f280..9a68ea5b 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_include.svg b/docs/test_cases/t40003_include.svg index 6db84dd2..3716c976 100644 --- a/docs/test_cases/t40003_include.svg +++ b/docs/test_cases/t40003_include.svg @@ -1,6 +1,6 @@ - + @@ -9,66 +9,66 @@ - + include - + dependants - + dependencies - + src - + dependants - + dependencies - - + + t3.h - - + + t2.h - - + + t1.h - - + + t3.h - - + + t2.h - - + + t1.h - - + + t5.h - - + + t1.cc - - + + t2.cc diff --git a/tests/test_cases.yaml b/tests/test_cases.yaml index 12be8585..e10d342d 100644 --- a/tests/test_cases.yaml +++ b/tests/test_cases.yaml @@ -154,6 +154,12 @@ test_cases: - name: t20002 title: Free function sequence diagram test case description: + - name: t20003 + title: Function template sequence diagram test case + description: + - name: t20004 + title: Function template instantiation sequence diagram test case + description: Package diagrams: - name: t30001 title: Basic package diagram test case From c94d1dea3f89231b7c994886716c995b89165406 Mon Sep 17 00:00:00 2001 From: Bartek Kryza Date: Wed, 2 Nov 2022 19:09:18 +0100 Subject: [PATCH 14/77] Fixed sequence diagram participant ordering --- .../plantuml/sequence_diagram_generator.cc | 54 +++++++++++++++---- .../plantuml/sequence_diagram_generator.h | 7 ++- 2 files changed, 51 insertions(+), 10 deletions(-) diff --git a/src/sequence_diagram/generators/plantuml/sequence_diagram_generator.cc b/src/sequence_diagram/generators/plantuml/sequence_diagram_generator.cc index 4618deae..0d65b040 100644 --- a/src/sequence_diagram/generators/plantuml/sequence_diagram_generator.cc +++ b/src/sequence_diagram/generators/plantuml/sequence_diagram_generator.cc @@ -46,6 +46,9 @@ void generator::generate_call(const message &m, std::ostream &ostr) const return; } + generate_participant(ostr, m.from); + generate_participant(ostr, m.to); + auto message = m.message_name; if (!message.empty()) { message = m_config.using_namespace().relative(message); @@ -101,22 +104,57 @@ void generator::generate_activity(const activity &a, std::ostream &ostr) const } } -void generator::generate_participants(std::ostream &ostr) const +void generator::generate_participant(std::ostream &ostr, common::id_t id) const { for (const auto participant_id : m_model.active_participants_) { + if (participant_id != id) + continue; + + if (is_participant_generated(participant_id)) + return; + const auto &participant = m_model.get_participant(participant_id).value(); - if (participant.type_name() == "method") - continue; + if (participant.type_name() == "method") { + const auto &class_id = + m_model.get_participant(participant_id) + .value() + .class_id(); - ostr << "participant \"" - << m_config.using_namespace().relative( - participant.full_name(false)) - << "\" as " << participant.alias() << '\n'; + if (is_participant_generated(class_id)) + return; + + const auto &class_participant = + m_model.get_participant(class_id).value(); + + ostr << "participant \"" + << m_config.using_namespace().relative( + class_participant.full_name(false)) + << "\" as " << class_participant.alias() << '\n'; + + generated_participants_.emplace(class_id); + } + else { + ostr << "participant \"" + << m_config.using_namespace().relative( + participant.full_name(false)) + << "\" as " << participant.alias() << '\n'; + + generated_participants_.emplace(participant_id); + } + + return; } } +bool generator::is_participant_generated(common::id_t id) const +{ + return std::find(generated_participants_.begin(), + generated_participants_.end(), + id) != generated_participants_.end(); +} + void generator::generate(std::ostream &ostr) const { m_model.print(); @@ -125,8 +163,6 @@ void generator::generate(std::ostream &ostr) const generate_plantuml_directives(ostr, m_config.puml().before); - generate_participants(ostr); - for (const auto &sf : m_config.start_from()) { if (sf.location_type == source_location::location_t::function) { std::int64_t start_from; diff --git a/src/sequence_diagram/generators/plantuml/sequence_diagram_generator.h b/src/sequence_diagram/generators/plantuml/sequence_diagram_generator.h index a5d13a34..4621682c 100644 --- a/src/sequence_diagram/generators/plantuml/sequence_diagram_generator.h +++ b/src/sequence_diagram/generators/plantuml/sequence_diagram_generator.h @@ -52,12 +52,17 @@ public: void generate_return(const clanguml::sequence_diagram::model::message &m, std::ostream &ostr) const; - void generate_participants(std::ostream &ostr) const; + void generate_participant(std::ostream &ostr, common::id_t id) const; void generate_activity(const clanguml::sequence_diagram::model::activity &a, std::ostream &ostr) const; void generate(std::ostream &ostr) const; + +private: + bool is_participant_generated(common::id_t id) const; + + mutable std::set generated_participants_; }; } From 1dfade12f028c8037adfae636c31cc04ae381d70 Mon Sep 17 00:00:00 2001 From: Bartek Kryza Date: Sat, 5 Nov 2022 13:52:54 +0100 Subject: [PATCH 15/77] Fixed initial function template specialization sequence diagram test case --- src/config/config.cc | 66 ++++++----- src/config/config.h | 4 +- .../visitor/translation_unit_visitor.cc | 109 +++++++++++------- tests/t20004/t20004.cc | 37 +++++- tests/t20004/test_case.h | 18 +++ 5 files changed, 155 insertions(+), 79 deletions(-) diff --git a/src/config/config.cc b/src/config/config.cc index d8e0ffff..a1309431 100644 --- a/src/config/config.cc +++ b/src/config/config.cc @@ -131,6 +131,38 @@ std::vector diagram::get_translation_units( return translation_units; } +void diagram::initialize_type_aliases() +{ + if (!type_aliases().count("std::basic_string")) { + type_aliases().insert({"std::basic_string", "std::string"}); + } + if (!type_aliases().count("std::basic_string,std::allocator>")) { + type_aliases().insert({"std::basic_string,std::allocator>", + "std::string"}); + } + if (!type_aliases().count("std::basic_string")) { + type_aliases().insert({"std::basic_string", "std::wstring"}); + } + if (!type_aliases().count("std::basic_string")) { + type_aliases().insert( + {"std::basic_string", "std::u16string"}); + } + if (!type_aliases().count("std::basic_string")) { + type_aliases().insert( + {"std::basic_string", "std::u32string"}); + } + if (!type_aliases().count("std::integral_constant")) { + type_aliases().insert( + {"std::integral_constant", "std::true_type"}); + } + if (!type_aliases().count("std::integral_constant")) { + type_aliases().insert( + {"std::integral_constant", "std::false_type"}); + } +} + common::model::diagram_t class_diagram::type() const { return common::model::diagram_t::kClass; @@ -179,38 +211,6 @@ void class_diagram::initialize_relationship_hints() } } -void class_diagram::initialize_type_aliases() -{ - if (!type_aliases().count("std::basic_string")) { - type_aliases().insert({"std::basic_string", "std::string"}); - } - if (!type_aliases().count("std::basic_string,std::allocator>")) { - type_aliases().insert({"std::basic_string,std::allocator>", - "std::string"}); - } - if (!type_aliases().count("std::basic_string")) { - type_aliases().insert({"std::basic_string", "std::wstring"}); - } - if (!type_aliases().count("std::basic_string")) { - type_aliases().insert( - {"std::basic_string", "std::u16string"}); - } - if (!type_aliases().count("std::basic_string")) { - type_aliases().insert( - {"std::basic_string", "std::u32string"}); - } - if (!type_aliases().count("std::integral_constant")) { - type_aliases().insert( - {"std::integral_constant", "std::true_type"}); - } - if (!type_aliases().count("std::integral_constant")) { - type_aliases().insert( - {"std::integral_constant", "std::false_type"}); - } -} - template <> void append_value(plantuml &l, const plantuml &r) { l.append(r); @@ -590,6 +590,8 @@ template <> struct convert { get_option(node, rhs.start_from); + rhs.initialize_type_aliases(); + return true; } }; diff --git a/src/config/config.h b/src/config/config.h index 7d659b6d..202ffdec 100644 --- a/src/config/config.h +++ b/src/config/config.h @@ -156,6 +156,8 @@ struct diagram : public inheritable_diagram_options { std::vector get_translation_units( const std::filesystem::path &root_directory) const; + void initialize_type_aliases(); + std::string name; }; @@ -174,8 +176,6 @@ struct class_diagram : public diagram { option layout{"layout"}; void initialize_relationship_hints(); - - void initialize_type_aliases(); }; struct sequence_diagram : public diagram { diff --git a/src/sequence_diagram/visitor/translation_unit_visitor.cc b/src/sequence_diagram/visitor/translation_unit_visitor.cc index 0a8e0ff1..b908a934 100644 --- a/src/sequence_diagram/visitor/translation_unit_visitor.cc +++ b/src/sequence_diagram/visitor/translation_unit_visitor.cc @@ -237,32 +237,51 @@ bool translation_unit_visitor::VisitFunctionDecl(clang::FunctionDecl *f) if (!diagram().should_include(function_name)) return true; - LOG_DBG("Visiting function declaration {}", function_name); + LOG_DBG("Visiting function declaration {} at {}", function_name, + f->getLocation().printToString(source_manager())); - if (f->isTemplated() && f->getDescribedTemplate()) { - // If the described templated of this function is already in the model - // skip it: - if (get_ast_local_id(f->getDescribedTemplate()->getID())) - return true; + if (f->isTemplated()) { + if (f->getDescribedTemplate()) { + // If the described templated of this function is already in the + // model skip it: + if (get_ast_local_id(f->getDescribedTemplate()->getID())) + return true; + } } - auto f_ptr = std::make_unique( - config().using_namespace()); + if (f->isFunctionTemplateSpecialization()) { + auto f_ptr = build_function_template_instantiation(*f); - common::model::namespace_ ns{function_name}; - f_ptr->set_name(ns.name()); - ns.pop_back(); - f_ptr->set_namespace(ns); - f_ptr->set_id(common::to_id(function_name)); + f_ptr->set_id(common::to_id(f_ptr->full_name(false))); - call_expression_context_.update(f); + call_expression_context_.update(f); - call_expression_context_.set_caller_id(f_ptr->id()); + call_expression_context_.set_caller_id(f_ptr->id()); - set_ast_local_id(f->getID(), f_ptr->id()); + set_ast_local_id(f->getID(), f_ptr->id()); - // TODO: Handle overloaded functions with different arguments - diagram().add_participant(std::move(f_ptr)); + // TODO: Handle overloaded functions with different arguments + diagram().add_participant(std::move(f_ptr)); + } + else { + auto f_ptr = std::make_unique( + config().using_namespace()); + + common::model::namespace_ ns{function_name}; + f_ptr->set_name(ns.name()); + ns.pop_back(); + f_ptr->set_namespace(ns); + f_ptr->set_id(common::to_id(function_name)); + + call_expression_context_.update(f); + + call_expression_context_.set_caller_id(f_ptr->id()); + + set_ast_local_id(f->getID(), f_ptr->id()); + + // TODO: Handle overloaded functions with different arguments + diagram().add_participant(std::move(f_ptr)); + } return true; } @@ -423,34 +442,42 @@ bool translation_unit_visitor::VisitCallExpr(clang::CallExpr *expr) return true; bool is_implicit = false; - if (!get_ast_local_id(callee_function->getID()).has_value()) { - // This is implicit function template - // specialization/instantiation We have to build it - std::unique_ptr f_ptr = - build_function_template_instantiation(*callee_function); + auto callee_name = + callee_function->getQualifiedNameAsString() + "()"; + + std::unique_ptr f_ptr; + + // + // The target template function is implicit if it's + // specialization/instantiation was not explicitly defined + // (i.e. it was not added to the diagram by visitor methods) + // + is_implicit = + !get_ast_local_id(callee_function->getID()).has_value(); + + // + // If the callee is a specialization of a function template, + // build it's instantiation model to get the id + // + if (callee_function->getTemplateSpecializationArgs() && + callee_function->getTemplateSpecializationArgs()->size() > 0) { + f_ptr = build_function_template_instantiation(*callee_function); + + callee_name = f_ptr->full_name(false); f_ptr->set_id(common::to_id(f_ptr->full_name(false))); set_ast_local_id(callee_function->getID(), f_ptr->id()); - diagram().add_participant(std::move(f_ptr)); - - // This is not optimal way to check whether the callee - // declaration is implicit or explicit (we don't want implicit - // declarations as separate participants), but is there a better - // way? - is_implicit = true; } if (is_implicit) LOG_DBG("Processing implicit template specialization {}", - diagram() - .get_participant( - get_ast_local_id(callee_function->getID()).value()) - .value() - .full_name(false)); + f_ptr->full_name(false)); m.to_name = callee_function->getQualifiedNameAsString(); if (is_implicit) { // If this is an implicit template specialization/instantiation + // for now we just redirect the call to it's primary template + // (TODO: this is not correct in a general case) m.to = get_ast_local_id( callee_function->getPrimaryTemplate()->getID()) .value(); @@ -458,14 +485,11 @@ bool translation_unit_visitor::VisitCallExpr(clang::CallExpr *expr) else m.to = get_ast_local_id(callee_function->getID()).value(); - auto message_name = - diagram() - .get_participant( - get_ast_local_id(callee_function->getID()).value()) - .value() - .full_name(false) - .substr(); + auto message_name = callee_name; m.message_name = message_name.substr(0, message_name.size() - 2); + + if (f_ptr) + diagram().add_participant(std::move(f_ptr)); } const auto &return_type = @@ -908,5 +932,4 @@ bool translation_unit_visitor::simplify_system_template( else return false; } - } diff --git a/tests/t20004/t20004.cc b/tests/t20004/t20004.cc index 097c43a7..6290ffaf 100644 --- a/tests/t20004/t20004.cc +++ b/tests/t20004/t20004.cc @@ -1,16 +1,49 @@ +#include + namespace clanguml { namespace t20004 { template T m4(T p); +template <> [[maybe_unused]] int m4(int p) { return p + 2; } + +template <> [[maybe_unused]] unsigned long m4(unsigned long p) +{ + return 1000 * p; +} + template T m3(T p) { return m4(p); } template T m2(T p) { return m3(p); } +template <> [[maybe_unused]] std::string m2(std::string p) +{ + return std::string{"m2"} + p; +} + template T m1(T p) { return m2(p); } -template <> [[maybe_unused]] int m4(int p) { return p + 2; } +template <> [[maybe_unused]] float m1(float p) { return 2 * p; } -int main() { return m1(0); } +template <> [[maybe_unused]] unsigned long m1(unsigned long p) +{ + return m4(p); +} + +template <> [[maybe_unused]] std::string m1(std::string p) +{ + return m2(p); +} + +int main() +{ + m1(2.2); + + m1(100); + + m1("main"); + + return m1(0); +} } } diff --git a/tests/t20004/test_case.h b/tests/t20004/test_case.h index 441eb808..0d386f6b 100644 --- a/tests/t20004/test_case.h +++ b/tests/t20004/test_case.h @@ -32,7 +32,25 @@ TEST_CASE("t20004", "[test-case][sequence]") AliasMatcher _A(puml); REQUIRE_THAT(puml, StartsWith("@startuml")); + REQUIRE_THAT(puml, HasCall(_A("main()"), _A("m1()"), "m1")); + REQUIRE_THAT(puml, !HasCall(_A("m1()"), _A("m1()"), "m2")); + REQUIRE_THAT( + puml, !HasCall(_A("m1()"), _A("m1()"), "m2")); + + REQUIRE_THAT(puml, + HasCall(_A("main()"), _A("m1()"), "m1")); + REQUIRE_THAT(puml, + HasCall(_A("m1()"), _A("m4()"), + "m4")); + + REQUIRE_THAT(puml, + HasCall(_A("main()"), _A("m1()"), "m1")); + REQUIRE_THAT(puml, + HasCall(_A("m1()"), _A("m2()"), + "m2")); + REQUIRE_THAT(puml, HasCall(_A("main()"), _A("m1()"), "m1")); + REQUIRE_THAT(puml, HasCall(_A("m1()"), _A("m2()"), "m2")); REQUIRE_THAT(puml, HasCall(_A("m2()"), _A("m3()"), "m3")); REQUIRE_THAT(puml, HasCall(_A("m3()"), _A("m4()"), "m4")); REQUIRE_THAT(puml, EndsWith("@enduml\n")); From 558d1b6eff16aac001e73eadae2a1db5c6b5f239 Mon Sep 17 00:00:00 2001 From: Bartek Kryza Date: Sat, 5 Nov 2022 13:54:28 +0100 Subject: [PATCH 16/77] Updated test case documentation --- docs/test_cases/t00002_class.svg | 36 +++--- docs/test_cases/t00003_class.svg | 46 ++++---- docs/test_cases/t00004_class.svg | 76 ++++++------- docs/test_cases/t00005_class.svg | 110 +++++++++--------- docs/test_cases/t00006_class.svg | 132 ++++++++++----------- docs/test_cases/t00007_class.svg | 30 ++--- docs/test_cases/t00008_class.svg | 56 ++++----- docs/test_cases/t00009_class.svg | 32 +++--- docs/test_cases/t00010_class.svg | 34 +++--- docs/test_cases/t00011_class.svg | 22 ++-- docs/test_cases/t00012_class.svg | 66 +++++------ docs/test_cases/t00013_class.svg | 82 +++++++------- docs/test_cases/t00014_class.svg | 116 +++++++++---------- docs/test_cases/t00015_class.svg | 22 ++-- docs/test_cases/t00016_class.svg | 30 ++--- docs/test_cases/t00017_class.svg | 66 +++++------ docs/test_cases/t00018_class.svg | 18 +-- docs/test_cases/t00019_class.svg | 40 +++---- docs/test_cases/t00020_class.svg | 38 +++---- docs/test_cases/t00021_class.svg | 30 ++--- docs/test_cases/t00022_class.svg | 14 +-- docs/test_cases/t00023_class.svg | 26 ++--- docs/test_cases/t00024_class.svg | 22 ++-- docs/test_cases/t00025_class.svg | 34 +++--- docs/test_cases/t00026_class.svg | 42 +++---- docs/test_cases/t00027_class.svg | 58 +++++----- docs/test_cases/t00028_class.svg | 78 ++++++------- docs/test_cases/t00029_class.svg | 50 ++++---- docs/test_cases/t00030_class.svg | 46 ++++---- docs/test_cases/t00031_class.svg | 50 ++++---- docs/test_cases/t00032_class.svg | 40 +++---- docs/test_cases/t00033_class.svg | 48 ++++---- docs/test_cases/t00034_class.svg | 46 ++++---- docs/test_cases/t00035_class.svg | 22 ++-- docs/test_cases/t00036_class.svg | 38 +++---- docs/test_cases/t00037_class.svg | 54 ++++----- docs/test_cases/t00038_class.svg | 58 +++++----- docs/test_cases/t00039_class.svg | 78 ++++++------- docs/test_cases/t00040_class.svg | 26 ++--- docs/test_cases/t00041_class.svg | 54 ++++----- docs/test_cases/t00042_class.svg | 36 +++--- docs/test_cases/t00043_class.svg | 50 ++++---- docs/test_cases/t00044_class.svg | 36 +++--- docs/test_cases/t00045_class.svg | 70 ++++++------ docs/test_cases/t00046_class.svg | 64 +++++------ docs/test_cases/t00047_class.svg | 22 ++-- docs/test_cases/t00048_class.svg | 50 ++++---- docs/test_cases/t00049_class.svg | 32 +++--- docs/test_cases/t00050_class.svg | 70 ++++++------ docs/test_cases/t20001_sequence.svg | 114 +++++++++---------- docs/test_cases/t20002_sequence.svg | 58 +++++----- docs/test_cases/t20003_sequence.svg | 54 ++++----- docs/test_cases/t20004.md | 37 +++++- docs/test_cases/t20004_sequence.svg | 170 +++++++++++++++++++--------- docs/test_cases/t30001_package.svg | 48 ++++---- docs/test_cases/t30002_package.svg | 90 +++++++-------- docs/test_cases/t30003_package.svg | 26 ++--- docs/test_cases/t30004_package.svg | 30 ++--- docs/test_cases/t30005_package.svg | 38 +++---- docs/test_cases/t30006_package.svg | 16 +-- docs/test_cases/t30007_package.svg | 20 ++-- docs/test_cases/t30008_package.svg | 34 +++--- docs/test_cases/t40001_include.svg | 30 ++--- docs/test_cases/t40002_include.svg | 34 +++--- docs/test_cases/t40003_include.svg | 50 ++++---- 65 files changed, 1669 insertions(+), 1576 deletions(-) diff --git a/docs/test_cases/t00002_class.svg b/docs/test_cases/t00002_class.svg index fa486f1b..1bf70dbc 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_class.svg b/docs/test_cases/t00003_class.svg index 3a7313ff..f0e042f8 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_class.svg b/docs/test_cases/t00004_class.svg index fd5a149f..43727076 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,15 +59,15 @@ Red - - + + A::AA::AAA - + C::B @@ -75,8 +75,8 @@ int - - + + C @@ -84,39 +84,39 @@ T - + - + t : T - + - + b_int : B<int> - - + + C::AA - - + + C::AA::AAA - - + + C::AA::CCC @@ -125,8 +125,8 @@ CCC_2 - - + + C::B @@ -134,16 +134,16 @@ V - + - + b : V - - + + C::CC @@ -152,16 +152,16 @@ CC_2 - - + + detail::D - - + + detail::D::AA @@ -171,8 +171,8 @@ AA_3 - - + + detail::D::DD diff --git a/docs/test_cases/t00005_class.svg b/docs/test_cases/t00005_class.svg index 2e998860..fc18e8ef 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_class.svg b/docs/test_cases/t00006_class.svg index 44c75717..dad9bbc2 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,15 +146,15 @@ T - + - + data : std::vector<T> - + custom_container @@ -162,102 +162,102 @@ 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_class.svg b/docs/test_cases/t00007_class.svg index 118707c2..9e029d08 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_class.svg b/docs/test_cases/t00008_class.svg index c8127dd1..7cca8bbd 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,CMP,int N - + - + 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,15 +87,15 @@ T,C<> - + - + template_template : C<T> - + B @@ -103,18 +103,18 @@ int,Vector - - + + D - + - + ints : B<int,Vector> diff --git a/docs/test_cases/t00009_class.svg b/docs/test_cases/t00009_class.svg index 41183b28..09153b9c 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,15 +18,15 @@ T - + - + value : T - + A @@ -34,7 +34,7 @@ int - + A @@ -42,7 +42,7 @@ std::string - + A @@ -50,32 +50,32 @@ 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_class.svg b/docs/test_cases/t00010_class.svg index 2717c743..e0be1a3c 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,22 +18,22 @@ T,P - + - + first : T - + - + second : P - + A @@ -41,8 +41,8 @@ T,std::string - - + + B @@ -50,15 +50,15 @@ T - + - + astring : A<T,std::string> - + B @@ -66,18 +66,18 @@ int - - + + C - + - + aintstring : B<int> diff --git a/docs/test_cases/t00011_class.svg b/docs/test_cases/t00011_class.svg index d2c2ddff..ff9dd719 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_class.svg b/docs/test_cases/t00012_class.svg index 4ec1dc64..9c4c163c 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,14 +60,14 @@ - + - + ints : std::array<T,sizeof...(Is)> - + A @@ -75,7 +75,7 @@ int,std::string,float - + A @@ -83,7 +83,7 @@ int,std::string,bool - + B @@ -91,7 +91,7 @@ 3,2,1 - + B @@ -99,7 +99,7 @@ 1,1,1,1 - + C @@ -107,50 +107,50 @@ 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_class.svg b/docs/test_cases/t00013_class.svg index c739066a..a3235ab0 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,15 +18,15 @@ T - + - + f : T - + ABCD::F @@ -34,70 +34,70 @@ int - - + + A - + - + a : int - - + + B - + - + b : int - - + + C - + - + c : int - - + + D - + - + d : int print(R * r) : void - - + + E @@ -105,16 +105,16 @@ T - + - + e : T - - + + G @@ -122,22 +122,22 @@ T,Args... - + - + g : T - + - + args : std::tuple<Args...> - + E @@ -145,7 +145,7 @@ int - + G @@ -153,7 +153,7 @@ int,float,std::string - + E @@ -161,25 +161,25 @@ std::string - - + + R - + - + gintstring : G<int,float,std::string> - + - + estring : E<std::string> diff --git a/docs/test_cases/t00014_class.svg b/docs/test_cases/t00014_class.svg index 521dec3a..1c5f29e3 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,37 +18,37 @@ T,P - + - + t : T - + - + p : P - - + + B - + - + value : std::string - + A @@ -56,7 +56,7 @@ T,std::string - + A @@ -64,7 +64,7 @@ T,std::unique_ptr<std::string> - + A @@ -72,7 +72,7 @@ long,T - + A @@ -80,7 +80,7 @@ double,T - + A @@ -88,7 +88,7 @@ long,U - + A @@ -96,7 +96,7 @@ long,bool - + A @@ -104,7 +104,7 @@ double,bool - + A @@ -112,7 +112,7 @@ long,float - + A @@ -120,7 +120,7 @@ double,float - + A @@ -128,7 +128,7 @@ bool,std::string - + A @@ -136,7 +136,7 @@ float,std::unique_ptr<std::string> - + A @@ -144,7 +144,7 @@ int,std::string - + A @@ -152,7 +152,7 @@ std::string,std::string - + A @@ -160,7 +160,7 @@ char,std::string - + A @@ -168,116 +168,116 @@ wchar_t,std::string - - + + R - + - + 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 - + - + bs : BVector - + - + bs2 : BVector2 - + - + cb : SimpleCallback<ACharString> - + - + gcb : GenericCallback<R::AWCharString> - + - + vcb : VoidCallback - + - + vps : VectorPtr<B> diff --git a/docs/test_cases/t00015_class.svg b/docs/test_cases/t00015_class.svg index 80ff07fa..ac70476d 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_class.svg b/docs/test_cases/t00016_class.svg index 212f200d..e901bc99 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<> @@ -19,8 +19,8 @@ value : enum - - + + is_numeric @@ -29,8 +29,8 @@ value : enum - - + + is_numeric @@ -41,8 +41,8 @@ value : enum - - + + is_numeric @@ -53,8 +53,8 @@ value : enum - - + + is_numeric @@ -65,8 +65,8 @@ value : enum - - + + is_numeric @@ -77,8 +77,8 @@ value : enum - - + + is_numeric diff --git a/docs/test_cases/t00017_class.svg b/docs/test_cases/t00017_class.svg index 04d6ab7e..172a5a52 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_class.svg b/docs/test_cases/t00018_class.svg index acafb8f3..e6f49a98 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_class.svg b/docs/test_cases/t00019_class.svg index 1a79f31b..f7062c8c 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,7 +83,7 @@ m1_calls() const : int m2_calls() const : int - + Layer3 @@ -91,7 +91,7 @@ Base - + Layer2 @@ -99,7 +99,7 @@ Layer3<Base> - + Layer1 @@ -107,18 +107,18 @@ Layer2<Layer3<Base>> - - + + A - + - + layers : std::unique_ptr<Layer1<Layer2<Layer3<Base>>>> diff --git a/docs/test_cases/t00020_class.svg b/docs/test_cases/t00020_class.svg index b58f2bec..b8203cd9 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_class.svg b/docs/test_cases/t00021_class.svg index 44810759..a10022a5 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_class.svg b/docs/test_cases/t00022_class.svg index 32566e0b..129b0405 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_class.svg b/docs/test_cases/t00023_class.svg index c96e156f..4d31c574 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_class.svg b/docs/test_cases/t00024_class.svg index a80b2b2b..a5888583 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_class.svg b/docs/test_cases/t00025_class.svg index d8b06cbb..cb647766 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,7 +56,7 @@ m1() : void m2() : void - + Proxy @@ -64,7 +64,7 @@ Target1 - + Proxy @@ -72,25 +72,25 @@ Target2 - - + + ProxyHolder - + - + proxy1 : Proxy<Target1> - + - + proxy2 : Proxy<Target2> diff --git a/docs/test_cases/t00026_class.svg b/docs/test_cases/t00026_class.svg index 4b8a9ccc..262e4c7c 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>(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,7 +78,7 @@ state(const std::string & n) : Memento<T> & set_state(const std::string & s, Memento<T> && m) : void - + Caretaker @@ -86,7 +86,7 @@ std::string - + Originator @@ -94,25 +94,25 @@ std::string - - + + StringMemento - + - + caretaker : Caretaker<std::string> - + - + originator : Originator<std::string> diff --git a/docs/test_cases/t00027_class.svg b/docs/test_cases/t00027_class.svg index ed6cab2f..51423ab5 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,14 @@ ~Shape() = default : void - + Line - - + + Line @@ -39,14 +39,14 @@ display() : void - + Text - - + + Text @@ -57,8 +57,8 @@ display() : void - - + + ShapeDecorator @@ -67,8 +67,8 @@ display() = 0 : void - - + + Color @@ -79,8 +79,8 @@ display() : void - - + + Weight @@ -91,7 +91,7 @@ display() : void - + Line @@ -99,7 +99,7 @@ Color,Weight - + Line @@ -107,7 +107,7 @@ Color - + Text @@ -115,7 +115,7 @@ Color,Weight - + Text @@ -123,39 +123,39 @@ Color - - + + Window - + - + border : Line<Color,Weight> - + - + divider : Line<Color> - + - + title : Text<Color,Weight> - + - + description : Text<Color> diff --git a/docs/test_cases/t00028_class.svg b/docs/test_cases/t00028_class.svg index 681b63e7..ae340854 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,10 +94,10 @@ three - + F enum note. - + E @@ -105,59 +105,59 @@ 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. diff --git a/docs/test_cases/t00029_class.svg b/docs/test_cases/t00029_class.svg index ff096f47..8cea0685 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_class.svg b/docs/test_cases/t00030_class.svg index ba4a1b62..52ecf348 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_class.svg b/docs/test_cases/t00031_class.svg index 0daaf29d..62e0963a 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,23 +47,23 @@ T - + - + ttt : T - - + + D - + C @@ -71,39 +71,39 @@ int - - + + R - + - + aaa : A * - + - + bbb : std::vector<B> - + - + ccc : C<int> - + - + ddd : D * diff --git a/docs/test_cases/t00032_class.svg b/docs/test_cases/t00032_class.svg index f94af2a8..914ad039 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,15 +64,15 @@ T,L,Ts... - + - + counter : L - + Overload @@ -80,18 +80,18 @@ TBase,int,A,B,C - - + + R - + - + overload : Overload<TBase,int,A,B,C> diff --git a/docs/test_cases/t00033_class.svg b/docs/test_cases/t00033_class.svg index 5960d3c1..27023c12 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,30 +52,30 @@ T - + - + ccc : T - - + + D - + - + ddd : int - + C @@ -83,7 +83,7 @@ D - + B @@ -91,7 +91,7 @@ std::unique_ptr<C<D>> - + A @@ -99,18 +99,18 @@ B<std::unique_ptr<C<D>>> - - + + R - + - + abc : A<B<std::unique_ptr<C<D>>>> diff --git a/docs/test_cases/t00034_class.svg b/docs/test_cases/t00034_class.svg index f8e766f9..b8bf95ee 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,16 +31,16 @@ - - + + lift_void - - + + lift_void @@ -49,8 +49,8 @@ - - + + drop_void @@ -59,16 +59,16 @@ - - + + drop_void - - + + drop_void @@ -77,33 +77,33 @@ - - + + A - - + + R - + - + la : lift_void_t<A> * - + - + lv : lift_void_t<void> * diff --git a/docs/test_cases/t00035_class.svg b/docs/test_cases/t00035_class.svg index 74121034..d4cc21ad 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_class.svg b/docs/test_cases/t00036_class.svg index 673c4c47..59adfa30 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,15 +43,15 @@ T - + - + a : T - + A @@ -59,23 +59,23 @@ int - - + + B - + - + a_int : A<int> - - + + C diff --git a/docs/test_cases/t00037_class.svg b/docs/test_cases/t00037_class.svg index 592001cf..bcf9e3fd 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_620) - + - + units : ST::(anonymous_739) - - + + 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_class.svg b/docs/test_cases/t00038_class.svg index 9d076e46..bed1dd6a 100644 --- a/docs/test_cases/t00038_class.svg +++ b/docs/test_cases/t00038_class.svg @@ -1,6 +1,6 @@ - + @@ -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,16 +88,16 @@ - - + + map - - + + map @@ -106,8 +106,8 @@ - - + + map @@ -116,8 +116,8 @@ - - + + map @@ -126,8 +126,8 @@ - - + + map diff --git a/docs/test_cases/t00039_class.svg b/docs/test_cases/t00039_class.svg index 7e08d5e6..8874f94b 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_class.svg b/docs/test_cases/t00040_class.svg index ca73f23c..f689ac0c 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_class.svg b/docs/test_cases/t00041_class.svg index 4ffb0dc3..7a66c1f9 100644 --- a/docs/test_cases/t00041_class.svg +++ b/docs/test_cases/t00041_class.svg @@ -1,6 +1,6 @@ - + @@ -9,100 +9,100 @@ - - + + R - - + + D - + - + rr : RR * - - + + E - - + + F - - + + RR - + - + e : E * - + - + f : F * - + - + g : detail::G * - - + + RRR - - + + ns1::N - - + + ns1::NN - - + + ns1::NM diff --git a/docs/test_cases/t00042_class.svg b/docs/test_cases/t00042_class.svg index db09a589..106b4e70 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,22 +52,22 @@ T,K - + - + b : T - + - + bb : K - + A @@ -75,7 +75,7 @@ double - + A @@ -83,7 +83,7 @@ std::string - + B diff --git a/docs/test_cases/t00043_class.svg b/docs/test_cases/t00043_class.svg index bf228515..86b0b6fb 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_class.svg b/docs/test_cases/t00044_class.svg index af476d5f..5fcdee22 100644 --- a/docs/test_cases/t00044_class.svg +++ b/docs/test_cases/t00044_class.svg @@ -1,6 +1,6 @@ - + @@ -9,7 +9,7 @@ - + signal_handler @@ -17,8 +17,8 @@ ,A - - + + sink @@ -27,15 +27,15 @@ sink<signal_handler<type-parameter-0-0 (type-parameter-0-1...), type-parameter-0-2> >(sink<signal_handler<type-parameter-0-0 (type-parameter-0-1...),type-parameter-0-2>>::signal_t & sh) : void - + - + signal : sink<signal_handler<type-parameter-0-0 (type-parameter-0-1...),type-parameter-0-2>>::signal_t * - - + + sink @@ -46,23 +46,23 @@ sink<signal_handler<type-parameter-0-0 (type-parameter-0-1...), type-parameter-0-2> >(sink<signal_handler<type-parameter-0-0 (type-parameter-0-1...),type-parameter-0-2>>::signal_t & sh) : void - + - + signal : sink<signal_handler<type-parameter-0-0 (type-parameter-0-1...),type-parameter-0-2>>::signal_t * - - + + signal_handler - - + + signal_handler @@ -71,8 +71,8 @@ - - + + signal_handler @@ -81,8 +81,8 @@ - - + + sink diff --git a/docs/test_cases/t00045_class.svg b/docs/test_cases/t00045_class.svg index 2c7a8ffa..7e66f867 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_class.svg b/docs/test_cases/t00046_class.svg index 9eb3dc36..de2852d1 100644 --- a/docs/test_cases/t00046_class.svg +++ b/docs/test_cases/t00046_class.svg @@ -1,6 +1,6 @@ - + @@ -9,118 +9,118 @@ - + ns1 - + ns2 - + __gnu_cxx - - + + A - - + + A - - + + B - - + + C - - + + D - - + + E - - + + R - + - + a : ns1::ns2::A * - + - + ns1_a : ns1::A * - + - + ns1_ns2_a : ns1::ns2::A * - + - + root_a : ::A * - + - + i : std::vector<std::uint8_t> foo(AA & aa) : void - - + + A - - + + AA diff --git a/docs/test_cases/t00047_class.svg b/docs/test_cases/t00047_class.svg index 101ea069..79977629 100644 --- a/docs/test_cases/t00047_class.svg +++ b/docs/test_cases/t00047_class.svg @@ -1,6 +1,6 @@ - + @@ -9,16 +9,16 @@ - - + + conditional_t - - + + conditional_t @@ -27,8 +27,8 @@ - - + + conditional_t @@ -37,8 +37,8 @@ - - + + conditional_t @@ -47,8 +47,8 @@ - - + + conditional_t diff --git a/docs/test_cases/t00048_class.svg b/docs/test_cases/t00048_class.svg index e73bc56f..b1c2df83 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_class.svg b/docs/test_cases/t00049_class.svg index c3c79f3d..a9020bd7 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,17 +18,17 @@ T - + - + a : T get_a() : T & - + A @@ -36,7 +36,7 @@ intmap - + A @@ -44,7 +44,7 @@ thestring - + A @@ -52,32 +52,32 @@ std::vector<thestring> - - + + R - + - + a_string : A<thestring> - + - + a_vector_string : A<string_vector> - + - + a_int_map : A<intmap> diff --git a/docs/test_cases/t00050_class.svg b/docs/test_cases/t00050_class.svg index 9ffbde9b..33b8c5ae 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 diff --git a/docs/test_cases/t20001_sequence.svg b/docs/test_cases/t20001_sequence.svg index 127a2d8f..8ec09f14 100644 --- a/docs/test_cases/t20001_sequence.svg +++ b/docs/test_cases/t20001_sequence.svg @@ -1,6 +1,6 @@ - + - + @@ -9,60 +9,60 @@ - - - - - - - - - - B - - B - - tmain() - - tmain() - - A - - A - - - - - - - - wrap_add3() - - - add3() - - - - - add() - - - - - - - - - log_result() - - - - - log_result() - - - - - Main test function + + + + + + + + + + tmain() + + tmain() + + B + + B + + A + + A + + + + + + + + wrap_add3() + + + add3() + + + + + add() + + + + + + + + + log_result() + + + + + log_result() + + + + + Main test function diff --git a/docs/test_cases/t20002_sequence.svg b/docs/test_cases/t20002_sequence.svg index be9f5584..f187f22b 100644 --- a/docs/test_cases/t20002_sequence.svg +++ b/docs/test_cases/t20002_sequence.svg @@ -1,6 +1,6 @@ - + @@ -9,40 +9,40 @@ - - - + + + - - m4() - - m4() - + + m1() + + m1() + m2() - + m2() - - m1() - - m1() - - m3() - - m3() - - - - - - m2() - - + + m3() + + m3() + + m4() + + m4() + + + + + + m2() + + m3() - - - m4() + + + m4() diff --git a/docs/test_cases/t20003_sequence.svg b/docs/test_cases/t20003_sequence.svg index 3fca83bc..7aaa6a62 100644 --- a/docs/test_cases/t20003_sequence.svg +++ b/docs/test_cases/t20003_sequence.svg @@ -1,6 +1,6 @@ - + @@ -9,45 +9,45 @@ - - - + + + - + m1<T>() - + m1<T>() - + m2<T>() - + m2<T>() - - m4<T>() - - m4<T>() - - m3<T>() - - m3<T>() - - - + + m3<T>() + + m3<T>() + + m4<T>() + + m4<T>() + + + m2<T>() - - + + m3<T>() - - - m4<T>() - - + + + m4<T>() + + - + diff --git a/docs/test_cases/t20004.md b/docs/test_cases/t20004.md index c924f5fe..6d9fdd8d 100644 --- a/docs/test_cases/t20004.md +++ b/docs/test_cases/t20004.md @@ -19,20 +19,53 @@ diagrams: ## Source code File t20004.cc ```cpp +#include + namespace clanguml { namespace t20004 { template T m4(T p); +template <> [[maybe_unused]] int m4(int p) { return p + 2; } + +template <> [[maybe_unused]] unsigned long m4(unsigned long p) +{ + return 1000 * p; +} + template T m3(T p) { return m4(p); } template T m2(T p) { return m3(p); } +template <> [[maybe_unused]] std::string m2(std::string p) +{ + return std::string{"m2"} + p; +} + template T m1(T p) { return m2(p); } -template <> [[maybe_unused]] int m4(int p) { return p + 2; } +template <> [[maybe_unused]] float m1(float p) { return 2 * p; } -int main() { return m1(0); } +template <> [[maybe_unused]] unsigned long m1(unsigned long p) +{ + return m4(p); +} + +template <> [[maybe_unused]] std::string m1(std::string p) +{ + return m2(p); +} + +int main() +{ + m1(2.2); + + m1(100); + + m1("main"); + + return m1(0); +} } } diff --git a/docs/test_cases/t20004_sequence.svg b/docs/test_cases/t20004_sequence.svg index d2876a3f..cb7783be 100644 --- a/docs/test_cases/t20004_sequence.svg +++ b/docs/test_cases/t20004_sequence.svg @@ -1,6 +1,6 @@ - + - + @@ -9,58 +9,118 @@ - - - - - - - - - - - m2<T>() - - m2<T>() - - main() - - main() - - m1<T>() - - m1<T>() - - m4<T>() - - m4<T>() - - m3<T>() - - m3<T>() - - - - - - - m1<int>() - - - m2<T>() - - - m3<T>() - - - m4<T>() - - - - - - - - + + + + + + + + + + + + + + + + + + + + + main() + + main() + + m1<float>() + + m1<float>() + + m1<unsigned long>() + + m1<unsigned long>() + + m4<unsigned long>() + + m4<unsigned long>() + + m1<std::string>() + + m1<std::string>() + + m2<std::string>() + + m2<std::string>() + + m1<T>() + + m1<T>() + + m2<T>() + + m2<T>() + + m3<T>() + + m3<T>() + + m4<T>() + + m4<T>() + + + + + + + + + + + + m1<float>() + + + + + m1<unsigned long>() + + + m4<unsigned long>() + + + + + + + m1<std::string>() + + + m2<std::string>() + + + + + + + m1<int>() + + + m2<T>() + + + m3<T>() + + + m4<T>() + + + + + + + + diff --git a/docs/test_cases/t30001_package.svg b/docs/test_cases/t30001_package.svg index 2d413863..5eb16bf1 100644 --- a/docs/test_cases/t30001_package.svg +++ b/docs/test_cases/t30001_package.svg @@ -1,6 +1,6 @@ - + @@ -9,63 +9,63 @@ - - + + 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_package.svg b/docs/test_cases/t30002_package.svg index c14315b8..e8a9ad69 100644 --- a/docs/test_cases/t30002_package.svg +++ b/docs/test_cases/t30002_package.svg @@ -1,6 +1,6 @@ - + @@ -9,113 +9,113 @@ - - + + A - - + + AA - - + + B - - + + BB - - + + A1 - - + + A2 - - + + A3 - - + + A4 - - + + A5 - - + + A6 - - + + A7 - - + + A8 - - + + A9 - - + + A10 - - + + A11 - - + + A12 - - + + A13 - - + + A14 - - + + A15 - - + + A16 - - + + A17 - - + + BBB diff --git a/docs/test_cases/t30003_package.svg b/docs/test_cases/t30003_package.svg index c5e447d9..ffe70336 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_package.svg b/docs/test_cases/t30004_package.svg index 19a56288..ce1e6e42 100644 --- a/docs/test_cases/t30004_package.svg +++ b/docs/test_cases/t30004_package.svg @@ -1,6 +1,6 @@ - + @@ -9,40 +9,40 @@ - - + + A - + Package AAA. - + Package BBB. - + CCCC package note. - + We skipped DDD. - - + + AAA - - + + BBB - - + + CCC - - + + EEE diff --git a/docs/test_cases/t30005_package.svg b/docs/test_cases/t30005_package.svg index 551a1ee1..d6a19637 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_package.svg b/docs/test_cases/t30006_package.svg index f33402c9..e49df033 100644 --- a/docs/test_cases/t30006_package.svg +++ b/docs/test_cases/t30006_package.svg @@ -1,6 +1,6 @@ - + @@ -9,22 +9,22 @@ - - + + B - - + + A - - + + C - + Top A note. diff --git a/docs/test_cases/t30007_package.svg b/docs/test_cases/t30007_package.svg index fb339a0b..bb267862 100644 --- a/docs/test_cases/t30007_package.svg +++ b/docs/test_cases/t30007_package.svg @@ -1,6 +1,6 @@ - + @@ -9,27 +9,27 @@ - - + + A - - + + B - - + + AA - - + + C - + Compare layout with t30006. diff --git a/docs/test_cases/t30008_package.svg b/docs/test_cases/t30008_package.svg index e49dbbe2..91bdb564 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/t40001_include.svg b/docs/test_cases/t40001_include.svg index 62ff26f0..ea68f320 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 diff --git a/docs/test_cases/t40002_include.svg b/docs/test_cases/t40002_include.svg index 9a68ea5b..ce3a49e9 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_include.svg b/docs/test_cases/t40003_include.svg index 3716c976..f5d1f204 100644 --- a/docs/test_cases/t40003_include.svg +++ b/docs/test_cases/t40003_include.svg @@ -1,6 +1,6 @@ - + @@ -9,66 +9,66 @@ - + include - + dependants - + dependencies - + src - + dependants - + dependencies - - + + t3.h - - + + t2.h - - + + t1.h - - + + t3.h - - + + t2.h - - + + t1.h - - + + t5.h - - + + t1.cc - - + + t2.cc From a1e447966d1d5e327537064865586711db5e4b1b Mon Sep 17 00:00:00 2001 From: Bartek Kryza Date: Sun, 13 Nov 2022 02:49:09 +0100 Subject: [PATCH 17/77] WIP --- .../plantuml/sequence_diagram_generator.cc | 13 ++- src/sequence_diagram/model/activity.h | 7 +- src/sequence_diagram/model/diagram.cc | 20 +++- src/sequence_diagram/model/diagram.h | 16 +-- src/sequence_diagram/model/message.h | 32 +++--- src/sequence_diagram/model/participant.h | 12 ++ .../visitor/translation_unit_visitor.cc | 106 ++++++++++++++---- .../visitor/translation_unit_visitor.h | 100 +++++------------ tests/t20005/.clang-uml | 14 +++ tests/t20005/t20005.cc | 21 ++++ tests/t20005/test_case.h | 45 ++++++++ tests/test_cases.cc | 1 + tests/test_cases.yaml | 3 + util/templates/test_cases/.clang-uml | 4 +- 14 files changed, 263 insertions(+), 131 deletions(-) create mode 100644 tests/t20005/.clang-uml create mode 100644 tests/t20005/t20005.cc create mode 100644 tests/t20005/test_case.h diff --git a/src/sequence_diagram/generators/plantuml/sequence_diagram_generator.cc b/src/sequence_diagram/generators/plantuml/sequence_diagram_generator.cc index 0d65b040..b3a154fe 100644 --- a/src/sequence_diagram/generators/plantuml/sequence_diagram_generator.cc +++ b/src/sequence_diagram/generators/plantuml/sequence_diagram_generator.cc @@ -60,7 +60,7 @@ void generator::generate_call(const message &m, std::ostream &ostr) const << to.value().alias() << " : " << message << std::endl; LOG_DBG("Generated call '{}' from {} [{}] to {} [{}]", message, from, - m.from_name, to, m.to_name); + m.from, to, m.to); } void generator::generate_return(const message &m, std::ostream &ostr) const @@ -84,19 +84,19 @@ void generator::generate_activity(const activity &a, std::ostream &ostr) const if (!to) continue; - LOG_DBG("Generating message {} --> {}", m.from_name, m.to_name); + LOG_DBG("Generating message {} --> {}", m.from, m.to); generate_call(m, ostr); ostr << "activate " << to.value().alias() << std::endl; if (m_model.sequences.find(m.to) != m_model.sequences.end()) { LOG_DBG("Creating activity {} --> {} - missing sequence {}", - m.from_name, m.to_name, m.to); + m.from, m.to, m.to); generate_activity(m_model.sequences[m.to], ostr); } else LOG_DBG("Skipping activity {} --> {} - missing sequence {}", - m.from_name, m.to_name, m.to); + m.from, m.to, m.to); generate_return(m, ostr); @@ -159,6 +159,8 @@ void generator::generate(std::ostream &ostr) const { m_model.print(); + + ostr << "@startuml" << std::endl; generate_plantuml_directives(ostr, m_config.puml().before); @@ -167,7 +169,8 @@ void generator::generate(std::ostream &ostr) const if (sf.location_type == source_location::location_t::function) { std::int64_t start_from; for (const auto &[k, v] : m_model.sequences) { - std::string vfrom = v.from; + const auto& caller = *m_model.participants.at(v.from); + std::string vfrom = caller.full_name(false); if (vfrom == sf.location) { LOG_DBG("Found sequence diagram start point: {}", k); start_from = k; diff --git a/src/sequence_diagram/model/activity.h b/src/sequence_diagram/model/activity.h index d60cb225..bee9c4d7 100644 --- a/src/sequence_diagram/model/activity.h +++ b/src/sequence_diagram/model/activity.h @@ -18,6 +18,7 @@ #pragma once #include "message.h" +#include "participant.h" #include #include @@ -25,8 +26,10 @@ namespace clanguml::sequence_diagram::model { struct activity { - std::uint_least64_t usr; - std::string from; +// std::uint_least64_t from_id; +// std::string from_name; +// std::string from_method_name; + common::model::diagram_element::id_t from; std::vector messages; }; diff --git a/src/sequence_diagram/model/diagram.cc b/src/sequence_diagram/model/diagram.cc index e919938a..6f6616b6 100644 --- a/src/sequence_diagram/model/diagram.cc +++ b/src/sequence_diagram/model/diagram.cc @@ -73,13 +73,25 @@ inja::json diagram::context() const void diagram::print() const { + LOG_DBG(" --- Participants ---"); + for (const auto &[id, participant] : participants) { + LOG_DBG("{} - {}", id, participant->to_string()); + } + + LOG_DBG(" --- Activities ---"); for (const auto &[from_id, act] : sequences) { LOG_DBG("Sequence id={}:", from_id); - LOG_DBG(" Activity id={}, from={}:", act.usr, act.from); + const auto &from_activity = *(participants.at(from_id)); + LOG_DBG(" Activity id={}, from={}:", act.from, + from_activity.full_name(false)); for (const auto &message : act.messages) { - LOG_DBG( - " Message from={}, from_id={}, to={}, to_id={}, name={}", - message.from_name, message.from, message.to_name, message.to, + const auto &from_participant = *participants.at(message.from); + const auto &to_participant = *participants.at(message.to); + + LOG_DBG(" Message from={}, from_id={}, " + "to={}, to_id={}, name={}", + from_participant.full_name(false), from_participant.id(), + to_participant.full_name(false), to_participant.id(), message.message_name); } } diff --git a/src/sequence_diagram/model/diagram.h b/src/sequence_diagram/model/diagram.h index 4b66d149..6f12f911 100644 --- a/src/sequence_diagram/model/diagram.h +++ b/src/sequence_diagram/model/diagram.h @@ -66,16 +66,16 @@ public: void add_participant(std::unique_ptr p) { - LOG_DBG("Adding {} participant: {}, {} [{}]", p->type_name(), - p->full_name(false), p->id(), - p->type_name() == "method" - ? dynamic_cast(p.get())->method_name() - : ""); + const auto participant_id = p->id(); - const auto pid = p->id(); + if (participants.find(participant_id) == participants.end()) { + LOG_DBG("Adding '{}' participant: {}, {} [{}]", p->type_name(), + p->full_name(false), p->id(), + p->type_name() == "method" + ? dynamic_cast(p.get())->method_name() + : ""); - if (participants.find(pid) == participants.end()) { - participants.emplace(pid, std::move(p)); + participants.emplace(participant_id, std::move(p)); } } diff --git a/src/sequence_diagram/model/message.h b/src/sequence_diagram/model/message.h index 606fa95a..07087964 100644 --- a/src/sequence_diagram/model/message.h +++ b/src/sequence_diagram/model/message.h @@ -18,6 +18,7 @@ #pragma once #include "common/model/enums.h" +#include "participant.h" #include #include @@ -27,9 +28,10 @@ namespace clanguml::sequence_diagram::model { struct message { message() : from{} - , from_name{} +// , from_method_name{} +// , from_name{} , to{} - , to_name{} +// , to_name{} , message_name{} , return_type{} , line{} @@ -37,17 +39,21 @@ struct message { } common::model::message_t type; - - /// Source participant id - std::uint_least64_t from; - std::string from_name; - // std::uint_least64_t from_usr{}; - - /// Target participant id - std::uint_least64_t to; - std::string to_name; - - // std::int64_t to_usr{}; + common::model::diagram_element::id_t from; + common::model::diagram_element::id_t to; +// +// /// Source participant id +// std::uint_least64_t from; +// std::string from_method_name; +// +// std::string from_name; +// // std::uint_least64_t from_usr{}; +// +// /// Target participant id +// std::uint_least64_t to; +// std::string to_name; +// +// // std::int64_t to_usr{}; std::string message_name; diff --git a/src/sequence_diagram/model/participant.h b/src/sequence_diagram/model/participant.h index 1990c7ec..e8a77efd 100644 --- a/src/sequence_diagram/model/participant.h +++ b/src/sequence_diagram/model/participant.h @@ -66,6 +66,12 @@ struct participant : public common::model::element, std::string type_name() const override { return "participant"; } + virtual std::string to_string() const + { + return fmt::format("Participant '{}': id={} name={}", type_name(), id(), + full_name(false)); + } + stereotype_t stereotype_{stereotype_t::participant}; }; @@ -148,6 +154,12 @@ struct method : public participant { diagram_element::id_t class_id() const { return class_id_; } + std::string to_string() const override + { + return fmt::format("Participant '{}': id={}, name={}, class_id={}", + type_name(), id(), full_name(false), class_id()); + } + private: diagram_element::id_t class_id_; std::string method_name_; diff --git a/src/sequence_diagram/visitor/translation_unit_visitor.cc b/src/sequence_diagram/visitor/translation_unit_visitor.cc index b908a934..7d06bfff 100644 --- a/src/sequence_diagram/visitor/translation_unit_visitor.cc +++ b/src/sequence_diagram/visitor/translation_unit_visitor.cc @@ -78,8 +78,6 @@ bool translation_unit_visitor::VisitCXXRecordDecl(clang::CXXRecordDecl *cls) if (!diagram().should_include(cls->getQualifiedNameAsString())) return true; - call_expression_context_.reset(); - if (!diagram().should_include(cls->getQualifiedNameAsString())) { return true; } @@ -102,6 +100,8 @@ bool translation_unit_visitor::VisitCXXRecordDecl(clang::CXXRecordDecl *cls) if (!c_ptr) return true; + call_expression_context_.reset(); + const auto cls_id = c_ptr->id(); set_ast_local_id(cls->getID(), cls_id); @@ -152,9 +152,9 @@ bool translation_unit_visitor::VisitClassTemplateDecl( if (!diagram().should_include(cls->getQualifiedNameAsString())) return true; - LOG_DBG("= Visiting class template declaration {} at {}", + LOG_DBG("= Visiting class template declaration {} at {} [{}]", cls->getQualifiedNameAsString(), - cls->getLocation().printToString(source_manager())); + cls->getLocation().printToString(source_manager()), (void *)cls); auto c_ptr = create_class_declaration(cls->getTemplatedDecl()); @@ -181,8 +181,7 @@ bool translation_unit_visitor::VisitClassTemplateDecl( } if (diagram_.should_include(*c_ptr)) { - const auto name = c_ptr->full_name(); - LOG_DBG("Adding class template {} with id {}", name, id); + LOG_DBG("Adding class template {} with id {}", cls_full_name, id); call_expression_context_.set_caller_id(id); call_expression_context_.update(cls); @@ -195,7 +194,7 @@ bool translation_unit_visitor::VisitClassTemplateDecl( bool translation_unit_visitor::VisitCXXMethodDecl(clang::CXXMethodDecl *m) { - if (call_expression_context_.current_class_decl_ == nullptr || + if (call_expression_context_.current_class_decl_ == nullptr && call_expression_context_.current_class_template_decl_ == nullptr) return true; @@ -210,11 +209,22 @@ bool translation_unit_visitor::VisitCXXMethodDecl(clang::CXXMethodDecl *m) m_ptr->set_name(ns.name()); ns.pop_back(); m_ptr->set_namespace(ns); - m_ptr->set_id(common::to_id(m->getQualifiedNameAsString())); - m_ptr->set_class_id( - get_ast_local_id(call_expression_context_.current_class_decl_->getID()) - .value()); + if (call_expression_context_.current_class_decl_) + m_ptr->set_class_id(get_ast_local_id( + call_expression_context_.current_class_decl_->getID()) + .value()); + else + m_ptr->set_class_id(get_ast_local_id( + call_expression_context_.current_class_template_decl_->getID()) + .value()); + + m_ptr->set_name( + diagram().participants.at(m_ptr->class_id())->full_name_no_ns() + + "::" + m->getNameAsString()); + + m_ptr->set_id( + common::to_id(m_ptr->full_name(false) + "::" + m->getNameAsString())); call_expression_context_.update(m); @@ -327,6 +337,8 @@ bool translation_unit_visitor::VisitCallExpr(clang::CallExpr *expr) using clanguml::sequence_diagram::model::activity; using clanguml::sequence_diagram::model::message; + // expr->dump(); + // Skip casts, moves and such if (expr->isCallToStdMove()) return true; @@ -337,24 +349,28 @@ bool translation_unit_visitor::VisitCallExpr(clang::CallExpr *expr) if (clang::dyn_cast_or_null(expr)) return true; + call_expression_context_.dump(); + if (!call_expression_context_.valid()) return true; message m; m.type = message_t::kCall; m.from = call_expression_context_.caller_id(); - m.from_name = diagram().participants.at(m.from)->full_name(false); const auto ¤t_ast_context = *call_expression_context_.get_ast_context(); + LOG_DBG("Visiting call expression at {}", + expr->getBeginLoc().printToString(source_manager())); + if (const auto *operator_call_expr = clang::dyn_cast_or_null(expr); operator_call_expr != nullptr) { // TODO: Handle C++ operator calls } // - // class method + // Call to a class method // else if (const auto *method_call_expr = clang::dyn_cast_or_null(expr); @@ -376,7 +392,6 @@ bool translation_unit_visitor::VisitCallExpr(clang::CallExpr *expr) // encountered by the visitor - for now it's not a problem // as overloaded methods are not supported m.to = common::to_id(method_decl->getQualifiedNameAsString()); - m.to_name = callee_decl->getQualifiedNameAsString(); m.message_name = method_decl->getNameAsString(); m.return_type = method_call_expr->getCallReturnType(current_ast_context) .getAsString(); @@ -385,6 +400,9 @@ bool translation_unit_visitor::VisitCallExpr(clang::CallExpr *expr) diagram().add_active_participant( get_ast_local_id(callee_decl->getID()).value()); } + // + // Call to a function + // else if (const auto *function_call_expr = clang::dyn_cast_or_null(expr); function_call_expr != nullptr) { @@ -396,8 +414,49 @@ bool translation_unit_visitor::VisitCallExpr(clang::CallExpr *expr) } if (!callee_decl) { - if (clang::dyn_cast_or_null( + // + // Call to a method of a class template + // + if (clang::dyn_cast_or_null( function_call_expr->getCallee())) { + auto *dependent_member_callee = + clang::dyn_cast_or_null( + function_call_expr->getCallee()); + + if (!dependent_member_callee->getBaseType().isNull()) { + const auto *primary_template = + dependent_member_callee->getBaseType() + ->getAs() + ->getTemplateName() + .getAsTemplateDecl(); + + auto callee_method_full_name = + diagram() + .participants + .at(get_ast_local_id(primary_template->getID()) + .value()) + ->full_name(false) + + "::" + + dependent_member_callee->getMember().getAsString(); + + auto callee_id = common::to_id(callee_method_full_name); + m.to = callee_id; + + m.message_name = + dependent_member_callee->getMember().getAsString(); + m.return_type = ""; + + if (get_ast_local_id(primary_template->getID())) + diagram().add_active_participant( + get_ast_local_id(primary_template->getID()) + .value()); + } + } + // + // Call to a template function + // + else if (clang::dyn_cast_or_null( + function_call_expr->getCallee())) { // This is probably a template auto *unresolved_expr = clang::dyn_cast_or_null( @@ -411,7 +470,8 @@ bool translation_unit_visitor::VisitCallExpr(clang::CallExpr *expr) auto *ftd = clang::dyn_cast_or_null< clang::FunctionTemplateDecl>(decl); - m.to_name = to_string(ftd); + // m.to_name = + // to_string(ftd); m.to = get_ast_local_id(ftd->getID()).value(); auto message_name = diagram() @@ -430,11 +490,8 @@ bool translation_unit_visitor::VisitCallExpr(clang::CallExpr *expr) } } else { - if (!callee_decl) - return true; - if (callee_decl->isTemplateDecl()) - LOG_DBG("Call to template function!!!!"); + LOG_DBG("Call to template function"); const auto *callee_function = callee_decl->getAsFunction(); @@ -473,7 +530,8 @@ bool translation_unit_visitor::VisitCallExpr(clang::CallExpr *expr) LOG_DBG("Processing implicit template specialization {}", f_ptr->full_name(false)); - m.to_name = callee_function->getQualifiedNameAsString(); + // m.to_name = + // callee_function->getQualifiedNameAsString(); if (is_implicit) { // If this is an implicit template specialization/instantiation // for now we just redirect the call to it's primary template @@ -512,8 +570,8 @@ bool translation_unit_visitor::VisitCallExpr(clang::CallExpr *expr) if (m.from > 0 && m.to > 0) { if (diagram().sequences.find(m.from) == diagram().sequences.end()) { activity a; - a.usr = m.from; - a.from = m.from_name; + // a.usr = m.from; + a.from = m.from; diagram().sequences.insert({m.from, std::move(a)}); } @@ -521,7 +579,7 @@ bool translation_unit_visitor::VisitCallExpr(clang::CallExpr *expr) diagram().add_active_participant(m.to); LOG_DBG("Found call {} from {} [{}] to {} [{}] ", m.message_name, - m.from_name, m.from, m.to_name, m.to); + m.from, m.from, m.to, m.to); diagram().sequences[m.from].messages.emplace_back(std::move(m)); diff --git a/src/sequence_diagram/visitor/translation_unit_visitor.h b/src/sequence_diagram/visitor/translation_unit_visitor.h index 3d3e4d31..afb408dc 100644 --- a/src/sequence_diagram/visitor/translation_unit_visitor.h +++ b/src/sequence_diagram/visitor/translation_unit_visitor.h @@ -32,6 +32,7 @@ std::string to_string(const clang::FunctionTemplateDecl *decl); struct call_expression_context { call_expression_context() : current_class_decl_{nullptr} + , current_class_template_decl_{nullptr} , current_method_decl_{nullptr} , current_function_decl_{nullptr} , current_function_template_decl_{nullptr} @@ -40,29 +41,40 @@ struct call_expression_context { void reset() { + current_caller_id_ = 0; current_class_decl_ = nullptr; + current_class_template_decl_ = nullptr; current_method_decl_ = nullptr; current_function_decl_ = nullptr; current_function_template_decl_ = nullptr; } + void dump() + { + LOG_DBG("current_caller_id_ = {}", current_caller_id_); + LOG_DBG("current_class_decl_ = {}", (void *)current_class_decl_); + LOG_DBG("current_class_template_decl_ = {}", + (void *)current_class_template_decl_); + LOG_DBG("current_method_decl_ = {}", (void *)current_method_decl_); + LOG_DBG("current_function_decl_ = {}", (void *)current_function_decl_); + LOG_DBG("current_function_template_decl_ = {}", + (void *)current_function_template_decl_); + } + bool valid() const { return (current_class_decl_ != nullptr) || + (current_class_template_decl_ != nullptr) || (current_method_decl_ != nullptr) || (current_function_decl_ != nullptr) || (current_function_template_decl_ != nullptr); } - void update(clang::CXXRecordDecl *cls) { current_class_decl_ = cls; } - - void update(clang::ClassTemplateDecl *clst) - { - current_class_template_decl_ = clst; - } - clang::ASTContext *get_ast_context() { + if (current_class_template_decl_) + return ¤t_class_template_decl_->getASTContext(); + if (current_class_decl_) return ¤t_class_decl_->getASTContext(); @@ -72,6 +84,13 @@ struct call_expression_context { return ¤t_function_decl_->getASTContext(); } + void update(clang::CXXRecordDecl *cls) { current_class_decl_ = cls; } + + void update(clang::ClassTemplateDecl *clst) + { + current_class_template_decl_ = clst; + } + void update(clang::CXXMethodDecl *method) { current_method_decl_ = method; } void update(clang::FunctionDecl *function) @@ -118,73 +137,6 @@ struct call_expression_context { current_function_template_decl_ != nullptr; } - // std::string caller_name() const - // { - // if (in_class_method()) - // return current_class_decl_->getQualifiedNameAsString(); - // else if (in_function_template()) { - // return to_string(current_function_template_decl_); - // } - // else if (in_function()) { - // const auto function_name = - // current_function_decl_->getQualifiedNameAsString(); - // LOG_DBG("Processing function {}", function_name); - // // Handle call expression within free function - // if - // (current_function_decl_->isFunctionTemplateSpecialization()) { - // /* - // /// This template specialization was formed from a - // template-id but - // /// has not yet been declared, defined, or - // instantiated. TSK_Undeclared = 0, - // /// This template specialization was implicitly - // instantiated - // from a - // /// template. (C++ [temp.inst]). - // TSK_ImplicitInstantiation, - // /// This template specialization was declared or - // defined by - // an - // /// explicit specialization (C++ [temp.expl.spec]) or - // partial - // /// specialization (C++ [temp.class.spec]). - // TSK_ExplicitSpecialization, - // /// This template specialization was instantiated from - // a - // template - // /// due to an explicit instantiation declaration - // request - // /// (C++11 [temp.explicit]). - // TSK_ExplicitInstantiationDeclaration, - // /// This template specialization was instantiated from - // a - // template - // /// due to an explicit instantiation definition - // request - // /// (C++ [temp.explicit]). - // TSK_ExplicitInstantiationDefinition - // */ - // [[maybe_unused]] const auto specialization_kind = - // current_function_decl_->getTemplateSpecializationKind(); - // [[maybe_unused]] const auto *primary_template = - // current_function_decl_->getPrimaryTemplate(); - // - // for (const auto &arg : - // current_function_decl_->getTemplateSpecializationArgs() - // ->asArray()) { - // LOG_DBG("TEMPLATE SPECIALIZATION ARG:"); - // arg.dump(); - // } - // - // LOG_DBG("--------------"); - // } - // - // return function_name + "()"; - // } - // else - // return ""; - // } - std::int64_t caller_id() const { return current_caller_id_; } void set_caller_id(std::int64_t id) diff --git a/tests/t20005/.clang-uml b/tests/t20005/.clang-uml new file mode 100644 index 00000000..d6248303 --- /dev/null +++ b/tests/t20005/.clang-uml @@ -0,0 +1,14 @@ +compilation_database_dir: .. +output_directory: puml +diagrams: + t20005_sequence: + type: sequence + glob: + - ../../tests/t20005/t20005.cc + include: + namespaces: + - clanguml::t20005 + using_namespace: + - clanguml::t20005 + start_from: + - function: "clanguml::t20005::C::c" \ No newline at end of file diff --git a/tests/t20005/t20005.cc b/tests/t20005/t20005.cc new file mode 100644 index 00000000..de066173 --- /dev/null +++ b/tests/t20005/t20005.cc @@ -0,0 +1,21 @@ +namespace clanguml { +namespace t20005 { + +template struct A { + T a(T arg) { return arg; } +}; + +template struct B { + T b(T arg) { return a_.a(arg); } + + A a_; +}; + +template struct C { + T c(T arg) { return b_.b(arg); } + + B b_; +}; + +} +} \ No newline at end of file diff --git a/tests/t20005/test_case.h b/tests/t20005/test_case.h new file mode 100644 index 00000000..f2f6ef6a --- /dev/null +++ b/tests/t20005/test_case.h @@ -0,0 +1,45 @@ +/** + * tests/t20005/test_case.h + * + * Copyright (c) 2021-2022 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("t20005", "[test-case][sequence]") +{ + auto [config, db] = load_config("t20005"); + + auto diagram = config.diagrams["t20005_sequence"]; + + REQUIRE(diagram->name == "t20005_sequence"); + + auto model = generate_sequence_diagram(*db, diagram); + + REQUIRE(model->name() == "t20005_sequence"); + + auto puml = generate_sequence_puml(diagram, *model); + AliasMatcher _A(puml); + + REQUIRE_THAT(puml, StartsWith("@startuml")); + REQUIRE_THAT(puml, EndsWith("@enduml\n")); + + + // Check if all calls exist + REQUIRE_THAT(puml, HasCall(_A("C"), _A("B"), "b")); + REQUIRE_THAT(puml, HasCall(_A("B"), _A("A"), "a")); + + + save_puml( + "./" + config.output_directory() + "/" + diagram->name + ".puml", puml); +} \ No newline at end of file diff --git a/tests/test_cases.cc b/tests/test_cases.cc index 84ec433d..0433f165 100644 --- a/tests/test_cases.cc +++ b/tests/test_cases.cc @@ -251,6 +251,7 @@ using namespace clanguml::test::matchers; #include "t20002/test_case.h" #include "t20003/test_case.h" #include "t20004/test_case.h" +#include "t20005/test_case.h" /// /// Package diagram tests diff --git a/tests/test_cases.yaml b/tests/test_cases.yaml index e10d342d..a78044a6 100644 --- a/tests/test_cases.yaml +++ b/tests/test_cases.yaml @@ -160,6 +160,9 @@ test_cases: - name: t20004 title: Function template instantiation sequence diagram test case description: + - name: t20005 + title: Class template basic sequence diagram + description: Package diagrams: - name: t30001 title: Basic package diagram test case diff --git a/util/templates/test_cases/.clang-uml b/util/templates/test_cases/.clang-uml index 4e1e2749..63e89fab 100644 --- a/util/templates/test_cases/.clang-uml +++ b/util/templates/test_cases/.clang-uml @@ -7,4 +7,6 @@ diagrams: - ../../tests/{{ name }}/{{ name }}.cc include: namespaces: - - clanguml::{{ name }} \ No newline at end of file + - clanguml::{{ name }} + using_namespace: + - clanguml::{{ name }} \ No newline at end of file From f3aec40b2ab8a94b4eb196fe0f6b29df13bb7058 Mon Sep 17 00:00:00 2001 From: Bartek Kryza Date: Sun, 13 Nov 2022 14:29:32 +0100 Subject: [PATCH 18/77] Fixed test case with template class sequence diagram --- .../plantuml/sequence_diagram_generator.cc | 12 +++++------- src/sequence_diagram/model/activity.h | 3 --- src/sequence_diagram/model/message.h | 16 ---------------- .../visitor/translation_unit_visitor.cc | 12 ++++++++++-- tests/t20005/test_case.h | 2 -- 5 files changed, 15 insertions(+), 30 deletions(-) diff --git a/src/sequence_diagram/generators/plantuml/sequence_diagram_generator.cc b/src/sequence_diagram/generators/plantuml/sequence_diagram_generator.cc index b3a154fe..c5929be2 100644 --- a/src/sequence_diagram/generators/plantuml/sequence_diagram_generator.cc +++ b/src/sequence_diagram/generators/plantuml/sequence_diagram_generator.cc @@ -90,13 +90,13 @@ void generator::generate_activity(const activity &a, std::ostream &ostr) const ostr << "activate " << to.value().alias() << std::endl; if (m_model.sequences.find(m.to) != m_model.sequences.end()) { - LOG_DBG("Creating activity {} --> {} - missing sequence {}", - m.from, m.to, m.to); + LOG_DBG("Creating activity {} --> {} - missing sequence {}", m.from, + m.to, m.to); generate_activity(m_model.sequences[m.to], ostr); } else - LOG_DBG("Skipping activity {} --> {} - missing sequence {}", - m.from, m.to, m.to); + LOG_DBG("Skipping activity {} --> {} - missing sequence {}", m.from, + m.to, m.to); generate_return(m, ostr); @@ -159,8 +159,6 @@ void generator::generate(std::ostream &ostr) const { m_model.print(); - - ostr << "@startuml" << std::endl; generate_plantuml_directives(ostr, m_config.puml().before); @@ -169,7 +167,7 @@ void generator::generate(std::ostream &ostr) const if (sf.location_type == source_location::location_t::function) { std::int64_t start_from; for (const auto &[k, v] : m_model.sequences) { - const auto& caller = *m_model.participants.at(v.from); + const auto &caller = *m_model.participants.at(v.from); std::string vfrom = caller.full_name(false); if (vfrom == sf.location) { LOG_DBG("Found sequence diagram start point: {}", k); diff --git a/src/sequence_diagram/model/activity.h b/src/sequence_diagram/model/activity.h index bee9c4d7..41505d9f 100644 --- a/src/sequence_diagram/model/activity.h +++ b/src/sequence_diagram/model/activity.h @@ -26,9 +26,6 @@ namespace clanguml::sequence_diagram::model { struct activity { -// std::uint_least64_t from_id; -// std::string from_name; -// std::string from_method_name; common::model::diagram_element::id_t from; std::vector messages; }; diff --git a/src/sequence_diagram/model/message.h b/src/sequence_diagram/model/message.h index 07087964..3707d238 100644 --- a/src/sequence_diagram/model/message.h +++ b/src/sequence_diagram/model/message.h @@ -28,10 +28,7 @@ namespace clanguml::sequence_diagram::model { struct message { message() : from{} -// , from_method_name{} -// , from_name{} , to{} -// , to_name{} , message_name{} , return_type{} , line{} @@ -41,19 +38,6 @@ struct message { common::model::message_t type; common::model::diagram_element::id_t from; common::model::diagram_element::id_t to; -// -// /// Source participant id -// std::uint_least64_t from; -// std::string from_method_name; -// -// std::string from_name; -// // std::uint_least64_t from_usr{}; -// -// /// Target participant id -// std::uint_least64_t to; -// std::string to_name; -// -// // std::int64_t to_usr{}; std::string message_name; diff --git a/src/sequence_diagram/visitor/translation_unit_visitor.cc b/src/sequence_diagram/visitor/translation_unit_visitor.cc index 7d06bfff..8db85314 100644 --- a/src/sequence_diagram/visitor/translation_unit_visitor.cc +++ b/src/sequence_diagram/visitor/translation_unit_visitor.cc @@ -223,8 +223,13 @@ bool translation_unit_visitor::VisitCXXMethodDecl(clang::CXXMethodDecl *m) diagram().participants.at(m_ptr->class_id())->full_name_no_ns() + "::" + m->getNameAsString()); - m_ptr->set_id( - common::to_id(m_ptr->full_name(false) + "::" + m->getNameAsString())); + m_ptr->set_id(common::to_id( + diagram().participants.at(m_ptr->class_id())->full_name(false) + + "::" + m->getNameAsString())); + + LOG_DBG("Set id {} for method name {}", m_ptr->id(), + diagram().participants.at(m_ptr->class_id())->full_name(false) + + "::" + m->getNameAsString()); call_expression_context_.update(m); @@ -396,6 +401,9 @@ bool translation_unit_visitor::VisitCallExpr(clang::CallExpr *expr) m.return_type = method_call_expr->getCallReturnType(current_ast_context) .getAsString(); + LOG_DBG("Set callee method id {} for method name {}", m.to, + method_decl->getQualifiedNameAsString()); + if (get_ast_local_id(callee_decl->getID())) diagram().add_active_participant( get_ast_local_id(callee_decl->getID()).value()); diff --git a/tests/t20005/test_case.h b/tests/t20005/test_case.h index f2f6ef6a..2f8bed5d 100644 --- a/tests/t20005/test_case.h +++ b/tests/t20005/test_case.h @@ -34,12 +34,10 @@ TEST_CASE("t20005", "[test-case][sequence]") REQUIRE_THAT(puml, StartsWith("@startuml")); REQUIRE_THAT(puml, EndsWith("@enduml\n")); - // Check if all calls exist REQUIRE_THAT(puml, HasCall(_A("C"), _A("B"), "b")); REQUIRE_THAT(puml, HasCall(_A("B"), _A("A"), "a")); - save_puml( "./" + config.output_directory() + "/" + diagram->name + ".puml", puml); } \ No newline at end of file From 4513e1727511f3eee72855841ee24476d984b65a Mon Sep 17 00:00:00 2001 From: Bartek Kryza Date: Mon, 21 Nov 2022 23:56:02 +0100 Subject: [PATCH 19/77] Adding template class specialization sequence diagram test case --- src/sequence_diagram/model/participant.cc | 35 ++ src/sequence_diagram/model/participant.h | 3 + .../visitor/translation_unit_visitor.cc | 493 +++++++++++++++++- .../visitor/translation_unit_visitor.h | 26 +- tests/t20001/t20001.cc | 4 +- tests/t20006/.clang-uml | 14 + tests/t20006/t20006.cc | 30 ++ tests/t20006/test_case.h | 47 ++ tests/test_cases.cc | 1 + 9 files changed, 640 insertions(+), 13 deletions(-) create mode 100644 tests/t20006/.clang-uml create mode 100644 tests/t20006/t20006.cc create mode 100644 tests/t20006/test_case.h diff --git a/src/sequence_diagram/model/participant.cc b/src/sequence_diagram/model/participant.cc index fe9ca514..d787857c 100644 --- a/src/sequence_diagram/model/participant.cc +++ b/src/sequence_diagram/model/participant.cc @@ -63,6 +63,38 @@ template_trait::templates() const return templates_; } +int template_trait::calculate_template_specialization_match( + const template_trait &other, const std::string &full_name) const +{ + int res{}; + +// std::string left = name_and_ns(); +// // TODO: handle variadic templates +// if ((name_and_ns() != full_name) || +// (templates().size() != other.templates().size())) { +// return res; +// } + + // Iterate over all template arguments + for (auto i = 0U; i < other.templates().size(); i++) { + const auto &template_arg = templates().at(i); + const auto &other_template_arg = other.templates().at(i); + + if (template_arg == other_template_arg) { + res++; + } + else if (other_template_arg.is_specialization_of(template_arg)) { + continue; + } + else { + res = 0; + break; + } + } + + return res; +} + class_::class_(const common::model::namespace_ &using_namespace) : participant{using_namespace} { @@ -122,6 +154,9 @@ std::string class_::full_name(bool relative) const return res; } +bool operator==(const class_ &l, const class_ &r) { return l.id() == r.id(); } + + function::function(const common::model::namespace_ &using_namespace) : participant{using_namespace} { diff --git a/src/sequence_diagram/model/participant.h b/src/sequence_diagram/model/participant.h index e8a77efd..a2048ff2 100644 --- a/src/sequence_diagram/model/participant.h +++ b/src/sequence_diagram/model/participant.h @@ -39,6 +39,9 @@ struct template_trait { const std::vector & templates() const; + int calculate_template_specialization_match( + const template_trait &other, const std::string &full_name) const; + private: std::vector templates_; std::string base_template_full_name_; diff --git a/src/sequence_diagram/visitor/translation_unit_visitor.cc b/src/sequence_diagram/visitor/translation_unit_visitor.cc index 8db85314..2bb101ab 100644 --- a/src/sequence_diagram/visitor/translation_unit_visitor.cc +++ b/src/sequence_diagram/visitor/translation_unit_visitor.cc @@ -192,6 +192,60 @@ bool translation_unit_visitor::VisitClassTemplateDecl( return true; } +bool translation_unit_visitor::VisitClassTemplateSpecializationDecl( + clang::ClassTemplateSpecializationDecl *cls) +{ + if (source_manager().isInSystemHeader(cls->getSourceRange().getBegin())) + return true; + + if (!diagram().should_include(cls->getQualifiedNameAsString())) + return true; + + if(cls->isImplicit()) + LOG_DBG("!!!!!!!!!!!!!!!!!!!!!"); + + LOG_DBG("= Visiting template specialization declaration {} at {}", + cls->getQualifiedNameAsString(), + cls->getLocation().printToString(source_manager())); + + // TODO: Add support for classes defined in function/method bodies + if (cls->isLocalClass()) + return true; + + auto template_specialization_ptr = process_template_specialization(cls); + + if (!template_specialization_ptr) + return true; + + const auto cls_full_name = template_specialization_ptr->full_name(false); + const auto id = common::to_id(cls_full_name); + + template_specialization_ptr->set_id(id); + + set_ast_local_id(cls->getID(), id); + + if (!cls->isCompleteDefinition()) { + forward_declarations_.emplace( + id, std::move(template_specialization_ptr)); + return true; + } + else { + forward_declarations_.erase(id); + } + + if (diagram_.should_include(*template_specialization_ptr)) { + LOG_DBG("Adding class template specialization {} with id {}", + cls_full_name, id); + + call_expression_context_.set_caller_id(id); + call_expression_context_.update(cls); + + diagram_.add_participant(std::move(template_specialization_ptr)); + } + + return true; +} + bool translation_unit_visitor::VisitCXXMethodDecl(clang::CXXMethodDecl *m) { if (call_expression_context_.current_class_decl_ == nullptr && @@ -385,18 +439,45 @@ bool translation_unit_visitor::VisitCallExpr(clang::CallExpr *expr) const auto *method_decl = method_call_expr->getMethodDecl(); std::string method_name = method_decl->getQualifiedNameAsString(); - const auto *callee_decl = - method_decl ? method_decl->getParent() : nullptr; + auto *callee_decl = method_decl ? method_decl->getParent() : nullptr; if (!(callee_decl && diagram().should_include( callee_decl->getQualifiedNameAsString()))) return true; - // TODO: The method can be called before it's declaration has been - // encountered by the visitor - for now it's not a problem - // as overloaded methods are not supported - m.to = common::to_id(method_decl->getQualifiedNameAsString()); + const auto *callee_template_specialization = + clang::dyn_cast( + callee_decl); + + if (callee_template_specialization) { + LOG_DBG("Callee is a template specialization declaration {}", + callee_template_specialization->getQualifiedNameAsString()); + + if (!get_ast_local_id(callee_template_specialization->getID())) { + callee_template_specialization->dump(); + + + call_expression_context context_backup = call_expression_context_; + + // Since this visitor will overwrite the call_expression_context_ + // we need to back it up and restore it later + VisitClassTemplateSpecializationDecl( + const_cast( + callee_template_specialization)); + + call_expression_context_ = context_backup; + } + + m.to = get_ast_local_id(callee_template_specialization->getID()) + .value(); + } + else { + // TODO: The method can be called before it's declaration has been + // encountered by the visitor - for now it's not a problem + // as overloaded methods are not supported + m.to = common::to_id(method_decl->getQualifiedNameAsString()); + } m.message_name = method_decl->getNameAsString(); m.return_type = method_call_expr->getCallReturnType(current_ast_context) .getAsString(); @@ -800,7 +881,7 @@ translation_unit_visitor::build_function_template_instantiation( // // Instantiate the template arguments // - std::optional parent; + model::template_trait *parent{nullptr}; build_template_instantiation_process_template_arguments(parent, template_base_params, decl.getTemplateSpecializationArgs()->asArray(), template_instantiation, "", decl.getPrimaryTemplate()); @@ -810,7 +891,7 @@ translation_unit_visitor::build_function_template_instantiation( void translation_unit_visitor:: build_template_instantiation_process_template_arguments( - std::optional &parent, + model::template_trait *parent, std::deque> &template_base_params, const clang::ArrayRef &template_args, model::template_trait &template_instantiation, @@ -903,7 +984,7 @@ void translation_unit_visitor:: void translation_unit_visitor:: build_template_instantiation_process_type_argument( - std::optional &parent, + model::template_trait *parent, const std::string &full_template_specialization_name, const clang::TemplateDecl *template_decl, const clang::TemplateArgument &arg, @@ -987,6 +1068,400 @@ void translation_unit_visitor:: } } +std::unique_ptr +translation_unit_visitor::process_template_specialization( + clang::ClassTemplateSpecializationDecl *cls) +{ + auto c_ptr{std::make_unique(config_.using_namespace())}; + auto &template_instantiation = *c_ptr; + + // TODO: refactor to method get_qualified_name() + auto qualified_name = cls->getQualifiedNameAsString(); + util::replace_all(qualified_name, "(anonymous namespace)", ""); + util::replace_all(qualified_name, "::::", "::"); + + common::model::namespace_ ns{qualified_name}; + ns.pop_back(); + template_instantiation.set_name(cls->getNameAsString()); + template_instantiation.set_namespace(ns); + + template_instantiation.is_struct(cls->isStruct()); + + process_comment(*cls, template_instantiation); + set_source_location(*cls, template_instantiation); + + if (template_instantiation.skip()) + return {}; + + const auto template_args_count = cls->getTemplateArgs().size(); + for (auto arg_it = 0U; arg_it < template_args_count; arg_it++) { + const auto arg = cls->getTemplateArgs().get(arg_it); + process_template_specialization_argument( + cls, template_instantiation, arg, arg_it); + } + + template_instantiation.set_id( + common::to_id(template_instantiation.full_name(false))); + + set_ast_local_id(cls->getID(), template_instantiation.id()); + + return c_ptr; +} + +void translation_unit_visitor::process_template_specialization_argument( + const clang::ClassTemplateSpecializationDecl *cls, + model::class_ &template_instantiation, const clang::TemplateArgument &arg, + size_t argument_index, bool in_parameter_pack) +{ + const auto argument_kind = arg.getKind(); + + if (argument_kind == clang::TemplateArgument::Type) { + class_diagram::model::template_parameter argument; + argument.is_template_parameter(false); + + // If this is a nested template type - add nested templates as + // template arguments + if (arg.getAsType()->getAs()) { + const auto *nested_template_type = + arg.getAsType()->getAs(); + + const auto nested_template_name = + nested_template_type->getTemplateName() + .getAsTemplateDecl() + ->getQualifiedNameAsString(); + + argument.set_name(nested_template_name); + + auto nested_template_instantiation = build_template_instantiation( + *arg.getAsType()->getAs(), + &template_instantiation); + + argument.set_id(nested_template_instantiation->id()); + + for (const auto &t : nested_template_instantiation->templates()) + argument.add_template_param(t); + + // Check if this template should be simplified (e.g. system + // template aliases such as 'std:basic_string' should be + // simply 'std::string') + simplify_system_template(argument, + argument.to_string(config().using_namespace(), false)); + } + else if (arg.getAsType()->getAs()) { + auto type_name = + common::to_string(arg.getAsType(), cls->getASTContext()); + + // clang does not provide declared template parameter/argument + // names in template specializations - so we have to extract + // them from raw source code... + if (type_name.find("type-parameter-") == 0) { + auto declaration_text = common::get_source_text_raw( + cls->getSourceRange(), source_manager()); + + declaration_text = declaration_text.substr( + declaration_text.find(cls->getNameAsString()) + + cls->getNameAsString().size() + 1); + + auto template_params = + cx::util::parse_unexposed_template_params( + declaration_text, [](const auto &t) { return t; }); + + if (template_params.size() > argument_index) + type_name = template_params[argument_index].to_string( + config().using_namespace(), false); + else { + LOG_DBG("Failed to find type specialization for argument " + "{} at index {} in declaration \n===\n{}\n===\n", + type_name, argument_index, declaration_text); + } + } + + argument.set_name(type_name); + } + else { + auto type_name = + common::to_string(arg.getAsType(), cls->getASTContext()); + if (type_name.find('<') != std::string::npos) { + // Sometimes template instantiation is reported as + // RecordType in the AST and getAs to + // TemplateSpecializationType returns null pointer so we + // have to at least make sure it's properly formatted + // (e.g. std:integral_constant, or any template + // specialization which contains it - see t00038) + process_unexposed_template_specialization_parameters( + type_name.substr(type_name.find('<') + 1, + type_name.size() - (type_name.find('<') + 2)), + argument, template_instantiation); + + argument.set_name(type_name.substr(0, type_name.find('<'))); + } + else if (type_name.find("type-parameter-") == 0) { + auto declaration_text = common::get_source_text_raw( + cls->getSourceRange(), source_manager()); + + declaration_text = declaration_text.substr( + declaration_text.find(cls->getNameAsString()) + + cls->getNameAsString().size() + 1); + + auto template_params = + cx::util::parse_unexposed_template_params( + declaration_text, [](const auto &t) { return t; }); + + if (template_params.size() > argument_index) + type_name = template_params[argument_index].to_string( + config().using_namespace(), false); + else { + LOG_DBG("Failed to find type specialization for argument " + "{} at index {} in declaration \n===\n{}\n===\n", + type_name, argument_index, declaration_text); + } + + // Otherwise just set the name for the template argument to + // whatever clang says + argument.set_name(type_name); + } + else + argument.set_name(type_name); + } + + LOG_DBG("Adding template instantiation argument {}", + argument.to_string(config().using_namespace(), false)); + + simplify_system_template( + argument, argument.to_string(config().using_namespace(), false)); + + template_instantiation.add_template(std::move(argument)); + } + else if (argument_kind == clang::TemplateArgument::Integral) { + class_diagram::model::template_parameter argument; + argument.is_template_parameter(false); + argument.set_type(std::to_string(arg.getAsIntegral().getExtValue())); + template_instantiation.add_template(std::move(argument)); + } + else if (argument_kind == clang::TemplateArgument::Expression) { + class_diagram::model::template_parameter argument; + argument.is_template_parameter(false); + argument.set_type(common::get_source_text( + arg.getAsExpr()->getSourceRange(), source_manager())); + template_instantiation.add_template(std::move(argument)); + } + else if (argument_kind == clang::TemplateArgument::TemplateExpansion) { + class_diagram::model::template_parameter argument; + argument.is_template_parameter(true); + + cls->getLocation().dump(source_manager()); + } + else if (argument_kind == clang::TemplateArgument::Pack) { + // This will only work for now if pack is at the end + size_t argument_pack_index{argument_index}; + for (const auto &template_argument : arg.getPackAsArray()) { + process_template_specialization_argument(cls, + template_instantiation, template_argument, + argument_pack_index++, true); + } + } + else { + LOG_ERROR("Unsupported template argument kind {} [{}]", arg.getKind(), + cls->getLocation().printToString(source_manager())); + } +} + +std::unique_ptr +translation_unit_visitor::build_template_instantiation( + const clang::TemplateSpecializationType &template_type_decl, + model::class_ *parent) +{ + // TODO: Make sure we only build instantiation once + + // + // Here we'll hold the template base params to replace with the + // instantiated values + // + std::deque> + template_base_params{}; + + auto *template_type_ptr = &template_type_decl; + if (template_type_decl.isTypeAlias() && + template_type_decl.getAliasedType() + ->getAs()) + template_type_ptr = template_type_decl.getAliasedType() + ->getAs(); + + auto &template_type = *template_type_ptr; + + // + // Create class_ instance to hold the template instantiation + // + auto template_instantiation_ptr = + std::make_unique(config_.using_namespace()); + auto &template_instantiation = *template_instantiation_ptr; + std::string full_template_specialization_name = common::to_string( + template_type.desugar(), + template_type.getTemplateName().getAsTemplateDecl()->getASTContext()); + + auto *template_decl{template_type.getTemplateName().getAsTemplateDecl()}; + + auto template_decl_qualified_name = + template_decl->getQualifiedNameAsString(); + + auto *class_template_decl{ + clang::dyn_cast(template_decl)}; + + if (class_template_decl && class_template_decl->getTemplatedDecl() && + class_template_decl->getTemplatedDecl()->getParent() && + class_template_decl->getTemplatedDecl()->getParent()->isRecord()) { + + common::model::namespace_ ns{ + common::get_tag_namespace(*class_template_decl->getTemplatedDecl() + ->getParent() + ->getOuterLexicalRecordContext())}; + + std::string ns_str = ns.to_string(); + std::string name = template_decl->getQualifiedNameAsString(); + if (!ns_str.empty()) { + name = name.substr(ns_str.size() + 2); + } + + util::replace_all(name, "::", "##"); + template_instantiation.set_name(name); + + template_instantiation.set_namespace(ns); + } + else { + common::model::namespace_ ns{template_decl_qualified_name}; + ns.pop_back(); + template_instantiation.set_name(template_decl->getNameAsString()); + template_instantiation.set_namespace(ns); + } + + // TODO: Refactor handling of base parameters to a separate method + + // We need this to match any possible base classes coming from template + // arguments + std::vector< + std::pair> + template_parameter_names{}; + + for (const auto *parameter : *template_decl->getTemplateParameters()) { + if (parameter->isTemplateParameter() && + (parameter->isTemplateParameterPack() || + parameter->isParameterPack())) { + template_parameter_names.emplace_back( + parameter->getNameAsString(), true); + } + else + template_parameter_names.emplace_back( + parameter->getNameAsString(), false); + } + + // Check if the primary template has any base classes + int base_index = 0; + + const auto *templated_class_decl = + clang::dyn_cast_or_null( + template_decl->getTemplatedDecl()); + + if (templated_class_decl && templated_class_decl->hasDefinition()) + for (const auto &base : templated_class_decl->bases()) { + const auto base_class_name = common::to_string( + base.getType(), templated_class_decl->getASTContext(), false); + + LOG_DBG("Found template instantiation base: {}, {}", + base_class_name, base_index); + + // Check if any of the primary template arguments has a + // parameter equal to this type + auto it = std::find_if(template_parameter_names.begin(), + template_parameter_names.end(), + [&base_class_name]( + const auto &p) { return p.first == base_class_name; }); + + if (it != template_parameter_names.end()) { + const auto ¶meter_name = it->first; + const bool is_variadic = it->second; + // Found base class which is a template parameter + LOG_DBG("Found base class which is a template parameter " + "{}, {}, {}", + parameter_name, is_variadic, + std::distance(template_parameter_names.begin(), it)); + + template_base_params.emplace_back(parameter_name, + std::distance(template_parameter_names.begin(), it), + is_variadic); + } + else { + // This is a regular base class - it is handled by + // process_template + } + base_index++; + } + + build_template_instantiation_process_template_arguments(parent, + template_base_params, template_type.template_arguments(), + template_instantiation, full_template_specialization_name, + template_decl); + + // First try to find the best match for this template in partially + // specialized templates + std::string destination{}; + std::string best_match_full_name{}; + auto full_template_name = template_instantiation.full_name(false); + int best_match{}; + common::model::diagram_element::id_t best_match_id{0}; + + for (const auto &[id, c] : diagram().participants) { + const auto *participant_as_class = + dynamic_cast(c.get()); + if ((participant_as_class != nullptr) && + (*participant_as_class == template_instantiation)) + continue; + + auto c_full_name = participant_as_class->full_name(false); + auto match = + participant_as_class->calculate_template_specialization_match( + template_instantiation, template_instantiation.name_and_ns()); + + if (match > best_match) { + best_match = match; + best_match_full_name = c_full_name; + best_match_id = participant_as_class->id(); + } + } + + auto templated_decl_id = + template_type.getTemplateName().getAsTemplateDecl()->getID(); + // auto templated_decl_local_id = + // get_ast_local_id(templated_decl_id).value_or(0); + + if (best_match_id > 0) { + destination = best_match_full_name; + } + else { + LOG_DBG("== Cannot determine global id for specialization template {} " + "- delaying until the translation unit is complete ", + templated_decl_id); + } + + template_instantiation.set_id( + common::to_id(template_instantiation_ptr->full_name(false))); + + return template_instantiation_ptr; +} + +void translation_unit_visitor:: + process_unexposed_template_specialization_parameters( + const std::string &type_name, + class_diagram::model::template_parameter &tp, model::class_ &c) const +{ + auto template_params = cx::util::parse_unexposed_template_params( + type_name, [](const std::string &t) { return t; }); + + for (auto ¶m : template_params) { + tp.add_template_param(param); + } +} + bool translation_unit_visitor::simplify_system_template( class_diagram::model::template_parameter &ct, const std::string &full_name) { diff --git a/src/sequence_diagram/visitor/translation_unit_visitor.h b/src/sequence_diagram/visitor/translation_unit_visitor.h index afb408dc..f3cdafa6 100644 --- a/src/sequence_diagram/visitor/translation_unit_visitor.h +++ b/src/sequence_diagram/visitor/translation_unit_visitor.h @@ -169,7 +169,10 @@ public: virtual bool VisitCXXRecordDecl(clang::CXXRecordDecl *cls); - bool VisitClassTemplateDecl(clang::ClassTemplateDecl *cls); + virtual bool VisitClassTemplateDecl(clang::ClassTemplateDecl *cls); + + virtual bool VisitClassTemplateSpecializationDecl( + clang::ClassTemplateSpecializationDecl *cls); virtual bool VisitFunctionDecl(clang::FunctionDecl *function_declaration); @@ -203,7 +206,7 @@ private: build_function_template_instantiation(const clang::FunctionDecl &pDecl); void build_template_instantiation_process_template_arguments( - std::optional &parent, + model::template_trait *parent, std::deque> &template_base_params, const clang::ArrayRef &template_args, model::template_trait &template_instantiation, @@ -230,13 +233,30 @@ private: class_diagram::model::template_parameter &argument) const; void build_template_instantiation_process_type_argument( - std::optional &parent, + model::template_trait *parent, const std::string &full_template_specialization_name, const clang::TemplateDecl *template_decl, const clang::TemplateArgument &arg, model::template_trait &template_instantiation, class_diagram::model::template_parameter &argument); + std::unique_ptr process_template_specialization( + clang::ClassTemplateSpecializationDecl *cls); + + void process_template_specialization_argument( + const clang::ClassTemplateSpecializationDecl *cls, + model::class_ &template_instantiation, + const clang::TemplateArgument &arg, size_t argument_index, + bool in_parameter_pack = false); + + void process_unexposed_template_specialization_parameters( + const std::string &type_name, + class_diagram::model::template_parameter &tp, model::class_ &c) const; + + std::unique_ptr build_template_instantiation( + const clang::TemplateSpecializationType &template_type_decl, + model::class_ *parent); + bool simplify_system_template(class_diagram::model::template_parameter &ct, const std::string &full_name); diff --git a/tests/t20001/t20001.cc b/tests/t20001/t20001.cc index 18878c11..98135a05 100644 --- a/tests/t20001/t20001.cc +++ b/tests/t20001/t20001.cc @@ -64,7 +64,9 @@ int tmain() A a; B b(a); - return b.wrap_add3(1, 2, 3); + auto tmp = a.add(1, 2); + + return b.wrap_add3(tmp, 2, 3); } } } diff --git a/tests/t20006/.clang-uml b/tests/t20006/.clang-uml new file mode 100644 index 00000000..dedfb8f7 --- /dev/null +++ b/tests/t20006/.clang-uml @@ -0,0 +1,14 @@ +compilation_database_dir: .. +output_directory: puml +diagrams: + t20006_sequence: + type: sequence + glob: + - ../../tests/t20006/t20006.cc + include: + namespaces: + - clanguml::t20006 + using_namespace: + - clanguml::t20006 + start_from: + - function: "clanguml::t20006::tmain()" \ No newline at end of file diff --git a/tests/t20006/t20006.cc b/tests/t20006/t20006.cc new file mode 100644 index 00000000..bcd278d6 --- /dev/null +++ b/tests/t20006/t20006.cc @@ -0,0 +1,30 @@ +#include + +namespace clanguml { +namespace t20006 { + +template struct A { + T a(T arg) { return arg; } + T a1(T arg) { return arg; } +}; + +template struct B { + T b(T arg) { return a_.a(arg); } + A a_; +}; + +template <> struct B { + std::string b(std::string arg) { return arg; } + A a_; +}; + +void tmain() +{ + B bint; + B bstring; + + bint.b(1); + bstring.b("bstring"); +} +} +} \ No newline at end of file diff --git a/tests/t20006/test_case.h b/tests/t20006/test_case.h new file mode 100644 index 00000000..d50da514 --- /dev/null +++ b/tests/t20006/test_case.h @@ -0,0 +1,47 @@ +/** + * tests/t20006/test_case.h + * + * Copyright (c) 2021-2022 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("t20006", "[test-case][sequence]") +{ + auto [config, db] = load_config("t20006"); + + auto diagram = config.diagrams["t20006_sequence"]; + + REQUIRE(diagram->name == "t20006_sequence"); + + auto model = generate_sequence_diagram(*db, diagram); + + REQUIRE(model->name() == "t20006_sequence"); + + auto puml = generate_sequence_puml(diagram, *model); + AliasMatcher _A(puml); + + REQUIRE_THAT(puml, StartsWith("@startuml")); + REQUIRE_THAT(puml, EndsWith("@enduml\n")); + + // Check if all calls exist + REQUIRE_THAT(puml, HasCall(_A("tmain()"), _A("B"), "b")); + REQUIRE_THAT(puml, HasCall(_A("B"), _A("A"), "a")); + + REQUIRE_THAT(puml, HasCall(_A("tmain()"), _A("B"), "b")); + REQUIRE_THAT( + puml, !HasCall(_A("B"), _A("A"), "a")); + + save_puml( + "./" + config.output_directory() + "/" + diagram->name + ".puml", puml); +} \ No newline at end of file diff --git a/tests/test_cases.cc b/tests/test_cases.cc index 0433f165..79289f4b 100644 --- a/tests/test_cases.cc +++ b/tests/test_cases.cc @@ -252,6 +252,7 @@ using namespace clanguml::test::matchers; #include "t20003/test_case.h" #include "t20004/test_case.h" #include "t20005/test_case.h" +#include "t20006/test_case.h" /// /// Package diagram tests From b264ef5402d47d11565ba2f7ae03ddc83d30dc8e Mon Sep 17 00:00:00 2001 From: Bartek Kryza Date: Wed, 23 Nov 2022 00:05:43 +0100 Subject: [PATCH 20/77] Added basic test case for sequence diagrams with template specializations --- src/sequence_diagram/model/participant.cc | 13 +- src/sequence_diagram/model/participant.h | 18 +++ .../visitor/translation_unit_visitor.cc | 123 ++++++++++++++---- .../visitor/translation_unit_visitor.h | 17 +++ tests/t20006/t20006.cc | 8 +- tests/t20006/test_case.h | 8 +- 6 files changed, 144 insertions(+), 43 deletions(-) diff --git a/src/sequence_diagram/model/participant.cc b/src/sequence_diagram/model/participant.cc index d787857c..dbe4642c 100644 --- a/src/sequence_diagram/model/participant.cc +++ b/src/sequence_diagram/model/participant.cc @@ -68,12 +68,12 @@ int template_trait::calculate_template_specialization_match( { int res{}; -// std::string left = name_and_ns(); -// // TODO: handle variadic templates -// if ((name_and_ns() != full_name) || -// (templates().size() != other.templates().size())) { -// return res; -// } + // std::string left = name_and_ns(); + // // TODO: handle variadic templates + // if ((name_and_ns() != full_name) || + // (templates().size() != other.templates().size())) { + // return res; + // } // Iterate over all template arguments for (auto i = 0U; i < other.templates().size(); i++) { @@ -156,7 +156,6 @@ std::string class_::full_name(bool relative) const bool operator==(const class_ &l, const class_ &r) { return l.id() == r.id(); } - function::function(const common::model::namespace_ &using_namespace) : participant{using_namespace} { diff --git a/src/sequence_diagram/model/participant.h b/src/sequence_diagram/model/participant.h index a2048ff2..2720bef5 100644 --- a/src/sequence_diagram/model/participant.h +++ b/src/sequence_diagram/model/participant.h @@ -42,9 +42,14 @@ struct template_trait { int calculate_template_specialization_match( const template_trait &other, const std::string &full_name) const; + bool is_implicit() const { return is_implicit_; } + + void set_implicit(bool implicit) { is_implicit_ = implicit; } + private: std::vector templates_; std::string base_template_full_name_; + bool is_implicit_{false}; }; struct participant : public common::model::element, @@ -155,6 +160,18 @@ struct method : public participant { void set_class_id(diagram_element::id_t id) { class_id_ = id; } + void set_class_full_name(const std::string &name) + { + class_full_name_ = name; + } + + const auto &class_full_name() const { return class_full_name_; } + + std::string full_name(bool /*relative*/) const override + { + return class_full_name() + "::" + method_name(); + } + diagram_element::id_t class_id() const { return class_id_; } std::string to_string() const override @@ -166,6 +183,7 @@ struct method : public participant { private: diagram_element::id_t class_id_; std::string method_name_; + std::string class_full_name_; }; struct function_template : public participant, public template_trait { diff --git a/src/sequence_diagram/visitor/translation_unit_visitor.cc b/src/sequence_diagram/visitor/translation_unit_visitor.cc index 2bb101ab..8c943089 100644 --- a/src/sequence_diagram/visitor/translation_unit_visitor.cc +++ b/src/sequence_diagram/visitor/translation_unit_visitor.cc @@ -201,9 +201,6 @@ bool translation_unit_visitor::VisitClassTemplateSpecializationDecl( if (!diagram().should_include(cls->getQualifiedNameAsString())) return true; - if(cls->isImplicit()) - LOG_DBG("!!!!!!!!!!!!!!!!!!!!!"); - LOG_DBG("= Visiting template specialization declaration {} at {}", cls->getQualifiedNameAsString(), cls->getLocation().printToString(source_manager())); @@ -249,7 +246,9 @@ bool translation_unit_visitor::VisitClassTemplateSpecializationDecl( bool translation_unit_visitor::VisitCXXMethodDecl(clang::CXXMethodDecl *m) { if (call_expression_context_.current_class_decl_ == nullptr && - call_expression_context_.current_class_template_decl_ == nullptr) + call_expression_context_.current_class_template_decl_ == nullptr && + call_expression_context_.current_class_template_specialization_decl_ == + nullptr) return true; call_expression_context_.update(m); @@ -258,20 +257,49 @@ bool translation_unit_visitor::VisitCXXMethodDecl(clang::CXXMethodDecl *m) config().using_namespace()); common::model::namespace_ ns{m->getQualifiedNameAsString()}; - m_ptr->set_method_name(ns.name()); + auto method_name = ns.name(); + m_ptr->set_method_name(method_name); ns.pop_back(); m_ptr->set_name(ns.name()); ns.pop_back(); - m_ptr->set_namespace(ns); + // m_ptr->set_namespace(ns); - if (call_expression_context_.current_class_decl_) - m_ptr->set_class_id(get_ast_local_id( - call_expression_context_.current_class_decl_->getID()) - .value()); - else - m_ptr->set_class_id(get_ast_local_id( - call_expression_context_.current_class_template_decl_->getID()) - .value()); + if (call_expression_context_.current_class_decl_) { + const auto ¤t_class = + diagram() + .get_participant(get_ast_local_id( + call_expression_context_.current_class_decl_->getID()) + .value()) + .value(); + + m_ptr->set_class_id(current_class.id()); + m_ptr->set_class_full_name(current_class.full_name(false)); + } + else if (call_expression_context_.current_class_template_decl_) { + const auto ¤t_template_class = + diagram() + .get_participant( + get_ast_local_id(call_expression_context_ + .current_class_template_decl_->getID()) + .value()) + .value(); + + m_ptr->set_class_id(current_template_class.id()); + m_ptr->set_class_full_name(current_template_class.full_name(false)); + } + else { + const auto ¤t_template_specialization_class = + diagram() + .get_participant(get_ast_local_id( + call_expression_context_ + .current_class_template_specialization_decl_->getID()) + .value()) + .value(); + + m_ptr->set_class_id(current_template_specialization_class.id()); + m_ptr->set_class_full_name( + current_template_specialization_class.full_name(false)); + } m_ptr->set_name( diagram().participants.at(m_ptr->class_id())->full_name_no_ns() + @@ -396,8 +424,6 @@ bool translation_unit_visitor::VisitCallExpr(clang::CallExpr *expr) using clanguml::sequence_diagram::model::activity; using clanguml::sequence_diagram::model::message; - // expr->dump(); - // Skip casts, moves and such if (expr->isCallToStdMove()) return true; @@ -455,30 +481,73 @@ bool translation_unit_visitor::VisitCallExpr(clang::CallExpr *expr) callee_template_specialization->getQualifiedNameAsString()); if (!get_ast_local_id(callee_template_specialization->getID())) { - callee_template_specialization->dump(); + call_expression_context context_backup = + call_expression_context_; - - call_expression_context context_backup = call_expression_context_; - - // Since this visitor will overwrite the call_expression_context_ - // we need to back it up and restore it later + // Since this visitor will overwrite the + // call_expression_context_ we need to back it up and restore it + // later VisitClassTemplateSpecializationDecl( const_cast( callee_template_specialization)); call_expression_context_ = context_backup; + + diagram() + .get_participant(get_ast_local_id( + callee_template_specialization->getID()) + .value()) + .value() + .set_implicit(true); } - m.to = get_ast_local_id(callee_template_specialization->getID()) - .value(); + const auto &participant = + diagram() + .get_participant(get_ast_local_id( + callee_template_specialization->getID()) + .value()) + .value(); + + if (participant.is_implicit()) { + const auto *parent_template = + callee_template_specialization->getSpecializedTemplate(); + + const auto &parent_template_participant = + diagram() + .get_participant( + get_ast_local_id(parent_template->getID()).value()) + .value(); + + const auto parent_method_name = + parent_template_participant.full_name(false) + + "::" + method_decl->getNameAsString(); + + m.to = common::to_id(parent_method_name); + m.message_name = participant.full_name_no_ns() + + "::" + method_decl->getNameAsString(); + } + else { + const auto &specialization_participant = + diagram() + .get_participant(get_ast_local_id( + callee_template_specialization->getID()) + .value()) + .value(); + const auto specialization_method_name = + specialization_participant.full_name(false) + + "::" + method_decl->getNameAsString(); + + m.to = common::to_id(specialization_method_name); + m.message_name = method_decl->getNameAsString(); + } } else { // TODO: The method can be called before it's declaration has been // encountered by the visitor - for now it's not a problem // as overloaded methods are not supported m.to = common::to_id(method_decl->getQualifiedNameAsString()); + m.message_name = method_decl->getNameAsString(); } - m.message_name = method_decl->getNameAsString(); m.return_type = method_call_expr->getCallReturnType(current_ast_context) .getAsString(); @@ -555,12 +624,10 @@ bool translation_unit_visitor::VisitCallExpr(clang::CallExpr *expr) for (const auto *decl : unresolved_expr->decls()) { if (clang::dyn_cast_or_null< clang::FunctionTemplateDecl>(decl)) { - + // Yes, it's a template auto *ftd = clang::dyn_cast_or_null< clang::FunctionTemplateDecl>(decl); - // m.to_name = - // to_string(ftd); m.to = get_ast_local_id(ftd->getID()).value(); auto message_name = diagram() diff --git a/src/sequence_diagram/visitor/translation_unit_visitor.h b/src/sequence_diagram/visitor/translation_unit_visitor.h index f3cdafa6..d9009c8a 100644 --- a/src/sequence_diagram/visitor/translation_unit_visitor.h +++ b/src/sequence_diagram/visitor/translation_unit_visitor.h @@ -33,9 +33,11 @@ struct call_expression_context { call_expression_context() : current_class_decl_{nullptr} , current_class_template_decl_{nullptr} + , current_class_template_specialization_decl_{nullptr} , current_method_decl_{nullptr} , current_function_decl_{nullptr} , current_function_template_decl_{nullptr} + , current_caller_id_{0} { } @@ -44,6 +46,7 @@ struct call_expression_context { current_caller_id_ = 0; current_class_decl_ = nullptr; current_class_template_decl_ = nullptr; + current_class_template_specialization_decl_ = nullptr; current_method_decl_ = nullptr; current_function_decl_ = nullptr; current_function_template_decl_ = nullptr; @@ -55,6 +58,8 @@ struct call_expression_context { LOG_DBG("current_class_decl_ = {}", (void *)current_class_decl_); LOG_DBG("current_class_template_decl_ = {}", (void *)current_class_template_decl_); + LOG_DBG("current_class_template_specialization_decl_ = {}", + (void *)current_class_template_specialization_decl_); LOG_DBG("current_method_decl_ = {}", (void *)current_method_decl_); LOG_DBG("current_function_decl_ = {}", (void *)current_function_decl_); LOG_DBG("current_function_template_decl_ = {}", @@ -65,6 +70,7 @@ struct call_expression_context { { return (current_class_decl_ != nullptr) || (current_class_template_decl_ != nullptr) || + (current_class_template_specialization_decl_ != nullptr) || (current_method_decl_ != nullptr) || (current_function_decl_ != nullptr) || (current_function_template_decl_ != nullptr); @@ -72,6 +78,10 @@ struct call_expression_context { clang::ASTContext *get_ast_context() { + if (current_class_template_specialization_decl_) + return ¤t_class_template_specialization_decl_ + ->getASTContext(); + if (current_class_template_decl_) return ¤t_class_template_decl_->getASTContext(); @@ -86,6 +96,11 @@ struct call_expression_context { void update(clang::CXXRecordDecl *cls) { current_class_decl_ = cls; } + void update(clang::ClassTemplateSpecializationDecl *clst) + { + current_class_template_specialization_decl_ = clst; + } + void update(clang::ClassTemplateDecl *clst) { current_class_template_decl_ = clst; @@ -147,6 +162,8 @@ struct call_expression_context { clang::CXXRecordDecl *current_class_decl_; clang::ClassTemplateDecl *current_class_template_decl_; + clang::ClassTemplateSpecializationDecl + *current_class_template_specialization_decl_; clang::CXXMethodDecl *current_method_decl_; clang::FunctionDecl *current_function_decl_; clang::FunctionTemplateDecl *current_function_template_decl_; diff --git a/tests/t20006/t20006.cc b/tests/t20006/t20006.cc index bcd278d6..20729063 100644 --- a/tests/t20006/t20006.cc +++ b/tests/t20006/t20006.cc @@ -4,17 +4,17 @@ namespace clanguml { namespace t20006 { template struct A { - T a(T arg) { return arg; } - T a1(T arg) { return arg; } + T a_int(T arg) { return arg + 1; } + T a_string(T arg) { return arg + "_string"; } }; template struct B { - T b(T arg) { return a_.a(arg); } + T b(T arg) { return a_.a_int(arg); } A a_; }; template <> struct B { - std::string b(std::string arg) { return arg; } + std::string b(std::string arg) { return a_.a_string(arg); } A a_; }; diff --git a/tests/t20006/test_case.h b/tests/t20006/test_case.h index d50da514..9c5e9c8d 100644 --- a/tests/t20006/test_case.h +++ b/tests/t20006/test_case.h @@ -35,12 +35,12 @@ TEST_CASE("t20006", "[test-case][sequence]") REQUIRE_THAT(puml, EndsWith("@enduml\n")); // Check if all calls exist - REQUIRE_THAT(puml, HasCall(_A("tmain()"), _A("B"), "b")); - REQUIRE_THAT(puml, HasCall(_A("B"), _A("A"), "a")); + REQUIRE_THAT(puml, HasCall(_A("tmain()"), _A("B"), "B::b")); + REQUIRE_THAT(puml, HasCall(_A("B"), _A("A"), "a_int")); REQUIRE_THAT(puml, HasCall(_A("tmain()"), _A("B"), "b")); - REQUIRE_THAT( - puml, !HasCall(_A("B"), _A("A"), "a")); + REQUIRE_THAT(puml, + HasCall(_A("B"), _A("A"), "A::a_string")); save_puml( "./" + config.output_directory() + "/" + diagram->name + ".puml", puml); From e2f34c7ddaf5548b83e51f753b5a30debc18054d Mon Sep 17 00:00:00 2001 From: Bartek Kryza Date: Wed, 23 Nov 2022 00:09:00 +0100 Subject: [PATCH 21/77] Updated test case documentation --- docs/test_cases.md | 2 + docs/test_cases/t00002_class.svg | 36 ++++---- docs/test_cases/t00003_class.svg | 46 +++++----- docs/test_cases/t00004_class.svg | 76 ++++++++-------- docs/test_cases/t00005_class.svg | 110 +++++++++++------------ docs/test_cases/t00006_class.svg | 132 ++++++++++++++-------------- docs/test_cases/t00007_class.svg | 30 +++---- docs/test_cases/t00008_class.svg | 56 ++++++------ docs/test_cases/t00009_class.svg | 32 +++---- docs/test_cases/t00010_class.svg | 34 +++---- docs/test_cases/t00011_class.svg | 22 ++--- docs/test_cases/t00012_class.svg | 66 +++++++------- docs/test_cases/t00013_class.svg | 82 ++++++++--------- docs/test_cases/t00014_class.svg | 116 ++++++++++++------------ docs/test_cases/t00015_class.svg | 22 ++--- docs/test_cases/t00016_class.svg | 30 +++---- docs/test_cases/t00017_class.svg | 66 +++++++------- docs/test_cases/t00018_class.svg | 18 ++-- docs/test_cases/t00019_class.svg | 40 ++++----- docs/test_cases/t00020_class.svg | 38 ++++---- docs/test_cases/t00021_class.svg | 30 +++---- docs/test_cases/t00022_class.svg | 14 +-- docs/test_cases/t00023_class.svg | 26 +++--- docs/test_cases/t00024_class.svg | 22 ++--- docs/test_cases/t00025_class.svg | 34 +++---- docs/test_cases/t00026_class.svg | 42 ++++----- docs/test_cases/t00027_class.svg | 58 ++++++------ docs/test_cases/t00028_class.svg | 78 ++++++++-------- docs/test_cases/t00029_class.svg | 50 +++++------ docs/test_cases/t00030_class.svg | 46 +++++----- docs/test_cases/t00031_class.svg | 50 +++++------ docs/test_cases/t00032_class.svg | 40 ++++----- docs/test_cases/t00033_class.svg | 48 +++++----- docs/test_cases/t00034_class.svg | 46 +++++----- docs/test_cases/t00035_class.svg | 22 ++--- docs/test_cases/t00036_class.svg | 38 ++++---- docs/test_cases/t00037_class.svg | 54 ++++++------ docs/test_cases/t00038_class.svg | 58 ++++++------ docs/test_cases/t00039_class.svg | 78 ++++++++-------- docs/test_cases/t00040_class.svg | 26 +++--- docs/test_cases/t00041_class.svg | 54 ++++++------ docs/test_cases/t00042_class.svg | 36 ++++---- docs/test_cases/t00043_class.svg | 50 +++++------ docs/test_cases/t00044_class.svg | 36 ++++---- docs/test_cases/t00045_class.svg | 70 +++++++-------- docs/test_cases/t00046_class.svg | 64 +++++++------- docs/test_cases/t00047_class.svg | 22 ++--- docs/test_cases/t00048_class.svg | 50 +++++------ docs/test_cases/t00049_class.svg | 32 +++---- docs/test_cases/t00050_class.svg | 70 +++++++-------- docs/test_cases/t20001.md | 4 +- docs/test_cases/t20001_sequence.svg | 119 +++++++++++++------------ docs/test_cases/t20005.md | 45 ++++++++++ docs/test_cases/t20005_sequence.svg | 42 +++++++++ docs/test_cases/t20006.md | 54 ++++++++++++ docs/test_cases/t20006_sequence.svg | 61 +++++++++++++ docs/test_cases/t30001_package.svg | 48 +++++----- docs/test_cases/t30002_package.svg | 90 +++++++++---------- docs/test_cases/t30003_package.svg | 26 +++--- docs/test_cases/t30004_package.svg | 30 +++---- docs/test_cases/t30005_package.svg | 38 ++++---- docs/test_cases/t30006_package.svg | 16 ++-- docs/test_cases/t30007_package.svg | 20 ++--- docs/test_cases/t30008_package.svg | 34 +++---- docs/test_cases/t40001_include.svg | 30 +++---- docs/test_cases/t40002_include.svg | 34 +++---- docs/test_cases/t40003_include.svg | 50 +++++------ tests/test_cases.yaml | 3 + 68 files changed, 1679 insertions(+), 1463 deletions(-) create mode 100644 docs/test_cases/t20005.md create mode 100644 docs/test_cases/t20005_sequence.svg create mode 100644 docs/test_cases/t20006.md create mode 100644 docs/test_cases/t20006_sequence.svg diff --git a/docs/test_cases.md b/docs/test_cases.md index 6f9ea0d2..e948a6ba 100644 --- a/docs/test_cases.md +++ b/docs/test_cases.md @@ -54,6 +54,8 @@ * [t20002](./test_cases/t20002.md) - Free function sequence diagram test case * [t20003](./test_cases/t20003.md) - Function template sequence diagram test case * [t20004](./test_cases/t20004.md) - Function template instantiation sequence diagram test case + * [t20005](./test_cases/t20005.md) - Class template basic sequence diagram + * [t20006](./test_cases/t20006.md) - Class template specialization basic sequence diagram ## Package diagrams * [t30001](./test_cases/t30001.md) - Basic package diagram test case * [t30002](./test_cases/t30002.md) - Package dependency test case diff --git a/docs/test_cases/t00002_class.svg b/docs/test_cases/t00002_class.svg index 1bf70dbc..5d09bf5c 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_class.svg b/docs/test_cases/t00003_class.svg index f0e042f8..228d8350 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_class.svg b/docs/test_cases/t00004_class.svg index 43727076..12d80d4e 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,15 +59,15 @@ Red - - + + A::AA::AAA - + C::B @@ -75,8 +75,8 @@ int - - + + C @@ -84,39 +84,39 @@ T - + - + t : T - + - + b_int : B<int> - - + + C::AA - - + + C::AA::AAA - - + + C::AA::CCC @@ -125,8 +125,8 @@ CCC_2 - - + + C::B @@ -134,16 +134,16 @@ V - + - + b : V - - + + C::CC @@ -152,16 +152,16 @@ CC_2 - - + + detail::D - - + + detail::D::AA @@ -171,8 +171,8 @@ AA_3 - - + + detail::D::DD diff --git a/docs/test_cases/t00005_class.svg b/docs/test_cases/t00005_class.svg index fc18e8ef..15924af8 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_class.svg b/docs/test_cases/t00006_class.svg index dad9bbc2..ada50c28 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,15 +146,15 @@ T - + - + data : std::vector<T> - + custom_container @@ -162,102 +162,102 @@ 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_class.svg b/docs/test_cases/t00007_class.svg index 9e029d08..daa7a9dd 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_class.svg b/docs/test_cases/t00008_class.svg index 7cca8bbd..02243ab7 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,CMP,int N - + - + 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,15 +87,15 @@ T,C<> - + - + template_template : C<T> - + B @@ -103,18 +103,18 @@ int,Vector - - + + D - + - + ints : B<int,Vector> diff --git a/docs/test_cases/t00009_class.svg b/docs/test_cases/t00009_class.svg index 09153b9c..15d5c871 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,15 +18,15 @@ T - + - + value : T - + A @@ -34,7 +34,7 @@ int - + A @@ -42,7 +42,7 @@ std::string - + A @@ -50,32 +50,32 @@ 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_class.svg b/docs/test_cases/t00010_class.svg index e0be1a3c..85f4705c 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,22 +18,22 @@ T,P - + - + first : T - + - + second : P - + A @@ -41,8 +41,8 @@ T,std::string - - + + B @@ -50,15 +50,15 @@ T - + - + astring : A<T,std::string> - + B @@ -66,18 +66,18 @@ int - - + + C - + - + aintstring : B<int> diff --git a/docs/test_cases/t00011_class.svg b/docs/test_cases/t00011_class.svg index ff9dd719..74fc0428 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_class.svg b/docs/test_cases/t00012_class.svg index 9c4c163c..5d2f379d 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,14 +60,14 @@ - + - + ints : std::array<T,sizeof...(Is)> - + A @@ -75,7 +75,7 @@ int,std::string,float - + A @@ -83,7 +83,7 @@ int,std::string,bool - + B @@ -91,7 +91,7 @@ 3,2,1 - + B @@ -99,7 +99,7 @@ 1,1,1,1 - + C @@ -107,50 +107,50 @@ 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_class.svg b/docs/test_cases/t00013_class.svg index a3235ab0..49e4d499 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,15 +18,15 @@ T - + - + f : T - + ABCD::F @@ -34,70 +34,70 @@ int - - + + A - + - + a : int - - + + B - + - + b : int - - + + C - + - + c : int - - + + D - + - + d : int print(R * r) : void - - + + E @@ -105,16 +105,16 @@ T - + - + e : T - - + + G @@ -122,22 +122,22 @@ T,Args... - + - + g : T - + - + args : std::tuple<Args...> - + E @@ -145,7 +145,7 @@ int - + G @@ -153,7 +153,7 @@ int,float,std::string - + E @@ -161,25 +161,25 @@ std::string - - + + R - + - + gintstring : G<int,float,std::string> - + - + estring : E<std::string> diff --git a/docs/test_cases/t00014_class.svg b/docs/test_cases/t00014_class.svg index 1c5f29e3..4b0501ec 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,37 +18,37 @@ T,P - + - + t : T - + - + p : P - - + + B - + - + value : std::string - + A @@ -56,7 +56,7 @@ T,std::string - + A @@ -64,7 +64,7 @@ T,std::unique_ptr<std::string> - + A @@ -72,7 +72,7 @@ long,T - + A @@ -80,7 +80,7 @@ double,T - + A @@ -88,7 +88,7 @@ long,U - + A @@ -96,7 +96,7 @@ long,bool - + A @@ -104,7 +104,7 @@ double,bool - + A @@ -112,7 +112,7 @@ long,float - + A @@ -120,7 +120,7 @@ double,float - + A @@ -128,7 +128,7 @@ bool,std::string - + A @@ -136,7 +136,7 @@ float,std::unique_ptr<std::string> - + A @@ -144,7 +144,7 @@ int,std::string - + A @@ -152,7 +152,7 @@ std::string,std::string - + A @@ -160,7 +160,7 @@ char,std::string - + A @@ -168,116 +168,116 @@ wchar_t,std::string - - + + R - + - + 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 - + - + bs : BVector - + - + bs2 : BVector2 - + - + cb : SimpleCallback<ACharString> - + - + gcb : GenericCallback<R::AWCharString> - + - + vcb : VoidCallback - + - + vps : VectorPtr<B> diff --git a/docs/test_cases/t00015_class.svg b/docs/test_cases/t00015_class.svg index ac70476d..8abbbe5f 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_class.svg b/docs/test_cases/t00016_class.svg index e901bc99..2c28e1cb 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<> @@ -19,8 +19,8 @@ value : enum - - + + is_numeric @@ -29,8 +29,8 @@ value : enum - - + + is_numeric @@ -41,8 +41,8 @@ value : enum - - + + is_numeric @@ -53,8 +53,8 @@ value : enum - - + + is_numeric @@ -65,8 +65,8 @@ value : enum - - + + is_numeric @@ -77,8 +77,8 @@ value : enum - - + + is_numeric diff --git a/docs/test_cases/t00017_class.svg b/docs/test_cases/t00017_class.svg index 172a5a52..7d4c008a 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_class.svg b/docs/test_cases/t00018_class.svg index e6f49a98..e9b34fab 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_class.svg b/docs/test_cases/t00019_class.svg index f7062c8c..1e1605f7 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,7 +83,7 @@ m1_calls() const : int m2_calls() const : int - + Layer3 @@ -91,7 +91,7 @@ Base - + Layer2 @@ -99,7 +99,7 @@ Layer3<Base> - + Layer1 @@ -107,18 +107,18 @@ Layer2<Layer3<Base>> - - + + A - + - + layers : std::unique_ptr<Layer1<Layer2<Layer3<Base>>>> diff --git a/docs/test_cases/t00020_class.svg b/docs/test_cases/t00020_class.svg index b8203cd9..31af521e 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_class.svg b/docs/test_cases/t00021_class.svg index a10022a5..77ab2234 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_class.svg b/docs/test_cases/t00022_class.svg index 129b0405..953f2883 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_class.svg b/docs/test_cases/t00023_class.svg index 4d31c574..0e05149d 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_class.svg b/docs/test_cases/t00024_class.svg index a5888583..f2d886ff 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_class.svg b/docs/test_cases/t00025_class.svg index cb647766..7b62c41e 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,7 +56,7 @@ m1() : void m2() : void - + Proxy @@ -64,7 +64,7 @@ Target1 - + Proxy @@ -72,25 +72,25 @@ Target2 - - + + ProxyHolder - + - + proxy1 : Proxy<Target1> - + - + proxy2 : Proxy<Target2> diff --git a/docs/test_cases/t00026_class.svg b/docs/test_cases/t00026_class.svg index 262e4c7c..c7e3f383 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>(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,7 +78,7 @@ state(const std::string & n) : Memento<T> & set_state(const std::string & s, Memento<T> && m) : void - + Caretaker @@ -86,7 +86,7 @@ std::string - + Originator @@ -94,25 +94,25 @@ std::string - - + + StringMemento - + - + caretaker : Caretaker<std::string> - + - + originator : Originator<std::string> diff --git a/docs/test_cases/t00027_class.svg b/docs/test_cases/t00027_class.svg index 51423ab5..dbe6ca93 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,14 @@ ~Shape() = default : void - + Line - - + + Line @@ -39,14 +39,14 @@ display() : void - + Text - - + + Text @@ -57,8 +57,8 @@ display() : void - - + + ShapeDecorator @@ -67,8 +67,8 @@ display() = 0 : void - - + + Color @@ -79,8 +79,8 @@ display() : void - - + + Weight @@ -91,7 +91,7 @@ display() : void - + Line @@ -99,7 +99,7 @@ Color,Weight - + Line @@ -107,7 +107,7 @@ Color - + Text @@ -115,7 +115,7 @@ Color,Weight - + Text @@ -123,39 +123,39 @@ Color - - + + Window - + - + border : Line<Color,Weight> - + - + divider : Line<Color> - + - + title : Text<Color,Weight> - + - + description : Text<Color> diff --git a/docs/test_cases/t00028_class.svg b/docs/test_cases/t00028_class.svg index ae340854..f1b2fd63 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,10 +94,10 @@ three - + F enum note. - + E @@ -105,59 +105,59 @@ 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. diff --git a/docs/test_cases/t00029_class.svg b/docs/test_cases/t00029_class.svg index 8cea0685..047e16a3 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_class.svg b/docs/test_cases/t00030_class.svg index 52ecf348..aa910626 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_class.svg b/docs/test_cases/t00031_class.svg index 62e0963a..f0143516 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,23 +47,23 @@ T - + - + ttt : T - - + + D - + C @@ -71,39 +71,39 @@ int - - + + R - + - + aaa : A * - + - + bbb : std::vector<B> - + - + ccc : C<int> - + - + ddd : D * diff --git a/docs/test_cases/t00032_class.svg b/docs/test_cases/t00032_class.svg index 914ad039..de950d96 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,15 +64,15 @@ T,L,Ts... - + - + counter : L - + Overload @@ -80,18 +80,18 @@ TBase,int,A,B,C - - + + R - + - + overload : Overload<TBase,int,A,B,C> diff --git a/docs/test_cases/t00033_class.svg b/docs/test_cases/t00033_class.svg index 27023c12..cff14585 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,30 +52,30 @@ T - + - + ccc : T - - + + D - + - + ddd : int - + C @@ -83,7 +83,7 @@ D - + B @@ -91,7 +91,7 @@ std::unique_ptr<C<D>> - + A @@ -99,18 +99,18 @@ B<std::unique_ptr<C<D>>> - - + + R - + - + abc : A<B<std::unique_ptr<C<D>>>> diff --git a/docs/test_cases/t00034_class.svg b/docs/test_cases/t00034_class.svg index b8bf95ee..a1de61e2 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,16 +31,16 @@ - - + + lift_void - - + + lift_void @@ -49,8 +49,8 @@ - - + + drop_void @@ -59,16 +59,16 @@ - - + + drop_void - - + + drop_void @@ -77,33 +77,33 @@ - - + + A - - + + R - + - + la : lift_void_t<A> * - + - + lv : lift_void_t<void> * diff --git a/docs/test_cases/t00035_class.svg b/docs/test_cases/t00035_class.svg index d4cc21ad..a6bd3a48 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_class.svg b/docs/test_cases/t00036_class.svg index 59adfa30..c1e4a5f1 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,15 +43,15 @@ T - + - + a : T - + A @@ -59,23 +59,23 @@ int - - + + B - + - + a_int : A<int> - - + + C diff --git a/docs/test_cases/t00037_class.svg b/docs/test_cases/t00037_class.svg index bcf9e3fd..b6b94b4f 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_620) - + - + units : ST::(anonymous_739) - - + + 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_class.svg b/docs/test_cases/t00038_class.svg index bed1dd6a..231bc643 100644 --- a/docs/test_cases/t00038_class.svg +++ b/docs/test_cases/t00038_class.svg @@ -1,6 +1,6 @@ - + @@ -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,16 +88,16 @@ - - + + map - - + + map @@ -106,8 +106,8 @@ - - + + map @@ -116,8 +116,8 @@ - - + + map @@ -126,8 +126,8 @@ - - + + map diff --git a/docs/test_cases/t00039_class.svg b/docs/test_cases/t00039_class.svg index 8874f94b..0c1ec295 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_class.svg b/docs/test_cases/t00040_class.svg index f689ac0c..b5e532c6 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_class.svg b/docs/test_cases/t00041_class.svg index 7a66c1f9..ee612851 100644 --- a/docs/test_cases/t00041_class.svg +++ b/docs/test_cases/t00041_class.svg @@ -1,6 +1,6 @@ - + @@ -9,100 +9,100 @@ - - + + R - - + + D - + - + rr : RR * - - + + E - - + + F - - + + RR - + - + e : E * - + - + f : F * - + - + g : detail::G * - - + + RRR - - + + ns1::N - - + + ns1::NN - - + + ns1::NM diff --git a/docs/test_cases/t00042_class.svg b/docs/test_cases/t00042_class.svg index 106b4e70..649066ad 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,22 +52,22 @@ T,K - + - + b : T - + - + bb : K - + A @@ -75,7 +75,7 @@ double - + A @@ -83,7 +83,7 @@ std::string - + B diff --git a/docs/test_cases/t00043_class.svg b/docs/test_cases/t00043_class.svg index 86b0b6fb..b4097784 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_class.svg b/docs/test_cases/t00044_class.svg index 5fcdee22..30e680ec 100644 --- a/docs/test_cases/t00044_class.svg +++ b/docs/test_cases/t00044_class.svg @@ -1,6 +1,6 @@ - + @@ -9,7 +9,7 @@ - + signal_handler @@ -17,8 +17,8 @@ ,A - - + + sink @@ -27,15 +27,15 @@ sink<signal_handler<type-parameter-0-0 (type-parameter-0-1...), type-parameter-0-2> >(sink<signal_handler<type-parameter-0-0 (type-parameter-0-1...),type-parameter-0-2>>::signal_t & sh) : void - + - + signal : sink<signal_handler<type-parameter-0-0 (type-parameter-0-1...),type-parameter-0-2>>::signal_t * - - + + sink @@ -46,23 +46,23 @@ sink<signal_handler<type-parameter-0-0 (type-parameter-0-1...), type-parameter-0-2> >(sink<signal_handler<type-parameter-0-0 (type-parameter-0-1...),type-parameter-0-2>>::signal_t & sh) : void - + - + signal : sink<signal_handler<type-parameter-0-0 (type-parameter-0-1...),type-parameter-0-2>>::signal_t * - - + + signal_handler - - + + signal_handler @@ -71,8 +71,8 @@ - - + + signal_handler @@ -81,8 +81,8 @@ - - + + sink diff --git a/docs/test_cases/t00045_class.svg b/docs/test_cases/t00045_class.svg index 7e66f867..fa5a17d5 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_class.svg b/docs/test_cases/t00046_class.svg index de2852d1..a8ac31db 100644 --- a/docs/test_cases/t00046_class.svg +++ b/docs/test_cases/t00046_class.svg @@ -1,6 +1,6 @@ - + @@ -9,118 +9,118 @@ - + ns1 - + ns2 - + __gnu_cxx - - + + A - - + + A - - + + B - - + + C - - + + D - - + + E - - + + R - + - + a : ns1::ns2::A * - + - + ns1_a : ns1::A * - + - + ns1_ns2_a : ns1::ns2::A * - + - + root_a : ::A * - + - + i : std::vector<std::uint8_t> foo(AA & aa) : void - - + + A - - + + AA diff --git a/docs/test_cases/t00047_class.svg b/docs/test_cases/t00047_class.svg index 79977629..6d8ca90b 100644 --- a/docs/test_cases/t00047_class.svg +++ b/docs/test_cases/t00047_class.svg @@ -1,6 +1,6 @@ - + @@ -9,16 +9,16 @@ - - + + conditional_t - - + + conditional_t @@ -27,8 +27,8 @@ - - + + conditional_t @@ -37,8 +37,8 @@ - - + + conditional_t @@ -47,8 +47,8 @@ - - + + conditional_t diff --git a/docs/test_cases/t00048_class.svg b/docs/test_cases/t00048_class.svg index b1c2df83..4c73e45d 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_class.svg b/docs/test_cases/t00049_class.svg index a9020bd7..1609346a 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,17 +18,17 @@ T - + - + a : T get_a() : T & - + A @@ -36,7 +36,7 @@ intmap - + A @@ -44,7 +44,7 @@ thestring - + A @@ -52,32 +52,32 @@ std::vector<thestring> - - + + R - + - + a_string : A<thestring> - + - + a_vector_string : A<string_vector> - + - + a_int_map : A<intmap> diff --git a/docs/test_cases/t00050_class.svg b/docs/test_cases/t00050_class.svg index 33b8c5ae..2403792d 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 diff --git a/docs/test_cases/t20001.md b/docs/test_cases/t20001.md index b3d53a3b..27ad35e4 100644 --- a/docs/test_cases/t20001.md +++ b/docs/test_cases/t20001.md @@ -94,7 +94,9 @@ int tmain() A a; B b(a); - return b.wrap_add3(1, 2, 3); + auto tmp = a.add(1, 2); + + return b.wrap_add3(tmp, 2, 3); } } } diff --git a/docs/test_cases/t20001_sequence.svg b/docs/test_cases/t20001_sequence.svg index 8ec09f14..6aff01bf 100644 --- a/docs/test_cases/t20001_sequence.svg +++ b/docs/test_cases/t20001_sequence.svg @@ -1,6 +1,6 @@ - + - + @@ -9,60 +9,67 @@ - - - - - - - - - + + + + + + + + + + tmain() - - tmain() - - B - - B - - A - - A - - - - - - - - wrap_add3() - - - add3() - - - - - add() - - - - - - - - - log_result() - - - - - log_result() - - - - - Main test function + + tmain() + + A + + A + + B + + B + + + + + + + + + add() + + + + + wrap_add3() + + + add3() + + + + + add() + + + + + + + + + log_result() + + + + + log_result() + + + + + Main test function diff --git a/docs/test_cases/t20005.md b/docs/test_cases/t20005.md new file mode 100644 index 00000000..697e6766 --- /dev/null +++ b/docs/test_cases/t20005.md @@ -0,0 +1,45 @@ +# t20005 - Class template basic sequence diagram +## Config +```yaml +compilation_database_dir: .. +output_directory: puml +diagrams: + t20005_sequence: + type: sequence + glob: + - ../../tests/t20005/t20005.cc + include: + namespaces: + - clanguml::t20005 + using_namespace: + - clanguml::t20005 + start_from: + - function: "clanguml::t20005::C::c" +``` +## Source code +File t20005.cc +```cpp +namespace clanguml { +namespace t20005 { + +template struct A { + T a(T arg) { return arg; } +}; + +template struct B { + T b(T arg) { return a_.a(arg); } + + A a_; +}; + +template struct C { + T c(T arg) { return b_.b(arg); } + + B b_; +}; + +} +} +``` +## Generated UML diagrams +![t20005_sequence](./t20005_sequence.svg "Class template basic sequence diagram") diff --git a/docs/test_cases/t20005_sequence.svg b/docs/test_cases/t20005_sequence.svg new file mode 100644 index 00000000..93241fd4 --- /dev/null +++ b/docs/test_cases/t20005_sequence.svg @@ -0,0 +1,42 @@ + + + + + + + + + + + + + + + + + + C<T> + + C<T> + + B<T> + + B<T> + + A<T> + + A<T> + + + + + b() + + + a() + + + + + + diff --git a/docs/test_cases/t20006.md b/docs/test_cases/t20006.md new file mode 100644 index 00000000..6f03ab31 --- /dev/null +++ b/docs/test_cases/t20006.md @@ -0,0 +1,54 @@ +# t20006 - Class template specialization basic sequence diagram +## Config +```yaml +compilation_database_dir: .. +output_directory: puml +diagrams: + t20006_sequence: + type: sequence + glob: + - ../../tests/t20006/t20006.cc + include: + namespaces: + - clanguml::t20006 + using_namespace: + - clanguml::t20006 + start_from: + - function: "clanguml::t20006::tmain()" +``` +## Source code +File t20006.cc +```cpp +#include + +namespace clanguml { +namespace t20006 { + +template struct A { + T a_int(T arg) { return arg + 1; } + T a_string(T arg) { return arg + "_string"; } +}; + +template struct B { + T b(T arg) { return a_.a_int(arg); } + A a_; +}; + +template <> struct B { + std::string b(std::string arg) { return a_.a_string(arg); } + A a_; +}; + +void tmain() +{ + B bint; + B bstring; + + bint.b(1); + bstring.b("bstring"); +} +} +} +``` +## Generated UML diagrams +![t20006_sequence](./t20006_sequence.svg "Class template specialization basic sequence diagram") diff --git a/docs/test_cases/t20006_sequence.svg b/docs/test_cases/t20006_sequence.svg new file mode 100644 index 00000000..fe452937 --- /dev/null +++ b/docs/test_cases/t20006_sequence.svg @@ -0,0 +1,61 @@ + + + + + + + + + + + + + + + + + + + + + tmain() + + tmain() + + B<T> + + B<T> + + A<T> + + A<T> + + B<std::string> + + B<std::string> + + + + + + + B<int>::b() + + + a_int() + + + + + + + b() + + + A<std::string>::a_string() + + + + + + diff --git a/docs/test_cases/t30001_package.svg b/docs/test_cases/t30001_package.svg index 5eb16bf1..c1d741c4 100644 --- a/docs/test_cases/t30001_package.svg +++ b/docs/test_cases/t30001_package.svg @@ -1,6 +1,6 @@ - + @@ -9,63 +9,63 @@ - - + + 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_package.svg b/docs/test_cases/t30002_package.svg index e8a9ad69..e534f6d6 100644 --- a/docs/test_cases/t30002_package.svg +++ b/docs/test_cases/t30002_package.svg @@ -1,6 +1,6 @@ - + @@ -9,113 +9,113 @@ - - + + A - - + + AA - - + + B - - + + BB - - + + A1 - - + + A2 - - + + A3 - - + + A4 - - + + A5 - - + + A6 - - + + A7 - - + + A8 - - + + A9 - - + + A10 - - + + A11 - - + + A12 - - + + A13 - - + + A14 - - + + A15 - - + + A16 - - + + A17 - - + + BBB diff --git a/docs/test_cases/t30003_package.svg b/docs/test_cases/t30003_package.svg index ffe70336..0f1db71b 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_package.svg b/docs/test_cases/t30004_package.svg index ce1e6e42..c9d49c24 100644 --- a/docs/test_cases/t30004_package.svg +++ b/docs/test_cases/t30004_package.svg @@ -1,6 +1,6 @@ - + @@ -9,40 +9,40 @@ - - + + A - + Package AAA. - + Package BBB. - + CCCC package note. - + We skipped DDD. - - + + AAA - - + + BBB - - + + CCC - - + + EEE diff --git a/docs/test_cases/t30005_package.svg b/docs/test_cases/t30005_package.svg index d6a19637..db701280 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_package.svg b/docs/test_cases/t30006_package.svg index e49df033..4e80ec45 100644 --- a/docs/test_cases/t30006_package.svg +++ b/docs/test_cases/t30006_package.svg @@ -1,6 +1,6 @@ - + @@ -9,22 +9,22 @@ - - + + B - - + + A - - + + C - + Top A note. diff --git a/docs/test_cases/t30007_package.svg b/docs/test_cases/t30007_package.svg index bb267862..9340bd64 100644 --- a/docs/test_cases/t30007_package.svg +++ b/docs/test_cases/t30007_package.svg @@ -1,6 +1,6 @@ - + @@ -9,27 +9,27 @@ - - + + A - - + + B - - + + AA - - + + C - + Compare layout with t30006. diff --git a/docs/test_cases/t30008_package.svg b/docs/test_cases/t30008_package.svg index 91bdb564..005bd5eb 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/t40001_include.svg b/docs/test_cases/t40001_include.svg index ea68f320..86a198f4 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 diff --git a/docs/test_cases/t40002_include.svg b/docs/test_cases/t40002_include.svg index ce3a49e9..605dc076 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_include.svg b/docs/test_cases/t40003_include.svg index f5d1f204..14634817 100644 --- a/docs/test_cases/t40003_include.svg +++ b/docs/test_cases/t40003_include.svg @@ -1,6 +1,6 @@ - + @@ -9,66 +9,66 @@ - + include - + dependants - + dependencies - + src - + dependants - + dependencies - - + + t3.h - - + + t2.h - - + + t1.h - - + + t3.h - - + + t2.h - - + + t1.h - - + + t5.h - - + + t1.cc - - + + t2.cc diff --git a/tests/test_cases.yaml b/tests/test_cases.yaml index a78044a6..72076e25 100644 --- a/tests/test_cases.yaml +++ b/tests/test_cases.yaml @@ -163,6 +163,9 @@ test_cases: - name: t20005 title: Class template basic sequence diagram description: + - name: t20006 + title: Class template specialization basic sequence diagram + description: Package diagrams: - name: t30001 title: Basic package diagram test case From c7bfcbd66f45ff4a51d36b4337656f828eba4d5a Mon Sep 17 00:00:00 2001 From: Bartek Kryza Date: Wed, 23 Nov 2022 00:24:17 +0100 Subject: [PATCH 22/77] Fixed building on LLVM 12 --- .../visitor/translation_unit_visitor.cc | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/src/sequence_diagram/visitor/translation_unit_visitor.cc b/src/sequence_diagram/visitor/translation_unit_visitor.cc index 8c943089..8f04b263 100644 --- a/src/sequence_diagram/visitor/translation_unit_visitor.cc +++ b/src/sequence_diagram/visitor/translation_unit_visitor.cc @@ -706,18 +706,13 @@ bool translation_unit_visitor::VisitCallExpr(clang::CallExpr *expr) diagram().add_participant(std::move(f_ptr)); } - const auto &return_type = - function_call_expr->getCallReturnType(current_ast_context); - // - // Without this if, this crashes test case t20003 on LLVM <= 12 + // This crashes on LLVM <= 12, for now just return empty type // - if (!clang::dyn_cast_or_null( - function_call_expr->getCallee())) { - m.return_type = return_type.getAsString(); - } - else - m.return_type = ""; + // const auto &return_type = + // function_call_expr->getCallReturnType(current_ast_context); + // m.return_type = return_type.getAsString(); + m.return_type = ""; } else { return true; From e586c9d062dc1d823e8cd5cbcfc183fbe4eb294d Mon Sep 17 00:00:00 2001 From: Bartek Kryza Date: Sun, 27 Nov 2022 12:51:02 +0100 Subject: [PATCH 23/77] Added basic test case for sequence diagrams with class template specializations --- .../visitor/translation_unit_visitor.cc | 155 ++++++++---------- .../visitor/translation_unit_visitor.h | 8 +- tests/t20004/test_case.h | 25 ++- tests/t20006/t20006.cc | 38 ++++- tests/t20006/test_case.h | 24 ++- 5 files changed, 137 insertions(+), 113 deletions(-) diff --git a/src/sequence_diagram/visitor/translation_unit_visitor.cc b/src/sequence_diagram/visitor/translation_unit_visitor.cc index 8f04b263..b1b81a63 100644 --- a/src/sequence_diagram/visitor/translation_unit_visitor.cc +++ b/src/sequence_diagram/visitor/translation_unit_visitor.cc @@ -201,7 +201,7 @@ bool translation_unit_visitor::VisitClassTemplateSpecializationDecl( if (!diagram().should_include(cls->getQualifiedNameAsString())) return true; - LOG_DBG("= Visiting template specialization declaration {} at {}", + LOG_DBG("##### Visiting template specialization declaration {} at {}", cls->getQualifiedNameAsString(), cls->getLocation().printToString(source_manager())); @@ -251,6 +251,10 @@ bool translation_unit_visitor::VisitCXXMethodDecl(clang::CXXMethodDecl *m) nullptr) return true; + LOG_DBG("= Processing method {} in class {} [{}]", + m->getQualifiedNameAsString(), + m->getParent()->getQualifiedNameAsString(), (void *)m->getParent()); + call_expression_context_.update(m); auto m_ptr = std::make_unique( @@ -262,45 +266,24 @@ bool translation_unit_visitor::VisitCXXMethodDecl(clang::CXXMethodDecl *m) ns.pop_back(); m_ptr->set_name(ns.name()); ns.pop_back(); - // m_ptr->set_namespace(ns); - if (call_expression_context_.current_class_decl_) { - const auto ¤t_class = - diagram() - .get_participant(get_ast_local_id( - call_expression_context_.current_class_decl_->getID()) - .value()) - .value(); + clang::Decl *parent_decl = m->getParent(); - m_ptr->set_class_id(current_class.id()); - m_ptr->set_class_full_name(current_class.full_name(false)); - } - else if (call_expression_context_.current_class_template_decl_) { - const auto ¤t_template_class = - diagram() - .get_participant( - get_ast_local_id(call_expression_context_ - .current_class_template_decl_->getID()) - .value()) - .value(); + if (call_expression_context_.current_class_template_decl_) + parent_decl = call_expression_context_.current_class_template_decl_; - m_ptr->set_class_id(current_template_class.id()); - m_ptr->set_class_full_name(current_template_class.full_name(false)); - } - else { - const auto ¤t_template_specialization_class = - diagram() - .get_participant(get_ast_local_id( - call_expression_context_ - .current_class_template_specialization_decl_->getID()) - .value()) - .value(); + call_expression_context_.dump(); - m_ptr->set_class_id(current_template_specialization_class.id()); - m_ptr->set_class_full_name( - current_template_specialization_class.full_name(false)); - } + LOG_DBG("Getting method's class with local id {}", parent_decl->getID()); + const auto &method_class = + diagram() + .get_participant( + get_ast_local_id(parent_decl->getID()).value()) + .value(); + + m_ptr->set_class_id(method_class.id()); + m_ptr->set_class_full_name(method_class.full_name(false)); m_ptr->set_name( diagram().participants.at(m_ptr->class_id())->full_name_no_ns() + "::" + m->getNameAsString()); @@ -434,8 +417,6 @@ bool translation_unit_visitor::VisitCallExpr(clang::CallExpr *expr) if (clang::dyn_cast_or_null(expr)) return true; - call_expression_context_.dump(); - if (!call_expression_context_.valid()) return true; @@ -480,27 +461,6 @@ bool translation_unit_visitor::VisitCallExpr(clang::CallExpr *expr) LOG_DBG("Callee is a template specialization declaration {}", callee_template_specialization->getQualifiedNameAsString()); - if (!get_ast_local_id(callee_template_specialization->getID())) { - call_expression_context context_backup = - call_expression_context_; - - // Since this visitor will overwrite the - // call_expression_context_ we need to back it up and restore it - // later - VisitClassTemplateSpecializationDecl( - const_cast( - callee_template_specialization)); - - call_expression_context_ = context_backup; - - diagram() - .get_participant(get_ast_local_id( - callee_template_specialization->getID()) - .value()) - .value() - .set_implicit(true); - } - const auto &participant = diagram() .get_participant(get_ast_local_id( @@ -509,6 +469,7 @@ bool translation_unit_visitor::VisitCallExpr(clang::CallExpr *expr) .value(); if (participant.is_implicit()) { + /* const auto *parent_template = callee_template_specialization->getSpecializedTemplate(); @@ -525,6 +486,32 @@ bool translation_unit_visitor::VisitCallExpr(clang::CallExpr *expr) m.to = common::to_id(parent_method_name); m.message_name = participant.full_name_no_ns() + "::" + method_decl->getNameAsString(); + */ + const auto specialization_method_name = + participant.full_name(false) + + "::" + method_decl->getNameAsString(); + + m.to = common::to_id(method_name); + m.message_name = method_decl->getNameAsString(); + + // Since this is an implicit instantiation it might not exist + // so we have to create this participant here and it to the + // diagram + if (!diagram() + .get_participant(m.to) + .has_value()) { + auto m_ptr = + std::make_unique( + config().using_namespace()); + m_ptr->set_id(m.to); + m_ptr->set_method_name(method_decl->getNameAsString()); + m_ptr->set_name(method_decl->getNameAsString()); + m_ptr->set_class_id(participant.id()); + m_ptr->set_class_full_name(participant.full_name(false)); + set_ast_local_id(method_decl->getID(), m_ptr->id()); + diagram().add_active_participant(m_ptr->id()); + diagram().add_participant(std::move(m_ptr)); + } } else { const auto &specialization_participant = @@ -676,19 +663,14 @@ bool translation_unit_visitor::VisitCallExpr(clang::CallExpr *expr) callee_function->getTemplateSpecializationArgs()->size() > 0) { f_ptr = build_function_template_instantiation(*callee_function); - callee_name = f_ptr->full_name(false); - f_ptr->set_id(common::to_id(f_ptr->full_name(false))); set_ast_local_id(callee_function->getID(), f_ptr->id()); } - if (is_implicit) + if (is_implicit) { LOG_DBG("Processing implicit template specialization {}", f_ptr->full_name(false)); - // m.to_name = - // callee_function->getQualifiedNameAsString(); - if (is_implicit) { // If this is an implicit template specialization/instantiation // for now we just redirect the call to it's primary template // (TODO: this is not correct in a general case) @@ -1061,29 +1043,28 @@ void translation_unit_visitor:: // template arguments if (arg.getAsType()->getAs()) { - for (const auto ¶m_type : - arg.getAsType()->getAs()->param_types()) { - - if (!param_type->getAs()) - continue; - - // auto classTemplateSpecialization = - // llvm::dyn_cast( - // param_type->getAsRecordDecl()); - - // if (classTemplateSpecialization) { - // // Read arg info as needed. - // auto nested_template_instantiation = - // build_template_instantiation_from_class_template_specialization( - // *classTemplateSpecialization, - // *param_type->getAs(), - // diagram().should_include( - // full_template_specialization_name) - // ? - // std::make_optional(&template_instantiation) - // : parent); - // } - } +// for (const auto ¶m_type : +// arg.getAsType()->getAs()->param_types()) { +// +// if (!param_type->getAs()) +// continue; +// +// auto classTemplateSpecialization = +// llvm::dyn_cast( +// param_type->getAsRecordDecl()); +// +// if (classTemplateSpecialization) { +// // Read arg info as needed. +// auto nested_template_instantiation = +// build_template_instantiation_from_class_template_specialization( +// *classTemplateSpecialization, +// *param_type->getAs(), +// diagram().should_include( +// full_template_specialization_name) +// ? std::make_optional(&template_instantiation) +// : parent); +// } +// } } else if (arg.getAsType()->getAs()) { const auto *nested_template_type = diff --git a/src/sequence_diagram/visitor/translation_unit_visitor.h b/src/sequence_diagram/visitor/translation_unit_visitor.h index d9009c8a..1bd94353 100644 --- a/src/sequence_diagram/visitor/translation_unit_visitor.h +++ b/src/sequence_diagram/visitor/translation_unit_visitor.h @@ -122,10 +122,6 @@ struct call_expression_context { function->getQualifiedNameAsString()) { current_function_template_decl_ = nullptr; } - // else { - // call_expression_context_.current_class_method_ = - // process_class_method(method); - // } } void update(clang::FunctionTemplateDecl *function_template) @@ -180,6 +176,10 @@ public: clanguml::sequence_diagram::model::diagram &diagram, const clanguml::config::sequence_diagram &config); + bool shouldVisitTemplateInstantiations() { + return true; + } + virtual bool VisitCallExpr(clang::CallExpr *expr); virtual bool VisitCXXMethodDecl(clang::CXXMethodDecl *method); diff --git a/tests/t20004/test_case.h b/tests/t20004/test_case.h index 0d386f6b..89ee5353 100644 --- a/tests/t20004/test_case.h +++ b/tests/t20004/test_case.h @@ -32,27 +32,24 @@ TEST_CASE("t20004", "[test-case][sequence]") AliasMatcher _A(puml); REQUIRE_THAT(puml, StartsWith("@startuml")); - REQUIRE_THAT(puml, HasCall(_A("main()"), _A("m1()"), "m1")); - REQUIRE_THAT(puml, !HasCall(_A("m1()"), _A("m1()"), "m2")); - REQUIRE_THAT( - puml, !HasCall(_A("m1()"), _A("m1()"), "m2")); + REQUIRE_THAT(puml, HasCall(_A("main()"), _A("m1()"), "m1")); + REQUIRE_THAT(puml, !HasCall(_A("m1()"), _A("m1()"), "m2")); + REQUIRE_THAT(puml, !HasCall(_A("m1()"), _A("m1()"), "m2")); - REQUIRE_THAT(puml, - HasCall(_A("main()"), _A("m1()"), "m1")); + REQUIRE_THAT(puml, HasCall(_A("main()"), _A("m1()"), "m1")); REQUIRE_THAT(puml, HasCall(_A("m1()"), _A("m4()"), - "m4")); + "m4")); - REQUIRE_THAT(puml, - HasCall(_A("main()"), _A("m1()"), "m1")); + REQUIRE_THAT(puml, HasCall(_A("main()"), _A("m1()"), "m1")); REQUIRE_THAT(puml, HasCall(_A("m1()"), _A("m2()"), - "m2")); + "m2")); - REQUIRE_THAT(puml, HasCall(_A("main()"), _A("m1()"), "m1")); - REQUIRE_THAT(puml, HasCall(_A("m1()"), _A("m2()"), "m2")); - REQUIRE_THAT(puml, HasCall(_A("m2()"), _A("m3()"), "m3")); - REQUIRE_THAT(puml, HasCall(_A("m3()"), _A("m4()"), "m4")); + REQUIRE_THAT(puml, HasCall(_A("main()"), _A("m1()"), "m1")); + REQUIRE_THAT(puml, HasCall(_A("m1()"), _A("m2()"), "m2")); + REQUIRE_THAT(puml, HasCall(_A("m2()"), _A("m3()"), "m3")); + REQUIRE_THAT(puml, HasCall(_A("m3()"), _A("m4()"), "m4")); REQUIRE_THAT(puml, EndsWith("@enduml\n")); save_puml( diff --git a/tests/t20006/t20006.cc b/tests/t20006/t20006.cc index 20729063..d2dfc302 100644 --- a/tests/t20006/t20006.cc +++ b/tests/t20006/t20006.cc @@ -4,20 +4,41 @@ namespace clanguml { namespace t20006 { template struct A { - T a_int(T arg) { return arg + 1; } - T a_string(T arg) { return arg + "_string"; } + T a1(T arg) { return arg; } + T a2(T arg) { return arg + arg; } }; template struct B { - T b(T arg) { return a_.a_int(arg); } + T b(T arg) { return a_.a1(arg); } A a_; }; template <> struct B { - std::string b(std::string arg) { return a_.a_string(arg); } + std::string b(std::string arg) { return a_.a2(arg); } A a_; }; +template struct AA { + void aa1(T t) { } + void aa2(T t) { } +}; + + +template struct BB { + void bb1(T t, F f) { aa_.aa1(t); } + void bb2(T t, F f) { aa_.aa2(t); } + + AA aa_; +}; + +template struct BB { + void bb1(T t, std::string f) { aa_.aa2(t); } + void bb2(T t, std::string f) { aa_.aa1(t); } + + AA aa_; +}; + + void tmain() { B bint; @@ -25,6 +46,15 @@ void tmain() bint.b(1); bstring.b("bstring"); + + BB bbint; + BB bbstring; + + bbint.bb1(1, 1); + bbint.bb2(2, 2); + + bbstring.bb1(1, "calling aa2"); + bbstring.bb2(1, "calling aa1"); } } } \ No newline at end of file diff --git a/tests/t20006/test_case.h b/tests/t20006/test_case.h index 9c5e9c8d..539f8ffc 100644 --- a/tests/t20006/test_case.h +++ b/tests/t20006/test_case.h @@ -35,12 +35,28 @@ TEST_CASE("t20006", "[test-case][sequence]") REQUIRE_THAT(puml, EndsWith("@enduml\n")); // Check if all calls exist - REQUIRE_THAT(puml, HasCall(_A("tmain()"), _A("B"), "B::b")); - REQUIRE_THAT(puml, HasCall(_A("B"), _A("A"), "a_int")); + REQUIRE_THAT(puml, HasCall(_A("tmain()"), _A("B"), "b")); + REQUIRE_THAT(puml, HasCall(_A("B"), _A("A"), "a1")); REQUIRE_THAT(puml, HasCall(_A("tmain()"), _A("B"), "b")); - REQUIRE_THAT(puml, - HasCall(_A("B"), _A("A"), "A::a_string")); + REQUIRE_THAT( + puml, HasCall(_A("B"), _A("A"), "a2")); + + REQUIRE_THAT(puml, HasCall(_A("tmain()"), _A("BB"), "bb1")); + REQUIRE_THAT(puml, HasCall(_A("BB"), _A("AA"), "aa1")); + + REQUIRE_THAT(puml, HasCall(_A("tmain()"), _A("BB"), "bb2")); + REQUIRE_THAT(puml, HasCall(_A("BB"), _A("AA"), "aa2")); + + REQUIRE_THAT( + puml, HasCall(_A("tmain()"), _A("BB"), "bb1")); + REQUIRE_THAT( + puml, HasCall(_A("BB"), _A("AA"), "aa2")); + + REQUIRE_THAT( + puml, HasCall(_A("tmain()"), _A("BB"), "bb2")); + REQUIRE_THAT( + puml, HasCall(_A("BB"), _A("AA"), "aa1")); save_puml( "./" + config.output_directory() + "/" + diagram->name + ".puml", puml); From b36355352da427ee37c58c9e232c7f80b5bd2bd2 Mon Sep 17 00:00:00 2001 From: Bartek Kryza Date: Sun, 27 Nov 2022 14:24:12 +0100 Subject: [PATCH 24/77] Added variadic class template sequence diagram test case --- .../visitor/translation_unit_visitor.cc | 37 ++------------- tests/t20007/.clang-uml | 14 ++++++ tests/t20007/t20007.cc | 25 ++++++++++ tests/t20007/test_case.h | 47 +++++++++++++++++++ tests/test_cases.cc | 1 + tests/test_cases.yaml | 3 ++ 6 files changed, 95 insertions(+), 32 deletions(-) create mode 100644 tests/t20007/.clang-uml create mode 100644 tests/t20007/t20007.cc create mode 100644 tests/t20007/test_case.h diff --git a/src/sequence_diagram/visitor/translation_unit_visitor.cc b/src/sequence_diagram/visitor/translation_unit_visitor.cc index b1b81a63..d45f03c0 100644 --- a/src/sequence_diagram/visitor/translation_unit_visitor.cc +++ b/src/sequence_diagram/visitor/translation_unit_visitor.cc @@ -641,45 +641,18 @@ bool translation_unit_visitor::VisitCallExpr(clang::CallExpr *expr) if (!callee_function) return true; - bool is_implicit = false; auto callee_name = callee_function->getQualifiedNameAsString() + "()"; std::unique_ptr f_ptr; - // - // The target template function is implicit if it's - // specialization/instantiation was not explicitly defined - // (i.e. it was not added to the diagram by visitor methods) - // - is_implicit = - !get_ast_local_id(callee_function->getID()).has_value(); - - // - // If the callee is a specialization of a function template, - // build it's instantiation model to get the id - // - if (callee_function->getTemplateSpecializationArgs() && - callee_function->getTemplateSpecializationArgs()->size() > 0) { - f_ptr = build_function_template_instantiation(*callee_function); - - f_ptr->set_id(common::to_id(f_ptr->full_name(false))); - set_ast_local_id(callee_function->getID(), f_ptr->id()); + if(!get_ast_local_id(callee_function->getID()).has_value()) { + // This is hopefully not an interesting call... + return true; } - - if (is_implicit) { - LOG_DBG("Processing implicit template specialization {}", - f_ptr->full_name(false)); - - // If this is an implicit template specialization/instantiation - // for now we just redirect the call to it's primary template - // (TODO: this is not correct in a general case) - m.to = get_ast_local_id( - callee_function->getPrimaryTemplate()->getID()) - .value(); - } - else + else { m.to = get_ast_local_id(callee_function->getID()).value(); + } auto message_name = callee_name; m.message_name = message_name.substr(0, message_name.size() - 2); diff --git a/tests/t20007/.clang-uml b/tests/t20007/.clang-uml new file mode 100644 index 00000000..40a6a2f7 --- /dev/null +++ b/tests/t20007/.clang-uml @@ -0,0 +1,14 @@ +compilation_database_dir: .. +output_directory: puml +diagrams: + t20007_sequence: + type: sequence + glob: + - ../../tests/t20007/t20007.cc + include: + namespaces: + - clanguml::t20007 + using_namespace: + - clanguml::t20007 + start_from: + - function: "clanguml::t20007::tmain()" \ No newline at end of file diff --git a/tests/t20007/t20007.cc b/tests/t20007/t20007.cc new file mode 100644 index 00000000..b7c3ec44 --- /dev/null +++ b/tests/t20007/t20007.cc @@ -0,0 +1,25 @@ +#include +#include + +namespace clanguml { +namespace t20007 { + +template struct Adder { + First add(First &&arg, Args &&...args) { return (arg + ... + args); } +}; + +void tmain() +{ + using namespace std::string_literals; + + Adder adder1; + Adder adder2; + Adder adder3; + + [[maybe_unused]] auto res1 = adder1.add(2, 2); + [[maybe_unused]] auto res2 = adder2.add(1, 2.0, 3.0); + [[maybe_unused]] auto res3 = adder3.add("one"s, "two"s, "three"s); +} + +} +} \ No newline at end of file diff --git a/tests/t20007/test_case.h b/tests/t20007/test_case.h new file mode 100644 index 00000000..5fc2d26a --- /dev/null +++ b/tests/t20007/test_case.h @@ -0,0 +1,47 @@ +/** + * tests/t20007/test_case.h + * + * Copyright (c) 2021-2022 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("t20007", "[test-case][sequence]") +{ + auto [config, db] = load_config("t20007"); + + auto diagram = config.diagrams["t20007_sequence"]; + + REQUIRE(diagram->name == "t20007_sequence"); + + auto model = generate_sequence_diagram(*db, diagram); + + REQUIRE(model->name() == "t20007_sequence"); + + auto puml = generate_sequence_puml(diagram, *model); + AliasMatcher _A(puml); + + REQUIRE_THAT(puml, StartsWith("@startuml")); + REQUIRE_THAT(puml, EndsWith("@enduml\n")); + + // Check if all calls exist + REQUIRE_THAT(puml, HasCall(_A("tmain()"), _A("Adder"), "add")); + REQUIRE_THAT( + puml, HasCall(_A("tmain()"), _A("Adder"), "add")); + REQUIRE_THAT(puml, + HasCall(_A("tmain()"), _A("Adder"), + "add")); + + save_puml( + "./" + config.output_directory() + "/" + diagram->name + ".puml", puml); +} \ No newline at end of file diff --git a/tests/test_cases.cc b/tests/test_cases.cc index 79289f4b..51a822cf 100644 --- a/tests/test_cases.cc +++ b/tests/test_cases.cc @@ -253,6 +253,7 @@ using namespace clanguml::test::matchers; #include "t20004/test_case.h" #include "t20005/test_case.h" #include "t20006/test_case.h" +#include "t20007/test_case.h" /// /// Package diagram tests diff --git a/tests/test_cases.yaml b/tests/test_cases.yaml index 72076e25..115abd8a 100644 --- a/tests/test_cases.yaml +++ b/tests/test_cases.yaml @@ -166,6 +166,9 @@ test_cases: - name: t20006 title: Class template specialization basic sequence diagram description: + - name: t20007 + title: Class template variadic argument list sequence diagram + description: Package diagrams: - name: t30001 title: Basic package diagram test case From df0163cdbfa5981a6ffbecf3faf728b0574c47ff Mon Sep 17 00:00:00 2001 From: Bartek Kryza Date: Sun, 27 Nov 2022 15:23:32 +0100 Subject: [PATCH 25/77] Added constexpr if sequence diagram test case --- tests/t20008/.clang-uml | 14 +++++++++++ tests/t20008/t20008.cc | 43 ++++++++++++++++++++++++++++++++ tests/t20008/test_case.h | 53 ++++++++++++++++++++++++++++++++++++++++ tests/test_cases.cc | 1 + tests/test_cases.h | 34 +++++++++++--------------- tests/test_cases.yaml | 3 +++ 6 files changed, 128 insertions(+), 20 deletions(-) create mode 100644 tests/t20008/.clang-uml create mode 100644 tests/t20008/t20008.cc create mode 100644 tests/t20008/test_case.h diff --git a/tests/t20008/.clang-uml b/tests/t20008/.clang-uml new file mode 100644 index 00000000..f266305c --- /dev/null +++ b/tests/t20008/.clang-uml @@ -0,0 +1,14 @@ +compilation_database_dir: .. +output_directory: puml +diagrams: + t20008_sequence: + type: sequence + glob: + - ../../tests/t20008/t20008.cc + include: + namespaces: + - clanguml::t20008 + using_namespace: + - clanguml::t20008 + start_from: + - function: "clanguml::t20008::tmain()" \ No newline at end of file diff --git a/tests/t20008/t20008.cc b/tests/t20008/t20008.cc new file mode 100644 index 00000000..3305ade0 --- /dev/null +++ b/tests/t20008/t20008.cc @@ -0,0 +1,43 @@ +#include +#include + +namespace clanguml { +namespace t20008 +{ + +template struct A { + void a1(T arg) { } + void a2(T arg) { } + void a3(T arg) { } +}; + +template struct B { + A a; + + void b(T arg) { + if constexpr (std::is_integral_v) { + a.a1(arg); + } + else if constexpr(std::is_pointer_v) { + a.a2(arg); + } + else { + a.a3(arg); + } + + } +}; + +void tmain() { + using namespace std::string_literals; + + B bint; + B bcharp; + B bstring; + + bint.b(1); + bcharp.b("1"); + bstring.b("1"s); +} +} +} \ No newline at end of file diff --git a/tests/t20008/test_case.h b/tests/t20008/test_case.h new file mode 100644 index 00000000..221485e2 --- /dev/null +++ b/tests/t20008/test_case.h @@ -0,0 +1,53 @@ +/** + * tests/t20008/test_case.h + * + * Copyright (c) 2021-2022 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("t20008", "[test-case][sequence]") +{ + auto [config, db] = load_config("t20008"); + + auto diagram = config.diagrams["t20008_sequence"]; + + REQUIRE(diagram->name == "t20008_sequence"); + + auto model = generate_sequence_diagram(*db, diagram); + + REQUIRE(model->name() == "t20008_sequence"); + + auto puml = generate_sequence_puml(diagram, *model); + AliasMatcher _A(puml); + + REQUIRE_THAT(puml, StartsWith("@startuml")); + REQUIRE_THAT(puml, EndsWith("@enduml\n")); + + // Check if all calls exist + REQUIRE_THAT(puml, HasCall(_A("tmain()"), _A("B"), "b")); + REQUIRE_THAT(puml, HasCall(_A("B"), _A("A"), "a1")); + REQUIRE_THAT(puml, !HasCall(_A("B"), _A("A"), "a2")); + REQUIRE_THAT(puml, !HasCall(_A("B"), _A("A"), "a3")); + + REQUIRE_THAT(puml, HasCall(_A("tmain()"), _A("B"), "b")); + REQUIRE_THAT( + puml, HasCall(_A("B"), _A("A"), "a2")); + + REQUIRE_THAT(puml, HasCall(_A("tmain()"), _A("B"), "b")); + REQUIRE_THAT( + puml, HasCall(_A("B"), _A("A"), "a3")); + + save_puml( + "./" + config.output_directory() + "/" + diagram->name + ".puml", puml); +} \ No newline at end of file diff --git a/tests/test_cases.cc b/tests/test_cases.cc index 51a822cf..74e7fe9a 100644 --- a/tests/test_cases.cc +++ b/tests/test_cases.cc @@ -254,6 +254,7 @@ using namespace clanguml::test::matchers; #include "t20005/test_case.h" #include "t20006/test_case.h" #include "t20007/test_case.h" +#include "t20008/test_case.h" /// /// Package diagram tests diff --git a/tests/test_cases.h b/tests/test_cases.h index 90302891..caf6a7fa 100644 --- a/tests/test_cases.h +++ b/tests/test_cases.h @@ -79,26 +79,19 @@ template constexpr bool has_type() noexcept return (std::is_same_v || ... || false); } -struct Public { -}; +struct Public { }; -struct Protected { -}; +struct Protected { }; -struct Private { -}; +struct Private { }; -struct Abstract { -}; +struct Abstract { }; -struct Static { -}; +struct Static { }; -struct Const { -}; +struct Const { }; -struct Default { -}; +struct Default { }; struct HasCallWithResultMatcher : ContainsMatcher { HasCallWithResultMatcher( @@ -158,6 +151,8 @@ struct AliasMatcher { util::replace_all(name, "(", "\\("); util::replace_all(name, ")", "\\)"); + util::replace_all(name, " ", "\\s"); + util::replace_all(name, "*", "\\*"); patterns.push_back( std::regex{"class\\s\"" + name + "\"\\sas\\s" + alias_regex}); @@ -180,12 +175,11 @@ struct AliasMatcher { for (const auto &line : puml) { for (const auto &pattern : patterns) { - if (std::regex_search(line, base_match, pattern)) { - if (base_match.size() == 2) { - std::ssub_match base_sub_match = base_match[1]; - std::string alias = base_sub_match.str(); - return trim(alias); - } + if (std::regex_search(line, base_match, pattern) && + base_match.size() == 2) { + std::ssub_match base_sub_match = base_match[1]; + std::string alias = base_sub_match.str(); + return trim(alias); } } } diff --git a/tests/test_cases.yaml b/tests/test_cases.yaml index 115abd8a..38b74d48 100644 --- a/tests/test_cases.yaml +++ b/tests/test_cases.yaml @@ -169,6 +169,9 @@ test_cases: - name: t20007 title: Class template variadic argument list sequence diagram description: + - name: t20008 + title: Constexpr if sequence diagram test case + description: Package diagrams: - name: t30001 title: Basic package diagram test case From 93e95613b4d256170373ea0eb1a1e5d0e5557101 Mon Sep 17 00:00:00 2001 From: Bartek Kryza Date: Sun, 27 Nov 2022 15:24:01 +0100 Subject: [PATCH 26/77] Fixed formatting --- .../visitor/translation_unit_visitor.cc | 48 ++++++++++--------- .../visitor/translation_unit_visitor.h | 4 +- tests/t20004/test_case.h | 8 ++-- tests/t20006/t20006.cc | 6 +-- tests/t20008/t20008.cc | 16 +++---- tests/test_cases.h | 21 +++++--- 6 files changed, 53 insertions(+), 50 deletions(-) diff --git a/src/sequence_diagram/visitor/translation_unit_visitor.cc b/src/sequence_diagram/visitor/translation_unit_visitor.cc index d45f03c0..9df65cd0 100644 --- a/src/sequence_diagram/visitor/translation_unit_visitor.cc +++ b/src/sequence_diagram/visitor/translation_unit_visitor.cc @@ -646,7 +646,7 @@ bool translation_unit_visitor::VisitCallExpr(clang::CallExpr *expr) std::unique_ptr f_ptr; - if(!get_ast_local_id(callee_function->getID()).has_value()) { + if (!get_ast_local_id(callee_function->getID()).has_value()) { // This is hopefully not an interesting call... return true; } @@ -1016,28 +1016,30 @@ void translation_unit_visitor:: // template arguments if (arg.getAsType()->getAs()) { -// for (const auto ¶m_type : -// arg.getAsType()->getAs()->param_types()) { -// -// if (!param_type->getAs()) -// continue; -// -// auto classTemplateSpecialization = -// llvm::dyn_cast( -// param_type->getAsRecordDecl()); -// -// if (classTemplateSpecialization) { -// // Read arg info as needed. -// auto nested_template_instantiation = -// build_template_instantiation_from_class_template_specialization( -// *classTemplateSpecialization, -// *param_type->getAs(), -// diagram().should_include( -// full_template_specialization_name) -// ? std::make_optional(&template_instantiation) -// : parent); -// } -// } + // for (const auto ¶m_type : + // arg.getAsType()->getAs()->param_types()) + // { + // + // if (!param_type->getAs()) + // continue; + // + // auto classTemplateSpecialization = + // llvm::dyn_cast( + // param_type->getAsRecordDecl()); + // + // if (classTemplateSpecialization) { + // // Read arg info as needed. + // auto nested_template_instantiation = + // build_template_instantiation_from_class_template_specialization( + // *classTemplateSpecialization, + // *param_type->getAs(), + // diagram().should_include( + // full_template_specialization_name) + // ? + // std::make_optional(&template_instantiation) + // : parent); + // } + // } } else if (arg.getAsType()->getAs()) { const auto *nested_template_type = diff --git a/src/sequence_diagram/visitor/translation_unit_visitor.h b/src/sequence_diagram/visitor/translation_unit_visitor.h index 1bd94353..e892282a 100644 --- a/src/sequence_diagram/visitor/translation_unit_visitor.h +++ b/src/sequence_diagram/visitor/translation_unit_visitor.h @@ -176,9 +176,7 @@ public: clanguml::sequence_diagram::model::diagram &diagram, const clanguml::config::sequence_diagram &config); - bool shouldVisitTemplateInstantiations() { - return true; - } + bool shouldVisitTemplateInstantiations() { return true; } virtual bool VisitCallExpr(clang::CallExpr *expr); diff --git a/tests/t20004/test_case.h b/tests/t20004/test_case.h index 89ee5353..615d3729 100644 --- a/tests/t20004/test_case.h +++ b/tests/t20004/test_case.h @@ -38,13 +38,11 @@ TEST_CASE("t20004", "[test-case][sequence]") REQUIRE_THAT(puml, HasCall(_A("main()"), _A("m1()"), "m1")); REQUIRE_THAT(puml, - HasCall(_A("m1()"), _A("m4()"), - "m4")); + HasCall(_A("m1()"), _A("m4()"), "m4")); REQUIRE_THAT(puml, HasCall(_A("main()"), _A("m1()"), "m1")); - REQUIRE_THAT(puml, - HasCall(_A("m1()"), _A("m2()"), - "m2")); + REQUIRE_THAT( + puml, HasCall(_A("m1()"), _A("m2()"), "m2")); REQUIRE_THAT(puml, HasCall(_A("main()"), _A("m1()"), "m1")); REQUIRE_THAT(puml, HasCall(_A("m1()"), _A("m2()"), "m2")); diff --git a/tests/t20006/t20006.cc b/tests/t20006/t20006.cc index d2dfc302..e0d6e2b3 100644 --- a/tests/t20006/t20006.cc +++ b/tests/t20006/t20006.cc @@ -19,11 +19,10 @@ template <> struct B { }; template struct AA { - void aa1(T t) { } - void aa2(T t) { } + void aa1(T t) { } + void aa2(T t) { } }; - template struct BB { void bb1(T t, F f) { aa_.aa1(t); } void bb2(T t, F f) { aa_.aa2(t); } @@ -38,7 +37,6 @@ template struct BB { AA aa_; }; - void tmain() { B bint; diff --git a/tests/t20008/t20008.cc b/tests/t20008/t20008.cc index 3305ade0..46f9173c 100644 --- a/tests/t20008/t20008.cc +++ b/tests/t20008/t20008.cc @@ -1,9 +1,8 @@ -#include #include +#include namespace clanguml { -namespace t20008 -{ +namespace t20008 { template struct A { void a1(T arg) { } @@ -14,25 +13,26 @@ template struct A { template struct B { A a; - void b(T arg) { + void b(T arg) + { if constexpr (std::is_integral_v) { a.a1(arg); } - else if constexpr(std::is_pointer_v) { + else if constexpr (std::is_pointer_v) { a.a2(arg); } else { a.a3(arg); } - } }; -void tmain() { +void tmain() +{ using namespace std::string_literals; B bint; - B bcharp; + B bcharp; B bstring; bint.b(1); diff --git a/tests/test_cases.h b/tests/test_cases.h index caf6a7fa..e1ec4aac 100644 --- a/tests/test_cases.h +++ b/tests/test_cases.h @@ -79,19 +79,26 @@ template constexpr bool has_type() noexcept return (std::is_same_v || ... || false); } -struct Public { }; +struct Public { +}; -struct Protected { }; +struct Protected { +}; -struct Private { }; +struct Private { +}; -struct Abstract { }; +struct Abstract { +}; -struct Static { }; +struct Static { +}; -struct Const { }; +struct Const { +}; -struct Default { }; +struct Default { +}; struct HasCallWithResultMatcher : ContainsMatcher { HasCallWithResultMatcher( From da5a4f8c5d91f246490af8e22667aa29c4e7c64e Mon Sep 17 00:00:00 2001 From: Bartek Kryza Date: Sun, 27 Nov 2022 15:26:21 +0100 Subject: [PATCH 27/77] Updated test case documentation --- docs/test_cases.md | 2 + docs/test_cases/t00002_class.svg | 36 ++--- docs/test_cases/t00003_class.svg | 46 +++--- docs/test_cases/t00004_class.svg | 76 +++++----- docs/test_cases/t00005_class.svg | 110 +++++++------- docs/test_cases/t00006_class.svg | 134 ++++++++--------- docs/test_cases/t00007_class.svg | 30 ++-- docs/test_cases/t00008_class.svg | 56 ++++---- docs/test_cases/t00009_class.svg | 32 ++--- docs/test_cases/t00010_class.svg | 34 ++--- docs/test_cases/t00011_class.svg | 22 +-- docs/test_cases/t00012_class.svg | 66 ++++----- docs/test_cases/t00013_class.svg | 82 +++++------ docs/test_cases/t00014_class.svg | 124 ++++++++-------- docs/test_cases/t00015_class.svg | 22 +-- docs/test_cases/t00016_class.svg | 30 ++-- docs/test_cases/t00017_class.svg | 66 ++++----- docs/test_cases/t00018_class.svg | 18 +-- docs/test_cases/t00019_class.svg | 40 +++--- docs/test_cases/t00020_class.svg | 38 ++--- docs/test_cases/t00021_class.svg | 30 ++-- docs/test_cases/t00022_class.svg | 14 +- docs/test_cases/t00023_class.svg | 26 ++-- docs/test_cases/t00024_class.svg | 22 +-- docs/test_cases/t00025_class.svg | 34 ++--- docs/test_cases/t00026_class.svg | 42 +++--- docs/test_cases/t00027_class.svg | 58 ++++---- docs/test_cases/t00028_class.svg | 78 +++++----- docs/test_cases/t00029_class.svg | 50 +++---- docs/test_cases/t00030_class.svg | 46 +++--- docs/test_cases/t00031_class.svg | 50 +++---- docs/test_cases/t00032_class.svg | 40 +++--- docs/test_cases/t00033_class.svg | 48 +++---- docs/test_cases/t00034_class.svg | 46 +++--- docs/test_cases/t00035_class.svg | 22 +-- docs/test_cases/t00036_class.svg | 38 ++--- docs/test_cases/t00037_class.svg | 178 +++++++++++------------ docs/test_cases/t00038_class.svg | 58 ++++---- docs/test_cases/t00039_class.svg | 78 +++++----- docs/test_cases/t00040_class.svg | 26 ++-- docs/test_cases/t00041_class.svg | 54 +++---- docs/test_cases/t00042_class.svg | 36 ++--- docs/test_cases/t00043_class.svg | 50 +++---- docs/test_cases/t00044_class.svg | 36 ++--- docs/test_cases/t00045_class.svg | 70 ++++----- docs/test_cases/t00046_class.svg | 64 ++++----- docs/test_cases/t00047_class.svg | 22 +-- docs/test_cases/t00048_class.svg | 50 +++---- docs/test_cases/t00049_class.svg | 32 ++--- docs/test_cases/t00050_class.svg | 72 +++++----- docs/test_cases/t20002_sequence.svg | 54 +++---- docs/test_cases/t20004_sequence.svg | 216 ++++++++++++++-------------- docs/test_cases/t20006.md | 36 ++++- docs/test_cases/t20006_sequence.svg | 152 ++++++++++++++------ docs/test_cases/t20007.md | 49 +++++++ docs/test_cases/t20007_sequence.svg | 54 +++++++ docs/test_cases/t20008.md | 67 +++++++++ docs/test_cases/t20008_sequence.svg | 78 ++++++++++ docs/test_cases/t30001_package.svg | 48 +++---- docs/test_cases/t30002_package.svg | 90 ++++++------ docs/test_cases/t30003_package.svg | 26 ++-- docs/test_cases/t30004_package.svg | 30 ++-- docs/test_cases/t30005_package.svg | 38 ++--- docs/test_cases/t30006_package.svg | 16 +-- docs/test_cases/t30007_package.svg | 20 +-- docs/test_cases/t30008_package.svg | 34 ++--- docs/test_cases/t40001_include.svg | 30 ++-- docs/test_cases/t40002_include.svg | 34 ++--- docs/test_cases/t40003_include.svg | 50 +++---- 69 files changed, 2000 insertions(+), 1656 deletions(-) create mode 100644 docs/test_cases/t20007.md create mode 100644 docs/test_cases/t20007_sequence.svg create mode 100644 docs/test_cases/t20008.md create mode 100644 docs/test_cases/t20008_sequence.svg diff --git a/docs/test_cases.md b/docs/test_cases.md index e948a6ba..f83226cd 100644 --- a/docs/test_cases.md +++ b/docs/test_cases.md @@ -56,6 +56,8 @@ * [t20004](./test_cases/t20004.md) - Function template instantiation sequence diagram test case * [t20005](./test_cases/t20005.md) - Class template basic sequence diagram * [t20006](./test_cases/t20006.md) - Class template specialization basic sequence diagram + * [t20007](./test_cases/t20007.md) - Class template variadic argument list sequence diagram + * [t20008](./test_cases/t20008.md) - Constexpr if sequence diagram test case ## Package diagrams * [t30001](./test_cases/t30001.md) - Basic package diagram test case * [t30002](./test_cases/t30002.md) - Package dependency test case diff --git a/docs/test_cases/t00002_class.svg b/docs/test_cases/t00002_class.svg index 5d09bf5c..6f0c7aaa 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_class.svg b/docs/test_cases/t00003_class.svg index 228d8350..1e7e0dd9 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_class.svg b/docs/test_cases/t00004_class.svg index 12d80d4e..0614670c 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,15 +59,15 @@ Red - - + + A::AA::AAA - + C::B @@ -75,8 +75,8 @@ int - - + + C @@ -84,39 +84,39 @@ T - + - + t : T - + - + b_int : B<int> - - + + C::AA - - + + C::AA::AAA - - + + C::AA::CCC @@ -125,8 +125,8 @@ CCC_2 - - + + C::B @@ -134,16 +134,16 @@ V - + - + b : V - - + + C::CC @@ -152,16 +152,16 @@ CC_2 - - + + detail::D - - + + detail::D::AA @@ -171,8 +171,8 @@ AA_3 - - + + detail::D::DD diff --git a/docs/test_cases/t00005_class.svg b/docs/test_cases/t00005_class.svg index 15924af8..98f35a94 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_class.svg b/docs/test_cases/t00006_class.svg index ada50c28..2353ae08 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,15 +146,15 @@ T - + - + data : std::vector<T> - + custom_container @@ -162,102 +162,102 @@ 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] + + 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_class.svg b/docs/test_cases/t00007_class.svg index daa7a9dd..e4436cb9 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_class.svg b/docs/test_cases/t00008_class.svg index 02243ab7..f18d5f4a 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,CMP,int N - + - + 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,15 +87,15 @@ T,C<> - + - + template_template : C<T> - + B @@ -103,18 +103,18 @@ int,Vector - - + + D - + - + ints : B<int,Vector> diff --git a/docs/test_cases/t00009_class.svg b/docs/test_cases/t00009_class.svg index 15d5c871..ad647b11 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,15 +18,15 @@ T - + - + value : T - + A @@ -34,7 +34,7 @@ int - + A @@ -42,7 +42,7 @@ std::string - + A @@ -50,32 +50,32 @@ 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_class.svg b/docs/test_cases/t00010_class.svg index 85f4705c..6be62f8a 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,22 +18,22 @@ T,P - + - + first : T - + - + second : P - + A @@ -41,8 +41,8 @@ T,std::string - - + + B @@ -50,15 +50,15 @@ T - + - + astring : A<T,std::string> - + B @@ -66,18 +66,18 @@ int - - + + C - + - + aintstring : B<int> diff --git a/docs/test_cases/t00011_class.svg b/docs/test_cases/t00011_class.svg index 74fc0428..6bd065c7 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_class.svg b/docs/test_cases/t00012_class.svg index 5d2f379d..4d202f25 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,14 +60,14 @@ - + - + ints : std::array<T,sizeof...(Is)> - + A @@ -75,7 +75,7 @@ int,std::string,float - + A @@ -83,7 +83,7 @@ int,std::string,bool - + B @@ -91,7 +91,7 @@ 3,2,1 - + B @@ -99,7 +99,7 @@ 1,1,1,1 - + C @@ -107,50 +107,50 @@ 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_class.svg b/docs/test_cases/t00013_class.svg index 49e4d499..0bb5ff71 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,15 +18,15 @@ T - + - + f : T - + ABCD::F @@ -34,70 +34,70 @@ int - - + + A - + - + a : int - - + + B - + - + b : int - - + + C - + - + c : int - - + + D - + - + d : int print(R * r) : void - - + + E @@ -105,16 +105,16 @@ T - + - + e : T - - + + G @@ -122,22 +122,22 @@ T,Args... - + - + g : T - + - + args : std::tuple<Args...> - + E @@ -145,7 +145,7 @@ int - + G @@ -153,7 +153,7 @@ int,float,std::string - + E @@ -161,25 +161,25 @@ std::string - - + + R - + - + gintstring : G<int,float,std::string> - + - + estring : E<std::string> diff --git a/docs/test_cases/t00014_class.svg b/docs/test_cases/t00014_class.svg index 4b0501ec..e22aadb3 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,37 +18,37 @@ T,P - + - + t : T - + - + p : P - - + + B - + - + value : std::string - + A @@ -56,7 +56,7 @@ T,std::string - + A @@ -64,7 +64,7 @@ T,std::unique_ptr<std::string> - + A @@ -72,7 +72,7 @@ long,T - + A @@ -80,7 +80,7 @@ double,T - + A @@ -88,7 +88,7 @@ long,U - + A @@ -96,7 +96,7 @@ long,bool - + A @@ -104,7 +104,7 @@ double,bool - + A @@ -112,7 +112,7 @@ long,float - + A @@ -120,7 +120,7 @@ double,float - + A @@ -128,7 +128,7 @@ bool,std::string - + A @@ -136,7 +136,7 @@ float,std::unique_ptr<std::string> - + A @@ -144,7 +144,7 @@ int,std::string - + A @@ -152,7 +152,7 @@ std::string,std::string - + A @@ -160,7 +160,7 @@ char,std::string - + A @@ -168,116 +168,116 @@ wchar_t,std::string - - + + R - + - + 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 - + - + bs : BVector - + - + bs2 : BVector2 - + - + cb : SimpleCallback<ACharString> - + - + gcb : GenericCallback<R::AWCharString> - + - + vcb : VoidCallback - + - + vps : VectorPtr<B> @@ -307,9 +307,9 @@ - + - + @@ -375,9 +375,9 @@ bstringstring - + - + diff --git a/docs/test_cases/t00015_class.svg b/docs/test_cases/t00015_class.svg index 8abbbe5f..2e7f1fb9 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_class.svg b/docs/test_cases/t00016_class.svg index 2c28e1cb..0e0a9fbb 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<> @@ -19,8 +19,8 @@ value : enum - - + + is_numeric @@ -29,8 +29,8 @@ value : enum - - + + is_numeric @@ -41,8 +41,8 @@ value : enum - - + + is_numeric @@ -53,8 +53,8 @@ value : enum - - + + is_numeric @@ -65,8 +65,8 @@ value : enum - - + + is_numeric @@ -77,8 +77,8 @@ value : enum - - + + is_numeric diff --git a/docs/test_cases/t00017_class.svg b/docs/test_cases/t00017_class.svg index 7d4c008a..294bb955 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_class.svg b/docs/test_cases/t00018_class.svg index e9b34fab..554ff2fd 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_class.svg b/docs/test_cases/t00019_class.svg index 1e1605f7..3d2054a0 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,7 +83,7 @@ m1_calls() const : int m2_calls() const : int - + Layer3 @@ -91,7 +91,7 @@ Base - + Layer2 @@ -99,7 +99,7 @@ Layer3<Base> - + Layer1 @@ -107,18 +107,18 @@ Layer2<Layer3<Base>> - - + + A - + - + layers : std::unique_ptr<Layer1<Layer2<Layer3<Base>>>> diff --git a/docs/test_cases/t00020_class.svg b/docs/test_cases/t00020_class.svg index 31af521e..5c5f7619 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_class.svg b/docs/test_cases/t00021_class.svg index 77ab2234..918562ae 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_class.svg b/docs/test_cases/t00022_class.svg index 953f2883..d4f3436a 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_class.svg b/docs/test_cases/t00023_class.svg index 0e05149d..132598f2 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_class.svg b/docs/test_cases/t00024_class.svg index f2d886ff..a44f01c6 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_class.svg b/docs/test_cases/t00025_class.svg index 7b62c41e..dafec971 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,7 +56,7 @@ m1() : void m2() : void - + Proxy @@ -64,7 +64,7 @@ Target1 - + Proxy @@ -72,25 +72,25 @@ Target2 - - + + ProxyHolder - + - + proxy1 : Proxy<Target1> - + - + proxy2 : Proxy<Target2> diff --git a/docs/test_cases/t00026_class.svg b/docs/test_cases/t00026_class.svg index c7e3f383..58e22af3 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>(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,7 +78,7 @@ state(const std::string & n) : Memento<T> & set_state(const std::string & s, Memento<T> && m) : void - + Caretaker @@ -86,7 +86,7 @@ std::string - + Originator @@ -94,25 +94,25 @@ std::string - - + + StringMemento - + - + caretaker : Caretaker<std::string> - + - + originator : Originator<std::string> diff --git a/docs/test_cases/t00027_class.svg b/docs/test_cases/t00027_class.svg index dbe6ca93..c1429930 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,14 @@ ~Shape() = default : void - + Line - - + + Line @@ -39,14 +39,14 @@ display() : void - + Text - - + + Text @@ -57,8 +57,8 @@ display() : void - - + + ShapeDecorator @@ -67,8 +67,8 @@ display() = 0 : void - - + + Color @@ -79,8 +79,8 @@ display() : void - - + + Weight @@ -91,7 +91,7 @@ display() : void - + Line @@ -99,7 +99,7 @@ Color,Weight - + Line @@ -107,7 +107,7 @@ Color - + Text @@ -115,7 +115,7 @@ Color,Weight - + Text @@ -123,39 +123,39 @@ Color - - + + Window - + - + border : Line<Color,Weight> - + - + divider : Line<Color> - + - + title : Text<Color,Weight> - + - + description : Text<Color> diff --git a/docs/test_cases/t00028_class.svg b/docs/test_cases/t00028_class.svg index f1b2fd63..ce780edf 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,10 +94,10 @@ three - + F enum note. - + E @@ -105,59 +105,59 @@ 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. diff --git a/docs/test_cases/t00029_class.svg b/docs/test_cases/t00029_class.svg index 047e16a3..a11d0af9 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_class.svg b/docs/test_cases/t00030_class.svg index aa910626..5e5cd290 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_class.svg b/docs/test_cases/t00031_class.svg index f0143516..9249af8a 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,23 +47,23 @@ T - + - + ttt : T - - + + D - + C @@ -71,39 +71,39 @@ int - - + + R - + - + aaa : A * - + - + bbb : std::vector<B> - + - + ccc : C<int> - + - + ddd : D * diff --git a/docs/test_cases/t00032_class.svg b/docs/test_cases/t00032_class.svg index de950d96..c253c35b 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,15 +64,15 @@ T,L,Ts... - + - + counter : L - + Overload @@ -80,18 +80,18 @@ TBase,int,A,B,C - - + + R - + - + overload : Overload<TBase,int,A,B,C> diff --git a/docs/test_cases/t00033_class.svg b/docs/test_cases/t00033_class.svg index cff14585..0bb9001f 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,30 +52,30 @@ T - + - + ccc : T - - + + D - + - + ddd : int - + C @@ -83,7 +83,7 @@ D - + B @@ -91,7 +91,7 @@ std::unique_ptr<C<D>> - + A @@ -99,18 +99,18 @@ B<std::unique_ptr<C<D>>> - - + + R - + - + abc : A<B<std::unique_ptr<C<D>>>> diff --git a/docs/test_cases/t00034_class.svg b/docs/test_cases/t00034_class.svg index a1de61e2..52d266d0 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,16 +31,16 @@ - - + + lift_void - - + + lift_void @@ -49,8 +49,8 @@ - - + + drop_void @@ -59,16 +59,16 @@ - - + + drop_void - - + + drop_void @@ -77,33 +77,33 @@ - - + + A - - + + R - + - + la : lift_void_t<A> * - + - + lv : lift_void_t<void> * diff --git a/docs/test_cases/t00035_class.svg b/docs/test_cases/t00035_class.svg index a6bd3a48..fb2ee6b6 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_class.svg b/docs/test_cases/t00036_class.svg index c1e4a5f1..3d87678c 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,15 +43,15 @@ T - + - + a : T - + A @@ -59,23 +59,23 @@ int - - + + B - + - + a_int : A<int> - - + + C diff --git a/docs/test_cases/t00037_class.svg b/docs/test_cases/t00037_class.svg index b6b94b4f..8039be44 100644 --- a/docs/test_cases/t00037_class.svg +++ b/docs/test_cases/t00037_class.svg @@ -1,6 +1,6 @@ - + - + @@ -9,114 +9,114 @@ - - - - - ST - - + + + + + ST + + - - - + + + - - dimensions : ST::(anonymous_620) + + dimensions : struct (anonymous struct at /home/bartek/devel/clang-uml-libtooling/tests/t00037/t00037.cc:6:5) - - - + + + - - units : ST::(anonymous_739) + + units : struct (anonymous struct at /home/bartek/devel/clang-uml-libtooling/tests/t00037/t00037.cc:14:5) - - - - - ST::(dimensions) - + + + + + ST::(dimensions) + - - - + + + - - t : double + + t : double - - - + + + - - x : double + + x : double - - - + + + - - y : double + + y : double - - - + + + - - z : double + + z : double - - - - - - ST::(units) - + + + + + + ST::(units) + - - - + + + - - c : double + + c : double - - - + + + - - h : double + + h : double - - - - - - A - + + + + + + A + - - - + + + - - st : ST + + st : ST - - - A() : void - - - - dimensions - - - - units - - - - st + + + A() : void + + + + dimensions + + + + units + + + + st diff --git a/docs/test_cases/t00038_class.svg b/docs/test_cases/t00038_class.svg index 231bc643..7d49b3b2 100644 --- a/docs/test_cases/t00038_class.svg +++ b/docs/test_cases/t00038_class.svg @@ -1,6 +1,6 @@ - + @@ -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,16 +88,16 @@ - - + + map - - + + map @@ -106,8 +106,8 @@ - - + + map @@ -116,8 +116,8 @@ - - + + map @@ -126,8 +126,8 @@ - - + + map diff --git a/docs/test_cases/t00039_class.svg b/docs/test_cases/t00039_class.svg index 0c1ec295..42f550c6 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_class.svg b/docs/test_cases/t00040_class.svg index b5e532c6..f2f28d80 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_class.svg b/docs/test_cases/t00041_class.svg index ee612851..44f2c920 100644 --- a/docs/test_cases/t00041_class.svg +++ b/docs/test_cases/t00041_class.svg @@ -1,6 +1,6 @@ - + @@ -9,100 +9,100 @@ - - + + R - - + + D - + - + rr : RR * - - + + E - - + + F - - + + RR - + - + e : E * - + - + f : F * - + - + g : detail::G * - - + + RRR - - + + ns1::N - - + + ns1::NN - - + + ns1::NM diff --git a/docs/test_cases/t00042_class.svg b/docs/test_cases/t00042_class.svg index 649066ad..14341b7a 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,22 +52,22 @@ T,K - + - + b : T - + - + bb : K - + A @@ -75,7 +75,7 @@ double - + A @@ -83,7 +83,7 @@ std::string - + B diff --git a/docs/test_cases/t00043_class.svg b/docs/test_cases/t00043_class.svg index b4097784..fc2fbde5 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_class.svg b/docs/test_cases/t00044_class.svg index 30e680ec..79f7e9d9 100644 --- a/docs/test_cases/t00044_class.svg +++ b/docs/test_cases/t00044_class.svg @@ -1,6 +1,6 @@ - + @@ -9,7 +9,7 @@ - + signal_handler @@ -17,8 +17,8 @@ ,A - - + + sink @@ -27,15 +27,15 @@ sink<signal_handler<type-parameter-0-0 (type-parameter-0-1...), type-parameter-0-2> >(sink<signal_handler<type-parameter-0-0 (type-parameter-0-1...),type-parameter-0-2>>::signal_t & sh) : void - + - + signal : sink<signal_handler<type-parameter-0-0 (type-parameter-0-1...),type-parameter-0-2>>::signal_t * - - + + sink @@ -46,23 +46,23 @@ sink<signal_handler<type-parameter-0-0 (type-parameter-0-1...), type-parameter-0-2> >(sink<signal_handler<type-parameter-0-0 (type-parameter-0-1...),type-parameter-0-2>>::signal_t & sh) : void - + - + signal : sink<signal_handler<type-parameter-0-0 (type-parameter-0-1...),type-parameter-0-2>>::signal_t * - - + + signal_handler - - + + signal_handler @@ -71,8 +71,8 @@ - - + + signal_handler @@ -81,8 +81,8 @@ - - + + sink diff --git a/docs/test_cases/t00045_class.svg b/docs/test_cases/t00045_class.svg index fa5a17d5..b5acf81e 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_class.svg b/docs/test_cases/t00046_class.svg index a8ac31db..fede75c0 100644 --- a/docs/test_cases/t00046_class.svg +++ b/docs/test_cases/t00046_class.svg @@ -1,6 +1,6 @@ - + @@ -9,118 +9,118 @@ - + ns1 - + ns2 - + __gnu_cxx - - + + A - - + + A - - + + B - - + + C - - + + D - - + + E - - + + R - + - + a : ns1::ns2::A * - + - + ns1_a : ns1::A * - + - + ns1_ns2_a : ns1::ns2::A * - + - + root_a : ::A * - + - + i : std::vector<std::uint8_t> foo(AA & aa) : void - - + + A - - + + AA diff --git a/docs/test_cases/t00047_class.svg b/docs/test_cases/t00047_class.svg index 6d8ca90b..aed11324 100644 --- a/docs/test_cases/t00047_class.svg +++ b/docs/test_cases/t00047_class.svg @@ -1,6 +1,6 @@ - + @@ -9,16 +9,16 @@ - - + + conditional_t - - + + conditional_t @@ -27,8 +27,8 @@ - - + + conditional_t @@ -37,8 +37,8 @@ - - + + conditional_t @@ -47,8 +47,8 @@ - - + + conditional_t diff --git a/docs/test_cases/t00048_class.svg b/docs/test_cases/t00048_class.svg index 4c73e45d..e5859ff1 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_class.svg b/docs/test_cases/t00049_class.svg index 1609346a..5ca3b880 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,17 +18,17 @@ T - + - + a : T get_a() : T & - + A @@ -36,7 +36,7 @@ intmap - + A @@ -44,7 +44,7 @@ thestring - + A @@ -52,32 +52,32 @@ std::vector<thestring> - - + + R - + - + a_string : A<thestring> - + - + a_vector_string : A<string_vector> - + - + a_int_map : A<intmap> diff --git a/docs/test_cases/t00050_class.svg b/docs/test_cases/t00050_class.svg index 2403792d..d44f6923 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] + + 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 diff --git a/docs/test_cases/t20002_sequence.svg b/docs/test_cases/t20002_sequence.svg index f187f22b..c3e59fc7 100644 --- a/docs/test_cases/t20002_sequence.svg +++ b/docs/test_cases/t20002_sequence.svg @@ -1,6 +1,6 @@ - + - + @@ -9,32 +9,32 @@ - - - - - - - - + + + + + + + + m1() - - m1() - + + m1() + m2() - - m2() - + + m2() + m3() - - m3() - + + m3() + m4() - - m4() - - - + + m4() + + + m2() @@ -44,5 +44,11 @@ m4() + + + + + + diff --git a/docs/test_cases/t20004_sequence.svg b/docs/test_cases/t20004_sequence.svg index cb7783be..f3cef76f 100644 --- a/docs/test_cases/t20004_sequence.svg +++ b/docs/test_cases/t20004_sequence.svg @@ -1,6 +1,6 @@ - + - + @@ -9,118 +9,118 @@ - - - - - - - - - + + + + + + + + + - - - - - - - - - - + + + + + + + + + + main() - + main() - - m1<float>() - - m1<float>() - - m1<unsigned long>() - - m1<unsigned long>() - - m4<unsigned long>() - - m4<unsigned long>() - - m1<std::string>() - - m1<std::string>() - - m2<std::string>() - - m2<std::string>() - - m1<T>() - - m1<T>() - - m2<T>() - - m2<T>() - - m3<T>() - - m3<T>() - - m4<T>() - - m4<T>() - - - - - - - - - - - - m1<float>() + + m1<float>() + + m1<float>() + + m1<unsigned long>() + + m1<unsigned long>() + + m4<unsigned long>() + + m4<unsigned long>() + + m1<std::string>() + + m1<std::string>() + + m2<std::string>() + + m2<std::string>() + + m1<int>() + + m1<int>() + + m2<int>() + + m2<int>() + + m3<int>() + + m3<int>() + + m4<int>() + + m4<int>() + + + + + + + + + + + + m1() - - - - m1<unsigned long>() - - - m4<unsigned long>() - - + + + + m1() + + + m4() + + - - - - m1<std::string>() - - - m2<std::string>() - - + + + + m1() + + + m2() + + - - - - m1<int>() - - - m2<T>() - - - m3<T>() - - - m4<T>() - - - - - - + + + + m1() + + + m2() + + + m3() + + + m4() + + + + + + - + diff --git a/docs/test_cases/t20006.md b/docs/test_cases/t20006.md index 6f03ab31..97ad9e3f 100644 --- a/docs/test_cases/t20006.md +++ b/docs/test_cases/t20006.md @@ -25,20 +25,39 @@ namespace clanguml { namespace t20006 { template struct A { - T a_int(T arg) { return arg + 1; } - T a_string(T arg) { return arg + "_string"; } + T a1(T arg) { return arg; } + T a2(T arg) { return arg + arg; } }; template struct B { - T b(T arg) { return a_.a_int(arg); } + T b(T arg) { return a_.a1(arg); } A a_; }; template <> struct B { - std::string b(std::string arg) { return a_.a_string(arg); } + std::string b(std::string arg) { return a_.a2(arg); } A a_; }; +template struct AA { + void aa1(T t) { } + void aa2(T t) { } +}; + +template struct BB { + void bb1(T t, F f) { aa_.aa1(t); } + void bb2(T t, F f) { aa_.aa2(t); } + + AA aa_; +}; + +template struct BB { + void bb1(T t, std::string f) { aa_.aa2(t); } + void bb2(T t, std::string f) { aa_.aa1(t); } + + AA aa_; +}; + void tmain() { B bint; @@ -46,6 +65,15 @@ void tmain() bint.b(1); bstring.b("bstring"); + + BB bbint; + BB bbstring; + + bbint.bb1(1, 1); + bbint.bb2(2, 2); + + bbstring.bb1(1, "calling aa2"); + bbstring.bb2(1, "calling aa1"); } } } diff --git a/docs/test_cases/t20006_sequence.svg b/docs/test_cases/t20006_sequence.svg index fe452937..47f4323b 100644 --- a/docs/test_cases/t20006_sequence.svg +++ b/docs/test_cases/t20006_sequence.svg @@ -1,6 +1,6 @@ - + - + @@ -9,53 +9,113 @@ - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + tmain() - - tmain() - - B<T> - - B<T> - - A<T> - - A<T> - - B<std::string> - - B<std::string> - - - - - - - B<int>::b() - - - a_int() - - + + 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> + + + + + + + + + + + + + + + b() + + + a1() + + - - - + + + b() - - - A<std::string>::a_string() - - + + + a2() + + - + + + + bb1() + + + aa1() + + + bb2() + + + aa2() + + + bb1() + + + aa2() + + + bb2() + + + aa1() diff --git a/docs/test_cases/t20007.md b/docs/test_cases/t20007.md new file mode 100644 index 00000000..37f55b34 --- /dev/null +++ b/docs/test_cases/t20007.md @@ -0,0 +1,49 @@ +# t20007 - Class template variadic argument list sequence diagram +## Config +```yaml +compilation_database_dir: .. +output_directory: puml +diagrams: + t20007_sequence: + type: sequence + glob: + - ../../tests/t20007/t20007.cc + include: + namespaces: + - clanguml::t20007 + using_namespace: + - clanguml::t20007 + start_from: + - function: "clanguml::t20007::tmain()" +``` +## Source code +File t20007.cc +```cpp +#include +#include + +namespace clanguml { +namespace t20007 { + +template struct Adder { + First add(First &&arg, Args &&...args) { return (arg + ... + args); } +}; + +void tmain() +{ + using namespace std::string_literals; + + Adder adder1; + Adder adder2; + Adder adder3; + + [[maybe_unused]] auto res1 = adder1.add(2, 2); + [[maybe_unused]] auto res2 = adder2.add(1, 2.0, 3.0); + [[maybe_unused]] auto res3 = adder3.add("one"s, "two"s, "three"s); +} + +} +} +``` +## Generated UML diagrams +![t20007_sequence](./t20007_sequence.svg "Class template variadic argument list sequence diagram") diff --git a/docs/test_cases/t20007_sequence.svg b/docs/test_cases/t20007_sequence.svg new file mode 100644 index 00000000..b89593d4 --- /dev/null +++ b/docs/test_cases/t20007_sequence.svg @@ -0,0 +1,54 @@ + + + + + + + + + + + + + + + + + + + + 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() + + + + + add() + + + + + add() + + + + diff --git a/docs/test_cases/t20008.md b/docs/test_cases/t20008.md new file mode 100644 index 00000000..e2ca37a0 --- /dev/null +++ b/docs/test_cases/t20008.md @@ -0,0 +1,67 @@ +# t20008 - Constexpr if sequence diagram test case +## Config +```yaml +compilation_database_dir: .. +output_directory: puml +diagrams: + t20008_sequence: + type: sequence + glob: + - ../../tests/t20008/t20008.cc + include: + namespaces: + - clanguml::t20008 + using_namespace: + - clanguml::t20008 + start_from: + - function: "clanguml::t20008::tmain()" +``` +## Source code +File t20008.cc +```cpp +#include +#include + +namespace clanguml { +namespace t20008 { + +template struct A { + void a1(T arg) { } + void a2(T arg) { } + void a3(T arg) { } +}; + +template struct B { + A a; + + void b(T arg) + { + if constexpr (std::is_integral_v) { + a.a1(arg); + } + else if constexpr (std::is_pointer_v) { + a.a2(arg); + } + else { + a.a3(arg); + } + } +}; + +void tmain() +{ + using namespace std::string_literals; + + B bint; + B bcharp; + B bstring; + + bint.b(1); + bcharp.b("1"); + bstring.b("1"s); +} +} +} +``` +## Generated UML diagrams +![t20008_sequence](./t20008_sequence.svg "Constexpr if sequence diagram test case") diff --git a/docs/test_cases/t20008_sequence.svg b/docs/test_cases/t20008_sequence.svg new file mode 100644 index 00000000..39cc56ab --- /dev/null +++ b/docs/test_cases/t20008_sequence.svg @@ -0,0 +1,78 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + 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() + + + a1() + + + b() + + + a2() + + + b() + + + a3() + + diff --git a/docs/test_cases/t30001_package.svg b/docs/test_cases/t30001_package.svg index c1d741c4..a7a7cfa2 100644 --- a/docs/test_cases/t30001_package.svg +++ b/docs/test_cases/t30001_package.svg @@ -1,6 +1,6 @@ - + @@ -9,63 +9,63 @@ - - + + 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_package.svg b/docs/test_cases/t30002_package.svg index e534f6d6..82de51ef 100644 --- a/docs/test_cases/t30002_package.svg +++ b/docs/test_cases/t30002_package.svg @@ -1,6 +1,6 @@ - + @@ -9,113 +9,113 @@ - - + + A - - + + AA - - + + B - - + + BB - - + + A1 - - + + A2 - - + + A3 - - + + A4 - - + + A5 - - + + A6 - - + + A7 - - + + A8 - - + + A9 - - + + A10 - - + + A11 - - + + A12 - - + + A13 - - + + A14 - - + + A15 - - + + A16 - - + + A17 - - + + BBB diff --git a/docs/test_cases/t30003_package.svg b/docs/test_cases/t30003_package.svg index 0f1db71b..ffa1efc0 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_package.svg b/docs/test_cases/t30004_package.svg index c9d49c24..667fd760 100644 --- a/docs/test_cases/t30004_package.svg +++ b/docs/test_cases/t30004_package.svg @@ -1,6 +1,6 @@ - + @@ -9,40 +9,40 @@ - - + + A - + Package AAA. - + Package BBB. - + CCCC package note. - + We skipped DDD. - - + + AAA - - + + BBB - - + + CCC - - + + EEE diff --git a/docs/test_cases/t30005_package.svg b/docs/test_cases/t30005_package.svg index db701280..6b25b317 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_package.svg b/docs/test_cases/t30006_package.svg index 4e80ec45..c3592d7a 100644 --- a/docs/test_cases/t30006_package.svg +++ b/docs/test_cases/t30006_package.svg @@ -1,6 +1,6 @@ - + @@ -9,22 +9,22 @@ - - + + B - - + + A - - + + C - + Top A note. diff --git a/docs/test_cases/t30007_package.svg b/docs/test_cases/t30007_package.svg index 9340bd64..771a1fd7 100644 --- a/docs/test_cases/t30007_package.svg +++ b/docs/test_cases/t30007_package.svg @@ -1,6 +1,6 @@ - + @@ -9,27 +9,27 @@ - - + + A - - + + B - - + + AA - - + + C - + Compare layout with t30006. diff --git a/docs/test_cases/t30008_package.svg b/docs/test_cases/t30008_package.svg index 005bd5eb..ca832552 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/t40001_include.svg b/docs/test_cases/t40001_include.svg index 86a198f4..f1ee6c66 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 diff --git a/docs/test_cases/t40002_include.svg b/docs/test_cases/t40002_include.svg index 605dc076..1ffbac23 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_include.svg b/docs/test_cases/t40003_include.svg index 14634817..6a7e9f1e 100644 --- a/docs/test_cases/t40003_include.svg +++ b/docs/test_cases/t40003_include.svg @@ -1,6 +1,6 @@ - + @@ -9,66 +9,66 @@ - + include - + dependants - + dependencies - + src - + dependants - + dependencies - - + + t3.h - - + + t2.h - - + + t1.h - - + + t3.h - - + + t2.h - - + + t1.h - - + + t5.h - - + + t1.cc - - + + t2.cc From f1af5460e30083e9908524f6e6fd48d0e40e01b7 Mon Sep 17 00:00:00 2001 From: Bartek Kryza Date: Sun, 27 Nov 2022 19:15:31 +0100 Subject: [PATCH 28/77] Refactored sequence diagram visitor --- .../visitor/translation_unit_visitor.cc | 143 +++++++++--------- .../visitor/translation_unit_visitor.h | 8 +- 2 files changed, 77 insertions(+), 74 deletions(-) diff --git a/src/sequence_diagram/visitor/translation_unit_visitor.cc b/src/sequence_diagram/visitor/translation_unit_visitor.cc index 9df65cd0..0ff84b37 100644 --- a/src/sequence_diagram/visitor/translation_unit_visitor.cc +++ b/src/sequence_diagram/visitor/translation_unit_visitor.cc @@ -58,6 +58,16 @@ translation_unit_visitor::translation_unit_visitor(clang::SourceManager &sm, { } +bool translation_unit_visitor::shouldVisitTemplateInstantiations() +{ + return true; +} + +call_expression_context &translation_unit_visitor::context() +{ + return call_expression_context_; +} + clanguml::sequence_diagram::model::diagram &translation_unit_visitor::diagram() { return diagram_; @@ -78,14 +88,10 @@ bool translation_unit_visitor::VisitCXXRecordDecl(clang::CXXRecordDecl *cls) if (!diagram().should_include(cls->getQualifiedNameAsString())) return true; - if (!diagram().should_include(cls->getQualifiedNameAsString())) { - return true; - } - if (cls->isTemplated() && cls->getDescribedTemplate()) { // If the described templated of this class is already in the model // skip it: - if (get_ast_local_id(cls->getDescribedTemplate()->getID())) + if (get_unique_id(cls->getDescribedTemplate()->getID())) return true; } @@ -100,11 +106,11 @@ bool translation_unit_visitor::VisitCXXRecordDecl(clang::CXXRecordDecl *cls) if (!c_ptr) return true; - call_expression_context_.reset(); + context().reset(); const auto cls_id = c_ptr->id(); - set_ast_local_id(cls->getID(), cls_id); + set_unique_id(cls->getID(), cls_id); auto &class_model = diagram() @@ -124,16 +130,16 @@ 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()); assert(class_model.id() == cls_id); - call_expression_context_.set_caller_id(cls_id); - call_expression_context_.update(cls); + context().set_caller_id(cls_id); + context().update(cls); - diagram_.add_participant(std::move(c_ptr)); + diagram().add_participant(std::move(c_ptr)); } else { LOG_DBG("Skipping class {} with id {}", class_model.full_name(), @@ -170,7 +176,7 @@ bool translation_unit_visitor::VisitClassTemplateDecl( c_ptr->set_id(id); - set_ast_local_id(cls->getID(), id); + set_unique_id(cls->getID(), id); if (!cls->getTemplatedDecl()->isCompleteDefinition()) { forward_declarations_.emplace(id, std::move(c_ptr)); @@ -180,13 +186,13 @@ bool translation_unit_visitor::VisitClassTemplateDecl( forward_declarations_.erase(id); } - if (diagram_.should_include(*c_ptr)) { + if (diagram().should_include(*c_ptr)) { LOG_DBG("Adding class template {} with id {}", cls_full_name, id); - call_expression_context_.set_caller_id(id); - call_expression_context_.update(cls); + context().set_caller_id(id); + context().update(cls); - diagram_.add_participant(std::move(c_ptr)); + diagram().add_participant(std::move(c_ptr)); } return true; @@ -201,7 +207,7 @@ bool translation_unit_visitor::VisitClassTemplateSpecializationDecl( if (!diagram().should_include(cls->getQualifiedNameAsString())) return true; - LOG_DBG("##### Visiting template specialization declaration {} at {}", + LOG_DBG("Visiting template specialization declaration {} at {}", cls->getQualifiedNameAsString(), cls->getLocation().printToString(source_manager())); @@ -219,7 +225,7 @@ bool translation_unit_visitor::VisitClassTemplateSpecializationDecl( template_specialization_ptr->set_id(id); - set_ast_local_id(cls->getID(), id); + set_unique_id(cls->getID(), id); if (!cls->isCompleteDefinition()) { forward_declarations_.emplace( @@ -230,14 +236,14 @@ bool translation_unit_visitor::VisitClassTemplateSpecializationDecl( forward_declarations_.erase(id); } - if (diagram_.should_include(*template_specialization_ptr)) { + if (diagram().should_include(*template_specialization_ptr)) { LOG_DBG("Adding class template specialization {} with id {}", cls_full_name, id); - call_expression_context_.set_caller_id(id); - call_expression_context_.update(cls); + context().set_caller_id(id); + context().update(cls); - diagram_.add_participant(std::move(template_specialization_ptr)); + diagram().add_participant(std::move(template_specialization_ptr)); } return true; @@ -245,17 +251,16 @@ bool translation_unit_visitor::VisitClassTemplateSpecializationDecl( bool translation_unit_visitor::VisitCXXMethodDecl(clang::CXXMethodDecl *m) { - if (call_expression_context_.current_class_decl_ == nullptr && - call_expression_context_.current_class_template_decl_ == nullptr && - call_expression_context_.current_class_template_specialization_decl_ == - nullptr) + if (context().current_class_decl_ == nullptr && + context().current_class_template_decl_ == nullptr && + context().current_class_template_specialization_decl_ == nullptr) return true; LOG_DBG("= Processing method {} in class {} [{}]", m->getQualifiedNameAsString(), m->getParent()->getQualifiedNameAsString(), (void *)m->getParent()); - call_expression_context_.update(m); + context().update(m); auto m_ptr = std::make_unique( config().using_namespace()); @@ -269,17 +274,15 @@ bool translation_unit_visitor::VisitCXXMethodDecl(clang::CXXMethodDecl *m) clang::Decl *parent_decl = m->getParent(); - if (call_expression_context_.current_class_template_decl_) - parent_decl = call_expression_context_.current_class_template_decl_; - - call_expression_context_.dump(); + if (context().current_class_template_decl_) + parent_decl = context().current_class_template_decl_; LOG_DBG("Getting method's class with local id {}", parent_decl->getID()); const auto &method_class = diagram() .get_participant( - get_ast_local_id(parent_decl->getID()).value()) + get_unique_id(parent_decl->getID()).value()) .value(); m_ptr->set_class_id(method_class.id()); @@ -296,11 +299,11 @@ bool translation_unit_visitor::VisitCXXMethodDecl(clang::CXXMethodDecl *m) diagram().participants.at(m_ptr->class_id())->full_name(false) + "::" + m->getNameAsString()); - call_expression_context_.update(m); + context().update(m); - call_expression_context_.set_caller_id(m_ptr->id()); + context().set_caller_id(m_ptr->id()); - set_ast_local_id(m->getID(), m_ptr->id()); + set_unique_id(m->getID(), m_ptr->id()); diagram().add_participant(std::move(m_ptr)); @@ -324,7 +327,7 @@ bool translation_unit_visitor::VisitFunctionDecl(clang::FunctionDecl *f) if (f->getDescribedTemplate()) { // If the described templated of this function is already in the // model skip it: - if (get_ast_local_id(f->getDescribedTemplate()->getID())) + if (get_unique_id(f->getDescribedTemplate()->getID())) return true; } } @@ -334,11 +337,11 @@ bool translation_unit_visitor::VisitFunctionDecl(clang::FunctionDecl *f) f_ptr->set_id(common::to_id(f_ptr->full_name(false))); - call_expression_context_.update(f); + context().update(f); - call_expression_context_.set_caller_id(f_ptr->id()); + context().set_caller_id(f_ptr->id()); - set_ast_local_id(f->getID(), f_ptr->id()); + set_unique_id(f->getID(), f_ptr->id()); // TODO: Handle overloaded functions with different arguments diagram().add_participant(std::move(f_ptr)); @@ -353,11 +356,11 @@ bool translation_unit_visitor::VisitFunctionDecl(clang::FunctionDecl *f) f_ptr->set_namespace(ns); f_ptr->set_id(common::to_id(function_name)); - call_expression_context_.update(f); + context().update(f); - call_expression_context_.set_caller_id(f_ptr->id()); + context().set_caller_id(f_ptr->id()); - set_ast_local_id(f->getID(), f_ptr->id()); + set_unique_id(f->getID(), f_ptr->id()); // TODO: Handle overloaded functions with different arguments diagram().add_participant(std::move(f_ptr)); @@ -389,10 +392,10 @@ bool translation_unit_visitor::VisitFunctionTemplateDecl( f_ptr->set_id(common::to_id(f_ptr->full_name(false))); - call_expression_context_.update(function_template); - call_expression_context_.set_caller_id(f_ptr->id()); + context().update(function_template); + context().set_caller_id(f_ptr->id()); - set_ast_local_id(function_template->getID(), f_ptr->id()); + set_unique_id(function_template->getID(), f_ptr->id()); // TODO: Handle overloaded functions with different arguments diagram().add_participant(std::move(f_ptr)); @@ -417,15 +420,14 @@ bool translation_unit_visitor::VisitCallExpr(clang::CallExpr *expr) if (clang::dyn_cast_or_null(expr)) return true; - if (!call_expression_context_.valid()) + if (!context().valid()) return true; message m; m.type = message_t::kCall; - m.from = call_expression_context_.caller_id(); + m.from = context().caller_id(); - const auto ¤t_ast_context = - *call_expression_context_.get_ast_context(); + const auto ¤t_ast_context = *context().get_ast_context(); LOG_DBG("Visiting call expression at {}", expr->getBeginLoc().printToString(source_manager())); @@ -463,9 +465,9 @@ bool translation_unit_visitor::VisitCallExpr(clang::CallExpr *expr) const auto &participant = diagram() - .get_participant(get_ast_local_id( - callee_template_specialization->getID()) - .value()) + .get_participant( + get_unique_id(callee_template_specialization->getID()) + .value()) .value(); if (participant.is_implicit()) { @@ -476,7 +478,7 @@ bool translation_unit_visitor::VisitCallExpr(clang::CallExpr *expr) const auto &parent_template_participant = diagram() .get_participant( - get_ast_local_id(parent_template->getID()).value()) + get_unique_id(parent_template->getID()).value()) .value(); const auto parent_method_name = @@ -508,7 +510,7 @@ bool translation_unit_visitor::VisitCallExpr(clang::CallExpr *expr) m_ptr->set_name(method_decl->getNameAsString()); m_ptr->set_class_id(participant.id()); m_ptr->set_class_full_name(participant.full_name(false)); - set_ast_local_id(method_decl->getID(), m_ptr->id()); + set_unique_id(method_decl->getID(), m_ptr->id()); diagram().add_active_participant(m_ptr->id()); diagram().add_participant(std::move(m_ptr)); } @@ -516,7 +518,7 @@ bool translation_unit_visitor::VisitCallExpr(clang::CallExpr *expr) else { const auto &specialization_participant = diagram() - .get_participant(get_ast_local_id( + .get_participant(get_unique_id( callee_template_specialization->getID()) .value()) .value(); @@ -541,9 +543,9 @@ bool translation_unit_visitor::VisitCallExpr(clang::CallExpr *expr) LOG_DBG("Set callee method id {} for method name {}", m.to, method_decl->getQualifiedNameAsString()); - if (get_ast_local_id(callee_decl->getID())) + if (get_unique_id(callee_decl->getID())) diagram().add_active_participant( - get_ast_local_id(callee_decl->getID()).value()); + get_unique_id(callee_decl->getID()).value()); } // // Call to a function @@ -578,7 +580,7 @@ bool translation_unit_visitor::VisitCallExpr(clang::CallExpr *expr) auto callee_method_full_name = diagram() .participants - .at(get_ast_local_id(primary_template->getID()) + .at(get_unique_id(primary_template->getID()) .value()) ->full_name(false) + "::" + @@ -591,10 +593,9 @@ bool translation_unit_visitor::VisitCallExpr(clang::CallExpr *expr) dependent_member_callee->getMember().getAsString(); m.return_type = ""; - if (get_ast_local_id(primary_template->getID())) + if (get_unique_id(primary_template->getID())) diagram().add_active_participant( - get_ast_local_id(primary_template->getID()) - .value()); + get_unique_id(primary_template->getID()).value()); } } // @@ -615,7 +616,7 @@ bool translation_unit_visitor::VisitCallExpr(clang::CallExpr *expr) auto *ftd = clang::dyn_cast_or_null< clang::FunctionTemplateDecl>(decl); - m.to = get_ast_local_id(ftd->getID()).value(); + m.to = get_unique_id(ftd->getID()).value(); auto message_name = diagram() .get_participant( @@ -646,12 +647,12 @@ bool translation_unit_visitor::VisitCallExpr(clang::CallExpr *expr) std::unique_ptr f_ptr; - if (!get_ast_local_id(callee_function->getID()).has_value()) { + if (!get_unique_id(callee_function->getID()).has_value()) { // This is hopefully not an interesting call... return true; } else { - m.to = get_ast_local_id(callee_function->getID()).value(); + m.to = get_unique_id(callee_function->getID()).value(); } auto message_name = callee_name; @@ -701,7 +702,7 @@ translation_unit_visitor::create_class_declaration(clang::CXXRecordDecl *cls) assert(cls != nullptr); auto c_ptr{std::make_unique( - config_.using_namespace())}; + config().using_namespace())}; auto &c = *c_ptr; // TODO: refactor to method get_qualified_name() @@ -725,7 +726,7 @@ translation_unit_visitor::create_class_declaration(clang::CXXRecordDecl *cls) // First check if the parent has been added to the diagram as regular // class - id_opt = get_ast_local_id(local_id); + id_opt = get_unique_id(local_id); // If not, check if the parent template declaration is in the model if (!id_opt) { @@ -734,7 +735,7 @@ translation_unit_visitor::create_class_declaration(clang::CXXRecordDecl *cls) ->getID(); if (static_cast(parent) ->getDescribedTemplate()) - id_opt = get_ast_local_id(local_id); + id_opt = get_unique_id(local_id); } assert(id_opt); @@ -853,7 +854,7 @@ bool translation_unit_visitor::process_template_parameters( return false; } -void translation_unit_visitor::set_ast_local_id( +void translation_unit_visitor::set_unique_id( int64_t local_id, common::model::diagram_element::id_t global_id) { LOG_DBG("== Setting local element mapping {} --> {}", local_id, global_id); @@ -862,7 +863,7 @@ void translation_unit_visitor::set_ast_local_id( } std::optional -translation_unit_visitor::get_ast_local_id(int64_t local_id) const +translation_unit_visitor::get_unique_id(int64_t local_id) const { if (local_ast_id_map_.find(local_id) == local_ast_id_map_.end()) return {}; @@ -1121,7 +1122,7 @@ translation_unit_visitor::process_template_specialization( template_instantiation.set_id( common::to_id(template_instantiation.full_name(false))); - set_ast_local_id(cls->getID(), template_instantiation.id()); + set_unique_id(cls->getID(), template_instantiation.id()); return c_ptr; } @@ -1450,7 +1451,7 @@ translation_unit_visitor::build_template_instantiation( auto templated_decl_id = template_type.getTemplateName().getAsTemplateDecl()->getID(); // auto templated_decl_local_id = - // get_ast_local_id(templated_decl_id).value_or(0); + // get_unique_id(templated_decl_id).value_or(0); if (best_match_id > 0) { destination = best_match_full_name; diff --git a/src/sequence_diagram/visitor/translation_unit_visitor.h b/src/sequence_diagram/visitor/translation_unit_visitor.h index e892282a..27765512 100644 --- a/src/sequence_diagram/visitor/translation_unit_visitor.h +++ b/src/sequence_diagram/visitor/translation_unit_visitor.h @@ -176,7 +176,7 @@ public: clanguml::sequence_diagram::model::diagram &diagram, const clanguml::config::sequence_diagram &config); - bool shouldVisitTemplateInstantiations() { return true; } + bool shouldVisitTemplateInstantiations(); virtual bool VisitCallExpr(clang::CallExpr *expr); @@ -198,15 +198,17 @@ public: const clanguml::config::sequence_diagram &config() const; + call_expression_context &context(); + void finalize() { } /// Store the mapping from local clang entity id (obtained using /// getID()) method to clang-uml global id - void set_ast_local_id( + void set_unique_id( int64_t local_id, common::model::diagram_element::id_t global_id); /// Retrieve the global clang-uml entity id based on the clang local id - std::optional get_ast_local_id( + std::optional get_unique_id( int64_t local_id) const; private: From 0e3c69ce38676324f44a948dd14cc6538f5ac918 Mon Sep 17 00:00:00 2001 From: Bartek Kryza Date: Tue, 29 Nov 2022 22:08:46 +0100 Subject: [PATCH 29/77] Added smart pointer dereference sequence diagram test case --- .../visitor/translation_unit_visitor.cc | 63 ++++++++++++++----- .../visitor/translation_unit_visitor.h | 26 +++++++- tests/t20009/.clang-uml | 14 +++++ tests/t20009/t20009.cc | 25 ++++++++ tests/t20009/test_case.h | 47 ++++++++++++++ tests/test_cases.cc | 1 + tests/test_cases.yaml | 3 + 7 files changed, 161 insertions(+), 18 deletions(-) create mode 100644 tests/t20009/.clang-uml create mode 100644 tests/t20009/t20009.cc create mode 100644 tests/t20009/test_case.h diff --git a/src/sequence_diagram/visitor/translation_unit_visitor.cc b/src/sequence_diagram/visitor/translation_unit_visitor.cc index 0ff84b37..3b44e8c6 100644 --- a/src/sequence_diagram/visitor/translation_unit_visitor.cc +++ b/src/sequence_diagram/visitor/translation_unit_visitor.cc @@ -279,32 +279,29 @@ bool translation_unit_visitor::VisitCXXMethodDecl(clang::CXXMethodDecl *m) LOG_DBG("Getting method's class with local id {}", parent_decl->getID()); + set_unique_id(m->getID(), m_ptr->id()); + const auto &method_class = - diagram() - .get_participant( - get_unique_id(parent_decl->getID()).value()) - .value(); + get_participant(parent_decl).value(); m_ptr->set_class_id(method_class.id()); m_ptr->set_class_full_name(method_class.full_name(false)); m_ptr->set_name( - diagram().participants.at(m_ptr->class_id())->full_name_no_ns() + + get_participant(m_ptr->class_id()).value().full_name_no_ns() + "::" + m->getNameAsString()); m_ptr->set_id(common::to_id( - diagram().participants.at(m_ptr->class_id())->full_name(false) + + get_participant(m_ptr->class_id()).value().full_name(false) + "::" + m->getNameAsString())); LOG_DBG("Set id {} for method name {}", m_ptr->id(), - diagram().participants.at(m_ptr->class_id())->full_name(false) + + get_participant(m_ptr->class_id()).value().full_name(false) + "::" + m->getNameAsString()); context().update(m); context().set_caller_id(m_ptr->id()); - set_unique_id(m->getID(), m_ptr->id()); - diagram().add_participant(std::move(m_ptr)); return true; @@ -577,14 +574,36 @@ bool translation_unit_visitor::VisitCallExpr(clang::CallExpr *expr) ->getTemplateName() .getAsTemplateDecl(); - auto callee_method_full_name = - diagram() - .participants - .at(get_unique_id(primary_template->getID()) - .value()) - ->full_name(false) + - "::" + - dependent_member_callee->getMember().getAsString(); + std::string callee_method_full_name; + + // First check if the primary template is already in the + // participants map + if (get_participant(primary_template).has_value()) { + callee_method_full_name = + get_participant(primary_template) + .value() + .full_name(false) + + "::" + + dependent_member_callee->getMember().getAsString(); + } + else if (is_smart_pointer(primary_template)) { + // Otherwise check if it a smart pointer + primary_template->getTemplateParameters() + ->asArray() + .front(); + + if (get_participant(primary_template).has_value()) { + callee_method_full_name = + get_participant(primary_template) + .value() + .full_name(false) + + "::" + + dependent_member_callee->getMember() + .getAsString(); + } + else + return true; + } auto callee_id = common::to_id(callee_method_full_name); m.to = callee_id; @@ -696,6 +715,16 @@ bool translation_unit_visitor::VisitCallExpr(clang::CallExpr *expr) return true; } +bool translation_unit_visitor::is_smart_pointer( + const clang::TemplateDecl *primary_template) const +{ + return primary_template->getQualifiedNameAsString().find( + "std::unique_ptr") == 0 || + primary_template->getQualifiedNameAsString().find("std::shared_ptr") == + 0 || + primary_template->getQualifiedNameAsString().find("std::weak_ptr") == 0; +} + std::unique_ptr translation_unit_visitor::create_class_declaration(clang::CXXRecordDecl *cls) { diff --git a/src/sequence_diagram/visitor/translation_unit_visitor.h b/src/sequence_diagram/visitor/translation_unit_visitor.h index 27765512..9d1d2a96 100644 --- a/src/sequence_diagram/visitor/translation_unit_visitor.h +++ b/src/sequence_diagram/visitor/translation_unit_visitor.h @@ -202,6 +202,29 @@ public: void finalize() { } + template + common::optional_ref get_participant(const clang::Decl *decl) + { + assert(decl != nullptr); + + auto unique_participant_id = get_unique_id(decl->getID()); + if (!unique_participant_id.has_value()) + return {}; + + return get_participant(unique_participant_id.value()); + } + + template + common::optional_ref get_participant( + const common::model::diagram_element::id_t id) + { + if (diagram().participants.find(id) == diagram().participants.end()) + return {}; + + return common::optional_ref( + *(static_cast(diagram().participants.at(id).get()))); + } + /// Store the mapping from local clang entity id (obtained using /// getID()) method to clang-uml global id void set_unique_id( @@ -277,6 +300,8 @@ private: bool simplify_system_template(class_diagram::model::template_parameter &ct, const std::string &full_name); + bool is_smart_pointer(const clang::TemplateDecl *primary_template) const; + // Reference to the output diagram model clanguml::sequence_diagram::model::diagram &diagram_; @@ -296,5 +321,4 @@ private: common::model::access_t>> anonymous_struct_relationships_; }; - } diff --git a/tests/t20009/.clang-uml b/tests/t20009/.clang-uml new file mode 100644 index 00000000..6f8b97ea --- /dev/null +++ b/tests/t20009/.clang-uml @@ -0,0 +1,14 @@ +compilation_database_dir: .. +output_directory: puml +diagrams: + t20009_sequence: + type: sequence + glob: + - ../../tests/t20009/t20009.cc + include: + namespaces: + - clanguml::t20009 + using_namespace: + - clanguml::t20009 + start_from: + - function: "clanguml::t20009::tmain()" \ No newline at end of file diff --git a/tests/t20009/t20009.cc b/tests/t20009/t20009.cc new file mode 100644 index 00000000..ce9ae973 --- /dev/null +++ b/tests/t20009/t20009.cc @@ -0,0 +1,25 @@ +#include +#include + +namespace clanguml { +namespace t20009 { +template struct A { + void a(T arg) { } +}; + +template struct B { + void b(T arg) { a->a(arg); } + + std::unique_ptr> a; +}; + +void tmain() +{ + std::shared_ptr> bstring; + auto bint = std::make_unique>(); + + bstring->b("b"); + bint.get()->b(42); +} +} +} \ No newline at end of file diff --git a/tests/t20009/test_case.h b/tests/t20009/test_case.h new file mode 100644 index 00000000..9c29d06e --- /dev/null +++ b/tests/t20009/test_case.h @@ -0,0 +1,47 @@ +/** + * tests/t20009/test_case.h + * + * Copyright (c) 2021-2022 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("t20009", "[test-case][sequence]") +{ + auto [config, db] = load_config("t20009"); + + auto diagram = config.diagrams["t20009_sequence"]; + + REQUIRE(diagram->name == "t20009_sequence"); + + auto model = generate_sequence_diagram(*db, diagram); + + REQUIRE(model->name() == "t20009_sequence"); + + auto puml = generate_sequence_puml(diagram, *model); + AliasMatcher _A(puml); + + REQUIRE_THAT(puml, StartsWith("@startuml")); + REQUIRE_THAT(puml, EndsWith("@enduml\n")); + + // Check if all calls exist + REQUIRE_THAT(puml, HasCall(_A("tmain()"), _A("B"), "b")); + REQUIRE_THAT( + puml, HasCall(_A("B"), _A("A"), "a")); + + REQUIRE_THAT(puml, HasCall(_A("tmain()"), _A("B"), "b")); + REQUIRE_THAT(puml, HasCall(_A("B"), _A("A"), "a")); + + save_puml( + "./" + config.output_directory() + "/" + diagram->name + ".puml", puml); +} \ No newline at end of file diff --git a/tests/test_cases.cc b/tests/test_cases.cc index 74e7fe9a..1103de0a 100644 --- a/tests/test_cases.cc +++ b/tests/test_cases.cc @@ -255,6 +255,7 @@ using namespace clanguml::test::matchers; #include "t20006/test_case.h" #include "t20007/test_case.h" #include "t20008/test_case.h" +#include "t20009/test_case.h" /// /// Package diagram tests diff --git a/tests/test_cases.yaml b/tests/test_cases.yaml index 38b74d48..4fa3d254 100644 --- a/tests/test_cases.yaml +++ b/tests/test_cases.yaml @@ -172,6 +172,9 @@ test_cases: - name: t20008 title: Constexpr if sequence diagram test case description: + - name: t20009 + title: Smart pointer dereference call expression test case + description: Package diagrams: - name: t30001 title: Basic package diagram test case From 9c3d65bf473125a31c01773647b6ab26bedf856b Mon Sep 17 00:00:00 2001 From: Bartek Kryza Date: Tue, 29 Nov 2022 22:55:49 +0100 Subject: [PATCH 30/77] Added calls through pointers and references in template instantiation sequence diagram test case --- .../visitor/translation_unit_visitor.cc | 15 +++++++++- .../visitor/translation_unit_visitor.h | 4 +++ tests/t20006/t20006.cc | 29 ++++++++++++++++--- tests/t20006/test_case.h | 5 ++++ 4 files changed, 48 insertions(+), 5 deletions(-) diff --git a/src/sequence_diagram/visitor/translation_unit_visitor.cc b/src/sequence_diagram/visitor/translation_unit_visitor.cc index 3b44e8c6..b0bb88d3 100644 --- a/src/sequence_diagram/visitor/translation_unit_visitor.cc +++ b/src/sequence_diagram/visitor/translation_unit_visitor.cc @@ -567,7 +567,9 @@ bool translation_unit_visitor::VisitCallExpr(clang::CallExpr *expr) clang::dyn_cast_or_null( function_call_expr->getCallee()); - if (!dependent_member_callee->getBaseType().isNull()) { + if (is_callee_valid_template_specialization( + dependent_member_callee)) { + const auto *primary_template = dependent_member_callee->getBaseType() ->getAs() @@ -715,6 +717,17 @@ bool translation_unit_visitor::VisitCallExpr(clang::CallExpr *expr) return true; } +bool translation_unit_visitor::is_callee_valid_template_specialization( + const clang::CXXDependentScopeMemberExpr *dependent_member_callee) const +{ + return !dependent_member_callee->getBaseType().isNull() && + dependent_member_callee->getBaseType() + ->getAs() && + !dependent_member_callee->getBaseType() + ->getAs() + ->isPointerType(); +} + bool translation_unit_visitor::is_smart_pointer( const clang::TemplateDecl *primary_template) const { diff --git a/src/sequence_diagram/visitor/translation_unit_visitor.h b/src/sequence_diagram/visitor/translation_unit_visitor.h index 9d1d2a96..02d42516 100644 --- a/src/sequence_diagram/visitor/translation_unit_visitor.h +++ b/src/sequence_diagram/visitor/translation_unit_visitor.h @@ -302,6 +302,10 @@ private: bool is_smart_pointer(const clang::TemplateDecl *primary_template) const; + bool is_callee_valid_template_specialization( + const clang::CXXDependentScopeMemberExpr *dependent_member_callee) + const; + // Reference to the output diagram model clanguml::sequence_diagram::model::diagram &diagram_; diff --git a/tests/t20006/t20006.cc b/tests/t20006/t20006.cc index e0d6e2b3..f76e9d54 100644 --- a/tests/t20006/t20006.cc +++ b/tests/t20006/t20006.cc @@ -31,10 +31,27 @@ template struct BB { }; template struct BB { - void bb1(T t, std::string f) { aa_.aa2(t); } - void bb2(T t, std::string f) { aa_.aa1(t); } + void bb1(T t, std::string f) { aa_->aa2(t); } + void bb2(T t, std::string f) { aa_->aa1(t); } - AA aa_; + BB(AA *aa) + : aa_{aa} + { + } + + AA *aa_; +}; + +template struct BB { + void bb1(T t, float f) { bb2(t, f); } + void bb2(T t, float f) { aa_.aa2(t); } + + BB(AA &aa) + : aa_{aa} + { + } + + AA &aa_; }; void tmain() @@ -46,13 +63,17 @@ void tmain() bstring.b("bstring"); BB bbint; - BB bbstring; + AA aaint; + BB bbstring{&aaint}; + BB bbfloat{aaint}; bbint.bb1(1, 1); bbint.bb2(2, 2); bbstring.bb1(1, "calling aa2"); bbstring.bb2(1, "calling aa1"); + + bbfloat.bb1(1, 1.0f); } } } \ No newline at end of file diff --git a/tests/t20006/test_case.h b/tests/t20006/test_case.h index 539f8ffc..77ba8a6b 100644 --- a/tests/t20006/test_case.h +++ b/tests/t20006/test_case.h @@ -58,6 +58,11 @@ TEST_CASE("t20006", "[test-case][sequence]") REQUIRE_THAT( puml, HasCall(_A("BB"), _A("AA"), "aa1")); + REQUIRE_THAT(puml, HasCall(_A("tmain()"), _A("BB"), "bb1")); + REQUIRE_THAT( + puml, HasCall(_A("BB"), _A("BB"), "bb2")); + REQUIRE_THAT(puml, HasCall(_A("BB"), _A("AA"), "aa2")); + save_puml( "./" + config.output_directory() + "/" + diagram->name + ".puml", puml); } \ No newline at end of file From 115ede3cc7526ac2ae83387a2041454029d8c7ae Mon Sep 17 00:00:00 2001 From: Bartek Kryza Date: Wed, 30 Nov 2022 19:50:40 +0100 Subject: [PATCH 31/77] Added smart pointer alias to t20009 test case --- tests/t20009/t20009.cc | 4 ++++ tests/t20009/test_case.h | 2 ++ 2 files changed, 6 insertions(+) diff --git a/tests/t20009/t20009.cc b/tests/t20009/t20009.cc index ce9ae973..50d9fa3f 100644 --- a/tests/t20009/t20009.cc +++ b/tests/t20009/t20009.cc @@ -13,13 +13,17 @@ template struct B { std::unique_ptr> a; }; +using BFloatPtr = std::shared_ptr>; + void tmain() { std::shared_ptr> bstring; auto bint = std::make_unique>(); + BFloatPtr bfloat; bstring->b("b"); bint.get()->b(42); + bfloat->b(1.0); } } } \ No newline at end of file diff --git a/tests/t20009/test_case.h b/tests/t20009/test_case.h index 9c29d06e..359e625a 100644 --- a/tests/t20009/test_case.h +++ b/tests/t20009/test_case.h @@ -42,6 +42,8 @@ TEST_CASE("t20009", "[test-case][sequence]") REQUIRE_THAT(puml, HasCall(_A("tmain()"), _A("B"), "b")); REQUIRE_THAT(puml, HasCall(_A("B"), _A("A"), "a")); + REQUIRE_THAT(puml, HasCall(_A("tmain()"), _A("B"), "b")); + REQUIRE_THAT(puml, HasCall(_A("B"), _A("A"), "a")); save_puml( "./" + config.output_directory() + "/" + diagram->name + ".puml", puml); } \ No newline at end of file From 73f399c8a0c762444466dfd5e2e7a1bf0769b6f2 Mon Sep 17 00:00:00 2001 From: Bartek Kryza Date: Wed, 30 Nov 2022 20:21:37 +0100 Subject: [PATCH 32/77] Added standard container sequence diagram test case --- src/sequence_diagram/model/diagram.cc | 5 +++ tests/t20010/.clang-uml | 14 ++++++++ tests/t20010/t20010.cc | 39 ++++++++++++++++++++ tests/t20010/test_case.h | 52 +++++++++++++++++++++++++++ tests/test_cases.cc | 1 + tests/test_cases.yaml | 3 ++ 6 files changed, 114 insertions(+) create mode 100644 tests/t20010/.clang-uml create mode 100644 tests/t20010/t20010.cc create mode 100644 tests/t20010/test_case.h diff --git a/src/sequence_diagram/model/diagram.cc b/src/sequence_diagram/model/diagram.cc index 6f6616b6..a660adfd 100644 --- a/src/sequence_diagram/model/diagram.cc +++ b/src/sequence_diagram/model/diagram.cc @@ -85,6 +85,11 @@ void diagram::print() const LOG_DBG(" Activity id={}, from={}:", act.from, from_activity.full_name(false)); for (const auto &message : act.messages) { + if (participants.find(message.from) == participants.end()) + continue; + if (participants.find(message.to) == participants.end()) + continue; + const auto &from_participant = *participants.at(message.from); const auto &to_participant = *participants.at(message.to); diff --git a/tests/t20010/.clang-uml b/tests/t20010/.clang-uml new file mode 100644 index 00000000..55f2dd81 --- /dev/null +++ b/tests/t20010/.clang-uml @@ -0,0 +1,14 @@ +compilation_database_dir: .. +output_directory: puml +diagrams: + t20010_sequence: + type: sequence + glob: + - ../../tests/t20010/t20010.cc + include: + namespaces: + - clanguml::t20010 + using_namespace: + - clanguml::t20010 + start_from: + - function: "clanguml::t20010::tmain()" \ No newline at end of file diff --git a/tests/t20010/t20010.cc b/tests/t20010/t20010.cc new file mode 100644 index 00000000..3b8745cd --- /dev/null +++ b/tests/t20010/t20010.cc @@ -0,0 +1,39 @@ +#include +#include +#include +#include + +namespace clanguml { +namespace t20010 { + +struct A { + void a1() { } + void a2() { } + void a3() { } + void a4() { } +}; + +template struct B { + void b1() { a_.a1(); } + void b2() { avector_.front().a2(); } + void b3() { aptrvector_.front()->a3(); } + void b4() { amap_.at(0).a4(); } + + A a_; + std::vector avector_; + std::vector> aptrvector_; + std::map amap_; +}; + +void tmain() +{ + B b; + + b.b1(); + b.b2(); + b.b3(); + b.b4(); +} + +} +} \ No newline at end of file diff --git a/tests/t20010/test_case.h b/tests/t20010/test_case.h new file mode 100644 index 00000000..b2be4711 --- /dev/null +++ b/tests/t20010/test_case.h @@ -0,0 +1,52 @@ +/** + * tests/t20010/test_case.h + * + * Copyright (c) 2021-2022 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("t20010", "[test-case][sequence]") +{ + auto [config, db] = load_config("t20010"); + + auto diagram = config.diagrams["t20010_sequence"]; + + REQUIRE(diagram->name == "t20010_sequence"); + + auto model = generate_sequence_diagram(*db, diagram); + + REQUIRE(model->name() == "t20010_sequence"); + + auto puml = generate_sequence_puml(diagram, *model); + AliasMatcher _A(puml); + + REQUIRE_THAT(puml, StartsWith("@startuml")); + REQUIRE_THAT(puml, EndsWith("@enduml\n")); + + // Check if all calls exist + REQUIRE_THAT(puml, HasCall(_A("tmain()"), _A("B"), "b1")); + REQUIRE_THAT(puml, HasCall(_A("B"), _A("A"), "a1")); + + REQUIRE_THAT(puml, HasCall(_A("tmain()"), _A("B"), "b2")); + REQUIRE_THAT(puml, HasCall(_A("B"), _A("A"), "a2")); + + REQUIRE_THAT(puml, HasCall(_A("tmain()"), _A("B"), "b3")); + REQUIRE_THAT(puml, HasCall(_A("B"), _A("A"), "a3")); + + REQUIRE_THAT(puml, HasCall(_A("tmain()"), _A("B"), "b4")); + REQUIRE_THAT(puml, HasCall(_A("B"), _A("A"), "a4")); + + save_puml( + "./" + config.output_directory() + "/" + diagram->name + ".puml", puml); +} \ No newline at end of file diff --git a/tests/test_cases.cc b/tests/test_cases.cc index 1103de0a..96a4d2f6 100644 --- a/tests/test_cases.cc +++ b/tests/test_cases.cc @@ -256,6 +256,7 @@ using namespace clanguml::test::matchers; #include "t20007/test_case.h" #include "t20008/test_case.h" #include "t20009/test_case.h" +#include "t20010/test_case.h" /// /// Package diagram tests diff --git a/tests/test_cases.yaml b/tests/test_cases.yaml index 4fa3d254..7b1c8a53 100644 --- a/tests/test_cases.yaml +++ b/tests/test_cases.yaml @@ -175,6 +175,9 @@ test_cases: - name: t20009 title: Smart pointer dereference call expression test case description: + - name: t20010 + title: Container sequence diagram test case + description: Package diagrams: - name: t30001 title: Basic package diagram test case From 68241ea9c89edb336bd4b57d67dd3f0f849768de Mon Sep 17 00:00:00 2001 From: Bartek Kryza Date: Wed, 30 Nov 2022 21:11:11 +0100 Subject: [PATCH 33/77] Added recursive call generated in sequence diagram test case --- .../plantuml/sequence_diagram_generator.cc | 21 +++++--- .../plantuml/sequence_diagram_generator.h | 3 +- tests/t20011/.clang-uml | 14 ++++++ tests/t20011/t20011.cc | 31 ++++++++++++ tests/t20011/test_case.h | 48 +++++++++++++++++++ tests/test_cases.cc | 1 + tests/test_cases.yaml | 3 ++ 7 files changed, 114 insertions(+), 7 deletions(-) create mode 100644 tests/t20011/.clang-uml create mode 100644 tests/t20011/t20011.cc create mode 100644 tests/t20011/test_case.h diff --git a/src/sequence_diagram/generators/plantuml/sequence_diagram_generator.cc b/src/sequence_diagram/generators/plantuml/sequence_diagram_generator.cc index c5929be2..2c3a6b79 100644 --- a/src/sequence_diagram/generators/plantuml/sequence_diagram_generator.cc +++ b/src/sequence_diagram/generators/plantuml/sequence_diagram_generator.cc @@ -77,22 +77,29 @@ void generator::generate_return(const message &m, std::ostream &ostr) const } } -void generator::generate_activity(const activity &a, std::ostream &ostr) const +void generator::generate_activity(const activity &a, std::ostream &ostr, + std::set &visited) const { for (const auto &m : a.messages) { + visited.emplace(m.from); + const auto &to = m_model.get_participant(m.to); if (!to) continue; LOG_DBG("Generating message {} --> {}", m.from, m.to); + generate_call(m, ostr); ostr << "activate " << to.value().alias() << std::endl; if (m_model.sequences.find(m.to) != m_model.sequences.end()) { - LOG_DBG("Creating activity {} --> {} - missing sequence {}", m.from, - m.to, m.to); - generate_activity(m_model.sequences[m.to], ostr); + if (visited.find(m.to) == + visited.end()) { // break infinite recursion on recursive calls + LOG_DBG("Creating activity {} --> {} - missing sequence {}", + m.from, m.to, m.to); + generate_activity(m_model.sequences[m.to], ostr, visited); + } } else LOG_DBG("Skipping activity {} --> {} - missing sequence {}", m.from, @@ -165,7 +172,7 @@ void generator::generate(std::ostream &ostr) const for (const auto &sf : m_config.start_from()) { if (sf.location_type == source_location::location_t::function) { - std::int64_t start_from; + common::model::diagram_element::id_t start_from; for (const auto &[k, v] : m_model.sequences) { const auto &caller = *m_model.participants.at(v.from); std::string vfrom = caller.full_name(false); @@ -175,7 +182,9 @@ void generator::generate(std::ostream &ostr) const break; } } - generate_activity(m_model.sequences[start_from], ostr); + std::set visited_participants; + generate_activity( + m_model.sequences[start_from], ostr, visited_participants); } else { // TODO: Add support for other sequence start location types diff --git a/src/sequence_diagram/generators/plantuml/sequence_diagram_generator.h b/src/sequence_diagram/generators/plantuml/sequence_diagram_generator.h index 4621682c..fc3c82b9 100644 --- a/src/sequence_diagram/generators/plantuml/sequence_diagram_generator.h +++ b/src/sequence_diagram/generators/plantuml/sequence_diagram_generator.h @@ -55,7 +55,8 @@ public: void generate_participant(std::ostream &ostr, common::id_t id) const; void generate_activity(const clanguml::sequence_diagram::model::activity &a, - std::ostream &ostr) const; + std::ostream &ostr, + std::set &visited) const; void generate(std::ostream &ostr) const; diff --git a/tests/t20011/.clang-uml b/tests/t20011/.clang-uml new file mode 100644 index 00000000..9a2a29be --- /dev/null +++ b/tests/t20011/.clang-uml @@ -0,0 +1,14 @@ +compilation_database_dir: .. +output_directory: puml +diagrams: + t20011_sequence: + type: sequence + glob: + - ../../tests/t20011/t20011.cc + include: + namespaces: + - clanguml::t20011 + using_namespace: + - clanguml::t20011 + start_from: + - function: "clanguml::t20011::tmain()" \ No newline at end of file diff --git a/tests/t20011/t20011.cc b/tests/t20011/t20011.cc new file mode 100644 index 00000000..e4ba19c7 --- /dev/null +++ b/tests/t20011/t20011.cc @@ -0,0 +1,31 @@ +namespace clanguml { +namespace t20011 { + +struct A { + void a(int i = 10) + { + if (i > 0) + a(i - 1); + } + + void b(int i = 10) { c(i); } + void c(int i) { d(i); } + void d(int i) + { + if (i > 0) + b(i - 1); + else + a(); + } +}; + +void tmain() +{ + A a; + + a.a(); + + a.b(); +} +} +} \ No newline at end of file diff --git a/tests/t20011/test_case.h b/tests/t20011/test_case.h new file mode 100644 index 00000000..55638487 --- /dev/null +++ b/tests/t20011/test_case.h @@ -0,0 +1,48 @@ +/** + * tests/t20011/test_case.h + * + * Copyright (c) 2021-2022 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("t20011", "[test-case][sequence]") +{ + auto [config, db] = load_config("t20011"); + + auto diagram = config.diagrams["t20011_sequence"]; + + REQUIRE(diagram->name == "t20011_sequence"); + + auto model = generate_sequence_diagram(*db, diagram); + + REQUIRE(model->name() == "t20011_sequence"); + + auto puml = generate_sequence_puml(diagram, *model); + AliasMatcher _A(puml); + + REQUIRE_THAT(puml, StartsWith("@startuml")); + REQUIRE_THAT(puml, EndsWith("@enduml\n")); + + // Check if all calls exist + REQUIRE_THAT(puml, HasCall(_A("tmain()"), _A("A"), "a")); + REQUIRE_THAT(puml, HasCall(_A("A"), _A("A"), "a")); + + REQUIRE_THAT(puml, HasCall(_A("tmain()"), _A("A"), "b")); + REQUIRE_THAT(puml, HasCall(_A("A"), _A("A"), "c")); + REQUIRE_THAT(puml, HasCall(_A("A"), _A("A"), "d")); + REQUIRE_THAT(puml, HasCall(_A("A"), _A("A"), "b")); + + save_puml( + "./" + config.output_directory() + "/" + diagram->name + ".puml", puml); +} \ No newline at end of file diff --git a/tests/test_cases.cc b/tests/test_cases.cc index 96a4d2f6..287a9539 100644 --- a/tests/test_cases.cc +++ b/tests/test_cases.cc @@ -257,6 +257,7 @@ using namespace clanguml::test::matchers; #include "t20008/test_case.h" #include "t20009/test_case.h" #include "t20010/test_case.h" +#include "t20011/test_case.h" /// /// Package diagram tests diff --git a/tests/test_cases.yaml b/tests/test_cases.yaml index 7b1c8a53..5a46f621 100644 --- a/tests/test_cases.yaml +++ b/tests/test_cases.yaml @@ -178,6 +178,9 @@ test_cases: - name: t20010 title: Container sequence diagram test case description: + - name: t20011 + title: Recursive calls sequence diagram test case + description: Package diagrams: - name: t30001 title: Basic package diagram test case From 459baa326c7e0b283503d1b6c4c3cb9291f4bff0 Mon Sep 17 00:00:00 2001 From: Bartek Kryza Date: Wed, 30 Nov 2022 21:32:37 +0100 Subject: [PATCH 34/77] Updated test case documentation --- docs/test_cases.md | 3 + docs/test_cases/t00002_class.svg | 36 ++++---- docs/test_cases/t00003_class.svg | 46 +++++----- docs/test_cases/t00004_class.svg | 76 +++++++-------- docs/test_cases/t00005_class.svg | 110 +++++++++++----------- docs/test_cases/t00006_class.svg | 132 +++++++++++++------------- docs/test_cases/t00007_class.svg | 30 +++--- docs/test_cases/t00008_class.svg | 56 +++++------ docs/test_cases/t00009_class.svg | 32 +++---- docs/test_cases/t00010_class.svg | 34 +++---- docs/test_cases/t00011_class.svg | 22 ++--- docs/test_cases/t00012_class.svg | 66 ++++++------- docs/test_cases/t00013_class.svg | 82 ++++++++--------- docs/test_cases/t00014_class.svg | 116 +++++++++++------------ docs/test_cases/t00015_class.svg | 22 ++--- docs/test_cases/t00016_class.svg | 30 +++--- docs/test_cases/t00017_class.svg | 66 ++++++------- docs/test_cases/t00018_class.svg | 18 ++-- docs/test_cases/t00019_class.svg | 40 ++++---- docs/test_cases/t00020_class.svg | 38 ++++---- docs/test_cases/t00021_class.svg | 30 +++--- docs/test_cases/t00022_class.svg | 14 +-- docs/test_cases/t00023_class.svg | 26 +++--- docs/test_cases/t00024_class.svg | 22 ++--- docs/test_cases/t00025_class.svg | 34 +++---- docs/test_cases/t00026_class.svg | 42 ++++----- docs/test_cases/t00027_class.svg | 58 ++++++------ docs/test_cases/t00028_class.svg | 78 ++++++++-------- docs/test_cases/t00029_class.svg | 50 +++++----- docs/test_cases/t00030_class.svg | 46 +++++----- docs/test_cases/t00031_class.svg | 50 +++++----- docs/test_cases/t00032_class.svg | 40 ++++---- docs/test_cases/t00033_class.svg | 48 +++++----- docs/test_cases/t00034_class.svg | 46 +++++----- docs/test_cases/t00035_class.svg | 22 ++--- docs/test_cases/t00036_class.svg | 38 ++++---- docs/test_cases/t00037_class.svg | 54 +++++------ docs/test_cases/t00038_class.svg | 58 ++++++------ docs/test_cases/t00039_class.svg | 78 ++++++++-------- docs/test_cases/t00040_class.svg | 26 +++--- docs/test_cases/t00041_class.svg | 54 +++++------ docs/test_cases/t00042_class.svg | 36 ++++---- docs/test_cases/t00043_class.svg | 50 +++++----- docs/test_cases/t00044_class.svg | 36 ++++---- docs/test_cases/t00045_class.svg | 70 +++++++------- docs/test_cases/t00046_class.svg | 64 ++++++------- docs/test_cases/t00047_class.svg | 22 ++--- docs/test_cases/t00048_class.svg | 50 +++++----- docs/test_cases/t00049_class.svg | 32 +++---- docs/test_cases/t00050_class.svg | 70 +++++++------- docs/test_cases/t20006.md | 29 +++++- docs/test_cases/t20006_sequence.svg | 138 ++++++++++++++++------------ docs/test_cases/t20009.md | 53 +++++++++++ docs/test_cases/t20009_sequence.svg | 78 ++++++++++++++++ docs/test_cases/t20010.md | 63 +++++++++++++ docs/test_cases/t20010_sequence.svg | 68 ++++++++++++++ docs/test_cases/t20011.md | 55 +++++++++++ docs/test_cases/t20011_sequence.svg | 68 ++++++++++++++ docs/test_cases/t30001_package.svg | 48 +++++----- docs/test_cases/t30002_package.svg | 90 +++++++++--------- docs/test_cases/t30003_package.svg | 26 +++--- docs/test_cases/t30004_package.svg | 30 +++--- docs/test_cases/t30005_package.svg | 38 ++++---- docs/test_cases/t30006_package.svg | 16 ++-- docs/test_cases/t30007_package.svg | 20 ++-- docs/test_cases/t30008_package.svg | 34 +++---- docs/test_cases/t40001_include.svg | 30 +++--- docs/test_cases/t40002_include.svg | 34 +++---- docs/test_cases/t40003_include.svg | 50 +++++----- 69 files changed, 1899 insertions(+), 1468 deletions(-) create mode 100644 docs/test_cases/t20009.md create mode 100644 docs/test_cases/t20009_sequence.svg create mode 100644 docs/test_cases/t20010.md create mode 100644 docs/test_cases/t20010_sequence.svg create mode 100644 docs/test_cases/t20011.md create mode 100644 docs/test_cases/t20011_sequence.svg diff --git a/docs/test_cases.md b/docs/test_cases.md index f83226cd..6ce3591d 100644 --- a/docs/test_cases.md +++ b/docs/test_cases.md @@ -58,6 +58,9 @@ * [t20006](./test_cases/t20006.md) - Class template specialization basic sequence diagram * [t20007](./test_cases/t20007.md) - Class template variadic argument list sequence diagram * [t20008](./test_cases/t20008.md) - Constexpr if sequence diagram test case + * [t20009](./test_cases/t20009.md) - Smart pointer dereference call expression test case + * [t20010](./test_cases/t20010.md) - Container sequence diagram test case + * [t20011](./test_cases/t20011.md) - Recursive calls sequence diagram test case ## Package diagrams * [t30001](./test_cases/t30001.md) - Basic package diagram test case * [t30002](./test_cases/t30002.md) - Package dependency test case diff --git a/docs/test_cases/t00002_class.svg b/docs/test_cases/t00002_class.svg index 6f0c7aaa..c4575341 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_class.svg b/docs/test_cases/t00003_class.svg index 1e7e0dd9..cd0d7b8a 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_class.svg b/docs/test_cases/t00004_class.svg index 0614670c..30330ada 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,15 +59,15 @@ Red - - + + A::AA::AAA - + C::B @@ -75,8 +75,8 @@ int - - + + C @@ -84,39 +84,39 @@ T - + - + t : T - + - + b_int : B<int> - - + + C::AA - - + + C::AA::AAA - - + + C::AA::CCC @@ -125,8 +125,8 @@ CCC_2 - - + + C::B @@ -134,16 +134,16 @@ V - + - + b : V - - + + C::CC @@ -152,16 +152,16 @@ CC_2 - - + + detail::D - - + + detail::D::AA @@ -171,8 +171,8 @@ AA_3 - - + + detail::D::DD diff --git a/docs/test_cases/t00005_class.svg b/docs/test_cases/t00005_class.svg index 98f35a94..9c3476fe 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_class.svg b/docs/test_cases/t00006_class.svg index 2353ae08..6acb77c0 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,15 +146,15 @@ T - + - + data : std::vector<T> - + custom_container @@ -162,102 +162,102 @@ 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_class.svg b/docs/test_cases/t00007_class.svg index e4436cb9..91571177 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_class.svg b/docs/test_cases/t00008_class.svg index f18d5f4a..fdc11a1e 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,CMP,int N - + - + 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,15 +87,15 @@ T,C<> - + - + template_template : C<T> - + B @@ -103,18 +103,18 @@ int,Vector - - + + D - + - + ints : B<int,Vector> diff --git a/docs/test_cases/t00009_class.svg b/docs/test_cases/t00009_class.svg index ad647b11..54e28fbb 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,15 +18,15 @@ T - + - + value : T - + A @@ -34,7 +34,7 @@ int - + A @@ -42,7 +42,7 @@ std::string - + A @@ -50,32 +50,32 @@ 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_class.svg b/docs/test_cases/t00010_class.svg index 6be62f8a..d4501dda 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,22 +18,22 @@ T,P - + - + first : T - + - + second : P - + A @@ -41,8 +41,8 @@ T,std::string - - + + B @@ -50,15 +50,15 @@ T - + - + astring : A<T,std::string> - + B @@ -66,18 +66,18 @@ int - - + + C - + - + aintstring : B<int> diff --git a/docs/test_cases/t00011_class.svg b/docs/test_cases/t00011_class.svg index 6bd065c7..c5ec7c92 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_class.svg b/docs/test_cases/t00012_class.svg index 4d202f25..3e53d1ed 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,14 +60,14 @@ - + - + ints : std::array<T,sizeof...(Is)> - + A @@ -75,7 +75,7 @@ int,std::string,float - + A @@ -83,7 +83,7 @@ int,std::string,bool - + B @@ -91,7 +91,7 @@ 3,2,1 - + B @@ -99,7 +99,7 @@ 1,1,1,1 - + C @@ -107,50 +107,50 @@ 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_class.svg b/docs/test_cases/t00013_class.svg index 0bb5ff71..d363882f 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,15 +18,15 @@ T - + - + f : T - + ABCD::F @@ -34,70 +34,70 @@ int - - + + A - + - + a : int - - + + B - + - + b : int - - + + C - + - + c : int - - + + D - + - + d : int print(R * r) : void - - + + E @@ -105,16 +105,16 @@ T - + - + e : T - - + + G @@ -122,22 +122,22 @@ T,Args... - + - + g : T - + - + args : std::tuple<Args...> - + E @@ -145,7 +145,7 @@ int - + G @@ -153,7 +153,7 @@ int,float,std::string - + E @@ -161,25 +161,25 @@ std::string - - + + R - + - + gintstring : G<int,float,std::string> - + - + estring : E<std::string> diff --git a/docs/test_cases/t00014_class.svg b/docs/test_cases/t00014_class.svg index e22aadb3..92f32a74 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,37 +18,37 @@ T,P - + - + t : T - + - + p : P - - + + B - + - + value : std::string - + A @@ -56,7 +56,7 @@ T,std::string - + A @@ -64,7 +64,7 @@ T,std::unique_ptr<std::string> - + A @@ -72,7 +72,7 @@ long,T - + A @@ -80,7 +80,7 @@ double,T - + A @@ -88,7 +88,7 @@ long,U - + A @@ -96,7 +96,7 @@ long,bool - + A @@ -104,7 +104,7 @@ double,bool - + A @@ -112,7 +112,7 @@ long,float - + A @@ -120,7 +120,7 @@ double,float - + A @@ -128,7 +128,7 @@ bool,std::string - + A @@ -136,7 +136,7 @@ float,std::unique_ptr<std::string> - + A @@ -144,7 +144,7 @@ int,std::string - + A @@ -152,7 +152,7 @@ std::string,std::string - + A @@ -160,7 +160,7 @@ char,std::string - + A @@ -168,116 +168,116 @@ wchar_t,std::string - - + + R - + - + 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 - + - + bs : BVector - + - + bs2 : BVector2 - + - + cb : SimpleCallback<ACharString> - + - + gcb : GenericCallback<R::AWCharString> - + - + vcb : VoidCallback - + - + vps : VectorPtr<B> diff --git a/docs/test_cases/t00015_class.svg b/docs/test_cases/t00015_class.svg index 2e7f1fb9..52073a75 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_class.svg b/docs/test_cases/t00016_class.svg index 0e0a9fbb..8d042296 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<> @@ -19,8 +19,8 @@ value : enum - - + + is_numeric @@ -29,8 +29,8 @@ value : enum - - + + is_numeric @@ -41,8 +41,8 @@ value : enum - - + + is_numeric @@ -53,8 +53,8 @@ value : enum - - + + is_numeric @@ -65,8 +65,8 @@ value : enum - - + + is_numeric @@ -77,8 +77,8 @@ value : enum - - + + is_numeric diff --git a/docs/test_cases/t00017_class.svg b/docs/test_cases/t00017_class.svg index 294bb955..5c5fb6de 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_class.svg b/docs/test_cases/t00018_class.svg index 554ff2fd..56c0cce5 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_class.svg b/docs/test_cases/t00019_class.svg index 3d2054a0..4d60d4cc 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,7 +83,7 @@ m1_calls() const : int m2_calls() const : int - + Layer3 @@ -91,7 +91,7 @@ Base - + Layer2 @@ -99,7 +99,7 @@ Layer3<Base> - + Layer1 @@ -107,18 +107,18 @@ Layer2<Layer3<Base>> - - + + A - + - + layers : std::unique_ptr<Layer1<Layer2<Layer3<Base>>>> diff --git a/docs/test_cases/t00020_class.svg b/docs/test_cases/t00020_class.svg index 5c5f7619..6d116e3f 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_class.svg b/docs/test_cases/t00021_class.svg index 918562ae..60b3803d 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_class.svg b/docs/test_cases/t00022_class.svg index d4f3436a..88c0d44a 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_class.svg b/docs/test_cases/t00023_class.svg index 132598f2..c9a9f1fb 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_class.svg b/docs/test_cases/t00024_class.svg index a44f01c6..f2966c61 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_class.svg b/docs/test_cases/t00025_class.svg index dafec971..6152bf3f 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,7 +56,7 @@ m1() : void m2() : void - + Proxy @@ -64,7 +64,7 @@ Target1 - + Proxy @@ -72,25 +72,25 @@ Target2 - - + + ProxyHolder - + - + proxy1 : Proxy<Target1> - + - + proxy2 : Proxy<Target2> diff --git a/docs/test_cases/t00026_class.svg b/docs/test_cases/t00026_class.svg index 58e22af3..c96b80dd 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>(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,7 +78,7 @@ state(const std::string & n) : Memento<T> & set_state(const std::string & s, Memento<T> && m) : void - + Caretaker @@ -86,7 +86,7 @@ std::string - + Originator @@ -94,25 +94,25 @@ std::string - - + + StringMemento - + - + caretaker : Caretaker<std::string> - + - + originator : Originator<std::string> diff --git a/docs/test_cases/t00027_class.svg b/docs/test_cases/t00027_class.svg index c1429930..71ba3eee 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,14 @@ ~Shape() = default : void - + Line - - + + Line @@ -39,14 +39,14 @@ display() : void - + Text - - + + Text @@ -57,8 +57,8 @@ display() : void - - + + ShapeDecorator @@ -67,8 +67,8 @@ display() = 0 : void - - + + Color @@ -79,8 +79,8 @@ display() : void - - + + Weight @@ -91,7 +91,7 @@ display() : void - + Line @@ -99,7 +99,7 @@ Color,Weight - + Line @@ -107,7 +107,7 @@ Color - + Text @@ -115,7 +115,7 @@ Color,Weight - + Text @@ -123,39 +123,39 @@ Color - - + + Window - + - + border : Line<Color,Weight> - + - + divider : Line<Color> - + - + title : Text<Color,Weight> - + - + description : Text<Color> diff --git a/docs/test_cases/t00028_class.svg b/docs/test_cases/t00028_class.svg index ce780edf..3bbf554a 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,10 +94,10 @@ three - + F enum note. - + E @@ -105,59 +105,59 @@ 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. diff --git a/docs/test_cases/t00029_class.svg b/docs/test_cases/t00029_class.svg index a11d0af9..dbc6f004 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_class.svg b/docs/test_cases/t00030_class.svg index 5e5cd290..afb46d35 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_class.svg b/docs/test_cases/t00031_class.svg index 9249af8a..8761c1c4 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,23 +47,23 @@ T - + - + ttt : T - - + + D - + C @@ -71,39 +71,39 @@ int - - + + R - + - + aaa : A * - + - + bbb : std::vector<B> - + - + ccc : C<int> - + - + ddd : D * diff --git a/docs/test_cases/t00032_class.svg b/docs/test_cases/t00032_class.svg index c253c35b..2500516b 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,15 +64,15 @@ T,L,Ts... - + - + counter : L - + Overload @@ -80,18 +80,18 @@ TBase,int,A,B,C - - + + R - + - + overload : Overload<TBase,int,A,B,C> diff --git a/docs/test_cases/t00033_class.svg b/docs/test_cases/t00033_class.svg index 0bb9001f..552c4a3d 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,30 +52,30 @@ T - + - + ccc : T - - + + D - + - + ddd : int - + C @@ -83,7 +83,7 @@ D - + B @@ -91,7 +91,7 @@ std::unique_ptr<C<D>> - + A @@ -99,18 +99,18 @@ B<std::unique_ptr<C<D>>> - - + + R - + - + abc : A<B<std::unique_ptr<C<D>>>> diff --git a/docs/test_cases/t00034_class.svg b/docs/test_cases/t00034_class.svg index 52d266d0..c266234b 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,16 +31,16 @@ - - + + lift_void - - + + lift_void @@ -49,8 +49,8 @@ - - + + drop_void @@ -59,16 +59,16 @@ - - + + drop_void - - + + drop_void @@ -77,33 +77,33 @@ - - + + A - - + + R - + - + la : lift_void_t<A> * - + - + lv : lift_void_t<void> * diff --git a/docs/test_cases/t00035_class.svg b/docs/test_cases/t00035_class.svg index fb2ee6b6..6a456a5c 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_class.svg b/docs/test_cases/t00036_class.svg index 3d87678c..9de74829 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,15 +43,15 @@ T - + - + a : T - + A @@ -59,23 +59,23 @@ int - - + + B - + - + a_int : A<int> - - + + C diff --git a/docs/test_cases/t00037_class.svg b/docs/test_cases/t00037_class.svg index 8039be44..456d678a 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 : struct (anonymous struct at /home/bartek/devel/clang-uml-libtooling/tests/t00037/t00037.cc:6:5) - + - + units : struct (anonymous struct at /home/bartek/devel/clang-uml-libtooling/tests/t00037/t00037.cc:14:5) - - + + 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_class.svg b/docs/test_cases/t00038_class.svg index 7d49b3b2..a4cdf1ff 100644 --- a/docs/test_cases/t00038_class.svg +++ b/docs/test_cases/t00038_class.svg @@ -1,6 +1,6 @@ - + @@ -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,16 +88,16 @@ - - + + map - - + + map @@ -106,8 +106,8 @@ - - + + map @@ -116,8 +116,8 @@ - - + + map @@ -126,8 +126,8 @@ - - + + map diff --git a/docs/test_cases/t00039_class.svg b/docs/test_cases/t00039_class.svg index 42f550c6..0a2d04bb 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_class.svg b/docs/test_cases/t00040_class.svg index f2f28d80..317895bb 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_class.svg b/docs/test_cases/t00041_class.svg index 44f2c920..cee40d52 100644 --- a/docs/test_cases/t00041_class.svg +++ b/docs/test_cases/t00041_class.svg @@ -1,6 +1,6 @@ - + @@ -9,100 +9,100 @@ - - + + R - - + + D - + - + rr : RR * - - + + E - - + + F - - + + RR - + - + e : E * - + - + f : F * - + - + g : detail::G * - - + + RRR - - + + ns1::N - - + + ns1::NN - - + + ns1::NM diff --git a/docs/test_cases/t00042_class.svg b/docs/test_cases/t00042_class.svg index 14341b7a..74906e7a 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,22 +52,22 @@ T,K - + - + b : T - + - + bb : K - + A @@ -75,7 +75,7 @@ double - + A @@ -83,7 +83,7 @@ std::string - + B diff --git a/docs/test_cases/t00043_class.svg b/docs/test_cases/t00043_class.svg index fc2fbde5..8448b01b 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_class.svg b/docs/test_cases/t00044_class.svg index 79f7e9d9..9cbbb7ad 100644 --- a/docs/test_cases/t00044_class.svg +++ b/docs/test_cases/t00044_class.svg @@ -1,6 +1,6 @@ - + @@ -9,7 +9,7 @@ - + signal_handler @@ -17,8 +17,8 @@ ,A - - + + sink @@ -27,15 +27,15 @@ sink<signal_handler<type-parameter-0-0 (type-parameter-0-1...), type-parameter-0-2> >(sink<signal_handler<type-parameter-0-0 (type-parameter-0-1...),type-parameter-0-2>>::signal_t & sh) : void - + - + signal : sink<signal_handler<type-parameter-0-0 (type-parameter-0-1...),type-parameter-0-2>>::signal_t * - - + + sink @@ -46,23 +46,23 @@ sink<signal_handler<type-parameter-0-0 (type-parameter-0-1...), type-parameter-0-2> >(sink<signal_handler<type-parameter-0-0 (type-parameter-0-1...),type-parameter-0-2>>::signal_t & sh) : void - + - + signal : sink<signal_handler<type-parameter-0-0 (type-parameter-0-1...),type-parameter-0-2>>::signal_t * - - + + signal_handler - - + + signal_handler @@ -71,8 +71,8 @@ - - + + signal_handler @@ -81,8 +81,8 @@ - - + + sink diff --git a/docs/test_cases/t00045_class.svg b/docs/test_cases/t00045_class.svg index b5acf81e..c08e32e4 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_class.svg b/docs/test_cases/t00046_class.svg index fede75c0..12b8006c 100644 --- a/docs/test_cases/t00046_class.svg +++ b/docs/test_cases/t00046_class.svg @@ -1,6 +1,6 @@ - + @@ -9,118 +9,118 @@ - + ns1 - + ns2 - + __gnu_cxx - - + + A - - + + A - - + + B - - + + C - - + + D - - + + E - - + + R - + - + a : ns1::ns2::A * - + - + ns1_a : ns1::A * - + - + ns1_ns2_a : ns1::ns2::A * - + - + root_a : ::A * - + - + i : std::vector<std::uint8_t> foo(AA & aa) : void - - + + A - - + + AA diff --git a/docs/test_cases/t00047_class.svg b/docs/test_cases/t00047_class.svg index aed11324..a6610525 100644 --- a/docs/test_cases/t00047_class.svg +++ b/docs/test_cases/t00047_class.svg @@ -1,6 +1,6 @@ - + @@ -9,16 +9,16 @@ - - + + conditional_t - - + + conditional_t @@ -27,8 +27,8 @@ - - + + conditional_t @@ -37,8 +37,8 @@ - - + + conditional_t @@ -47,8 +47,8 @@ - - + + conditional_t diff --git a/docs/test_cases/t00048_class.svg b/docs/test_cases/t00048_class.svg index e5859ff1..3acce986 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_class.svg b/docs/test_cases/t00049_class.svg index 5ca3b880..7dbd2ee0 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,17 +18,17 @@ T - + - + a : T get_a() : T & - + A @@ -36,7 +36,7 @@ intmap - + A @@ -44,7 +44,7 @@ thestring - + A @@ -52,32 +52,32 @@ std::vector<thestring> - - + + R - + - + a_string : A<thestring> - + - + a_vector_string : A<string_vector> - + - + a_int_map : A<intmap> diff --git a/docs/test_cases/t00050_class.svg b/docs/test_cases/t00050_class.svg index d44f6923..68c757b9 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 diff --git a/docs/test_cases/t20006.md b/docs/test_cases/t20006.md index 97ad9e3f..3c16a989 100644 --- a/docs/test_cases/t20006.md +++ b/docs/test_cases/t20006.md @@ -52,10 +52,27 @@ template struct BB { }; template struct BB { - void bb1(T t, std::string f) { aa_.aa2(t); } - void bb2(T t, std::string f) { aa_.aa1(t); } + void bb1(T t, std::string f) { aa_->aa2(t); } + void bb2(T t, std::string f) { aa_->aa1(t); } - AA aa_; + BB(AA *aa) + : aa_{aa} + { + } + + AA *aa_; +}; + +template struct BB { + void bb1(T t, float f) { bb2(t, f); } + void bb2(T t, float f) { aa_.aa2(t); } + + BB(AA &aa) + : aa_{aa} + { + } + + AA &aa_; }; void tmain() @@ -67,13 +84,17 @@ void tmain() bstring.b("bstring"); BB bbint; - BB bbstring; + AA aaint; + BB bbstring{&aaint}; + BB bbfloat{aaint}; bbint.bb1(1, 1); bbint.bb2(2, 2); bbstring.bb1(1, "calling aa2"); bbstring.bb2(1, "calling aa1"); + + bbfloat.bb1(1, 1.0f); } } } diff --git a/docs/test_cases/t20006_sequence.svg b/docs/test_cases/t20006_sequence.svg index 47f4323b..1a4faac0 100644 --- a/docs/test_cases/t20006_sequence.svg +++ b/docs/test_cases/t20006_sequence.svg @@ -1,6 +1,6 @@ - + - + @@ -9,70 +9,81 @@ - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + tmain() - - tmain() - + + tmain() + B<int> - - B<int> - + + B<int> + A<int> - - A<int> - + + A<int> + B<std::string> - - B<std::string> - + + B<std::string> + A<std::string> - - A<std::string> - + + A<std::string> + BB<int,int> - - BB<int,int> - + + BB<int,int> + AA<int> - - AA<int> - + + AA<int> + BB<int,std::string> - - BB<int,std::string> - - - - - - - - - - - - + + BB<int,std::string> + + BB<int,float> + + BB<int,float> + + + + + + + + + + + + + + + b() @@ -117,5 +128,16 @@ aa1() + + + bb1() + + + + + bb2() + + + aa2() diff --git a/docs/test_cases/t20009.md b/docs/test_cases/t20009.md new file mode 100644 index 00000000..e73dcf56 --- /dev/null +++ b/docs/test_cases/t20009.md @@ -0,0 +1,53 @@ +# t20009 - Smart pointer dereference call expression test case +## Config +```yaml +compilation_database_dir: .. +output_directory: puml +diagrams: + t20009_sequence: + type: sequence + glob: + - ../../tests/t20009/t20009.cc + include: + namespaces: + - clanguml::t20009 + using_namespace: + - clanguml::t20009 + start_from: + - function: "clanguml::t20009::tmain()" +``` +## Source code +File t20009.cc +```cpp +#include +#include + +namespace clanguml { +namespace t20009 { +template struct A { + void a(T arg) { } +}; + +template struct B { + void b(T arg) { a->a(arg); } + + std::unique_ptr> a; +}; + +using BFloatPtr = std::shared_ptr>; + +void tmain() +{ + std::shared_ptr> bstring; + auto bint = std::make_unique>(); + BFloatPtr bfloat; + + bstring->b("b"); + bint.get()->b(42); + bfloat->b(1.0); +} +} +} +``` +## Generated UML diagrams +![t20009_sequence](./t20009_sequence.svg "Smart pointer dereference call expression test case") diff --git a/docs/test_cases/t20009_sequence.svg b/docs/test_cases/t20009_sequence.svg new file mode 100644 index 00000000..e101f432 --- /dev/null +++ b/docs/test_cases/t20009_sequence.svg @@ -0,0 +1,78 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + 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() + + + a() + + + b() + + + a() + + + b() + + + a() + + diff --git a/docs/test_cases/t20010.md b/docs/test_cases/t20010.md new file mode 100644 index 00000000..0a067b96 --- /dev/null +++ b/docs/test_cases/t20010.md @@ -0,0 +1,63 @@ +# t20010 - Container sequence diagram test case +## Config +```yaml +compilation_database_dir: .. +output_directory: puml +diagrams: + t20010_sequence: + type: sequence + glob: + - ../../tests/t20010/t20010.cc + include: + namespaces: + - clanguml::t20010 + using_namespace: + - clanguml::t20010 + start_from: + - function: "clanguml::t20010::tmain()" +``` +## Source code +File t20010.cc +```cpp +#include +#include +#include +#include + +namespace clanguml { +namespace t20010 { + +struct A { + void a1() { } + void a2() { } + void a3() { } + void a4() { } +}; + +template struct B { + void b1() { a_.a1(); } + void b2() { avector_.front().a2(); } + void b3() { aptrvector_.front()->a3(); } + void b4() { amap_.at(0).a4(); } + + A a_; + std::vector avector_; + std::vector> aptrvector_; + std::map amap_; +}; + +void tmain() +{ + B b; + + b.b1(); + b.b2(); + b.b3(); + b.b4(); +} + +} +} +``` +## Generated UML diagrams +![t20010_sequence](./t20010_sequence.svg "Container sequence diagram test case") diff --git a/docs/test_cases/t20010_sequence.svg b/docs/test_cases/t20010_sequence.svg new file mode 100644 index 00000000..b44353af --- /dev/null +++ b/docs/test_cases/t20010_sequence.svg @@ -0,0 +1,68 @@ + + + + + + + + + + + + + + + + + + + + + + + + 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 new file mode 100644 index 00000000..3c9f43ef --- /dev/null +++ b/docs/test_cases/t20011.md @@ -0,0 +1,55 @@ +# t20011 - Recursive calls sequence diagram test case +## Config +```yaml +compilation_database_dir: .. +output_directory: puml +diagrams: + t20011_sequence: + type: sequence + glob: + - ../../tests/t20011/t20011.cc + include: + namespaces: + - clanguml::t20011 + using_namespace: + - clanguml::t20011 + start_from: + - function: "clanguml::t20011::tmain()" +``` +## Source code +File t20011.cc +```cpp +namespace clanguml { +namespace t20011 { + +struct A { + void a(int i = 10) + { + if (i > 0) + a(i - 1); + } + + void b(int i = 10) { c(i); } + void c(int i) { d(i); } + void d(int i) + { + if (i > 0) + b(i - 1); + else + a(); + } +}; + +void tmain() +{ + A a; + + a.a(); + + a.b(); +} +} +} +``` +## Generated UML diagrams +![t20011_sequence](./t20011_sequence.svg "Recursive calls sequence diagram test case") diff --git a/docs/test_cases/t20011_sequence.svg b/docs/test_cases/t20011_sequence.svg new file mode 100644 index 00000000..a1ef2360 --- /dev/null +++ b/docs/test_cases/t20011_sequence.svg @@ -0,0 +1,68 @@ + + + + + + + + + + + + + + + + + + + + + + tmain() + + tmain() + + A + + A + + + + + + + + + + a() + + + + + a() + + + b() + + + + + c() + + + + + d() + + + + + b() + + + + + a() + + diff --git a/docs/test_cases/t30001_package.svg b/docs/test_cases/t30001_package.svg index a7a7cfa2..51dc72a3 100644 --- a/docs/test_cases/t30001_package.svg +++ b/docs/test_cases/t30001_package.svg @@ -1,6 +1,6 @@ - + @@ -9,63 +9,63 @@ - - + + 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_package.svg b/docs/test_cases/t30002_package.svg index 82de51ef..4c7afedd 100644 --- a/docs/test_cases/t30002_package.svg +++ b/docs/test_cases/t30002_package.svg @@ -1,6 +1,6 @@ - + @@ -9,113 +9,113 @@ - - + + A - - + + AA - - + + B - - + + BB - - + + A1 - - + + A2 - - + + A3 - - + + A4 - - + + A5 - - + + A6 - - + + A7 - - + + A8 - - + + A9 - - + + A10 - - + + A11 - - + + A12 - - + + A13 - - + + A14 - - + + A15 - - + + A16 - - + + A17 - - + + BBB diff --git a/docs/test_cases/t30003_package.svg b/docs/test_cases/t30003_package.svg index ffa1efc0..036a242d 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_package.svg b/docs/test_cases/t30004_package.svg index 667fd760..74083c67 100644 --- a/docs/test_cases/t30004_package.svg +++ b/docs/test_cases/t30004_package.svg @@ -1,6 +1,6 @@ - + @@ -9,40 +9,40 @@ - - + + A - + Package AAA. - + Package BBB. - + CCCC package note. - + We skipped DDD. - - + + AAA - - + + BBB - - + + CCC - - + + EEE diff --git a/docs/test_cases/t30005_package.svg b/docs/test_cases/t30005_package.svg index 6b25b317..0fd6e399 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_package.svg b/docs/test_cases/t30006_package.svg index c3592d7a..f393147e 100644 --- a/docs/test_cases/t30006_package.svg +++ b/docs/test_cases/t30006_package.svg @@ -1,6 +1,6 @@ - + @@ -9,22 +9,22 @@ - - + + B - - + + A - - + + C - + Top A note. diff --git a/docs/test_cases/t30007_package.svg b/docs/test_cases/t30007_package.svg index 771a1fd7..e65c5a47 100644 --- a/docs/test_cases/t30007_package.svg +++ b/docs/test_cases/t30007_package.svg @@ -1,6 +1,6 @@ - + @@ -9,27 +9,27 @@ - - + + A - - + + B - - + + AA - - + + C - + Compare layout with t30006. diff --git a/docs/test_cases/t30008_package.svg b/docs/test_cases/t30008_package.svg index ca832552..a8b86c37 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/t40001_include.svg b/docs/test_cases/t40001_include.svg index f1ee6c66..2ff44cdf 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 diff --git a/docs/test_cases/t40002_include.svg b/docs/test_cases/t40002_include.svg index 1ffbac23..c2f3fd49 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_include.svg b/docs/test_cases/t40003_include.svg index 6a7e9f1e..9cfa840e 100644 --- a/docs/test_cases/t40003_include.svg +++ b/docs/test_cases/t40003_include.svg @@ -1,6 +1,6 @@ - + @@ -9,66 +9,66 @@ - + include - + dependants - + dependencies - + src - + dependants - + dependencies - - + + t3.h - - + + t2.h - - + + t1.h - - + + t3.h - - + + t2.h - - + + t1.h - - + + t5.h - - + + t1.cc - - + + t2.cc From d1d4d5e0e7b42f611eec04e66d9765188f3ab14a Mon Sep 17 00:00:00 2001 From: Bartek Kryza Date: Sun, 4 Dec 2022 01:33:02 +0100 Subject: [PATCH 35/77] Adding handling of lambda expressions in sequence diagrams --- .../plantuml/sequence_diagram_generator.cc | 23 +- .../plantuml/sequence_diagram_generator.h | 2 +- src/sequence_diagram/model/participant.h | 11 + .../visitor/translation_unit_visitor.cc | 198 +++++++++++++++++- .../visitor/translation_unit_visitor.h | 36 +++- tests/t20012/.clang-uml | 14 ++ tests/t20012/t20012.cc | 73 +++++++ tests/t20012/test_case.h | 66 ++++++ tests/test_cases.cc | 1 + 9 files changed, 416 insertions(+), 8 deletions(-) create mode 100644 tests/t20012/.clang-uml create mode 100644 tests/t20012/t20012.cc create mode 100644 tests/t20012/test_case.h diff --git a/src/sequence_diagram/generators/plantuml/sequence_diagram_generator.cc b/src/sequence_diagram/generators/plantuml/sequence_diagram_generator.cc index 2c3a6b79..a425c010 100644 --- a/src/sequence_diagram/generators/plantuml/sequence_diagram_generator.cc +++ b/src/sequence_diagram/generators/plantuml/sequence_diagram_generator.cc @@ -78,10 +78,10 @@ void generator::generate_return(const message &m, std::ostream &ostr) const } void generator::generate_activity(const activity &a, std::ostream &ostr, - std::set &visited) const + std::vector &visited) const { for (const auto &m : a.messages) { - visited.emplace(m.from); + visited.push_back(m.from); const auto &to = m_model.get_participant(m.to); if (!to) @@ -94,12 +94,16 @@ void generator::generate_activity(const activity &a, std::ostream &ostr, ostr << "activate " << to.value().alias() << std::endl; if (m_model.sequences.find(m.to) != m_model.sequences.end()) { - if (visited.find(m.to) == + if (std::find(visited.begin(), visited.end(), m.to) == visited.end()) { // break infinite recursion on recursive calls LOG_DBG("Creating activity {} --> {} - missing sequence {}", m.from, m.to, m.to); generate_activity(m_model.sequences[m.to], ostr, visited); } +// else { +// // clear the visited list after breaking the loop +// visited.clear(); +// } } else LOG_DBG("Skipping activity {} --> {} - missing sequence {}", m.from, @@ -107,6 +111,8 @@ void generator::generate_activity(const activity &a, std::ostream &ostr, generate_return(m, ostr); + visited.pop_back(); + ostr << "deactivate " << to.value().alias() << std::endl; } } @@ -182,9 +188,18 @@ void generator::generate(std::ostream &ostr) const break; } } - std::set visited_participants; + std::vector visited_participants; + + const auto& from = m_model.get_participant(start_from); + + generate_participant(ostr, start_from); + + ostr << "activate " << from.value().alias() << std::endl; + generate_activity( m_model.sequences[start_from], ostr, visited_participants); + + ostr << "deactivate " << from.value().alias() << std::endl; } else { // TODO: Add support for other sequence start location types diff --git a/src/sequence_diagram/generators/plantuml/sequence_diagram_generator.h b/src/sequence_diagram/generators/plantuml/sequence_diagram_generator.h index fc3c82b9..e2148bee 100644 --- a/src/sequence_diagram/generators/plantuml/sequence_diagram_generator.h +++ b/src/sequence_diagram/generators/plantuml/sequence_diagram_generator.h @@ -56,7 +56,7 @@ public: void generate_activity(const clanguml::sequence_diagram::model::activity &a, std::ostream &ostr, - std::set &visited) const; + std::vector &visited) const; void generate(std::ostream &ostr) const; diff --git a/src/sequence_diagram/model/participant.h b/src/sequence_diagram/model/participant.h index 2720bef5..d2abc452 100644 --- a/src/sequence_diagram/model/participant.h +++ b/src/sequence_diagram/model/participant.h @@ -115,11 +115,16 @@ public: void is_alias(bool alias) { is_alias_ = alias; } + bool is_lambda() const { return is_lambda_; } + + void is_lambda(bool is_lambda) { is_lambda_ = is_lambda; } + private: bool is_struct_{false}; bool is_template_{false}; bool is_template_instantiation_{false}; bool is_alias_{false}; + bool is_lambda_{false}; std::map type_aliases_; @@ -127,6 +132,12 @@ private: std::string full_name_; }; +struct lambda : public class_ { + using class_::class_; + + std::string type_name() const override { return "lambda"; } +}; + struct function : public participant { function(const common::model::namespace_ &using_namespace); diff --git a/src/sequence_diagram/visitor/translation_unit_visitor.cc b/src/sequence_diagram/visitor/translation_unit_visitor.cc index b0bb88d3..409b84fd 100644 --- a/src/sequence_diagram/visitor/translation_unit_visitor.cc +++ b/src/sequence_diagram/visitor/translation_unit_visitor.cc @@ -99,6 +99,9 @@ bool translation_unit_visitor::VisitCXXRecordDecl(clang::CXXRecordDecl *cls) if (cls->isLocalClass()) return true; + LOG_DBG("Visiting class declaration at {}", + cls->getBeginLoc().printToString(source_manager())); + // Build the class declaration and store it in the diagram, even // if we don't need it for any of the participants of this diagram auto c_ptr = create_class_declaration(cls); @@ -400,6 +403,73 @@ bool translation_unit_visitor::VisitFunctionTemplateDecl( return true; } +bool translation_unit_visitor::VisitLambdaExpr(clang::LambdaExpr *expr) +{ + const auto lambda_full_name = + expr->getLambdaClass()->getCanonicalDecl()->getNameAsString(); + + LOG_DBG("Visiting lambda expression {} at {}", lambda_full_name, + expr->getBeginLoc().printToString(source_manager())); + + LOG_DBG("Lambda call operator ID {} - lambda class ID {}, class call " + "operator ID {}", + expr->getCallOperator()->getID(), expr->getLambdaClass()->getID(), + expr->getLambdaClass()->getLambdaCallOperator()->getID()); + + // Create lambda class participant + auto *cls = expr->getLambdaClass(); + auto c_ptr = create_class_declaration(cls); + + if (!c_ptr) + return true; + + const auto cls_id = c_ptr->id(); + + set_unique_id(cls->getID(), cls_id); + + // Create lambda class operator() participant + auto m_ptr = std::make_unique( + config().using_namespace()); + + common::model::namespace_ ns{c_ptr->get_namespace()}; + auto method_name = "operator()"; + m_ptr->set_method_name(method_name); + ns.pop_back(); + + m_ptr->set_class_id(cls_id); + m_ptr->set_class_full_name(c_ptr->full_name(false)); + + diagram().add_participant(std::move(c_ptr)); + + m_ptr->set_id(common::to_id( + get_participant(cls_id).value().full_name(false) + "::" + method_name)); + + context().enter_lambda_expression(m_ptr->id()); + + set_unique_id(expr->getCallOperator()->getID(), m_ptr->id()); + + diagram().add_participant(std::move(m_ptr)); + + [[maybe_unused]] const auto is_generic_lambda = expr->isGenericLambda(); + + return true; +} + +bool translation_unit_visitor::TraverseLambdaExpr(clang::LambdaExpr *expr) +{ + const auto lambda_full_name = + expr->getLambdaClass()->getCanonicalDecl()->getNameAsString(); + + RecursiveASTVisitor::TraverseLambdaExpr(expr); + + LOG_DBG("Leaving lambda expression {} at {}", lambda_full_name, + expr->getBeginLoc().printToString(source_manager())); + + context().leave_lambda_expression(); + + return true; +} + bool translation_unit_visitor::VisitCallExpr(clang::CallExpr *expr) { using clanguml::common::model::message_t; @@ -424,6 +494,10 @@ bool translation_unit_visitor::VisitCallExpr(clang::CallExpr *expr) m.type = message_t::kCall; m.from = context().caller_id(); + if (context().lambda_caller_id() != 0) { + m.from = context().lambda_caller_id(); + } + const auto ¤t_ast_context = *context().get_ast_context(); LOG_DBG("Visiting call expression at {}", @@ -433,6 +507,26 @@ bool translation_unit_visitor::VisitCallExpr(clang::CallExpr *expr) clang::dyn_cast_or_null(expr); operator_call_expr != nullptr) { // TODO: Handle C++ operator calls + + LOG_DBG("Operator call expression to {} at {}", + expr->getCalleeDecl()->getID(), + expr->getBeginLoc().printToString(source_manager())); + + auto maybe_id = get_unique_id(expr->getCalleeDecl()->getID()); + if (maybe_id.has_value()) { + // Found operator() call to a participant + // auto maybe_participant = get_participant(maybe_id.value()); + // if (maybe_participant.has_value()) { + m.to = maybe_id.value(); + m.message_name = "operator()"; + //} + } + else { + m.to = expr->getCalleeDecl()->getID(); + m.message_name = "operator()"; + } + + if (clang::dyn_cast(expr)) { } } // // Call to a class method @@ -637,6 +731,9 @@ bool translation_unit_visitor::VisitCallExpr(clang::CallExpr *expr) auto *ftd = clang::dyn_cast_or_null< clang::FunctionTemplateDecl>(decl); + if (!get_unique_id(ftd->getID()).has_value()) + continue; + m.to = get_unique_id(ftd->getID()).value(); auto message_name = diagram() @@ -751,11 +848,16 @@ translation_unit_visitor::create_class_declaration(clang::CXXRecordDecl *cls) auto qualified_name = cls->getQualifiedNameAsString(); // common::get_qualified_name(*cls); - if (!diagram().should_include(qualified_name)) - return {}; + if (!cls->isLambda()) + if (!diagram().should_include(qualified_name)) + return {}; auto ns = common::get_tag_namespace(*cls); + if (cls->isLambda() && + !diagram().should_include(ns.to_string() + "::lambda")) + return {}; + const auto *parent = cls->getParent(); if (parent && parent->isRecord()) { @@ -815,6 +917,23 @@ translation_unit_visitor::create_class_declaration(clang::CXXRecordDecl *cls) c.nested(true); } + else if (cls->isLambda()) { + c.is_lambda(true); + if (cls->getParent()) { + auto parent_full_name = get_participant(context().caller_id()) + .value() + .full_name_no_ns(); + + const auto location = cls->getLocation(); + const auto type_name = + fmt::format("{}##(lambda {}:{})", parent_full_name, + source_manager().getSpellingLineNumber(location), + source_manager().getSpellingColumnNumber(location)); + c.set_name(type_name); + c.set_namespace(ns); + c.set_id(common::to_id(c.full_name(false))); + } + } else { c.set_name(common::get_tag_name(*cls)); c.set_namespace(ns); @@ -1208,6 +1327,35 @@ void translation_unit_visitor::process_template_specialization_argument( simplify_system_template(argument, argument.to_string(config().using_namespace(), false)); } + else if (arg.getAsType()->getAsCXXRecordDecl()) { + if (arg.getAsType()->getAsCXXRecordDecl()->isLambda()) { + if (get_unique_id( + arg.getAsType()->getAsCXXRecordDecl()->getID()) + .has_value()) { + argument.set_name(get_participant( + get_unique_id( + arg.getAsType()->getAsCXXRecordDecl()->getID()) + .value()) + .value() + .full_name(false)); + } + else { + auto parent_full_name = + get_participant(context().caller_id()) + .value() + .full_name_no_ns(); + + const auto location = + arg.getAsType()->getAsCXXRecordDecl()->getLocation(); + const auto type_name = + fmt::format("{}##(lambda {}:{})", parent_full_name, + source_manager().getSpellingLineNumber(location), + source_manager().getSpellingColumnNumber(location)); + + argument.set_name(type_name); + } + } + } else if (arg.getAsType()->getAs()) { auto type_name = common::to_string(arg.getAsType(), cls->getASTContext()); @@ -1312,6 +1460,41 @@ void translation_unit_visitor::process_template_specialization_argument( cls->getLocation().dump(source_manager()); } + // else if (arg.getKind() == clang::TemplateArgument::Expression) { + // if (clang::dyn_cast(arg.getAsExpr()) != + // nullptr) { + // class_diagram::model::template_parameter argument; + //// const auto location = + //// arg.getAsType()->getAsCXXRecordDecl()->getLocation(); + //// + //// auto type_name = fmt::format("(lambda {}:{}:{})", + //// source_manager().getFilename(location).str(), + //// source_manager().getSpellingLineNumber(location), + //// source_manager().getSpellingColumnNumber(location)); + //// + //// argument.set_name(type_name); + // + // if (get_unique_id( + // arg.getAsType()->getAsCXXRecordDecl()->getID()) + // .has_value()) { + // argument.set_name(get_participant( + // get_unique_id( + // arg.getAsType()->getAsCXXRecordDecl()->getID()) + // .value()) + // .value() + // .full_name(false)); + // } + // else { + // const auto location = + // arg.getAsType()->getAsCXXRecordDecl()->getLocation(); + // auto type_name = fmt::format("(lambda {}:{}:{})", + // source_manager().getFilename(location).str(), + // source_manager().getSpellingLineNumber(location), + // source_manager().getSpellingColumnNumber(location)); + // argument.set_name(type_name); + // } + // } + // } else if (argument_kind == clang::TemplateArgument::Pack) { // This will only work for now if pack is at the end size_t argument_pack_index{argument_index}; @@ -1534,4 +1717,15 @@ bool translation_unit_visitor::simplify_system_template( else return false; } + +void translation_unit_visitor::finalize() +{ + for (auto &[id, activity] : diagram().sequences) { + for (auto &m : activity.messages) { + if (local_ast_id_map_.find(m.to) != local_ast_id_map_.end()) { + m.to = local_ast_id_map_.at(m.to); + } + } + } +} } diff --git a/src/sequence_diagram/visitor/translation_unit_visitor.h b/src/sequence_diagram/visitor/translation_unit_visitor.h index 02d42516..a5223121 100644 --- a/src/sequence_diagram/visitor/translation_unit_visitor.h +++ b/src/sequence_diagram/visitor/translation_unit_visitor.h @@ -25,6 +25,8 @@ #include #include +#include + namespace clanguml::sequence_diagram::visitor { std::string to_string(const clang::FunctionTemplateDecl *decl); @@ -150,12 +152,39 @@ struct call_expression_context { std::int64_t caller_id() const { return current_caller_id_; } + std::int64_t lambda_caller_id() const + { + if(current_lambda_caller_id_.empty()) + return 0; + + return current_lambda_caller_id_.top(); + } + void set_caller_id(std::int64_t id) { LOG_DBG("Setting current caller id to {}", id); current_caller_id_ = id; } + void enter_lambda_expression(std::int64_t id) + { + LOG_DBG("Setting current lambda caller id to {}", id); + + assert(id != 0); + + current_lambda_caller_id_.push(id); + } + + void leave_lambda_expression() + { + assert(!current_lambda_caller_id_.empty()); + + LOG_DBG("Leaving current lambda expression id to {}", + current_lambda_caller_id_.top()); + + current_lambda_caller_id_.pop(); + } + clang::CXXRecordDecl *current_class_decl_; clang::ClassTemplateDecl *current_class_template_decl_; clang::ClassTemplateSpecializationDecl @@ -166,6 +195,7 @@ struct call_expression_context { private: std::int64_t current_caller_id_; + std::stack current_lambda_caller_id_; }; class translation_unit_visitor @@ -180,6 +210,10 @@ public: virtual bool VisitCallExpr(clang::CallExpr *expr); + virtual bool VisitLambdaExpr(clang::LambdaExpr *expr); + + virtual bool TraverseLambdaExpr(clang::LambdaExpr *expr); + virtual bool VisitCXXMethodDecl(clang::CXXMethodDecl *method); virtual bool VisitCXXRecordDecl(clang::CXXRecordDecl *cls); @@ -200,7 +234,7 @@ public: call_expression_context &context(); - void finalize() { } + void finalize(); template common::optional_ref get_participant(const clang::Decl *decl) diff --git a/tests/t20012/.clang-uml b/tests/t20012/.clang-uml new file mode 100644 index 00000000..bd288238 --- /dev/null +++ b/tests/t20012/.clang-uml @@ -0,0 +1,14 @@ +compilation_database_dir: .. +output_directory: puml +diagrams: + t20012_sequence: + type: sequence + glob: + - ../../tests/t20012/t20012.cc + include: + namespaces: + - clanguml::t20012 + using_namespace: + - clanguml::t20012 + start_from: + - function: "clanguml::t20012::tmain()" \ No newline at end of file diff --git a/tests/t20012/t20012.cc b/tests/t20012/t20012.cc new file mode 100644 index 00000000..488211a3 --- /dev/null +++ b/tests/t20012/t20012.cc @@ -0,0 +1,73 @@ +#include +#include + +namespace clanguml { +namespace t20012 { +struct A { + void a() { aa(); } + + void aa() { aaa(); } + + void aaa() { } +}; + +struct B { + void b() { bb(); } + + void bb() { bbb(); } + + void bbb() { } +}; + +struct C { + void c() { cc(); } + + void cc() { ccc(); } + + void ccc() { } +}; + +template struct R { + R(F &&f) + : f_{std::move(f)} + { + } + + void r() { f_(); } + + F f_; +}; + +void tmain() +{ + A a; + B b; + C c; + + // The activity shouldn't be marked at the lambda definition, but + // wherever it is actually called... + auto alambda = [&a, &b]() { + a.a(); + b.b(); + }; + + // ...like here + alambda(); + + // There should be no call to B in the sequence diagram as the blambda + // is never called + [[maybe_unused]] auto blambda = [&b]() { b.b(); }; + + // Nested lambdas should also work + auto clambda = [alambda, &c]() { + c.c(); + alambda(); + }; + clambda(); + + R r{[&c]() { c.c(); }}; + + r.r(); +} +} +} \ No newline at end of file diff --git a/tests/t20012/test_case.h b/tests/t20012/test_case.h new file mode 100644 index 00000000..16681581 --- /dev/null +++ b/tests/t20012/test_case.h @@ -0,0 +1,66 @@ +/** + * tests/t20012/test_case.h + * + * Copyright (c) 2021-2022 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("t20012", "[test-case][sequence]") +{ + auto [config, db] = load_config("t20012"); + + auto diagram = config.diagrams["t20012_sequence"]; + + REQUIRE(diagram->name == "t20012_sequence"); + + auto model = generate_sequence_diagram(*db, diagram); + + REQUIRE(model->name() == "t20012_sequence"); + + auto puml = generate_sequence_puml(diagram, *model); + AliasMatcher _A(puml); + + REQUIRE_THAT(puml, StartsWith("@startuml")); + REQUIRE_THAT(puml, EndsWith("@enduml\n")); + + // Check if all calls exist + REQUIRE_THAT(puml, + HasCall(_A("tmain()"), _A("tmain()##(lambda 49:20)"), "operator()")); + REQUIRE_THAT(puml, HasCall(_A("tmain()##(lambda 49: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 49: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 62: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 62:20)"), _A("tmain()##(lambda 49:20)"), + "operator()")); + + REQUIRE_THAT(puml, HasCall(_A("C"), _A("C"), "ccc")); + + REQUIRE_THAT(puml, HasCall(_A("tmain()"), _A("R"), "r")); + REQUIRE_THAT(puml, + HasCall(_A("R"), _A("tmain()##(lambda 68:9)"), + "operator()")); + REQUIRE_THAT( + puml, HasCall(_A("tmain()##(lambda 68:9)"), _A("C"), "c")); + + save_puml( + "./" + config.output_directory() + "/" + diagram->name + ".puml", puml); +} \ No newline at end of file diff --git a/tests/test_cases.cc b/tests/test_cases.cc index 287a9539..af89443c 100644 --- a/tests/test_cases.cc +++ b/tests/test_cases.cc @@ -258,6 +258,7 @@ using namespace clanguml::test::matchers; #include "t20009/test_case.h" #include "t20010/test_case.h" #include "t20011/test_case.h" +#include "t20012/test_case.h" /// /// Package diagram tests From 8684bc861bb0b308c0f6ce049f26f8665b7ba333 Mon Sep 17 00:00:00 2001 From: Bartek Kryza Date: Sun, 4 Dec 2022 12:10:52 +0100 Subject: [PATCH 36/77] Fixed lambda sequence diagram test case --- .../visitor/translation_unit_visitor.cc | 55 +++++++++---------- 1 file changed, 26 insertions(+), 29 deletions(-) diff --git a/src/sequence_diagram/visitor/translation_unit_visitor.cc b/src/sequence_diagram/visitor/translation_unit_visitor.cc index 409b84fd..324b5d79 100644 --- a/src/sequence_diagram/visitor/translation_unit_visitor.cc +++ b/src/sequence_diagram/visitor/translation_unit_visitor.cc @@ -1327,35 +1327,6 @@ void translation_unit_visitor::process_template_specialization_argument( simplify_system_template(argument, argument.to_string(config().using_namespace(), false)); } - else if (arg.getAsType()->getAsCXXRecordDecl()) { - if (arg.getAsType()->getAsCXXRecordDecl()->isLambda()) { - if (get_unique_id( - arg.getAsType()->getAsCXXRecordDecl()->getID()) - .has_value()) { - argument.set_name(get_participant( - get_unique_id( - arg.getAsType()->getAsCXXRecordDecl()->getID()) - .value()) - .value() - .full_name(false)); - } - else { - auto parent_full_name = - get_participant(context().caller_id()) - .value() - .full_name_no_ns(); - - const auto location = - arg.getAsType()->getAsCXXRecordDecl()->getLocation(); - const auto type_name = - fmt::format("{}##(lambda {}:{})", parent_full_name, - source_manager().getSpellingLineNumber(location), - source_manager().getSpellingColumnNumber(location)); - - argument.set_name(type_name); - } - } - } else if (arg.getAsType()->getAs()) { auto type_name = common::to_string(arg.getAsType(), cls->getASTContext()); @@ -1387,6 +1358,32 @@ void translation_unit_visitor::process_template_specialization_argument( argument.set_name(type_name); } + else if (arg.getAsType()->getAsCXXRecordDecl() && + arg.getAsType()->getAsCXXRecordDecl()->isLambda()) { + if (get_unique_id(arg.getAsType()->getAsCXXRecordDecl()->getID()) + .has_value()) { + argument.set_name(get_participant( + get_unique_id( + arg.getAsType()->getAsCXXRecordDecl()->getID()) + .value()) + .value() + .full_name(false)); + } + else { + auto parent_full_name = get_participant(context().caller_id()) + .value() + .full_name_no_ns(); + + const auto location = + arg.getAsType()->getAsCXXRecordDecl()->getLocation(); + const auto type_name = + fmt::format("{}##(lambda {}:{})", parent_full_name, + source_manager().getSpellingLineNumber(location), + source_manager().getSpellingColumnNumber(location)); + + argument.set_name(type_name); + } + } else { auto type_name = common::to_string(arg.getAsType(), cls->getASTContext()); From f07b35802aa4851538694d6c4e664e15f1ebd5aa Mon Sep 17 00:00:00 2001 From: Bartek Kryza Date: Sun, 4 Dec 2022 12:42:36 +0100 Subject: [PATCH 37/77] Refactored call expression context in sequence diagram visitor --- .../visitor/call_expression_context.cc | 188 ++++++++++++++++++ .../visitor/call_expression_context.h | 86 ++++++++ .../visitor/translation_unit_visitor.cc | 35 ---- .../visitor/translation_unit_visitor.h | 168 +--------------- 4 files changed, 275 insertions(+), 202 deletions(-) create mode 100644 src/sequence_diagram/visitor/call_expression_context.cc create mode 100644 src/sequence_diagram/visitor/call_expression_context.h diff --git a/src/sequence_diagram/visitor/call_expression_context.cc b/src/sequence_diagram/visitor/call_expression_context.cc new file mode 100644 index 00000000..784db53a --- /dev/null +++ b/src/sequence_diagram/visitor/call_expression_context.cc @@ -0,0 +1,188 @@ +/** + * src/sequence_diagram/visitor/call_expression_context.cc + * + * Copyright (c) 2021-2022 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. + */ + +#include "call_expression_context.h" + +namespace clanguml::sequence_diagram::visitor { + +call_expression_context::call_expression_context() + : current_class_decl_{nullptr} + , current_class_template_decl_{nullptr} + , current_class_template_specialization_decl_{nullptr} + , current_method_decl_{nullptr} + , current_function_decl_{nullptr} + , current_function_template_decl_{nullptr} + , current_caller_id_{0} +{ +} + +void call_expression_context::reset() +{ + current_caller_id_ = 0; + current_class_decl_ = nullptr; + current_class_template_decl_ = nullptr; + current_class_template_specialization_decl_ = nullptr; + current_method_decl_ = nullptr; + current_function_decl_ = nullptr; + current_function_template_decl_ = nullptr; +} + +void call_expression_context::dump() +{ + LOG_DBG("current_caller_id_ = {}", current_caller_id_); + LOG_DBG("current_class_decl_ = {}", (void *)current_class_decl_); + LOG_DBG("current_class_template_decl_ = {}", + (void *)current_class_template_decl_); + LOG_DBG("current_class_template_specialization_decl_ = {}", + (void *)current_class_template_specialization_decl_); + LOG_DBG("current_method_decl_ = {}", (void *)current_method_decl_); + LOG_DBG("current_function_decl_ = {}", (void *)current_function_decl_); + LOG_DBG("current_function_template_decl_ = {}", + (void *)current_function_template_decl_); +} + +bool call_expression_context::valid() const +{ + return (current_class_decl_ != nullptr) || + (current_class_template_decl_ != nullptr) || + (current_class_template_specialization_decl_ != nullptr) || + (current_method_decl_ != nullptr) || + (current_function_decl_ != nullptr) || + (current_function_template_decl_ != nullptr); +} + +clang::ASTContext *call_expression_context::get_ast_context() +{ + if (current_class_template_specialization_decl_) + return ¤t_class_template_specialization_decl_->getASTContext(); + + if (current_class_template_decl_) + return ¤t_class_template_decl_->getASTContext(); + + if (current_class_decl_) + return ¤t_class_decl_->getASTContext(); + + if (current_function_template_decl_) + return ¤t_function_template_decl_->getASTContext(); + + return ¤t_function_decl_->getASTContext(); +} + +void call_expression_context::update(clang::CXXRecordDecl *cls) +{ + current_class_decl_ = cls; +} + +void call_expression_context::update( + clang::ClassTemplateSpecializationDecl *clst) +{ + current_class_template_specialization_decl_ = clst; +} + +void call_expression_context::update(clang::ClassTemplateDecl *clst) +{ + current_class_template_decl_ = clst; +} + +void call_expression_context::update(clang::CXXMethodDecl *method) +{ + current_method_decl_ = method; +} + +void call_expression_context::update(clang::FunctionDecl *function) +{ + if (!function->isCXXClassMember()) + reset(); + + current_function_decl_ = function; + + // Check if this function is a part of template function declaration, + // If no - reset the current_function_template_decl_ + if (current_function_template_decl_ && + current_function_template_decl_->getQualifiedNameAsString() != + function->getQualifiedNameAsString()) { + current_function_template_decl_ = nullptr; + } +} + +void call_expression_context::update( + clang::FunctionTemplateDecl *function_template) +{ + current_function_template_decl_ = function_template; + + if (!function_template->isCXXClassMember()) + current_class_decl_ = nullptr; + + current_function_template_decl_ = function_template; +} + +bool call_expression_context::in_class_method() const +{ + return current_class_decl_ != nullptr; +} + +bool call_expression_context::in_function() const +{ + return current_class_decl_ == nullptr && current_function_decl_ != nullptr; +} + +bool call_expression_context::in_function_template() const +{ + return current_function_decl_ != nullptr && + current_function_template_decl_ != nullptr; +} + +std::int64_t call_expression_context::caller_id() const +{ + return current_caller_id_; +} + +std::int64_t call_expression_context::lambda_caller_id() const +{ + if (current_lambda_caller_id_.empty()) + return 0; + + return current_lambda_caller_id_.top(); +} + +void call_expression_context::set_caller_id(std::int64_t id) +{ + LOG_DBG("Setting current caller id to {}", id); + current_caller_id_ = id; +} + +void call_expression_context::enter_lambda_expression(std::int64_t id) +{ + LOG_DBG("Setting current lambda caller id to {}", id); + + assert(id != 0); + + current_lambda_caller_id_.push(id); +} + +void call_expression_context::leave_lambda_expression() +{ + assert(!current_lambda_caller_id_.empty()); + + LOG_DBG("Leaving current lambda expression id to {}", + current_lambda_caller_id_.top()); + + current_lambda_caller_id_.pop(); +} + +} \ No newline at end of file diff --git a/src/sequence_diagram/visitor/call_expression_context.h b/src/sequence_diagram/visitor/call_expression_context.h new file mode 100644 index 00000000..7e869603 --- /dev/null +++ b/src/sequence_diagram/visitor/call_expression_context.h @@ -0,0 +1,86 @@ +/** + * src/sequence_diagram/visitor/call_expression_context.h + * + * Copyright (c) 2021-2022 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/visitor/translation_unit_visitor.h" +//#include "config/config.h" +//#include "sequence_diagram/model/diagram.h" + +#include "util/util.h" + +#include +#include +#include + +#include + +namespace clanguml::sequence_diagram::visitor { + +struct call_expression_context { + call_expression_context(); + + void reset(); + + void dump(); + + bool valid() const; + + clang::ASTContext *get_ast_context(); + + void update(clang::CXXRecordDecl *cls); + + void update(clang::ClassTemplateSpecializationDecl *clst); + + void update(clang::ClassTemplateDecl *clst); + + void update(clang::CXXMethodDecl *method); + + void update(clang::FunctionDecl *function); + + void update(clang::FunctionTemplateDecl *function_template); + + bool in_class_method() const; + + bool in_function() const; + + bool in_function_template() const; + + std::int64_t caller_id() const; + + std::int64_t lambda_caller_id() const; + + void set_caller_id(std::int64_t id); + + void enter_lambda_expression(std::int64_t id); + + void leave_lambda_expression(); + + clang::CXXRecordDecl *current_class_decl_; + clang::ClassTemplateDecl *current_class_template_decl_; + clang::ClassTemplateSpecializationDecl + *current_class_template_specialization_decl_; + clang::CXXMethodDecl *current_method_decl_; + clang::FunctionDecl *current_function_decl_; + clang::FunctionTemplateDecl *current_function_template_decl_; + +private: + std::int64_t current_caller_id_; + std::stack current_lambda_caller_id_; +}; + +} \ No newline at end of file diff --git a/src/sequence_diagram/visitor/translation_unit_visitor.cc b/src/sequence_diagram/visitor/translation_unit_visitor.cc index 324b5d79..a813b64e 100644 --- a/src/sequence_diagram/visitor/translation_unit_visitor.cc +++ b/src/sequence_diagram/visitor/translation_unit_visitor.cc @@ -1457,41 +1457,6 @@ void translation_unit_visitor::process_template_specialization_argument( cls->getLocation().dump(source_manager()); } - // else if (arg.getKind() == clang::TemplateArgument::Expression) { - // if (clang::dyn_cast(arg.getAsExpr()) != - // nullptr) { - // class_diagram::model::template_parameter argument; - //// const auto location = - //// arg.getAsType()->getAsCXXRecordDecl()->getLocation(); - //// - //// auto type_name = fmt::format("(lambda {}:{}:{})", - //// source_manager().getFilename(location).str(), - //// source_manager().getSpellingLineNumber(location), - //// source_manager().getSpellingColumnNumber(location)); - //// - //// argument.set_name(type_name); - // - // if (get_unique_id( - // arg.getAsType()->getAsCXXRecordDecl()->getID()) - // .has_value()) { - // argument.set_name(get_participant( - // get_unique_id( - // arg.getAsType()->getAsCXXRecordDecl()->getID()) - // .value()) - // .value() - // .full_name(false)); - // } - // else { - // const auto location = - // arg.getAsType()->getAsCXXRecordDecl()->getLocation(); - // auto type_name = fmt::format("(lambda {}:{}:{})", - // source_manager().getFilename(location).str(), - // source_manager().getSpellingLineNumber(location), - // source_manager().getSpellingColumnNumber(location)); - // argument.set_name(type_name); - // } - // } - // } else if (argument_kind == clang::TemplateArgument::Pack) { // This will only work for now if pack is at the end size_t argument_pack_index{argument_index}; diff --git a/src/sequence_diagram/visitor/translation_unit_visitor.h b/src/sequence_diagram/visitor/translation_unit_visitor.h index a5223121..060d49cd 100644 --- a/src/sequence_diagram/visitor/translation_unit_visitor.h +++ b/src/sequence_diagram/visitor/translation_unit_visitor.h @@ -20,6 +20,7 @@ #include "common/visitor/translation_unit_visitor.h" #include "config/config.h" #include "sequence_diagram/model/diagram.h" +#include "call_expression_context.h" #include #include @@ -31,173 +32,6 @@ namespace clanguml::sequence_diagram::visitor { std::string to_string(const clang::FunctionTemplateDecl *decl); -struct call_expression_context { - call_expression_context() - : current_class_decl_{nullptr} - , current_class_template_decl_{nullptr} - , current_class_template_specialization_decl_{nullptr} - , current_method_decl_{nullptr} - , current_function_decl_{nullptr} - , current_function_template_decl_{nullptr} - , current_caller_id_{0} - { - } - - void reset() - { - current_caller_id_ = 0; - current_class_decl_ = nullptr; - current_class_template_decl_ = nullptr; - current_class_template_specialization_decl_ = nullptr; - current_method_decl_ = nullptr; - current_function_decl_ = nullptr; - current_function_template_decl_ = nullptr; - } - - void dump() - { - LOG_DBG("current_caller_id_ = {}", current_caller_id_); - LOG_DBG("current_class_decl_ = {}", (void *)current_class_decl_); - LOG_DBG("current_class_template_decl_ = {}", - (void *)current_class_template_decl_); - LOG_DBG("current_class_template_specialization_decl_ = {}", - (void *)current_class_template_specialization_decl_); - LOG_DBG("current_method_decl_ = {}", (void *)current_method_decl_); - LOG_DBG("current_function_decl_ = {}", (void *)current_function_decl_); - LOG_DBG("current_function_template_decl_ = {}", - (void *)current_function_template_decl_); - } - - bool valid() const - { - return (current_class_decl_ != nullptr) || - (current_class_template_decl_ != nullptr) || - (current_class_template_specialization_decl_ != nullptr) || - (current_method_decl_ != nullptr) || - (current_function_decl_ != nullptr) || - (current_function_template_decl_ != nullptr); - } - - clang::ASTContext *get_ast_context() - { - if (current_class_template_specialization_decl_) - return ¤t_class_template_specialization_decl_ - ->getASTContext(); - - if (current_class_template_decl_) - return ¤t_class_template_decl_->getASTContext(); - - if (current_class_decl_) - return ¤t_class_decl_->getASTContext(); - - if (current_function_template_decl_) - return ¤t_function_template_decl_->getASTContext(); - - return ¤t_function_decl_->getASTContext(); - } - - void update(clang::CXXRecordDecl *cls) { current_class_decl_ = cls; } - - void update(clang::ClassTemplateSpecializationDecl *clst) - { - current_class_template_specialization_decl_ = clst; - } - - void update(clang::ClassTemplateDecl *clst) - { - current_class_template_decl_ = clst; - } - - void update(clang::CXXMethodDecl *method) { current_method_decl_ = method; } - - void update(clang::FunctionDecl *function) - { - if (!function->isCXXClassMember()) - reset(); - - current_function_decl_ = function; - - // Check if this function is a part of template function declaration, - // If no - reset the current_function_template_decl_ - if (current_function_template_decl_ && - current_function_template_decl_->getQualifiedNameAsString() != - function->getQualifiedNameAsString()) { - current_function_template_decl_ = nullptr; - } - } - - void update(clang::FunctionTemplateDecl *function_template) - { - current_function_template_decl_ = function_template; - - if (!function_template->isCXXClassMember()) - current_class_decl_ = nullptr; - - current_function_template_decl_ = function_template; - } - - bool in_class_method() const { return current_class_decl_ != nullptr; } - - bool in_function() const - { - return current_class_decl_ == nullptr && - current_function_decl_ != nullptr; - } - - bool in_function_template() const - { - return current_function_decl_ != nullptr && - current_function_template_decl_ != nullptr; - } - - std::int64_t caller_id() const { return current_caller_id_; } - - std::int64_t lambda_caller_id() const - { - if(current_lambda_caller_id_.empty()) - return 0; - - return current_lambda_caller_id_.top(); - } - - void set_caller_id(std::int64_t id) - { - LOG_DBG("Setting current caller id to {}", id); - current_caller_id_ = id; - } - - void enter_lambda_expression(std::int64_t id) - { - LOG_DBG("Setting current lambda caller id to {}", id); - - assert(id != 0); - - current_lambda_caller_id_.push(id); - } - - void leave_lambda_expression() - { - assert(!current_lambda_caller_id_.empty()); - - LOG_DBG("Leaving current lambda expression id to {}", - current_lambda_caller_id_.top()); - - current_lambda_caller_id_.pop(); - } - - clang::CXXRecordDecl *current_class_decl_; - clang::ClassTemplateDecl *current_class_template_decl_; - clang::ClassTemplateSpecializationDecl - *current_class_template_specialization_decl_; - clang::CXXMethodDecl *current_method_decl_; - clang::FunctionDecl *current_function_decl_; - clang::FunctionTemplateDecl *current_function_template_decl_; - -private: - std::int64_t current_caller_id_; - std::stack current_lambda_caller_id_; -}; - class translation_unit_visitor : public clang::RecursiveASTVisitor, public common::visitor::translation_unit_visitor { From b87c6acd4487d2db4ef0d898e9987946b9273560 Mon Sep 17 00:00:00 2001 From: Bartek Kryza Date: Sun, 4 Dec 2022 13:19:44 +0100 Subject: [PATCH 38/77] Refactored lambda naming in sequence diagrams --- src/common/clang_utils.cc | 2 + .../plantuml/sequence_diagram_generator.cc | 11 +++- .../plantuml/sequence_diagram_generator.h | 2 + .../visitor/translation_unit_visitor.cc | 57 +++++++++++++------ .../visitor/translation_unit_visitor.h | 31 +++++++++- tests/t20012/test_case.h | 27 +++++---- 6 files changed, 98 insertions(+), 32 deletions(-) diff --git a/src/common/clang_utils.cc b/src/common/clang_utils.cc index c5fec542..e02210e9 100644 --- a/src/common/clang_utils.cc +++ b/src/common/clang_utils.cc @@ -164,6 +164,8 @@ std::string get_source_text( return get_source_text_raw(printable_range, sm); } + + template <> id_t to_id(const std::string &full_name) { return std::hash{}(full_name) >> 3; diff --git a/src/sequence_diagram/generators/plantuml/sequence_diagram_generator.cc b/src/sequence_diagram/generators/plantuml/sequence_diagram_generator.cc index a425c010..d775e103 100644 --- a/src/sequence_diagram/generators/plantuml/sequence_diagram_generator.cc +++ b/src/sequence_diagram/generators/plantuml/sequence_diagram_generator.cc @@ -36,6 +36,13 @@ generator::generator( { } +std::string generator::render_name(std::string name) const +{ + util::replace_all(name, "##", "::"); + + return name; +} + void generator::generate_call(const message &m, std::ostream &ostr) const { const auto &from = m_model.get_participant(m.from); @@ -142,8 +149,8 @@ void generator::generate_participant(std::ostream &ostr, common::id_t id) const m_model.get_participant(class_id).value(); ostr << "participant \"" - << m_config.using_namespace().relative( - class_participant.full_name(false)) + << render_name(m_config.using_namespace().relative( + class_participant.full_name(false))) << "\" as " << class_participant.alias() << '\n'; generated_participants_.emplace(class_id); diff --git a/src/sequence_diagram/generators/plantuml/sequence_diagram_generator.h b/src/sequence_diagram/generators/plantuml/sequence_diagram_generator.h index e2148bee..98273676 100644 --- a/src/sequence_diagram/generators/plantuml/sequence_diagram_generator.h +++ b/src/sequence_diagram/generators/plantuml/sequence_diagram_generator.h @@ -63,6 +63,8 @@ public: private: bool is_participant_generated(common::id_t id) const; + std::string render_name(std::string name) const; + mutable std::set generated_participants_; }; diff --git a/src/sequence_diagram/visitor/translation_unit_visitor.cc b/src/sequence_diagram/visitor/translation_unit_visitor.cc index a813b64e..a9163e04 100644 --- a/src/sequence_diagram/visitor/translation_unit_visitor.cc +++ b/src/sequence_diagram/visitor/translation_unit_visitor.cc @@ -68,11 +68,22 @@ call_expression_context &translation_unit_visitor::context() return call_expression_context_; } +const call_expression_context &translation_unit_visitor::context() const +{ + return call_expression_context_; +} + clanguml::sequence_diagram::model::diagram &translation_unit_visitor::diagram() { return diagram_; } +const clanguml::sequence_diagram::model::diagram & +translation_unit_visitor::diagram() const +{ + return diagram_; +} + const clanguml::config::sequence_diagram & translation_unit_visitor::config() const { @@ -920,15 +931,8 @@ translation_unit_visitor::create_class_declaration(clang::CXXRecordDecl *cls) else if (cls->isLambda()) { c.is_lambda(true); if (cls->getParent()) { - auto parent_full_name = get_participant(context().caller_id()) - .value() - .full_name_no_ns(); + const auto type_name = make_lambda_name(cls); - const auto location = cls->getLocation(); - const auto type_name = - fmt::format("{}##(lambda {}:{})", parent_full_name, - source_manager().getSpellingLineNumber(location), - source_manager().getSpellingColumnNumber(location)); c.set_name(type_name); c.set_namespace(ns); c.set_id(common::to_id(c.full_name(false))); @@ -1370,17 +1374,8 @@ void translation_unit_visitor::process_template_specialization_argument( .full_name(false)); } else { - auto parent_full_name = get_participant(context().caller_id()) - .value() - .full_name_no_ns(); - - const auto location = - arg.getAsType()->getAsCXXRecordDecl()->getLocation(); const auto type_name = - fmt::format("{}##(lambda {}:{})", parent_full_name, - source_manager().getSpellingLineNumber(location), - source_manager().getSpellingColumnNumber(location)); - + make_lambda_name(arg.getAsType()->getAsCXXRecordDecl()); argument.set_name(type_name); } } @@ -1680,6 +1675,32 @@ bool translation_unit_visitor::simplify_system_template( return false; } +std::string translation_unit_visitor::make_lambda_name( + const clang::CXXRecordDecl *cls) const +{ + std::string result; + const auto location = cls->getLocation(); + const auto file_line = source_manager().getSpellingLineNumber(location); + const auto file_column = source_manager().getSpellingColumnNumber(location); + const std::string file_name = + util::split(source_manager().getFilename(location).str(), "/").back(); + + if (context().caller_id() != 0 && + get_participant(context().caller_id()).has_value()) { + auto parent_full_name = + get_participant(context().caller_id()).value().full_name_no_ns(); + + result = fmt::format("{}##(lambda {}:{}:{})", parent_full_name, + file_name, file_line, file_column); + } + else { + result = + fmt::format("(lambda {}:{}:{})", file_name, file_line, file_column); + } + + return result; +} + void translation_unit_visitor::finalize() { for (auto &[id, activity] : diagram().sequences) { diff --git a/src/sequence_diagram/visitor/translation_unit_visitor.h b/src/sequence_diagram/visitor/translation_unit_visitor.h index 060d49cd..90fafbe7 100644 --- a/src/sequence_diagram/visitor/translation_unit_visitor.h +++ b/src/sequence_diagram/visitor/translation_unit_visitor.h @@ -17,10 +17,10 @@ */ #pragma once +#include "call_expression_context.h" #include "common/visitor/translation_unit_visitor.h" #include "config/config.h" #include "sequence_diagram/model/diagram.h" -#include "call_expression_context.h" #include #include @@ -64,10 +64,14 @@ public: clanguml::sequence_diagram::model::diagram &diagram(); + const clanguml::sequence_diagram::model::diagram &diagram() const; + const clanguml::config::sequence_diagram &config() const; call_expression_context &context(); + const call_expression_context &context() const; + void finalize(); template @@ -82,6 +86,18 @@ public: return get_participant(unique_participant_id.value()); } + template + const common::optional_ref get_participant(const clang::Decl *decl) const + { + assert(decl != nullptr); + + auto unique_participant_id = get_unique_id(decl->getID()); + if (!unique_participant_id.has_value()) + return {}; + + return get_participant(unique_participant_id.value()); + } + template common::optional_ref get_participant( const common::model::diagram_element::id_t id) @@ -93,6 +109,17 @@ public: *(static_cast(diagram().participants.at(id).get()))); } + template + const common::optional_ref get_participant( + const common::model::diagram_element::id_t id) const + { + if (diagram().participants.find(id) == diagram().participants.end()) + return {}; + + return common::optional_ref( + *(static_cast(diagram().participants.at(id).get()))); + } + /// Store the mapping from local clang entity id (obtained using /// getID()) method to clang-uml global id void set_unique_id( @@ -168,6 +195,8 @@ private: bool simplify_system_template(class_diagram::model::template_parameter &ct, const std::string &full_name); + std::string make_lambda_name(const clang::CXXRecordDecl *cls) const; + bool is_smart_pointer(const clang::TemplateDecl *primary_template) const; bool is_callee_valid_template_specialization( diff --git a/tests/t20012/test_case.h b/tests/t20012/test_case.h index 16681581..bc789226 100644 --- a/tests/t20012/test_case.h +++ b/tests/t20012/test_case.h @@ -36,30 +36,35 @@ TEST_CASE("t20012", "[test-case][sequence]") // Check if all calls exist REQUIRE_THAT(puml, - HasCall(_A("tmain()"), _A("tmain()##(lambda 49:20)"), "operator()")); - REQUIRE_THAT(puml, HasCall(_A("tmain()##(lambda 49:20)"), _A("A"), "a")); + HasCall(_A("tmain()"), _A("tmain()::(lambda t20012.cc:49:20)"), + "operator()")); + REQUIRE_THAT( + puml, HasCall(_A("tmain()::(lambda t20012.cc:49: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 49:20)"), _A("B"), "b")); + REQUIRE_THAT( + puml, HasCall(_A("tmain()::(lambda t20012.cc:49: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 62:20)"), _A("C"), "c")); + REQUIRE_THAT( + puml, HasCall(_A("tmain()::(lambda t20012.cc:62: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 62:20)"), _A("tmain()##(lambda 49:20)"), - "operator()")); + HasCall(_A("tmain()::(lambda t20012.cc:62:20)"), + _A("tmain()::(lambda t20012.cc:49:20)"), "operator()")); REQUIRE_THAT(puml, HasCall(_A("C"), _A("C"), "ccc")); - REQUIRE_THAT(puml, HasCall(_A("tmain()"), _A("R"), "r")); - REQUIRE_THAT(puml, - HasCall(_A("R"), _A("tmain()##(lambda 68:9)"), - "operator()")); REQUIRE_THAT( - puml, HasCall(_A("tmain()##(lambda 68:9)"), _A("C"), "c")); + puml, HasCall(_A("tmain()"), _A("R"), "r")); + REQUIRE_THAT(puml, + HasCall(_A("R"), + _A("tmain()::(lambda t20012.cc:68:9)"), "operator()")); + REQUIRE_THAT( + puml, HasCall(_A("tmain()::(lambda t20012.cc:68:9)"), _A("C"), "c")); save_puml( "./" + config.output_directory() + "/" + diagram->name + ".puml", puml); From 10da4ad164103b28ff611ef8e34e992f253b4e60 Mon Sep 17 00:00:00 2001 From: Bartek Kryza Date: Sun, 4 Dec 2022 14:41:23 +0100 Subject: [PATCH 39/77] Refactored sequence diagram call expression processing --- src/sequence_diagram/model/diagram.h | 13 + .../visitor/translation_unit_visitor.cc | 459 ++++++++---------- .../visitor/translation_unit_visitor.h | 31 +- 3 files changed, 250 insertions(+), 253 deletions(-) diff --git a/src/sequence_diagram/model/diagram.h b/src/sequence_diagram/model/diagram.h index 6f12f911..ae3d3a25 100644 --- a/src/sequence_diagram/model/diagram.h +++ b/src/sequence_diagram/model/diagram.h @@ -64,6 +64,19 @@ public: static_cast(participants.at(id).get())); } + template + const common::optional_ref get_participant( + common::model::diagram_element::id_t id) const + { + if (participants.find(id) == participants.end()) { + return {}; + } + + return common::optional_ref( + static_cast(participants.at(id).get())); + } + + void add_participant(std::unique_ptr p) { const auto participant_id = p->id(); diff --git a/src/sequence_diagram/visitor/translation_unit_visitor.cc b/src/sequence_diagram/visitor/translation_unit_visitor.cc index a9163e04..d047becd 100644 --- a/src/sequence_diagram/visitor/translation_unit_visitor.cc +++ b/src/sequence_diagram/visitor/translation_unit_visitor.cc @@ -505,39 +505,21 @@ bool translation_unit_visitor::VisitCallExpr(clang::CallExpr *expr) m.type = message_t::kCall; m.from = context().caller_id(); + // If we're currently inside a lambda expression, set it's id as + // message source rather then enclosing context if (context().lambda_caller_id() != 0) { m.from = context().lambda_caller_id(); } - const auto ¤t_ast_context = *context().get_ast_context(); - LOG_DBG("Visiting call expression at {}", expr->getBeginLoc().printToString(source_manager())); if (const auto *operator_call_expr = clang::dyn_cast_or_null(expr); operator_call_expr != nullptr) { - // TODO: Handle C++ operator calls - LOG_DBG("Operator call expression to {} at {}", - expr->getCalleeDecl()->getID(), - expr->getBeginLoc().printToString(source_manager())); - - auto maybe_id = get_unique_id(expr->getCalleeDecl()->getID()); - if (maybe_id.has_value()) { - // Found operator() call to a participant - // auto maybe_participant = get_participant(maybe_id.value()); - // if (maybe_participant.has_value()) { - m.to = maybe_id.value(); - m.message_name = "operator()"; - //} - } - else { - m.to = expr->getCalleeDecl()->getID(); - m.message_name = "operator()"; - } - - if (clang::dyn_cast(expr)) { } + if (!process_operator_call_expression(m, operator_call_expr)) + return true; } // // Call to a class method @@ -546,120 +528,18 @@ bool translation_unit_visitor::VisitCallExpr(clang::CallExpr *expr) clang::dyn_cast_or_null(expr); method_call_expr != nullptr) { - // Get callee declaration as methods parent - const auto *method_decl = method_call_expr->getMethodDecl(); - std::string method_name = method_decl->getQualifiedNameAsString(); - - auto *callee_decl = method_decl ? method_decl->getParent() : nullptr; - - if (!(callee_decl && - diagram().should_include( - callee_decl->getQualifiedNameAsString()))) + if (!process_class_method_call_expression(m, method_call_expr)) return true; - - const auto *callee_template_specialization = - clang::dyn_cast( - callee_decl); - - if (callee_template_specialization) { - LOG_DBG("Callee is a template specialization declaration {}", - callee_template_specialization->getQualifiedNameAsString()); - - const auto &participant = - diagram() - .get_participant( - get_unique_id(callee_template_specialization->getID()) - .value()) - .value(); - - if (participant.is_implicit()) { - /* - const auto *parent_template = - callee_template_specialization->getSpecializedTemplate(); - - const auto &parent_template_participant = - diagram() - .get_participant( - get_unique_id(parent_template->getID()).value()) - .value(); - - const auto parent_method_name = - parent_template_participant.full_name(false) + - "::" + method_decl->getNameAsString(); - - m.to = common::to_id(parent_method_name); - m.message_name = participant.full_name_no_ns() + - "::" + method_decl->getNameAsString(); - */ - const auto specialization_method_name = - participant.full_name(false) + - "::" + method_decl->getNameAsString(); - - m.to = common::to_id(method_name); - m.message_name = method_decl->getNameAsString(); - - // Since this is an implicit instantiation it might not exist - // so we have to create this participant here and it to the - // diagram - if (!diagram() - .get_participant(m.to) - .has_value()) { - auto m_ptr = - std::make_unique( - config().using_namespace()); - m_ptr->set_id(m.to); - m_ptr->set_method_name(method_decl->getNameAsString()); - m_ptr->set_name(method_decl->getNameAsString()); - m_ptr->set_class_id(participant.id()); - m_ptr->set_class_full_name(participant.full_name(false)); - set_unique_id(method_decl->getID(), m_ptr->id()); - diagram().add_active_participant(m_ptr->id()); - diagram().add_participant(std::move(m_ptr)); - } - } - else { - const auto &specialization_participant = - diagram() - .get_participant(get_unique_id( - callee_template_specialization->getID()) - .value()) - .value(); - const auto specialization_method_name = - specialization_participant.full_name(false) + - "::" + method_decl->getNameAsString(); - - m.to = common::to_id(specialization_method_name); - m.message_name = method_decl->getNameAsString(); - } - } - else { - // TODO: The method can be called before it's declaration has been - // encountered by the visitor - for now it's not a problem - // as overloaded methods are not supported - m.to = common::to_id(method_decl->getQualifiedNameAsString()); - m.message_name = method_decl->getNameAsString(); - } - m.return_type = method_call_expr->getCallReturnType(current_ast_context) - .getAsString(); - - LOG_DBG("Set callee method id {} for method name {}", m.to, - method_decl->getQualifiedNameAsString()); - - if (get_unique_id(callee_decl->getID())) - diagram().add_active_participant( - get_unique_id(callee_decl->getID()).value()); } // - // Call to a function + // Call to function or template // - else if (const auto *function_call_expr = - clang::dyn_cast_or_null(expr); - function_call_expr != nullptr) { - auto *callee_decl = function_call_expr->getCalleeDecl(); + else { + auto *callee_decl = expr->getCalleeDecl(); if (callee_decl == nullptr) { LOG_DBG("Cannot get callee declaration - trying direct callee..."); - callee_decl = function_call_expr->getDirectCallee(); + callee_decl = expr->getDirectCallee(); } if (!callee_decl) { @@ -667,128 +547,24 @@ bool translation_unit_visitor::VisitCallExpr(clang::CallExpr *expr) // Call to a method of a class template // if (clang::dyn_cast_or_null( - function_call_expr->getCallee())) { - auto *dependent_member_callee = - clang::dyn_cast_or_null( - function_call_expr->getCallee()); - - if (is_callee_valid_template_specialization( - dependent_member_callee)) { - - const auto *primary_template = - dependent_member_callee->getBaseType() - ->getAs() - ->getTemplateName() - .getAsTemplateDecl(); - - std::string callee_method_full_name; - - // First check if the primary template is already in the - // participants map - if (get_participant(primary_template).has_value()) { - callee_method_full_name = - get_participant(primary_template) - .value() - .full_name(false) + - "::" + - dependent_member_callee->getMember().getAsString(); - } - else if (is_smart_pointer(primary_template)) { - // Otherwise check if it a smart pointer - primary_template->getTemplateParameters() - ->asArray() - .front(); - - if (get_participant(primary_template).has_value()) { - callee_method_full_name = - get_participant(primary_template) - .value() - .full_name(false) + - "::" + - dependent_member_callee->getMember() - .getAsString(); - } - else - return true; - } - - auto callee_id = common::to_id(callee_method_full_name); - m.to = callee_id; - - m.message_name = - dependent_member_callee->getMember().getAsString(); - m.return_type = ""; - - if (get_unique_id(primary_template->getID())) - diagram().add_active_participant( - get_unique_id(primary_template->getID()).value()); + expr->getCallee())) { + if (!process_class_template_method_call_expression(m, expr)) { + return true; } } // - // Call to a template function + // Unresolved lookup expression are sometimes calls to template + // functions // else if (clang::dyn_cast_or_null( - function_call_expr->getCallee())) { - // This is probably a template - auto *unresolved_expr = - clang::dyn_cast_or_null( - function_call_expr->getCallee()); - - if (unresolved_expr) { - for (const auto *decl : unresolved_expr->decls()) { - if (clang::dyn_cast_or_null< - clang::FunctionTemplateDecl>(decl)) { - // Yes, it's a template - auto *ftd = clang::dyn_cast_or_null< - clang::FunctionTemplateDecl>(decl); - - if (!get_unique_id(ftd->getID()).has_value()) - continue; - - m.to = get_unique_id(ftd->getID()).value(); - auto message_name = - diagram() - .get_participant( - m.to) - .value() - .full_name(false) - .substr(); - m.message_name = - message_name.substr(0, message_name.size() - 2); - - break; - } - } - } + expr->getCallee())) { + if (!process_unresolved_lookup_call_expression(m, expr)) + return true; } } else { - if (callee_decl->isTemplateDecl()) - LOG_DBG("Call to template function"); - - const auto *callee_function = callee_decl->getAsFunction(); - - if (!callee_function) + if (!process_function_call_expression(m, expr)) return true; - - auto callee_name = - callee_function->getQualifiedNameAsString() + "()"; - - std::unique_ptr f_ptr; - - if (!get_unique_id(callee_function->getID()).has_value()) { - // This is hopefully not an interesting call... - return true; - } - else { - m.to = get_unique_id(callee_function->getID()).value(); - } - - auto message_name = callee_name; - m.message_name = message_name.substr(0, message_name.size() - 2); - - if (f_ptr) - diagram().add_participant(std::move(f_ptr)); } // @@ -799,9 +575,6 @@ bool translation_unit_visitor::VisitCallExpr(clang::CallExpr *expr) // m.return_type = return_type.getAsString(); m.return_type = ""; } - else { - return true; - } if (m.from > 0 && m.to > 0) { if (diagram().sequences.find(m.from) == diagram().sequences.end()) { @@ -825,6 +598,202 @@ bool translation_unit_visitor::VisitCallExpr(clang::CallExpr *expr) return true; } +bool translation_unit_visitor::process_operator_call_expression( + model::message &m, const clang::CXXOperatorCallExpr *operator_call_expr) +{ + LOG_DBG("Operator '{}' call expression to {} at {}", + getOperatorSpelling(operator_call_expr->getOperator()), + operator_call_expr->getCalleeDecl()->getID(), + operator_call_expr->getBeginLoc().printToString(source_manager())); + + auto maybe_id = get_unique_id(operator_call_expr->getCalleeDecl()->getID()); + if (maybe_id.has_value()) { + m.to = maybe_id.value(); + } + else { + m.to = operator_call_expr->getCalleeDecl()->getID(); + } + + m.message_name = fmt::format( + "operator{}", getOperatorSpelling(operator_call_expr->getOperator())); + + return true; +} + +bool translation_unit_visitor::process_class_method_call_expression( + model::message &m, const clang::CXXMemberCallExpr *method_call_expr) +{ + // Get callee declaration as methods parent + const auto *method_decl = method_call_expr->getMethodDecl(); + std::string method_name = method_decl->getQualifiedNameAsString(); + + auto *callee_decl = method_decl ? method_decl->getParent() : nullptr; + + if (!(callee_decl && + diagram().should_include(callee_decl->getQualifiedNameAsString()))) + return false; + + const auto *callee_template_specialization = + clang::dyn_cast(callee_decl); + + if (callee_template_specialization) { + LOG_DBG("Callee is a template specialization declaration {}", + callee_template_specialization->getQualifiedNameAsString()); + + const auto &specialization_participant = + diagram() + .get_participant( + get_unique_id(callee_template_specialization->getID()) + .value()) + .value(); + const auto specialization_method_name = + specialization_participant.full_name(false) + + "::" + method_decl->getNameAsString(); + + m.to = common::to_id(specialization_method_name); + m.message_name = method_decl->getNameAsString(); + } + else { + // TODO: The method can be called before it's declaration has been + // encountered by the visitor - for now it's not a problem + // as overloaded methods are not supported + m.to = common::to_id(method_decl->getQualifiedNameAsString()); + m.message_name = method_decl->getNameAsString(); + } + m.return_type = + method_call_expr->getCallReturnType(*context().get_ast_context()) + .getAsString(); + + LOG_DBG("Set callee method id {} for method name {}", m.to, + method_decl->getQualifiedNameAsString()); + + if (get_unique_id(callee_decl->getID())) + diagram().add_active_participant( + get_unique_id(callee_decl->getID()).value()); + + return true; +} + +bool translation_unit_visitor::process_class_template_method_call_expression( + model::message &m, const clang::CallExpr *expr) +{ + auto *dependent_member_callee = + clang::dyn_cast_or_null( + expr->getCallee()); + + if (is_callee_valid_template_specialization(dependent_member_callee)) { + + const auto *primary_template = + dependent_member_callee->getBaseType() + ->getAs() + ->getTemplateName() + .getAsTemplateDecl(); + + std::string callee_method_full_name; + + // First check if the primary template is already in the + // participants map + if (get_participant(primary_template).has_value()) { + callee_method_full_name = + get_participant(primary_template).value().full_name(false) + + "::" + dependent_member_callee->getMember().getAsString(); + } + else if (is_smart_pointer(primary_template)) { + // Otherwise check if it a smart pointer + primary_template->getTemplateParameters()->asArray().front(); + + if (get_participant(primary_template).has_value()) { + callee_method_full_name = + get_participant(primary_template).value().full_name(false) + + "::" + dependent_member_callee->getMember().getAsString(); + } + else + return false; + } + + auto callee_id = common::to_id(callee_method_full_name); + m.to = callee_id; + + m.message_name = dependent_member_callee->getMember().getAsString(); + m.return_type = ""; + + if (get_unique_id(primary_template->getID())) + diagram().add_active_participant( + get_unique_id(primary_template->getID()).value()); + } + + return true; +} + +bool translation_unit_visitor::process_function_call_expression( + model::message &m, const clang::CallExpr *expr) +{ + const auto *callee_decl = expr->getCalleeDecl(); + + if (callee_decl == nullptr) + return false; + + const auto *callee_function = callee_decl->getAsFunction(); + + if (!callee_function) + return false; + + auto callee_name = callee_function->getQualifiedNameAsString() + "()"; + + std::unique_ptr f_ptr; + + if (!get_unique_id(callee_function->getID()).has_value()) { + // This is hopefully not an interesting call... + return false; + } + else { + m.to = get_unique_id(callee_function->getID()).value(); + } + + auto message_name = callee_name; + m.message_name = message_name.substr(0, message_name.size() - 2); + + if (f_ptr) + diagram().add_participant(std::move(f_ptr)); + + return true; +} + +bool translation_unit_visitor::process_unresolved_lookup_call_expression( + model::message &m, const clang::CallExpr *expr) +{ + // This is probably a template + auto *unresolved_expr = + clang::dyn_cast_or_null(expr->getCallee()); + + if (unresolved_expr) { + for (const auto *decl : unresolved_expr->decls()) { + if (clang::dyn_cast_or_null(decl)) { + // Yes, it's a template + auto *ftd = + clang::dyn_cast_or_null(decl); + + if (!get_unique_id(ftd->getID()).has_value()) + continue; + + m.to = get_unique_id(ftd->getID()).value(); + auto message_name = + diagram() + .get_participant(m.to) + .value() + .full_name(false) + .substr(); + m.message_name = + message_name.substr(0, message_name.size() - 2); + + break; + } + } + } + + return true; +} + bool translation_unit_visitor::is_callee_valid_template_specialization( const clang::CXXDependentScopeMemberExpr *dependent_member_callee) const { diff --git a/src/sequence_diagram/visitor/translation_unit_visitor.h b/src/sequence_diagram/visitor/translation_unit_visitor.h index 90fafbe7..3991b723 100644 --- a/src/sequence_diagram/visitor/translation_unit_visitor.h +++ b/src/sequence_diagram/visitor/translation_unit_visitor.h @@ -42,22 +42,22 @@ public: bool shouldVisitTemplateInstantiations(); - virtual bool VisitCallExpr(clang::CallExpr *expr); + bool VisitCallExpr(clang::CallExpr *expr); - virtual bool VisitLambdaExpr(clang::LambdaExpr *expr); + bool VisitLambdaExpr(clang::LambdaExpr *expr); - virtual bool TraverseLambdaExpr(clang::LambdaExpr *expr); + bool TraverseLambdaExpr(clang::LambdaExpr *expr); - virtual bool VisitCXXMethodDecl(clang::CXXMethodDecl *method); + bool VisitCXXMethodDecl(clang::CXXMethodDecl *method); - virtual bool VisitCXXRecordDecl(clang::CXXRecordDecl *cls); + bool VisitCXXRecordDecl(clang::CXXRecordDecl *cls); - virtual bool VisitClassTemplateDecl(clang::ClassTemplateDecl *cls); + bool VisitClassTemplateDecl(clang::ClassTemplateDecl *cls); - virtual bool VisitClassTemplateSpecializationDecl( + bool VisitClassTemplateSpecializationDecl( clang::ClassTemplateSpecializationDecl *cls); - virtual bool VisitFunctionDecl(clang::FunctionDecl *function_declaration); + bool VisitFunctionDecl(clang::FunctionDecl *function_declaration); bool VisitFunctionTemplateDecl( clang::FunctionTemplateDecl *function_declaration); @@ -203,6 +203,21 @@ private: const clang::CXXDependentScopeMemberExpr *dependent_member_callee) const; + bool process_operator_call_expression(model::message &m, + const clang::CXXOperatorCallExpr *operator_call_expr); + + bool process_class_method_call_expression( + model::message &m, const clang::CXXMemberCallExpr *operator_call_expr); + + bool process_class_template_method_call_expression( + model::message &m, const clang::CallExpr *expr); + + bool process_function_call_expression( + model::message &m, const clang::CallExpr *expr); + + bool process_unresolved_lookup_call_expression( + model::message &m, const clang::CallExpr *expr); + // Reference to the output diagram model clanguml::sequence_diagram::model::diagram &diagram_; From 7ddd81c1b72cf9ae77667228ce067d1053d2636c Mon Sep 17 00:00:00 2001 From: Bartek Kryza Date: Sun, 4 Dec 2022 14:42:15 +0100 Subject: [PATCH 40/77] Fixed formatting --- src/common/clang_utils.cc | 2 -- .../generators/plantuml/sequence_diagram_generator.cc | 10 ++++------ src/sequence_diagram/model/diagram.h | 1 - 3 files changed, 4 insertions(+), 9 deletions(-) diff --git a/src/common/clang_utils.cc b/src/common/clang_utils.cc index e02210e9..c5fec542 100644 --- a/src/common/clang_utils.cc +++ b/src/common/clang_utils.cc @@ -164,8 +164,6 @@ std::string get_source_text( return get_source_text_raw(printable_range, sm); } - - template <> id_t to_id(const std::string &full_name) { return std::hash{}(full_name) >> 3; diff --git a/src/sequence_diagram/generators/plantuml/sequence_diagram_generator.cc b/src/sequence_diagram/generators/plantuml/sequence_diagram_generator.cc index d775e103..be064b43 100644 --- a/src/sequence_diagram/generators/plantuml/sequence_diagram_generator.cc +++ b/src/sequence_diagram/generators/plantuml/sequence_diagram_generator.cc @@ -107,10 +107,6 @@ void generator::generate_activity(const activity &a, std::ostream &ostr, m.from, m.to, m.to); generate_activity(m_model.sequences[m.to], ostr, visited); } -// else { -// // clear the visited list after breaking the loop -// visited.clear(); -// } } else LOG_DBG("Skipping activity {} --> {} - missing sequence {}", m.from, @@ -195,9 +191,11 @@ void generator::generate(std::ostream &ostr) const break; } } - std::vector visited_participants; + std::vector + visited_participants; - const auto& from = m_model.get_participant(start_from); + const auto &from = + m_model.get_participant(start_from); generate_participant(ostr, start_from); diff --git a/src/sequence_diagram/model/diagram.h b/src/sequence_diagram/model/diagram.h index ae3d3a25..0c275482 100644 --- a/src/sequence_diagram/model/diagram.h +++ b/src/sequence_diagram/model/diagram.h @@ -76,7 +76,6 @@ public: static_cast(participants.at(id).get())); } - void add_participant(std::unique_ptr p) { const auto participant_id = p->id(); From af8d7d704ad113f57c4bcaa534672ee6c14c1297 Mon Sep 17 00:00:00 2001 From: Bartek Kryza Date: Sun, 4 Dec 2022 14:46:44 +0100 Subject: [PATCH 41/77] Updated test case documentation --- docs/test_cases/t00002_class.svg | 36 +++--- docs/test_cases/t00003_class.svg | 46 +++---- docs/test_cases/t00004_class.svg | 76 ++++++------ docs/test_cases/t00005_class.svg | 110 ++++++++--------- docs/test_cases/t00006_class.svg | 134 ++++++++++----------- docs/test_cases/t00007_class.svg | 30 ++--- docs/test_cases/t00008_class.svg | 56 ++++----- docs/test_cases/t00009_class.svg | 32 ++--- docs/test_cases/t00010_class.svg | 34 +++--- docs/test_cases/t00011_class.svg | 22 ++-- docs/test_cases/t00012_class.svg | 66 +++++------ docs/test_cases/t00013_class.svg | 82 ++++++------- docs/test_cases/t00014_class.svg | 124 +++++++++---------- docs/test_cases/t00015_class.svg | 22 ++-- docs/test_cases/t00016_class.svg | 30 ++--- docs/test_cases/t00017_class.svg | 66 +++++------ docs/test_cases/t00018_class.svg | 18 +-- docs/test_cases/t00019_class.svg | 40 +++---- docs/test_cases/t00020_class.svg | 38 +++--- docs/test_cases/t00021_class.svg | 30 ++--- docs/test_cases/t00022_class.svg | 14 +-- docs/test_cases/t00023_class.svg | 26 ++-- docs/test_cases/t00024_class.svg | 22 ++-- docs/test_cases/t00025_class.svg | 34 +++--- docs/test_cases/t00026_class.svg | 42 +++---- docs/test_cases/t00027_class.svg | 58 ++++----- docs/test_cases/t00028_class.svg | 78 ++++++------ docs/test_cases/t00029_class.svg | 50 ++++---- docs/test_cases/t00030_class.svg | 46 +++---- docs/test_cases/t00031_class.svg | 50 ++++---- docs/test_cases/t00032_class.svg | 40 +++---- docs/test_cases/t00033_class.svg | 48 ++++---- docs/test_cases/t00034_class.svg | 46 +++---- docs/test_cases/t00035_class.svg | 22 ++-- docs/test_cases/t00036_class.svg | 38 +++--- docs/test_cases/t00037_class.svg | 178 ++++++++++++++-------------- docs/test_cases/t00038_class.svg | 58 ++++----- docs/test_cases/t00039_class.svg | 78 ++++++------ docs/test_cases/t00040_class.svg | 26 ++-- docs/test_cases/t00041_class.svg | 54 ++++----- docs/test_cases/t00042_class.svg | 36 +++--- docs/test_cases/t00043_class.svg | 50 ++++---- docs/test_cases/t00044_class.svg | 36 +++--- docs/test_cases/t00045_class.svg | 70 +++++------ docs/test_cases/t00046_class.svg | 64 +++++----- docs/test_cases/t00047_class.svg | 22 ++-- docs/test_cases/t00048_class.svg | 50 ++++---- docs/test_cases/t00049_class.svg | 32 ++--- docs/test_cases/t00050_class.svg | 72 +++++------ docs/test_cases/t20001_sequence.svg | 118 +++++++++--------- docs/test_cases/t20002_sequence.svg | 36 +++--- docs/test_cases/t20003_sequence.svg | 36 +++--- docs/test_cases/t20004_sequence.svg | 108 ++++++++--------- docs/test_cases/t20005_sequence.svg | 28 +++-- docs/test_cases/t20006_sequence.svg | 136 ++++++++++----------- docs/test_cases/t20007_sequence.svg | 52 ++++---- docs/test_cases/t20008_sequence.svg | 68 +++++------ docs/test_cases/t20009_sequence.svg | 68 +++++------ docs/test_cases/t20010_sequence.svg | 64 +++++----- docs/test_cases/t20011_sequence.svg | 75 ++++++------ docs/test_cases/t30001_package.svg | 48 ++++---- docs/test_cases/t30002_package.svg | 90 +++++++------- docs/test_cases/t30003_package.svg | 26 ++-- docs/test_cases/t30004_package.svg | 30 ++--- docs/test_cases/t30005_package.svg | 38 +++--- docs/test_cases/t30006_package.svg | 16 +-- docs/test_cases/t30007_package.svg | 20 ++-- docs/test_cases/t30008_package.svg | 34 +++--- docs/test_cases/t40001_include.svg | 30 ++--- docs/test_cases/t40002_include.svg | 34 +++--- docs/test_cases/t40003_include.svg | 50 ++++---- 71 files changed, 1883 insertions(+), 1854 deletions(-) diff --git a/docs/test_cases/t00002_class.svg b/docs/test_cases/t00002_class.svg index c4575341..5f763b40 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_class.svg b/docs/test_cases/t00003_class.svg index cd0d7b8a..e033f386 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_class.svg b/docs/test_cases/t00004_class.svg index 30330ada..71bf98c4 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,15 +59,15 @@ Red - - + + A::AA::AAA - + C::B @@ -75,8 +75,8 @@ int - - + + C @@ -84,39 +84,39 @@ T - + - + t : T - + - + b_int : B<int> - - + + C::AA - - + + C::AA::AAA - - + + C::AA::CCC @@ -125,8 +125,8 @@ CCC_2 - - + + C::B @@ -134,16 +134,16 @@ V - + - + b : V - - + + C::CC @@ -152,16 +152,16 @@ CC_2 - - + + detail::D - - + + detail::D::AA @@ -171,8 +171,8 @@ AA_3 - - + + detail::D::DD diff --git a/docs/test_cases/t00005_class.svg b/docs/test_cases/t00005_class.svg index 9c3476fe..9b8baaeb 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_class.svg b/docs/test_cases/t00006_class.svg index 6acb77c0..a712c5b6 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,15 +146,15 @@ T - + - + data : std::vector<T> - + custom_container @@ -162,102 +162,102 @@ 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] + + 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_class.svg b/docs/test_cases/t00007_class.svg index 91571177..55679e03 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_class.svg b/docs/test_cases/t00008_class.svg index fdc11a1e..e2644184 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,CMP,int N - + - + 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,15 +87,15 @@ T,C<> - + - + template_template : C<T> - + B @@ -103,18 +103,18 @@ int,Vector - - + + D - + - + ints : B<int,Vector> diff --git a/docs/test_cases/t00009_class.svg b/docs/test_cases/t00009_class.svg index 54e28fbb..de32573e 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,15 +18,15 @@ T - + - + value : T - + A @@ -34,7 +34,7 @@ int - + A @@ -42,7 +42,7 @@ std::string - + A @@ -50,32 +50,32 @@ 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_class.svg b/docs/test_cases/t00010_class.svg index d4501dda..1d15edc7 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,22 +18,22 @@ T,P - + - + first : T - + - + second : P - + A @@ -41,8 +41,8 @@ T,std::string - - + + B @@ -50,15 +50,15 @@ T - + - + astring : A<T,std::string> - + B @@ -66,18 +66,18 @@ int - - + + C - + - + aintstring : B<int> diff --git a/docs/test_cases/t00011_class.svg b/docs/test_cases/t00011_class.svg index c5ec7c92..c72b84f3 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_class.svg b/docs/test_cases/t00012_class.svg index 3e53d1ed..bacb9a37 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,14 +60,14 @@ - + - + ints : std::array<T,sizeof...(Is)> - + A @@ -75,7 +75,7 @@ int,std::string,float - + A @@ -83,7 +83,7 @@ int,std::string,bool - + B @@ -91,7 +91,7 @@ 3,2,1 - + B @@ -99,7 +99,7 @@ 1,1,1,1 - + C @@ -107,50 +107,50 @@ 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_class.svg b/docs/test_cases/t00013_class.svg index d363882f..50a120b7 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,15 +18,15 @@ T - + - + f : T - + ABCD::F @@ -34,70 +34,70 @@ int - - + + A - + - + a : int - - + + B - + - + b : int - - + + C - + - + c : int - - + + D - + - + d : int print(R * r) : void - - + + E @@ -105,16 +105,16 @@ T - + - + e : T - - + + G @@ -122,22 +122,22 @@ T,Args... - + - + g : T - + - + args : std::tuple<Args...> - + E @@ -145,7 +145,7 @@ int - + G @@ -153,7 +153,7 @@ int,float,std::string - + E @@ -161,25 +161,25 @@ std::string - - + + R - + - + gintstring : G<int,float,std::string> - + - + estring : E<std::string> diff --git a/docs/test_cases/t00014_class.svg b/docs/test_cases/t00014_class.svg index 92f32a74..218a88db 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,37 +18,37 @@ T,P - + - + t : T - + - + p : P - - + + B - + - + value : std::string - + A @@ -56,7 +56,7 @@ T,std::string - + A @@ -64,7 +64,7 @@ T,std::unique_ptr<std::string> - + A @@ -72,7 +72,7 @@ long,T - + A @@ -80,7 +80,7 @@ double,T - + A @@ -88,7 +88,7 @@ long,U - + A @@ -96,7 +96,7 @@ long,bool - + A @@ -104,7 +104,7 @@ double,bool - + A @@ -112,7 +112,7 @@ long,float - + A @@ -120,7 +120,7 @@ double,float - + A @@ -128,7 +128,7 @@ bool,std::string - + A @@ -136,7 +136,7 @@ float,std::unique_ptr<std::string> - + A @@ -144,7 +144,7 @@ int,std::string - + A @@ -152,7 +152,7 @@ std::string,std::string - + A @@ -160,7 +160,7 @@ char,std::string - + A @@ -168,116 +168,116 @@ wchar_t,std::string - - + + R - + - + 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 - + - + bs : BVector - + - + bs2 : BVector2 - + - + cb : SimpleCallback<ACharString> - + - + gcb : GenericCallback<R::AWCharString> - + - + vcb : VoidCallback - + - + vps : VectorPtr<B> @@ -307,9 +307,9 @@ - + - + @@ -375,9 +375,9 @@ bstringstring - + - + diff --git a/docs/test_cases/t00015_class.svg b/docs/test_cases/t00015_class.svg index 52073a75..91ff7e73 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_class.svg b/docs/test_cases/t00016_class.svg index 8d042296..4b599cfb 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<> @@ -19,8 +19,8 @@ value : enum - - + + is_numeric @@ -29,8 +29,8 @@ value : enum - - + + is_numeric @@ -41,8 +41,8 @@ value : enum - - + + is_numeric @@ -53,8 +53,8 @@ value : enum - - + + is_numeric @@ -65,8 +65,8 @@ value : enum - - + + is_numeric @@ -77,8 +77,8 @@ value : enum - - + + is_numeric diff --git a/docs/test_cases/t00017_class.svg b/docs/test_cases/t00017_class.svg index 5c5fb6de..b1dd131c 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_class.svg b/docs/test_cases/t00018_class.svg index 56c0cce5..90838edb 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_class.svg b/docs/test_cases/t00019_class.svg index 4d60d4cc..eb0cf359 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,7 +83,7 @@ m1_calls() const : int m2_calls() const : int - + Layer3 @@ -91,7 +91,7 @@ Base - + Layer2 @@ -99,7 +99,7 @@ Layer3<Base> - + Layer1 @@ -107,18 +107,18 @@ Layer2<Layer3<Base>> - - + + A - + - + layers : std::unique_ptr<Layer1<Layer2<Layer3<Base>>>> diff --git a/docs/test_cases/t00020_class.svg b/docs/test_cases/t00020_class.svg index 6d116e3f..624acee7 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_class.svg b/docs/test_cases/t00021_class.svg index 60b3803d..2b1e585c 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_class.svg b/docs/test_cases/t00022_class.svg index 88c0d44a..c4ced57e 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_class.svg b/docs/test_cases/t00023_class.svg index c9a9f1fb..ecc2025d 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_class.svg b/docs/test_cases/t00024_class.svg index f2966c61..b2677137 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_class.svg b/docs/test_cases/t00025_class.svg index 6152bf3f..cacc8635 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,7 +56,7 @@ m1() : void m2() : void - + Proxy @@ -64,7 +64,7 @@ Target1 - + Proxy @@ -72,25 +72,25 @@ Target2 - - + + ProxyHolder - + - + proxy1 : Proxy<Target1> - + - + proxy2 : Proxy<Target2> diff --git a/docs/test_cases/t00026_class.svg b/docs/test_cases/t00026_class.svg index c96b80dd..35808ec8 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>(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,7 +78,7 @@ state(const std::string & n) : Memento<T> & set_state(const std::string & s, Memento<T> && m) : void - + Caretaker @@ -86,7 +86,7 @@ std::string - + Originator @@ -94,25 +94,25 @@ std::string - - + + StringMemento - + - + caretaker : Caretaker<std::string> - + - + originator : Originator<std::string> diff --git a/docs/test_cases/t00027_class.svg b/docs/test_cases/t00027_class.svg index 71ba3eee..60d2fe44 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,14 @@ ~Shape() = default : void - + Line - - + + Line @@ -39,14 +39,14 @@ display() : void - + Text - - + + Text @@ -57,8 +57,8 @@ display() : void - - + + ShapeDecorator @@ -67,8 +67,8 @@ display() = 0 : void - - + + Color @@ -79,8 +79,8 @@ display() : void - - + + Weight @@ -91,7 +91,7 @@ display() : void - + Line @@ -99,7 +99,7 @@ Color,Weight - + Line @@ -107,7 +107,7 @@ Color - + Text @@ -115,7 +115,7 @@ Color,Weight - + Text @@ -123,39 +123,39 @@ Color - - + + Window - + - + border : Line<Color,Weight> - + - + divider : Line<Color> - + - + title : Text<Color,Weight> - + - + description : Text<Color> diff --git a/docs/test_cases/t00028_class.svg b/docs/test_cases/t00028_class.svg index 3bbf554a..7acc1783 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,10 +94,10 @@ three - + F enum note. - + E @@ -105,59 +105,59 @@ 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. diff --git a/docs/test_cases/t00029_class.svg b/docs/test_cases/t00029_class.svg index dbc6f004..bf752ecd 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_class.svg b/docs/test_cases/t00030_class.svg index afb46d35..e784a8be 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_class.svg b/docs/test_cases/t00031_class.svg index 8761c1c4..72f4e251 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,23 +47,23 @@ T - + - + ttt : T - - + + D - + C @@ -71,39 +71,39 @@ int - - + + R - + - + aaa : A * - + - + bbb : std::vector<B> - + - + ccc : C<int> - + - + ddd : D * diff --git a/docs/test_cases/t00032_class.svg b/docs/test_cases/t00032_class.svg index 2500516b..91728994 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,15 +64,15 @@ T,L,Ts... - + - + counter : L - + Overload @@ -80,18 +80,18 @@ TBase,int,A,B,C - - + + R - + - + overload : Overload<TBase,int,A,B,C> diff --git a/docs/test_cases/t00033_class.svg b/docs/test_cases/t00033_class.svg index 552c4a3d..92ace375 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,30 +52,30 @@ T - + - + ccc : T - - + + D - + - + ddd : int - + C @@ -83,7 +83,7 @@ D - + B @@ -91,7 +91,7 @@ std::unique_ptr<C<D>> - + A @@ -99,18 +99,18 @@ B<std::unique_ptr<C<D>>> - - + + R - + - + abc : A<B<std::unique_ptr<C<D>>>> diff --git a/docs/test_cases/t00034_class.svg b/docs/test_cases/t00034_class.svg index c266234b..59da6eb4 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,16 +31,16 @@ - - + + lift_void - - + + lift_void @@ -49,8 +49,8 @@ - - + + drop_void @@ -59,16 +59,16 @@ - - + + drop_void - - + + drop_void @@ -77,33 +77,33 @@ - - + + A - - + + R - + - + la : lift_void_t<A> * - + - + lv : lift_void_t<void> * diff --git a/docs/test_cases/t00035_class.svg b/docs/test_cases/t00035_class.svg index 6a456a5c..47cc1eb6 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_class.svg b/docs/test_cases/t00036_class.svg index 9de74829..3676248e 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,15 +43,15 @@ T - + - + a : T - + A @@ -59,23 +59,23 @@ int - - + + B - + - + a_int : A<int> - - + + C diff --git a/docs/test_cases/t00037_class.svg b/docs/test_cases/t00037_class.svg index 456d678a..96a528b9 100644 --- a/docs/test_cases/t00037_class.svg +++ b/docs/test_cases/t00037_class.svg @@ -1,6 +1,6 @@ - + - + @@ -9,114 +9,114 @@ - - - - - ST - - + + + + + ST + + - - - + + + - - dimensions : struct (anonymous struct at /home/bartek/devel/clang-uml-libtooling/tests/t00037/t00037.cc:6:5) + + dimensions : ST::(anonymous_620) - - - + + + - - units : struct (anonymous struct at /home/bartek/devel/clang-uml-libtooling/tests/t00037/t00037.cc:14:5) + + units : ST::(anonymous_739) - - - - - ST::(dimensions) - + + + + + ST::(dimensions) + - - - + + + - - t : double + + t : double - - - + + + - - x : double + + x : double - - - + + + - - y : double + + y : double - - - + + + - - z : double + + z : double - - - - - - ST::(units) - + + + + + + ST::(units) + - - - + + + - - c : double + + c : double - - - + + + - - h : double + + h : double - - - - - - A - + + + + + + A + - - - + + + - - st : ST + + st : ST - - - A() : void - - - - dimensions - - - - units - - - - st + + + A() : void + + + + dimensions + + + + units + + + + st diff --git a/docs/test_cases/t00038_class.svg b/docs/test_cases/t00038_class.svg index a4cdf1ff..7c08afde 100644 --- a/docs/test_cases/t00038_class.svg +++ b/docs/test_cases/t00038_class.svg @@ -1,6 +1,6 @@ - + @@ -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,16 +88,16 @@ - - + + map - - + + map @@ -106,8 +106,8 @@ - - + + map @@ -116,8 +116,8 @@ - - + + map @@ -126,8 +126,8 @@ - - + + map diff --git a/docs/test_cases/t00039_class.svg b/docs/test_cases/t00039_class.svg index 0a2d04bb..41be542b 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_class.svg b/docs/test_cases/t00040_class.svg index 317895bb..32413272 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_class.svg b/docs/test_cases/t00041_class.svg index cee40d52..10e9bebc 100644 --- a/docs/test_cases/t00041_class.svg +++ b/docs/test_cases/t00041_class.svg @@ -1,6 +1,6 @@ - + @@ -9,100 +9,100 @@ - - + + R - - + + D - + - + rr : RR * - - + + E - - + + F - - + + RR - + - + e : E * - + - + f : F * - + - + g : detail::G * - - + + RRR - - + + ns1::N - - + + ns1::NN - - + + ns1::NM diff --git a/docs/test_cases/t00042_class.svg b/docs/test_cases/t00042_class.svg index 74906e7a..4647f7a1 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,22 +52,22 @@ T,K - + - + b : T - + - + bb : K - + A @@ -75,7 +75,7 @@ double - + A @@ -83,7 +83,7 @@ std::string - + B diff --git a/docs/test_cases/t00043_class.svg b/docs/test_cases/t00043_class.svg index 8448b01b..34855014 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_class.svg b/docs/test_cases/t00044_class.svg index 9cbbb7ad..fb13a2e6 100644 --- a/docs/test_cases/t00044_class.svg +++ b/docs/test_cases/t00044_class.svg @@ -1,6 +1,6 @@ - + @@ -9,7 +9,7 @@ - + signal_handler @@ -17,8 +17,8 @@ ,A - - + + sink @@ -27,15 +27,15 @@ sink<signal_handler<type-parameter-0-0 (type-parameter-0-1...), type-parameter-0-2> >(sink<signal_handler<type-parameter-0-0 (type-parameter-0-1...),type-parameter-0-2>>::signal_t & sh) : void - + - + signal : sink<signal_handler<type-parameter-0-0 (type-parameter-0-1...),type-parameter-0-2>>::signal_t * - - + + sink @@ -46,23 +46,23 @@ sink<signal_handler<type-parameter-0-0 (type-parameter-0-1...), type-parameter-0-2> >(sink<signal_handler<type-parameter-0-0 (type-parameter-0-1...),type-parameter-0-2>>::signal_t & sh) : void - + - + signal : sink<signal_handler<type-parameter-0-0 (type-parameter-0-1...),type-parameter-0-2>>::signal_t * - - + + signal_handler - - + + signal_handler @@ -71,8 +71,8 @@ - - + + signal_handler @@ -81,8 +81,8 @@ - - + + sink diff --git a/docs/test_cases/t00045_class.svg b/docs/test_cases/t00045_class.svg index c08e32e4..3f11e6cd 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_class.svg b/docs/test_cases/t00046_class.svg index 12b8006c..8d644e54 100644 --- a/docs/test_cases/t00046_class.svg +++ b/docs/test_cases/t00046_class.svg @@ -1,6 +1,6 @@ - + @@ -9,118 +9,118 @@ - + ns1 - + ns2 - + __gnu_cxx - - + + A - - + + A - - + + B - - + + C - - + + D - - + + E - - + + R - + - + a : ns1::ns2::A * - + - + ns1_a : ns1::A * - + - + ns1_ns2_a : ns1::ns2::A * - + - + root_a : ::A * - + - + i : std::vector<std::uint8_t> foo(AA & aa) : void - - + + A - - + + AA diff --git a/docs/test_cases/t00047_class.svg b/docs/test_cases/t00047_class.svg index a6610525..3da5b1c4 100644 --- a/docs/test_cases/t00047_class.svg +++ b/docs/test_cases/t00047_class.svg @@ -1,6 +1,6 @@ - + @@ -9,16 +9,16 @@ - - + + conditional_t - - + + conditional_t @@ -27,8 +27,8 @@ - - + + conditional_t @@ -37,8 +37,8 @@ - - + + conditional_t @@ -47,8 +47,8 @@ - - + + conditional_t diff --git a/docs/test_cases/t00048_class.svg b/docs/test_cases/t00048_class.svg index 3acce986..35cfbdd7 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_class.svg b/docs/test_cases/t00049_class.svg index 7dbd2ee0..49ee8085 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,17 +18,17 @@ T - + - + a : T get_a() : T & - + A @@ -36,7 +36,7 @@ intmap - + A @@ -44,7 +44,7 @@ thestring - + A @@ -52,32 +52,32 @@ std::vector<thestring> - - + + R - + - + a_string : A<thestring> - + - + a_vector_string : A<string_vector> - + - + a_int_map : A<intmap> diff --git a/docs/test_cases/t00050_class.svg b/docs/test_cases/t00050_class.svg index 68c757b9..04295f8e 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] + + 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 diff --git a/docs/test_cases/t20001_sequence.svg b/docs/test_cases/t20001_sequence.svg index 6aff01bf..cea5c887 100644 --- a/docs/test_cases/t20001_sequence.svg +++ b/docs/test_cases/t20001_sequence.svg @@ -1,6 +1,6 @@ - + - + @@ -9,66 +9,68 @@ - - - - - - + + + + + + + - - - + + + tmain() - + tmain() - - A - - A - - B - - B - - - - - - - - - add() - - - - - wrap_add3() - - - add3() - - - - - add() - - - - - - - - - log_result() - - - - - log_result() + + A + + A + + B + + B + + + + + + + + + + add() + + + + + wrap_add3() + + + add3() + + + + + add() + + + + + + + + + log_result() + + + + + log_result() - - + + Main test function diff --git a/docs/test_cases/t20002_sequence.svg b/docs/test_cases/t20002_sequence.svg index c3e59fc7..f0dd197e 100644 --- a/docs/test_cases/t20002_sequence.svg +++ b/docs/test_cases/t20002_sequence.svg @@ -1,6 +1,6 @@ - + @@ -9,35 +9,37 @@ - - - + + + + - + m1() - + m1() - + m2() - + m2() - + m3() - + m3() - + m4() - + m4() - - - + + + + - - m2() + + m2() m3() diff --git a/docs/test_cases/t20003_sequence.svg b/docs/test_cases/t20003_sequence.svg index 7aaa6a62..85fc4d8d 100644 --- a/docs/test_cases/t20003_sequence.svg +++ b/docs/test_cases/t20003_sequence.svg @@ -1,6 +1,6 @@ - + @@ -9,35 +9,37 @@ - - - + + + + - + m1<T>() - + m1<T>() - + m2<T>() - + m2<T>() - + m3<T>() - + m3<T>() - + m4<T>() - + m4<T>() - - - + + + + - - m2<T>() + + m2<T>() m3<T>() diff --git a/docs/test_cases/t20004_sequence.svg b/docs/test_cases/t20004_sequence.svg index f3cef76f..4755d144 100644 --- a/docs/test_cases/t20004_sequence.svg +++ b/docs/test_cases/t20004_sequence.svg @@ -1,6 +1,6 @@ - + @@ -9,15 +9,16 @@ - - - - - - - - - + + + + + + + + + + @@ -28,83 +29,84 @@ - + main() - + main() - + m1<float>() - + m1<float>() - + m1<unsigned long>() - + m1<unsigned long>() - + m4<unsigned long>() - + m4<unsigned long>() - + m1<std::string>() - + m1<std::string>() - + m2<std::string>() - + m2<std::string>() - + m1<int>() - + m1<int>() - + m2<int>() - + m2<int>() - + m3<int>() - + m3<int>() - + m4<int>() - + m4<int>() - - - - - - - - - + + + + + + + + + + - - m1() - - + + m1() + + - - m1() + + m1() m4() - - + + - - m1() + + m1() m2() - - + + - - m1() + + m1() m2() diff --git a/docs/test_cases/t20005_sequence.svg b/docs/test_cases/t20005_sequence.svg index 93241fd4..dda1b150 100644 --- a/docs/test_cases/t20005_sequence.svg +++ b/docs/test_cases/t20005_sequence.svg @@ -1,6 +1,6 @@ - + @@ -9,28 +9,30 @@ - - + + + - + C<T> - + C<T> - + B<T> - + B<T> - + A<T> - + A<T> - - + + + - - b() + + b() a() diff --git a/docs/test_cases/t20006_sequence.svg b/docs/test_cases/t20006_sequence.svg index 1a4faac0..e4bf6ba8 100644 --- a/docs/test_cases/t20006_sequence.svg +++ b/docs/test_cases/t20006_sequence.svg @@ -1,6 +1,6 @@ - + @@ -9,21 +9,22 @@ - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + @@ -33,104 +34,105 @@ - + 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() + + b() a1() - - + + - - b() + + b() a2() - - + + - - bb1() + + bb1() aa1() - - bb2() + + bb2() aa2() - - bb1() + + bb1() aa2() - - bb2() + + bb2() aa1() - - bb1() + + bb1() diff --git a/docs/test_cases/t20007_sequence.svg b/docs/test_cases/t20007_sequence.svg index b89593d4..ca3a37f7 100644 --- a/docs/test_cases/t20007_sequence.svg +++ b/docs/test_cases/t20007_sequence.svg @@ -1,6 +1,6 @@ - + @@ -9,45 +9,47 @@ - - - + + + + - + 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() - - + + add() + + - - add() - - + + add() + + - - add() + + add() diff --git a/docs/test_cases/t20008_sequence.svg b/docs/test_cases/t20008_sequence.svg index 39cc56ab..e3f4dacc 100644 --- a/docs/test_cases/t20008_sequence.svg +++ b/docs/test_cases/t20008_sequence.svg @@ -1,6 +1,6 @@ - + @@ -9,12 +9,13 @@ - - - - - - + + + + + + + @@ -22,55 +23,56 @@ - + 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() + + b() a1() - - b() + + b() a2() - - b() + + b() a3() diff --git a/docs/test_cases/t20009_sequence.svg b/docs/test_cases/t20009_sequence.svg index e101f432..03a4a3ea 100644 --- a/docs/test_cases/t20009_sequence.svg +++ b/docs/test_cases/t20009_sequence.svg @@ -1,6 +1,6 @@ - + @@ -9,12 +9,13 @@ - - - - - - + + + + + + + @@ -22,55 +23,56 @@ - + 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() + + b() a() - - b() + + b() a() - - b() + + b() a() diff --git a/docs/test_cases/t20010_sequence.svg b/docs/test_cases/t20010_sequence.svg index b44353af..ed503036 100644 --- a/docs/test_cases/t20010_sequence.svg +++ b/docs/test_cases/t20010_sequence.svg @@ -1,6 +1,6 @@ - + @@ -9,58 +9,60 @@ - - - - - - - - + + + + + + + + + - + tmain() - + tmain() - + B<int> - + B<int> - + A - + A - - - - - - - - + + + + + + + + + - - b1() + + b1() a1() - - b2() + + b2() a2() - - b3() + + b3() a3() - - b4() + + b4() a4() diff --git a/docs/test_cases/t20011_sequence.svg b/docs/test_cases/t20011_sequence.svg index a1ef2360..b75dc7b5 100644 --- a/docs/test_cases/t20011_sequence.svg +++ b/docs/test_cases/t20011_sequence.svg @@ -1,6 +1,6 @@ - + - + @@ -9,41 +9,45 @@ - - - - - - - - - - + + + + + + + + + + + + tmain() - - tmain() - + + tmain() + A - - A - - - - - - - + + A + + + + + + + + + - - a() + + a() a() - - b() + + b() @@ -59,10 +63,15 @@ b() - - - - - a() + + + + + a() + + + + + a() diff --git a/docs/test_cases/t30001_package.svg b/docs/test_cases/t30001_package.svg index 51dc72a3..a5fbb2b8 100644 --- a/docs/test_cases/t30001_package.svg +++ b/docs/test_cases/t30001_package.svg @@ -1,6 +1,6 @@ - + @@ -9,63 +9,63 @@ - - + + 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_package.svg b/docs/test_cases/t30002_package.svg index 4c7afedd..d08a617b 100644 --- a/docs/test_cases/t30002_package.svg +++ b/docs/test_cases/t30002_package.svg @@ -1,6 +1,6 @@ - + @@ -9,113 +9,113 @@ - - + + A - - + + AA - - + + B - - + + BB - - + + A1 - - + + A2 - - + + A3 - - + + A4 - - + + A5 - - + + A6 - - + + A7 - - + + A8 - - + + A9 - - + + A10 - - + + A11 - - + + A12 - - + + A13 - - + + A14 - - + + A15 - - + + A16 - - + + A17 - - + + BBB diff --git a/docs/test_cases/t30003_package.svg b/docs/test_cases/t30003_package.svg index 036a242d..596751c4 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_package.svg b/docs/test_cases/t30004_package.svg index 74083c67..f35f5aad 100644 --- a/docs/test_cases/t30004_package.svg +++ b/docs/test_cases/t30004_package.svg @@ -1,6 +1,6 @@ - + @@ -9,40 +9,40 @@ - - + + A - + Package AAA. - + Package BBB. - + CCCC package note. - + We skipped DDD. - - + + AAA - - + + BBB - - + + CCC - - + + EEE diff --git a/docs/test_cases/t30005_package.svg b/docs/test_cases/t30005_package.svg index 0fd6e399..49185c09 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_package.svg b/docs/test_cases/t30006_package.svg index f393147e..b9e7699a 100644 --- a/docs/test_cases/t30006_package.svg +++ b/docs/test_cases/t30006_package.svg @@ -1,6 +1,6 @@ - + @@ -9,22 +9,22 @@ - - + + B - - + + A - - + + C - + Top A note. diff --git a/docs/test_cases/t30007_package.svg b/docs/test_cases/t30007_package.svg index e65c5a47..289e2bcb 100644 --- a/docs/test_cases/t30007_package.svg +++ b/docs/test_cases/t30007_package.svg @@ -1,6 +1,6 @@ - + @@ -9,27 +9,27 @@ - - + + A - - + + B - - + + AA - - + + C - + Compare layout with t30006. diff --git a/docs/test_cases/t30008_package.svg b/docs/test_cases/t30008_package.svg index a8b86c37..8e1b9360 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/t40001_include.svg b/docs/test_cases/t40001_include.svg index 2ff44cdf..83ae532f 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 diff --git a/docs/test_cases/t40002_include.svg b/docs/test_cases/t40002_include.svg index c2f3fd49..20a8e099 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_include.svg b/docs/test_cases/t40003_include.svg index 9cfa840e..245976fc 100644 --- a/docs/test_cases/t40003_include.svg +++ b/docs/test_cases/t40003_include.svg @@ -1,6 +1,6 @@ - + @@ -9,66 +9,66 @@ - + include - + dependants - + dependencies - + src - + dependants - + dependencies - - + + t3.h - - + + t2.h - - + + t1.h - - + + t3.h - - + + t2.h - - + + t1.h - - + + t5.h - - + + t1.cc - - + + t2.cc From 664a74faeecc93bd040d1381e78441c6098997fe Mon Sep 17 00:00:00 2001 From: Bartek Kryza Date: Sun, 4 Dec 2022 14:49:21 +0100 Subject: [PATCH 42/77] Updated test case documentation --- docs/test_cases.md | 1 + docs/test_cases/t00002_class.svg | 36 ++--- docs/test_cases/t00003_class.svg | 46 +++---- docs/test_cases/t00004_class.svg | 76 +++++------ docs/test_cases/t00005_class.svg | 110 +++++++-------- docs/test_cases/t00006_class.svg | 132 +++++++++--------- docs/test_cases/t00007_class.svg | 30 ++--- docs/test_cases/t00008_class.svg | 56 ++++---- docs/test_cases/t00009_class.svg | 32 ++--- docs/test_cases/t00010_class.svg | 34 ++--- docs/test_cases/t00011_class.svg | 22 +-- docs/test_cases/t00012_class.svg | 66 ++++----- docs/test_cases/t00013_class.svg | 82 +++++------ docs/test_cases/t00014_class.svg | 116 ++++++++-------- docs/test_cases/t00015_class.svg | 22 +-- docs/test_cases/t00016_class.svg | 30 ++--- docs/test_cases/t00017_class.svg | 66 ++++----- docs/test_cases/t00018_class.svg | 18 +-- docs/test_cases/t00019_class.svg | 40 +++--- docs/test_cases/t00020_class.svg | 38 +++--- docs/test_cases/t00021_class.svg | 30 ++--- docs/test_cases/t00022_class.svg | 14 +- docs/test_cases/t00023_class.svg | 26 ++-- docs/test_cases/t00024_class.svg | 22 +-- docs/test_cases/t00025_class.svg | 34 ++--- docs/test_cases/t00026_class.svg | 42 +++--- docs/test_cases/t00027_class.svg | 58 ++++---- docs/test_cases/t00028_class.svg | 78 +++++------ docs/test_cases/t00029_class.svg | 50 +++---- docs/test_cases/t00030_class.svg | 46 +++---- docs/test_cases/t00031_class.svg | 50 +++---- docs/test_cases/t00032_class.svg | 40 +++--- docs/test_cases/t00033_class.svg | 48 +++---- docs/test_cases/t00034_class.svg | 46 +++---- docs/test_cases/t00035_class.svg | 22 +-- docs/test_cases/t00036_class.svg | 38 +++--- docs/test_cases/t00037_class.svg | 54 ++++---- docs/test_cases/t00038_class.svg | 58 ++++---- docs/test_cases/t00039_class.svg | 78 +++++------ docs/test_cases/t00040_class.svg | 26 ++-- docs/test_cases/t00041_class.svg | 54 ++++---- docs/test_cases/t00042_class.svg | 36 ++--- docs/test_cases/t00043_class.svg | 50 +++---- docs/test_cases/t00044_class.svg | 36 ++--- docs/test_cases/t00045_class.svg | 70 +++++----- docs/test_cases/t00046_class.svg | 64 ++++----- docs/test_cases/t00047_class.svg | 22 +-- docs/test_cases/t00048_class.svg | 50 +++---- docs/test_cases/t00049_class.svg | 32 ++--- docs/test_cases/t00050_class.svg | 70 +++++----- docs/test_cases/t20012.md | 97 +++++++++++++ docs/test_cases/t20012_sequence.svg | 202 ++++++++++++++++++++++++++++ docs/test_cases/t30001_package.svg | 48 +++---- docs/test_cases/t30002_package.svg | 90 ++++++------- docs/test_cases/t30003_package.svg | 26 ++-- docs/test_cases/t30004_package.svg | 30 ++--- docs/test_cases/t30005_package.svg | 38 +++--- docs/test_cases/t30006_package.svg | 16 +-- docs/test_cases/t30007_package.svg | 20 +-- docs/test_cases/t30008_package.svg | 34 ++--- docs/test_cases/t40001_include.svg | 30 ++--- docs/test_cases/t40002_include.svg | 34 ++--- docs/test_cases/t40003_include.svg | 50 +++---- tests/test_cases.yaml | 3 + 64 files changed, 1709 insertions(+), 1406 deletions(-) create mode 100644 docs/test_cases/t20012.md create mode 100644 docs/test_cases/t20012_sequence.svg diff --git a/docs/test_cases.md b/docs/test_cases.md index 6ce3591d..386dd4ed 100644 --- a/docs/test_cases.md +++ b/docs/test_cases.md @@ -61,6 +61,7 @@ * [t20009](./test_cases/t20009.md) - Smart pointer dereference call expression test case * [t20010](./test_cases/t20010.md) - Container sequence diagram test case * [t20011](./test_cases/t20011.md) - Recursive calls sequence diagram test case + * [t20012](./test_cases/t20012.md) - Lambda expression call sequence diagram test case ## Package diagrams * [t30001](./test_cases/t30001.md) - Basic package diagram test case * [t30002](./test_cases/t30002.md) - Package dependency test case diff --git a/docs/test_cases/t00002_class.svg b/docs/test_cases/t00002_class.svg index 5f763b40..6b5e48d9 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_class.svg b/docs/test_cases/t00003_class.svg index e033f386..2f3a234a 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_class.svg b/docs/test_cases/t00004_class.svg index 71bf98c4..4bf3621f 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,15 +59,15 @@ Red - - + + A::AA::AAA - + C::B @@ -75,8 +75,8 @@ int - - + + C @@ -84,39 +84,39 @@ T - + - + t : T - + - + b_int : B<int> - - + + C::AA - - + + C::AA::AAA - - + + C::AA::CCC @@ -125,8 +125,8 @@ CCC_2 - - + + C::B @@ -134,16 +134,16 @@ V - + - + b : V - - + + C::CC @@ -152,16 +152,16 @@ CC_2 - - + + detail::D - - + + detail::D::AA @@ -171,8 +171,8 @@ AA_3 - - + + detail::D::DD diff --git a/docs/test_cases/t00005_class.svg b/docs/test_cases/t00005_class.svg index 9b8baaeb..109b68fd 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_class.svg b/docs/test_cases/t00006_class.svg index a712c5b6..70d841d4 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,15 +146,15 @@ T - + - + data : std::vector<T> - + custom_container @@ -162,102 +162,102 @@ 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_class.svg b/docs/test_cases/t00007_class.svg index 55679e03..fd6c7970 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_class.svg b/docs/test_cases/t00008_class.svg index e2644184..e20aa3fd 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,CMP,int N - + - + 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,15 +87,15 @@ T,C<> - + - + template_template : C<T> - + B @@ -103,18 +103,18 @@ int,Vector - - + + D - + - + ints : B<int,Vector> diff --git a/docs/test_cases/t00009_class.svg b/docs/test_cases/t00009_class.svg index de32573e..8278a48a 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,15 +18,15 @@ T - + - + value : T - + A @@ -34,7 +34,7 @@ int - + A @@ -42,7 +42,7 @@ std::string - + A @@ -50,32 +50,32 @@ 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_class.svg b/docs/test_cases/t00010_class.svg index 1d15edc7..e3ef7243 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,22 +18,22 @@ T,P - + - + first : T - + - + second : P - + A @@ -41,8 +41,8 @@ T,std::string - - + + B @@ -50,15 +50,15 @@ T - + - + astring : A<T,std::string> - + B @@ -66,18 +66,18 @@ int - - + + C - + - + aintstring : B<int> diff --git a/docs/test_cases/t00011_class.svg b/docs/test_cases/t00011_class.svg index c72b84f3..b6c42908 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_class.svg b/docs/test_cases/t00012_class.svg index bacb9a37..f3b5b83b 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,14 +60,14 @@ - + - + ints : std::array<T,sizeof...(Is)> - + A @@ -75,7 +75,7 @@ int,std::string,float - + A @@ -83,7 +83,7 @@ int,std::string,bool - + B @@ -91,7 +91,7 @@ 3,2,1 - + B @@ -99,7 +99,7 @@ 1,1,1,1 - + C @@ -107,50 +107,50 @@ 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_class.svg b/docs/test_cases/t00013_class.svg index 50a120b7..7ab568bc 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,15 +18,15 @@ T - + - + f : T - + ABCD::F @@ -34,70 +34,70 @@ int - - + + A - + - + a : int - - + + B - + - + b : int - - + + C - + - + c : int - - + + D - + - + d : int print(R * r) : void - - + + E @@ -105,16 +105,16 @@ T - + - + e : T - - + + G @@ -122,22 +122,22 @@ T,Args... - + - + g : T - + - + args : std::tuple<Args...> - + E @@ -145,7 +145,7 @@ int - + G @@ -153,7 +153,7 @@ int,float,std::string - + E @@ -161,25 +161,25 @@ std::string - - + + R - + - + gintstring : G<int,float,std::string> - + - + estring : E<std::string> diff --git a/docs/test_cases/t00014_class.svg b/docs/test_cases/t00014_class.svg index 218a88db..37caa13b 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,37 +18,37 @@ T,P - + - + t : T - + - + p : P - - + + B - + - + value : std::string - + A @@ -56,7 +56,7 @@ T,std::string - + A @@ -64,7 +64,7 @@ T,std::unique_ptr<std::string> - + A @@ -72,7 +72,7 @@ long,T - + A @@ -80,7 +80,7 @@ double,T - + A @@ -88,7 +88,7 @@ long,U - + A @@ -96,7 +96,7 @@ long,bool - + A @@ -104,7 +104,7 @@ double,bool - + A @@ -112,7 +112,7 @@ long,float - + A @@ -120,7 +120,7 @@ double,float - + A @@ -128,7 +128,7 @@ bool,std::string - + A @@ -136,7 +136,7 @@ float,std::unique_ptr<std::string> - + A @@ -144,7 +144,7 @@ int,std::string - + A @@ -152,7 +152,7 @@ std::string,std::string - + A @@ -160,7 +160,7 @@ char,std::string - + A @@ -168,116 +168,116 @@ wchar_t,std::string - - + + R - + - + 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 - + - + bs : BVector - + - + bs2 : BVector2 - + - + cb : SimpleCallback<ACharString> - + - + gcb : GenericCallback<R::AWCharString> - + - + vcb : VoidCallback - + - + vps : VectorPtr<B> diff --git a/docs/test_cases/t00015_class.svg b/docs/test_cases/t00015_class.svg index 91ff7e73..ec3d812d 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_class.svg b/docs/test_cases/t00016_class.svg index 4b599cfb..934ec139 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<> @@ -19,8 +19,8 @@ value : enum - - + + is_numeric @@ -29,8 +29,8 @@ value : enum - - + + is_numeric @@ -41,8 +41,8 @@ value : enum - - + + is_numeric @@ -53,8 +53,8 @@ value : enum - - + + is_numeric @@ -65,8 +65,8 @@ value : enum - - + + is_numeric @@ -77,8 +77,8 @@ value : enum - - + + is_numeric diff --git a/docs/test_cases/t00017_class.svg b/docs/test_cases/t00017_class.svg index b1dd131c..8b789e20 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_class.svg b/docs/test_cases/t00018_class.svg index 90838edb..fd81ebc6 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_class.svg b/docs/test_cases/t00019_class.svg index eb0cf359..ed541c44 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,7 +83,7 @@ m1_calls() const : int m2_calls() const : int - + Layer3 @@ -91,7 +91,7 @@ Base - + Layer2 @@ -99,7 +99,7 @@ Layer3<Base> - + Layer1 @@ -107,18 +107,18 @@ Layer2<Layer3<Base>> - - + + A - + - + layers : std::unique_ptr<Layer1<Layer2<Layer3<Base>>>> diff --git a/docs/test_cases/t00020_class.svg b/docs/test_cases/t00020_class.svg index 624acee7..4791137e 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_class.svg b/docs/test_cases/t00021_class.svg index 2b1e585c..6f8855fa 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_class.svg b/docs/test_cases/t00022_class.svg index c4ced57e..7aeb6694 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_class.svg b/docs/test_cases/t00023_class.svg index ecc2025d..8e6d59d0 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_class.svg b/docs/test_cases/t00024_class.svg index b2677137..7ff06f01 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_class.svg b/docs/test_cases/t00025_class.svg index cacc8635..79490579 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,7 +56,7 @@ m1() : void m2() : void - + Proxy @@ -64,7 +64,7 @@ Target1 - + Proxy @@ -72,25 +72,25 @@ Target2 - - + + ProxyHolder - + - + proxy1 : Proxy<Target1> - + - + proxy2 : Proxy<Target2> diff --git a/docs/test_cases/t00026_class.svg b/docs/test_cases/t00026_class.svg index 35808ec8..e8f11de1 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>(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,7 +78,7 @@ state(const std::string & n) : Memento<T> & set_state(const std::string & s, Memento<T> && m) : void - + Caretaker @@ -86,7 +86,7 @@ std::string - + Originator @@ -94,25 +94,25 @@ std::string - - + + StringMemento - + - + caretaker : Caretaker<std::string> - + - + originator : Originator<std::string> diff --git a/docs/test_cases/t00027_class.svg b/docs/test_cases/t00027_class.svg index 60d2fe44..1a9017d6 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,14 @@ ~Shape() = default : void - + Line - - + + Line @@ -39,14 +39,14 @@ display() : void - + Text - - + + Text @@ -57,8 +57,8 @@ display() : void - - + + ShapeDecorator @@ -67,8 +67,8 @@ display() = 0 : void - - + + Color @@ -79,8 +79,8 @@ display() : void - - + + Weight @@ -91,7 +91,7 @@ display() : void - + Line @@ -99,7 +99,7 @@ Color,Weight - + Line @@ -107,7 +107,7 @@ Color - + Text @@ -115,7 +115,7 @@ Color,Weight - + Text @@ -123,39 +123,39 @@ Color - - + + Window - + - + border : Line<Color,Weight> - + - + divider : Line<Color> - + - + title : Text<Color,Weight> - + - + description : Text<Color> diff --git a/docs/test_cases/t00028_class.svg b/docs/test_cases/t00028_class.svg index 7acc1783..5de86165 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,10 +94,10 @@ three - + F enum note. - + E @@ -105,59 +105,59 @@ 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. diff --git a/docs/test_cases/t00029_class.svg b/docs/test_cases/t00029_class.svg index bf752ecd..f7198d27 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_class.svg b/docs/test_cases/t00030_class.svg index e784a8be..f6ab4725 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_class.svg b/docs/test_cases/t00031_class.svg index 72f4e251..d0f2982a 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,23 +47,23 @@ T - + - + ttt : T - - + + D - + C @@ -71,39 +71,39 @@ int - - + + R - + - + aaa : A * - + - + bbb : std::vector<B> - + - + ccc : C<int> - + - + ddd : D * diff --git a/docs/test_cases/t00032_class.svg b/docs/test_cases/t00032_class.svg index 91728994..ebbce3cc 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,15 +64,15 @@ T,L,Ts... - + - + counter : L - + Overload @@ -80,18 +80,18 @@ TBase,int,A,B,C - - + + R - + - + overload : Overload<TBase,int,A,B,C> diff --git a/docs/test_cases/t00033_class.svg b/docs/test_cases/t00033_class.svg index 92ace375..31f77a3d 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,30 +52,30 @@ T - + - + ccc : T - - + + D - + - + ddd : int - + C @@ -83,7 +83,7 @@ D - + B @@ -91,7 +91,7 @@ std::unique_ptr<C<D>> - + A @@ -99,18 +99,18 @@ B<std::unique_ptr<C<D>>> - - + + R - + - + abc : A<B<std::unique_ptr<C<D>>>> diff --git a/docs/test_cases/t00034_class.svg b/docs/test_cases/t00034_class.svg index 59da6eb4..b244fc7f 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,16 +31,16 @@ - - + + lift_void - - + + lift_void @@ -49,8 +49,8 @@ - - + + drop_void @@ -59,16 +59,16 @@ - - + + drop_void - - + + drop_void @@ -77,33 +77,33 @@ - - + + A - - + + R - + - + la : lift_void_t<A> * - + - + lv : lift_void_t<void> * diff --git a/docs/test_cases/t00035_class.svg b/docs/test_cases/t00035_class.svg index 47cc1eb6..c52a8ba3 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_class.svg b/docs/test_cases/t00036_class.svg index 3676248e..242aaad7 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,15 +43,15 @@ T - + - + a : T - + A @@ -59,23 +59,23 @@ int - - + + B - + - + a_int : A<int> - - + + C diff --git a/docs/test_cases/t00037_class.svg b/docs/test_cases/t00037_class.svg index 96a528b9..fe3edc6f 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_620) - + - + units : ST::(anonymous_739) - - + + 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_class.svg b/docs/test_cases/t00038_class.svg index 7c08afde..1d72fc33 100644 --- a/docs/test_cases/t00038_class.svg +++ b/docs/test_cases/t00038_class.svg @@ -1,6 +1,6 @@ - + @@ -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,16 +88,16 @@ - - + + map - - + + map @@ -106,8 +106,8 @@ - - + + map @@ -116,8 +116,8 @@ - - + + map @@ -126,8 +126,8 @@ - - + + map diff --git a/docs/test_cases/t00039_class.svg b/docs/test_cases/t00039_class.svg index 41be542b..da7cf09a 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_class.svg b/docs/test_cases/t00040_class.svg index 32413272..f8c4e7b9 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_class.svg b/docs/test_cases/t00041_class.svg index 10e9bebc..2c6db52f 100644 --- a/docs/test_cases/t00041_class.svg +++ b/docs/test_cases/t00041_class.svg @@ -1,6 +1,6 @@ - + @@ -9,100 +9,100 @@ - - + + R - - + + D - + - + rr : RR * - - + + E - - + + F - - + + RR - + - + e : E * - + - + f : F * - + - + g : detail::G * - - + + RRR - - + + ns1::N - - + + ns1::NN - - + + ns1::NM diff --git a/docs/test_cases/t00042_class.svg b/docs/test_cases/t00042_class.svg index 4647f7a1..2750b4b9 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,22 +52,22 @@ T,K - + - + b : T - + - + bb : K - + A @@ -75,7 +75,7 @@ double - + A @@ -83,7 +83,7 @@ std::string - + B diff --git a/docs/test_cases/t00043_class.svg b/docs/test_cases/t00043_class.svg index 34855014..d5cae539 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_class.svg b/docs/test_cases/t00044_class.svg index fb13a2e6..6e07657a 100644 --- a/docs/test_cases/t00044_class.svg +++ b/docs/test_cases/t00044_class.svg @@ -1,6 +1,6 @@ - + @@ -9,7 +9,7 @@ - + signal_handler @@ -17,8 +17,8 @@ ,A - - + + sink @@ -27,15 +27,15 @@ sink<signal_handler<type-parameter-0-0 (type-parameter-0-1...), type-parameter-0-2> >(sink<signal_handler<type-parameter-0-0 (type-parameter-0-1...),type-parameter-0-2>>::signal_t & sh) : void - + - + signal : sink<signal_handler<type-parameter-0-0 (type-parameter-0-1...),type-parameter-0-2>>::signal_t * - - + + sink @@ -46,23 +46,23 @@ sink<signal_handler<type-parameter-0-0 (type-parameter-0-1...), type-parameter-0-2> >(sink<signal_handler<type-parameter-0-0 (type-parameter-0-1...),type-parameter-0-2>>::signal_t & sh) : void - + - + signal : sink<signal_handler<type-parameter-0-0 (type-parameter-0-1...),type-parameter-0-2>>::signal_t * - - + + signal_handler - - + + signal_handler @@ -71,8 +71,8 @@ - - + + signal_handler @@ -81,8 +81,8 @@ - - + + sink diff --git a/docs/test_cases/t00045_class.svg b/docs/test_cases/t00045_class.svg index 3f11e6cd..cff821e2 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_class.svg b/docs/test_cases/t00046_class.svg index 8d644e54..9808d4e8 100644 --- a/docs/test_cases/t00046_class.svg +++ b/docs/test_cases/t00046_class.svg @@ -1,6 +1,6 @@ - + @@ -9,118 +9,118 @@ - + ns1 - + ns2 - + __gnu_cxx - - + + A - - + + A - - + + B - - + + C - - + + D - - + + E - - + + R - + - + a : ns1::ns2::A * - + - + ns1_a : ns1::A * - + - + ns1_ns2_a : ns1::ns2::A * - + - + root_a : ::A * - + - + i : std::vector<std::uint8_t> foo(AA & aa) : void - - + + A - - + + AA diff --git a/docs/test_cases/t00047_class.svg b/docs/test_cases/t00047_class.svg index 3da5b1c4..5215f8d7 100644 --- a/docs/test_cases/t00047_class.svg +++ b/docs/test_cases/t00047_class.svg @@ -1,6 +1,6 @@ - + @@ -9,16 +9,16 @@ - - + + conditional_t - - + + conditional_t @@ -27,8 +27,8 @@ - - + + conditional_t @@ -37,8 +37,8 @@ - - + + conditional_t @@ -47,8 +47,8 @@ - - + + conditional_t diff --git a/docs/test_cases/t00048_class.svg b/docs/test_cases/t00048_class.svg index 35cfbdd7..65a266d0 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_class.svg b/docs/test_cases/t00049_class.svg index 49ee8085..bb2f2db4 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,17 +18,17 @@ T - + - + a : T get_a() : T & - + A @@ -36,7 +36,7 @@ intmap - + A @@ -44,7 +44,7 @@ thestring - + A @@ -52,32 +52,32 @@ std::vector<thestring> - - + + R - + - + a_string : A<thestring> - + - + a_vector_string : A<string_vector> - + - + a_int_map : A<intmap> diff --git a/docs/test_cases/t00050_class.svg b/docs/test_cases/t00050_class.svg index 04295f8e..3ef44faf 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 diff --git a/docs/test_cases/t20012.md b/docs/test_cases/t20012.md new file mode 100644 index 00000000..a1f443da --- /dev/null +++ b/docs/test_cases/t20012.md @@ -0,0 +1,97 @@ +# t20012 - Lambda expression call sequence diagram test case +## Config +```yaml +compilation_database_dir: .. +output_directory: puml +diagrams: + t20012_sequence: + type: sequence + glob: + - ../../tests/t20012/t20012.cc + include: + namespaces: + - clanguml::t20012 + using_namespace: + - clanguml::t20012 + start_from: + - function: "clanguml::t20012::tmain()" +``` +## Source code +File t20012.cc +```cpp +#include +#include + +namespace clanguml { +namespace t20012 { +struct A { + void a() { aa(); } + + void aa() { aaa(); } + + void aaa() { } +}; + +struct B { + void b() { bb(); } + + void bb() { bbb(); } + + void bbb() { } +}; + +struct C { + void c() { cc(); } + + void cc() { ccc(); } + + void ccc() { } +}; + +template struct R { + R(F &&f) + : f_{std::move(f)} + { + } + + void r() { f_(); } + + F f_; +}; + +void tmain() +{ + A a; + B b; + C c; + + // The activity shouldn't be marked at the lambda definition, but + // wherever it is actually called... + auto alambda = [&a, &b]() { + a.a(); + b.b(); + }; + + // ...like here + alambda(); + + // There should be no call to B in the sequence diagram as the blambda + // is never called + [[maybe_unused]] auto blambda = [&b]() { b.b(); }; + + // Nested lambdas should also work + auto clambda = [alambda, &c]() { + c.c(); + alambda(); + }; + clambda(); + + R r{[&c]() { c.c(); }}; + + r.r(); +} +} +} +``` +## Generated UML diagrams +![t20012_sequence](./t20012_sequence.svg "Lambda expression call sequence diagram test case") diff --git a/docs/test_cases/t20012_sequence.svg b/docs/test_cases/t20012_sequence.svg new file mode 100644 index 00000000..c38a488e --- /dev/null +++ b/docs/test_cases/t20012_sequence.svg @@ -0,0 +1,202 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + tmain() + + tmain() + + tmain()::(lambda t20012.cc:49:20) + + tmain()::(lambda t20012.cc:49:20) + + A + + A + + B + + B + + tmain()::(lambda t20012.cc:62:20) + + tmain()::(lambda t20012.cc:62:20) + + C + + C + + R<R::(lambda t20012.cc:68:9)> + + R<R::(lambda t20012.cc:68:9)> + + tmain()::(lambda t20012.cc:68:9) + + tmain()::(lambda t20012.cc:68:9) + + + + + + + + + + + + + + + + + + + + + + + + + + + operator()() + + + a() + + + + + aa() + + + + + aaa() + + + b() + + + + + bb() + + + + + bbb() + + + + + operator()() + + + c() + + + + + cc() + + + + + ccc() + + + operator()() + + + a() + + + + + aa() + + + + + aaa() + + + b() + + + + + bb() + + + + + bbb() + + + + + + + r() + + + operator()() + + + c() + + + + + cc() + + + + + ccc() + + + + diff --git a/docs/test_cases/t30001_package.svg b/docs/test_cases/t30001_package.svg index a5fbb2b8..d4826fef 100644 --- a/docs/test_cases/t30001_package.svg +++ b/docs/test_cases/t30001_package.svg @@ -1,6 +1,6 @@ - + @@ -9,63 +9,63 @@ - - + + 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_package.svg b/docs/test_cases/t30002_package.svg index d08a617b..1ac1bf98 100644 --- a/docs/test_cases/t30002_package.svg +++ b/docs/test_cases/t30002_package.svg @@ -1,6 +1,6 @@ - + @@ -9,113 +9,113 @@ - - + + A - - + + AA - - + + B - - + + BB - - + + A1 - - + + A2 - - + + A3 - - + + A4 - - + + A5 - - + + A6 - - + + A7 - - + + A8 - - + + A9 - - + + A10 - - + + A11 - - + + A12 - - + + A13 - - + + A14 - - + + A15 - - + + A16 - - + + A17 - - + + BBB diff --git a/docs/test_cases/t30003_package.svg b/docs/test_cases/t30003_package.svg index 596751c4..6dbf224a 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_package.svg b/docs/test_cases/t30004_package.svg index f35f5aad..e1979abe 100644 --- a/docs/test_cases/t30004_package.svg +++ b/docs/test_cases/t30004_package.svg @@ -1,6 +1,6 @@ - + @@ -9,40 +9,40 @@ - - + + A - + Package AAA. - + Package BBB. - + CCCC package note. - + We skipped DDD. - - + + AAA - - + + BBB - - + + CCC - - + + EEE diff --git a/docs/test_cases/t30005_package.svg b/docs/test_cases/t30005_package.svg index 49185c09..6915f760 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_package.svg b/docs/test_cases/t30006_package.svg index b9e7699a..dacb4b9b 100644 --- a/docs/test_cases/t30006_package.svg +++ b/docs/test_cases/t30006_package.svg @@ -1,6 +1,6 @@ - + @@ -9,22 +9,22 @@ - - + + B - - + + A - - + + C - + Top A note. diff --git a/docs/test_cases/t30007_package.svg b/docs/test_cases/t30007_package.svg index 289e2bcb..f3933d00 100644 --- a/docs/test_cases/t30007_package.svg +++ b/docs/test_cases/t30007_package.svg @@ -1,6 +1,6 @@ - + @@ -9,27 +9,27 @@ - - + + A - - + + B - - + + AA - - + + C - + Compare layout with t30006. diff --git a/docs/test_cases/t30008_package.svg b/docs/test_cases/t30008_package.svg index 8e1b9360..aec51717 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/t40001_include.svg b/docs/test_cases/t40001_include.svg index 83ae532f..7545f850 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 diff --git a/docs/test_cases/t40002_include.svg b/docs/test_cases/t40002_include.svg index 20a8e099..0ef82202 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_include.svg b/docs/test_cases/t40003_include.svg index 245976fc..d6df213a 100644 --- a/docs/test_cases/t40003_include.svg +++ b/docs/test_cases/t40003_include.svg @@ -1,6 +1,6 @@ - + @@ -9,66 +9,66 @@ - + include - + dependants - + dependencies - + src - + dependants - + dependencies - - + + t3.h - - + + t2.h - - + + t1.h - - + + t3.h - - + + t2.h - - + + t1.h - - + + t5.h - - + + t1.cc - - + + t2.cc diff --git a/tests/test_cases.yaml b/tests/test_cases.yaml index 5a46f621..241086fc 100644 --- a/tests/test_cases.yaml +++ b/tests/test_cases.yaml @@ -181,6 +181,9 @@ test_cases: - name: t20011 title: Recursive calls sequence diagram test case description: + - name: t20012 + title: Lambda expression call sequence diagram test case + description: Package diagrams: - name: t30001 title: Basic package diagram test case From 5a8b739eba77d437617c75da9a4237bb337c5769 Mon Sep 17 00:00:00 2001 From: Bartek Kryza Date: Sun, 4 Dec 2022 15:04:36 +0100 Subject: [PATCH 43/77] Fixed GitHub Actions build --- src/sequence_diagram/visitor/call_expression_context.cc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/sequence_diagram/visitor/call_expression_context.cc b/src/sequence_diagram/visitor/call_expression_context.cc index 784db53a..a936dae2 100644 --- a/src/sequence_diagram/visitor/call_expression_context.cc +++ b/src/sequence_diagram/visitor/call_expression_context.cc @@ -177,7 +177,8 @@ void call_expression_context::enter_lambda_expression(std::int64_t id) void call_expression_context::leave_lambda_expression() { - assert(!current_lambda_caller_id_.empty()); + if(current_lambda_caller_id_.empty()) + return; LOG_DBG("Leaving current lambda expression id to {}", current_lambda_caller_id_.top()); From 1644a201d05076ee0ad494def8113ae1326f1b0b Mon Sep 17 00:00:00 2001 From: Bartek Kryza Date: Sun, 4 Dec 2022 22:51:57 +0100 Subject: [PATCH 44/77] Added function and method arguments in sequence diagrams --- src/common/model/source_location.h | 5 + .../visitor/translation_unit_visitor.cc | 1 + .../plantuml/sequence_diagram_generator.cc | 18 +- src/sequence_diagram/model/participant.cc | 16 +- src/sequence_diagram/model/participant.h | 42 ++++- .../visitor/translation_unit_visitor.cc | 159 +++++++++++------- .../visitor/translation_unit_visitor.h | 2 + tests/t20001/test_case.h | 10 +- tests/t20002/test_case.h | 6 +- tests/t20003/.clang-uml | 2 +- tests/t20003/t20003.cc | 4 - tests/t20003/test_case.h | 6 +- tests/t20004/test_case.h | 34 ++-- tests/t20005/.clang-uml | 2 +- tests/t20005/test_case.h | 4 +- tests/t20006/test_case.h | 6 +- tests/t20013/.clang-uml | 14 ++ tests/t20013/t20013.cc | 27 +++ tests/t20013/test_case.h | 50 ++++++ tests/test_cases.cc | 1 + tests/test_cases.h | 6 +- 21 files changed, 299 insertions(+), 116 deletions(-) create mode 100644 tests/t20013/.clang-uml create mode 100644 tests/t20013/t20013.cc create mode 100644 tests/t20013/test_case.h diff --git a/src/common/model/source_location.h b/src/common/model/source_location.h index 6e2c4a91..38e880ef 100644 --- a/src/common/model/source_location.h +++ b/src/common/model/source_location.h @@ -39,8 +39,13 @@ public: void set_line(const unsigned line) { line_ = line; } + unsigned int location_id() const { return hash_; } + + void set_location_id(unsigned int h) { hash_ = h; } + private: std::string file_; unsigned int line_{0}; + unsigned int hash_; }; } \ No newline at end of file diff --git a/src/common/visitor/translation_unit_visitor.cc b/src/common/visitor/translation_unit_visitor.cc index 6c42e29f..6f0b0099 100644 --- a/src/common/visitor/translation_unit_visitor.cc +++ b/src/common/visitor/translation_unit_visitor.cc @@ -70,6 +70,7 @@ void translation_unit_visitor::set_source_location( element.set_file(source_manager_.getFilename(decl.getLocation()).str()); element.set_line( source_manager_.getSpellingLineNumber(decl.getLocation())); + element.set_location_id(decl.getLocation().getHashValue()); } } diff --git a/src/sequence_diagram/generators/plantuml/sequence_diagram_generator.cc b/src/sequence_diagram/generators/plantuml/sequence_diagram_generator.cc index be064b43..e2afa867 100644 --- a/src/sequence_diagram/generators/plantuml/sequence_diagram_generator.cc +++ b/src/sequence_diagram/generators/plantuml/sequence_diagram_generator.cc @@ -56,10 +56,11 @@ void generator::generate_call(const message &m, std::ostream &ostr) const generate_participant(ostr, m.from); generate_participant(ostr, m.to); - auto message = m.message_name; - if (!message.empty()) { - message = m_config.using_namespace().relative(message); - message += "()"; + std::string message; + + if (to.value().type_name() == "method") { + message = dynamic_cast(to.value()) + .message_name(model::function::message_render_mode::full); } ostr << from.value().alias() << " " @@ -133,7 +134,7 @@ void generator::generate_participant(std::ostream &ostr, common::id_t id) const m_model.get_participant(participant_id).value(); if (participant.type_name() == "method") { - const auto &class_id = + const auto class_id = m_model.get_participant(participant_id) .value() .class_id(); @@ -197,6 +198,13 @@ void generator::generate(std::ostream &ostr) const const auto &from = m_model.get_participant(start_from); + if (!from.has_value()) { + LOG_WARN( + "Failed to find participant {} for start_from condition", + sf.location); + continue; + } + generate_participant(ostr, start_from); ostr << "activate " << from.value().alias() << std::endl; diff --git a/src/sequence_diagram/model/participant.cc b/src/sequence_diagram/model/participant.cc index dbe4642c..94ca51d8 100644 --- a/src/sequence_diagram/model/participant.cc +++ b/src/sequence_diagram/model/participant.cc @@ -163,16 +163,18 @@ function::function(const common::model::namespace_ &using_namespace) std::string function::full_name(bool relative) const { - return element::full_name(relative) + "()"; + return fmt::format("{}({}){}", element::full_name(relative), + fmt::join(parameters_, ","), is_const() ? " const" : ""); } std::string function::full_name_no_ns() const { - return element::full_name_no_ns() + "()"; + return fmt::format("{}({}){}", element::full_name_no_ns(), + fmt::join(parameters_, ","), is_const() ? " const" : ""); } method::method(const common::model::namespace_ &using_namespace) - : participant{using_namespace} + : function{using_namespace} { } @@ -185,7 +187,7 @@ std::string method::alias() const function_template::function_template( const common::model::namespace_ &using_namespace) - : participant{using_namespace} + : function{using_namespace} { } @@ -199,7 +201,8 @@ std::string function_template::full_name(bool relative) const ostr << name_and_ns(); render_template_params(ostr, using_namespace(), relative); - ostr << "()"; + ostr << fmt::format( + "({}){}", fmt::join(parameters(), ","), is_const() ? " const" : ""); std::string res; @@ -224,7 +227,8 @@ std::string function_template::full_name_no_ns() const render_template_params(ostr, using_namespace(), false); - ostr << "()"; + ostr << fmt::format( + "({}){}", fmt::join(parameters(), ","), is_const() ? " const" : ""); return ostr.str(); } diff --git a/src/sequence_diagram/model/participant.h b/src/sequence_diagram/model/participant.h index d2abc452..5a36411d 100644 --- a/src/sequence_diagram/model/participant.h +++ b/src/sequence_diagram/model/participant.h @@ -139,6 +139,8 @@ struct lambda : public class_ { }; struct function : public participant { + enum class message_render_mode { full, no_arguments }; + function(const common::model::namespace_ &using_namespace); function(const function &) = delete; @@ -151,9 +153,31 @@ struct function : public participant { std::string full_name(bool relative = true) const override; std::string full_name_no_ns() const override; + + virtual std::string message_name(message_render_mode mode) const + { + if (mode == message_render_mode::no_arguments) { + return fmt::format("{}(){}", name(), is_const() ? " const" : ""); + } + + return fmt::format("{}({}){}", name(), fmt::join(parameters_, ","), + is_const() ? " const" : ""); + } + + bool is_const() const { return is_const_; } + + void is_const(bool c) { is_const_ = c; } + + void add_parameter(const std::string &a) { parameters_.push_back(a); } + + const std::vector ¶meters() const { return parameters_; } + +private: + bool is_const_{false}; + std::vector parameters_; }; -struct method : public participant { +struct method : public function { method(const common::model::namespace_ &using_namespace); method(const function &) = delete; @@ -180,7 +204,19 @@ struct method : public participant { std::string full_name(bool /*relative*/) const override { - return class_full_name() + "::" + method_name(); + return fmt::format("{}::{}({}){}", class_full_name(), method_name(), + fmt::join(parameters(), ","), is_const() ? " const" : ""); + } + + std::string message_name(message_render_mode mode) const override + { + if (mode == message_render_mode::no_arguments) { + return fmt::format( + "{}(){}", method_name(), is_const() ? " const" : ""); + } + + return fmt::format("{}({}){}", method_name(), + fmt::join(parameters(), ","), is_const() ? " const" : ""); } diagram_element::id_t class_id() const { return class_id_; } @@ -197,7 +233,7 @@ private: std::string class_full_name_; }; -struct function_template : public participant, public template_trait { +struct function_template : public function, public template_trait { function_template(const common::model::namespace_ &using_namespace); function_template(const function_template &) = delete; diff --git a/src/sequence_diagram/visitor/translation_unit_visitor.cc b/src/sequence_diagram/visitor/translation_unit_visitor.cc index d047becd..59b87ac3 100644 --- a/src/sequence_diagram/visitor/translation_unit_visitor.cc +++ b/src/sequence_diagram/visitor/translation_unit_visitor.cc @@ -293,8 +293,6 @@ bool translation_unit_visitor::VisitCXXMethodDecl(clang::CXXMethodDecl *m) LOG_DBG("Getting method's class with local id {}", parent_decl->getID()); - set_unique_id(m->getID(), m_ptr->id()); - const auto &method_class = get_participant(parent_decl).value(); @@ -304,13 +302,20 @@ bool translation_unit_visitor::VisitCXXMethodDecl(clang::CXXMethodDecl *m) get_participant(m_ptr->class_id()).value().full_name_no_ns() + "::" + m->getNameAsString()); - m_ptr->set_id(common::to_id( - get_participant(m_ptr->class_id()).value().full_name(false) + - "::" + m->getNameAsString())); + for (const auto *param : m->parameters()) { + m_ptr->add_parameter(simplify_system_template( + common::to_string(param->getType(), m->getASTContext()))); + } - LOG_DBG("Set id {} for method name {}", m_ptr->id(), - get_participant(m_ptr->class_id()).value().full_name(false) + - "::" + m->getNameAsString()); + set_source_location(*m, *m_ptr); + + const auto method_full_name = m_ptr->full_name(false); + + m_ptr->set_id(common::to_id(method_full_name)); + + set_unique_id(m->getID(), m_ptr->id()); + + LOG_DBG("Set id {} for method name {}", m_ptr->id(), method_full_name); context().update(m); @@ -365,7 +370,13 @@ bool translation_unit_visitor::VisitFunctionDecl(clang::FunctionDecl *f) f_ptr->set_name(ns.name()); ns.pop_back(); f_ptr->set_namespace(ns); - f_ptr->set_id(common::to_id(function_name)); + + for (const auto *param : f->parameters()) { + f_ptr->add_parameter(simplify_system_template( + common::to_string(param->getType(), f->getASTContext()))); + } + + f_ptr->set_id(common::to_id(f_ptr->full_name(false))); context().update(f); @@ -401,9 +412,16 @@ bool translation_unit_visitor::VisitFunctionTemplateDecl( process_template_parameters(*function_template, *f_ptr); + for (const auto *param : + function_template->getTemplatedDecl()->parameters()) { + f_ptr->add_parameter(simplify_system_template(common::to_string( + param->getType(), function_template->getASTContext()))); + } + f_ptr->set_id(common::to_id(f_ptr->full_name(false))); context().update(function_template); + context().set_caller_id(f_ptr->id()); set_unique_id(function_template->getID(), f_ptr->id()); @@ -633,33 +651,9 @@ bool translation_unit_visitor::process_class_method_call_expression( diagram().should_include(callee_decl->getQualifiedNameAsString()))) return false; - const auto *callee_template_specialization = - clang::dyn_cast(callee_decl); + m.to = method_decl->getID(); + m.message_name = method_decl->getNameAsString(); - if (callee_template_specialization) { - LOG_DBG("Callee is a template specialization declaration {}", - callee_template_specialization->getQualifiedNameAsString()); - - const auto &specialization_participant = - diagram() - .get_participant( - get_unique_id(callee_template_specialization->getID()) - .value()) - .value(); - const auto specialization_method_name = - specialization_participant.full_name(false) + - "::" + method_decl->getNameAsString(); - - m.to = common::to_id(specialization_method_name); - m.message_name = method_decl->getNameAsString(); - } - else { - // TODO: The method can be called before it's declaration has been - // encountered by the visitor - for now it's not a problem - // as overloaded methods are not supported - m.to = common::to_id(method_decl->getQualifiedNameAsString()); - m.message_name = method_decl->getNameAsString(); - } m.return_type = method_call_expr->getCallReturnType(*context().get_ast_context()) .getAsString(); @@ -682,8 +676,7 @@ bool translation_unit_visitor::process_class_template_method_call_expression( expr->getCallee()); if (is_callee_valid_template_specialization(dependent_member_callee)) { - - const auto *primary_template = + const auto *template_declaration = dependent_member_callee->getBaseType() ->getAs() ->getTemplateName() @@ -693,33 +686,52 @@ bool translation_unit_visitor::process_class_template_method_call_expression( // First check if the primary template is already in the // participants map - if (get_participant(primary_template).has_value()) { + if (get_participant(template_declaration).has_value()) { callee_method_full_name = - get_participant(primary_template).value().full_name(false) + + get_participant(template_declaration).value().full_name(false) + "::" + dependent_member_callee->getMember().getAsString(); - } - else if (is_smart_pointer(primary_template)) { - // Otherwise check if it a smart pointer - primary_template->getTemplateParameters()->asArray().front(); - if (get_participant(primary_template).has_value()) { - callee_method_full_name = - get_participant(primary_template).value().full_name(false) + + for (const auto &[id, p] : diagram().participants) { + const auto p_full_name = p->full_name(false); + + if (p_full_name.find(callee_method_full_name + "(") == 0) { + // TODO: This selects the first matching template method + // without considering arguments!!! + m.to = id; + break; + } + } + } + else if (is_smart_pointer(template_declaration)) { + // Otherwise check if it is a smart pointer + template_declaration->getTemplateParameters()->asArray().front(); + + if (get_participant(template_declaration).has_value()) { + callee_method_full_name = get_participant(template_declaration) + .value() + .full_name(false) + "::" + dependent_member_callee->getMember().getAsString(); + + for (const auto &[id, p] : diagram().participants) { + const auto p_full_name = p->full_name(false); + if (p_full_name.find(callee_method_full_name + "(") == 0) { + // TODO: This selects the first matching template method + // without considering arguments!!! + m.to = id; + break; + } + } } else return false; } - auto callee_id = common::to_id(callee_method_full_name); - m.to = callee_id; - m.message_name = dependent_member_callee->getMember().getAsString(); m.return_type = ""; - if (get_unique_id(primary_template->getID())) + if (get_unique_id(template_declaration->getID())) diagram().add_active_participant( - get_unique_id(primary_template->getID()).value()); + get_unique_id(template_declaration->getID()).value()); } return true; @@ -744,7 +756,7 @@ bool translation_unit_visitor::process_function_call_expression( if (!get_unique_id(callee_function->getID()).has_value()) { // This is hopefully not an interesting call... - return false; + m.to = callee_function->getID(); } else { m.to = get_unique_id(callee_function->getID()).value(); @@ -774,17 +786,10 @@ bool translation_unit_visitor::process_unresolved_lookup_call_expression( clang::dyn_cast_or_null(decl); if (!get_unique_id(ftd->getID()).has_value()) - continue; - - m.to = get_unique_id(ftd->getID()).value(); - auto message_name = - diagram() - .get_participant(m.to) - .value() - .full_name(false) - .substr(); - m.message_name = - message_name.substr(0, message_name.size() - 2); + m.to = ftd->getID(); + else { + m.to = get_unique_id(ftd->getID()).value(); + } break; } @@ -1038,6 +1043,11 @@ translation_unit_visitor::build_function_template_instantiation( template_base_params, decl.getTemplateSpecializationArgs()->asArray(), template_instantiation, "", decl.getPrimaryTemplate()); + for (const auto *param : decl.parameters()) { + template_instantiation_ptr->add_parameter( + common::to_string(param->getType(), decl.getASTContext())); + } + return template_instantiation_ptr; } @@ -1644,6 +1654,16 @@ bool translation_unit_visitor::simplify_system_template( return false; } +std::string translation_unit_visitor::simplify_system_template( + const std::string &full_name) const +{ + if (config().type_aliases().count(full_name) > 0) { + return config().type_aliases().at(full_name); + } + + return full_name; +} + std::string translation_unit_visitor::make_lambda_name( const clang::CXXRecordDecl *cls) const { @@ -1672,6 +1692,19 @@ std::string translation_unit_visitor::make_lambda_name( void translation_unit_visitor::finalize() { + decltype(diagram().active_participants_) active_participants_unique; + + for (auto id : diagram().active_participants_) { + if (local_ast_id_map_.find(id) != local_ast_id_map_.end()) { + active_participants_unique.emplace(local_ast_id_map_.at(id)); + } + else { + active_participants_unique.emplace(id); + } + } + + diagram().active_participants_ = std::move(active_participants_unique); + for (auto &[id, activity] : diagram().sequences) { for (auto &m : activity.messages) { if (local_ast_id_map_.find(m.to) != local_ast_id_map_.end()) { diff --git a/src/sequence_diagram/visitor/translation_unit_visitor.h b/src/sequence_diagram/visitor/translation_unit_visitor.h index 3991b723..a14c0f35 100644 --- a/src/sequence_diagram/visitor/translation_unit_visitor.h +++ b/src/sequence_diagram/visitor/translation_unit_visitor.h @@ -195,6 +195,8 @@ private: bool simplify_system_template(class_diagram::model::template_parameter &ct, const std::string &full_name); + std::string simplify_system_template(const std::string &full_name) const; + std::string make_lambda_name(const clang::CXXRecordDecl *cls) const; bool is_smart_pointer(const clang::TemplateDecl *primary_template) const; diff --git a/tests/t20001/test_case.h b/tests/t20001/test_case.h index 6ee8363a..c50075e6 100644 --- a/tests/t20001/test_case.h +++ b/tests/t20001/test_case.h @@ -38,11 +38,11 @@ TEST_CASE("t20001", "[test-case][sequence]") REQUIRE_THAT(puml, StartsWith("@startuml")); REQUIRE_THAT(puml, EndsWith("@enduml\n")); - REQUIRE_THAT(puml, HasCall(_A("A"), "log_result")); - REQUIRE_THAT(puml, HasCall(_A("B"), _A("A"), "log_result")); - REQUIRE_THAT(puml, HasCallWithResponse(_A("B"), _A("A"), "add3")); - REQUIRE_THAT(puml, HasCall(_A("A"), "add")); - REQUIRE_THAT(puml, !HasCall(_A("A"), _A("detail::C"), "add")); + REQUIRE_THAT(puml, HasCall(_A("A"), "log_result(int)")); + REQUIRE_THAT(puml, HasCall(_A("B"), _A("A"), "log_result(int)")); + REQUIRE_THAT(puml, HasCallWithResponse(_A("B"), _A("A"), "add3(int,int,int)")); + REQUIRE_THAT(puml, HasCall(_A("A"), "add(int,int)")); + REQUIRE_THAT(puml, !HasCall(_A("A"), _A("detail::C"), "add(int,int)")); save_puml( "./" + config.output_directory() + "/" + diagram->name + ".puml", puml); diff --git a/tests/t20002/test_case.h b/tests/t20002/test_case.h index 09691b06..d053c8ac 100644 --- a/tests/t20002/test_case.h +++ b/tests/t20002/test_case.h @@ -34,9 +34,9 @@ TEST_CASE("t20002", "[test-case][sequence]") REQUIRE_THAT(puml, StartsWith("@startuml")); REQUIRE_THAT(puml, EndsWith("@enduml\n")); - REQUIRE_THAT(puml, HasCall(_A("m1()"), _A("m2()"), "m2")); - REQUIRE_THAT(puml, HasCall(_A("m2()"), _A("m3()"), "m3")); - REQUIRE_THAT(puml, HasCall(_A("m3()"), _A("m4()"), "m4")); + REQUIRE_THAT(puml, HasCall(_A("m1()"), _A("m2()"), "")); + REQUIRE_THAT(puml, HasCall(_A("m2()"), _A("m3()"), "")); + REQUIRE_THAT(puml, HasCall(_A("m3()"), _A("m4()"), "")); save_puml( "./" + config.output_directory() + "/" + diagram->name + ".puml", puml); diff --git a/tests/t20003/.clang-uml b/tests/t20003/.clang-uml index d592e566..9aae6b72 100644 --- a/tests/t20003/.clang-uml +++ b/tests/t20003/.clang-uml @@ -11,4 +11,4 @@ diagrams: using_namespace: - clanguml::t20003 start_from: - - function: "clanguml::t20003::m1()" + - function: "clanguml::t20003::m1(T)" diff --git a/tests/t20003/t20003.cc b/tests/t20003/t20003.cc index af9b75ba..00c33395 100644 --- a/tests/t20003/t20003.cc +++ b/tests/t20003/t20003.cc @@ -1,7 +1,3 @@ -#include -#include -#include - namespace clanguml { namespace t20003 { diff --git a/tests/t20003/test_case.h b/tests/t20003/test_case.h index 557ba525..7a17c539 100644 --- a/tests/t20003/test_case.h +++ b/tests/t20003/test_case.h @@ -34,9 +34,9 @@ TEST_CASE("t20003", "[test-case][sequence]") REQUIRE_THAT(puml, StartsWith("@startuml")); REQUIRE_THAT(puml, EndsWith("@enduml\n")); - REQUIRE_THAT(puml, HasCall(_A("m1()"), _A("m2()"), "m2")); - REQUIRE_THAT(puml, HasCall(_A("m2()"), _A("m3()"), "m3")); - REQUIRE_THAT(puml, HasCall(_A("m3()"), _A("m4()"), "m4")); + REQUIRE_THAT(puml, HasCall(_A("m1(T)"), _A("m2(T)"), "")); + REQUIRE_THAT(puml, HasCall(_A("m2(T)"), _A("m3(T)"), "")); + REQUIRE_THAT(puml, HasCall(_A("m3(T)"), _A("m4(T)"), "")); save_puml( "./" + config.output_directory() + "/" + diagram->name + ".puml", puml); diff --git a/tests/t20004/test_case.h b/tests/t20004/test_case.h index 615d3729..fc827d68 100644 --- a/tests/t20004/test_case.h +++ b/tests/t20004/test_case.h @@ -32,22 +32,28 @@ TEST_CASE("t20004", "[test-case][sequence]") AliasMatcher _A(puml); REQUIRE_THAT(puml, StartsWith("@startuml")); - REQUIRE_THAT(puml, HasCall(_A("main()"), _A("m1()"), "m1")); - REQUIRE_THAT(puml, !HasCall(_A("m1()"), _A("m1()"), "m2")); - REQUIRE_THAT(puml, !HasCall(_A("m1()"), _A("m1()"), "m2")); - - REQUIRE_THAT(puml, HasCall(_A("main()"), _A("m1()"), "m1")); - REQUIRE_THAT(puml, - HasCall(_A("m1()"), _A("m4()"), "m4")); - - REQUIRE_THAT(puml, HasCall(_A("main()"), _A("m1()"), "m1")); + REQUIRE_THAT(puml, HasCall(_A("main()"), _A("m1(float)"), "")); REQUIRE_THAT( - puml, HasCall(_A("m1()"), _A("m2()"), "m2")); + puml, !HasCall(_A("m1(float)"), _A("m1(float)"), "")); + REQUIRE_THAT( + puml, !HasCall(_A("m1(float)"), _A("m1(float)"), "")); - REQUIRE_THAT(puml, HasCall(_A("main()"), _A("m1()"), "m1")); - REQUIRE_THAT(puml, HasCall(_A("m1()"), _A("m2()"), "m2")); - REQUIRE_THAT(puml, HasCall(_A("m2()"), _A("m3()"), "m3")); - REQUIRE_THAT(puml, HasCall(_A("m3()"), _A("m4()"), "m4")); + REQUIRE_THAT(puml, + HasCall(_A("main()"), _A("m1(unsigned long)"), "")); + REQUIRE_THAT(puml, + HasCall(_A("m1(unsigned long)"), + _A("m4(unsigned long)"), "")); + + REQUIRE_THAT( + puml, HasCall(_A("main()"), _A("m1(std::string)"), "")); + REQUIRE_THAT(puml, + HasCall(_A("m1(std::string)"), + _A("m2(std::string)"), "")); + + REQUIRE_THAT(puml, HasCall(_A("main()"), _A("m1(int)"), "")); + REQUIRE_THAT(puml, HasCall(_A("m1(int)"), _A("m2(int)"), "")); + REQUIRE_THAT(puml, HasCall(_A("m2(int)"), _A("m3(int)"), "")); + REQUIRE_THAT(puml, HasCall(_A("m3(int)"), _A("m4(int)"), "")); REQUIRE_THAT(puml, EndsWith("@enduml\n")); save_puml( diff --git a/tests/t20005/.clang-uml b/tests/t20005/.clang-uml index d6248303..7fbd937a 100644 --- a/tests/t20005/.clang-uml +++ b/tests/t20005/.clang-uml @@ -11,4 +11,4 @@ diagrams: using_namespace: - clanguml::t20005 start_from: - - function: "clanguml::t20005::C::c" \ No newline at end of file + - function: "clanguml::t20005::C::c(T)" \ No newline at end of file diff --git a/tests/t20005/test_case.h b/tests/t20005/test_case.h index 2f8bed5d..476ee657 100644 --- a/tests/t20005/test_case.h +++ b/tests/t20005/test_case.h @@ -35,8 +35,8 @@ TEST_CASE("t20005", "[test-case][sequence]") REQUIRE_THAT(puml, EndsWith("@enduml\n")); // Check if all calls exist - REQUIRE_THAT(puml, HasCall(_A("C"), _A("B"), "b")); - REQUIRE_THAT(puml, HasCall(_A("B"), _A("A"), "a")); + REQUIRE_THAT(puml, HasCall(_A("C"), _A("B"), "b(T)")); + REQUIRE_THAT(puml, HasCall(_A("B"), _A("A"), "a(T)")); save_puml( "./" + config.output_directory() + "/" + diagram->name + ".puml", puml); diff --git a/tests/t20006/test_case.h b/tests/t20006/test_case.h index 77ba8a6b..be090ce1 100644 --- a/tests/t20006/test_case.h +++ b/tests/t20006/test_case.h @@ -35,10 +35,10 @@ TEST_CASE("t20006", "[test-case][sequence]") REQUIRE_THAT(puml, EndsWith("@enduml\n")); // Check if all calls exist - REQUIRE_THAT(puml, HasCall(_A("tmain()"), _A("B"), "b")); - REQUIRE_THAT(puml, HasCall(_A("B"), _A("A"), "a1")); + REQUIRE_THAT(puml, HasCall(_A("tmain()"), _A("B"), "b(int)")); + REQUIRE_THAT(puml, HasCall(_A("B"), _A("A"), "a1(int)")); - REQUIRE_THAT(puml, HasCall(_A("tmain()"), _A("B"), "b")); + REQUIRE_THAT(puml, HasCall(_A("tmain()"), _A("B"), "b(std::string)")); REQUIRE_THAT( puml, HasCall(_A("B"), _A("A"), "a2")); diff --git a/tests/t20013/.clang-uml b/tests/t20013/.clang-uml new file mode 100644 index 00000000..e37d69ee --- /dev/null +++ b/tests/t20013/.clang-uml @@ -0,0 +1,14 @@ +compilation_database_dir: .. +output_directory: puml +diagrams: + t20013_sequence: + type: sequence + glob: + - ../../tests/t20013/t20013.cc + include: + namespaces: + - clanguml::t20013 + using_namespace: + - clanguml::t20013 + start_from: + - function: "clanguml::t20013::tmain(int,char **)" \ No newline at end of file diff --git a/tests/t20013/t20013.cc b/tests/t20013/t20013.cc new file mode 100644 index 00000000..616c09a2 --- /dev/null +++ b/tests/t20013/t20013.cc @@ -0,0 +1,27 @@ +namespace clanguml { +namespace t20013 { + +struct A { + int a1(int i) { return i; } + double a2(double d) { return d; } + const char *a3(const char *s) { return s; } +}; + +struct B { + int b(int i) { return a.a1(i); } + double b(double d) { return a.a2(d); } + const char *b(const char *s) { return a.a3(s); } + + A a; +}; + +void tmain(int argc, char **argv) +{ + B b; + + b.b(1); + b.b(2.0); + b.b("three"); +} +} +} \ No newline at end of file diff --git a/tests/t20013/test_case.h b/tests/t20013/test_case.h new file mode 100644 index 00000000..0b100356 --- /dev/null +++ b/tests/t20013/test_case.h @@ -0,0 +1,50 @@ +/** + * tests/t20013/test_case.h + * + * Copyright (c) 2021-2022 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("t20013", "[test-case][sequence]") +{ + auto [config, db] = load_config("t20013"); + + auto diagram = config.diagrams["t20013_sequence"]; + + REQUIRE(diagram->name == "t20013_sequence"); + + auto model = generate_sequence_diagram(*db, diagram); + + REQUIRE(model->name() == "t20013_sequence"); + + auto puml = generate_sequence_puml(diagram, *model); + AliasMatcher _A(puml); + + REQUIRE_THAT(puml, StartsWith("@startuml")); + REQUIRE_THAT(puml, EndsWith("@enduml\n")); + + // Check if all calls exist + REQUIRE_THAT(puml, HasCall(_A("tmain(int,char **)"), _A("B"), "b(int)")); + REQUIRE_THAT(puml, HasCall(_A("B"), _A("A"), "a1(int)")); + + REQUIRE_THAT(puml, HasCall(_A("tmain(int,char **)"), _A("B"), "b(double)")); + REQUIRE_THAT(puml, HasCall(_A("B"), _A("A"), "a2(double)")); + + REQUIRE_THAT( + puml, HasCall(_A("tmain(int,char **)"), _A("B"), "b(const char *)")); + REQUIRE_THAT(puml, HasCall(_A("B"), _A("A"), "a3(const char *)")); + + save_puml( + "./" + config.output_directory() + "/" + diagram->name + ".puml", puml); +} \ No newline at end of file diff --git a/tests/test_cases.cc b/tests/test_cases.cc index af89443c..beb24b90 100644 --- a/tests/test_cases.cc +++ b/tests/test_cases.cc @@ -259,6 +259,7 @@ using namespace clanguml::test::matchers; #include "t20010/test_case.h" #include "t20011/test_case.h" #include "t20012/test_case.h" +#include "t20013/test_case.h" /// /// Package diagram tests diff --git a/tests/test_cases.h b/tests/test_cases.h index e1ec4aac..23baa2b4 100644 --- a/tests/test_cases.h +++ b/tests/test_cases.h @@ -123,7 +123,7 @@ ContainsMatcher HasCall(std::string const &from, std::string const &message, CaseSensitive::Choice caseSensitivity = CaseSensitive::Yes) { return ContainsMatcher(CasedString( - fmt::format("{} -> {} : {}()", from, from, message), caseSensitivity)); + fmt::format("{} -> {} : {}", from, from, message), caseSensitivity)); } ContainsMatcher HasCall(std::string const &from, std::string const &to, @@ -131,7 +131,7 @@ ContainsMatcher HasCall(std::string const &from, std::string const &to, CaseSensitive::Choice caseSensitivity = CaseSensitive::Yes) { return ContainsMatcher(CasedString( - fmt::format("{} -> {} : {}()", from, to, message), caseSensitivity)); + fmt::format("{} -> {} : {}", from, to, message), caseSensitivity)); } auto HasCallWithResponse(std::string const &from, std::string const &to, @@ -140,7 +140,7 @@ auto HasCallWithResponse(std::string const &from, std::string const &to, { return HasCallWithResultMatcher( CasedString( - fmt::format("{} -> {} : {}()", from, to, message), caseSensitivity), + fmt::format("{} -> {} : {}", from, to, message), caseSensitivity), CasedString(fmt::format("{} --> {}", to, from), caseSensitivity)); } From 14c2cb62637db21b19fd3901613d5c8c0e30ebdd Mon Sep 17 00:00:00 2001 From: Bartek Kryza Date: Sun, 4 Dec 2022 23:38:26 +0100 Subject: [PATCH 45/77] Fixed handling of arguments in sequence diagrams --- .../visitor/translation_unit_visitor.cc | 16 ++++---- tests/t20006/test_case.h | 40 +++++++++++-------- tests/t20007/test_case.h | 10 +++-- tests/t20008/test_case.h | 19 +++++---- tests/t20009/test_case.h | 13 +++--- tests/t20010/test_case.h | 16 ++++---- tests/t20011/test_case.h | 12 +++--- tests/t20012/test_case.h | 32 +++++++-------- tests/test_cases.h | 2 +- 9 files changed, 86 insertions(+), 74 deletions(-) diff --git a/src/sequence_diagram/visitor/translation_unit_visitor.cc b/src/sequence_diagram/visitor/translation_unit_visitor.cc index 59b87ac3..df2233f3 100644 --- a/src/sequence_diagram/visitor/translation_unit_visitor.cc +++ b/src/sequence_diagram/visitor/translation_unit_visitor.cc @@ -304,7 +304,7 @@ bool translation_unit_visitor::VisitCXXMethodDecl(clang::CXXMethodDecl *m) for (const auto *param : m->parameters()) { m_ptr->add_parameter(simplify_system_template( - common::to_string(param->getType(), m->getASTContext()))); + common::to_string(param->getType(), m->getASTContext(), false))); } set_source_location(*m, *m_ptr); @@ -372,8 +372,8 @@ bool translation_unit_visitor::VisitFunctionDecl(clang::FunctionDecl *f) f_ptr->set_namespace(ns); for (const auto *param : f->parameters()) { - f_ptr->add_parameter(simplify_system_template( - common::to_string(param->getType(), f->getASTContext()))); + f_ptr->add_parameter(simplify_system_template(common::to_string( + param->getType(), f->getASTContext(), false))); } f_ptr->set_id(common::to_id(f_ptr->full_name(false))); @@ -415,7 +415,7 @@ bool translation_unit_visitor::VisitFunctionTemplateDecl( for (const auto *param : function_template->getTemplatedDecl()->parameters()) { f_ptr->add_parameter(simplify_system_template(common::to_string( - param->getType(), function_template->getASTContext()))); + param->getType(), function_template->getASTContext(), false))); } f_ptr->set_id(common::to_id(f_ptr->full_name(false))); @@ -426,7 +426,6 @@ bool translation_unit_visitor::VisitFunctionTemplateDecl( set_unique_id(function_template->getID(), f_ptr->id()); - // TODO: Handle overloaded functions with different arguments diagram().add_participant(std::move(f_ptr)); return true; @@ -1657,11 +1656,12 @@ bool translation_unit_visitor::simplify_system_template( std::string translation_unit_visitor::simplify_system_template( const std::string &full_name) const { - if (config().type_aliases().count(full_name) > 0) { - return config().type_aliases().at(full_name); + std::string result{full_name}; + for(const auto& [k, v] : config().type_aliases()) { + util::replace_all(result, k, v); } - return full_name; + return result; } std::string translation_unit_visitor::make_lambda_name( diff --git a/tests/t20006/test_case.h b/tests/t20006/test_case.h index be090ce1..dcedefb0 100644 --- a/tests/t20006/test_case.h +++ b/tests/t20006/test_case.h @@ -38,30 +38,36 @@ TEST_CASE("t20006", "[test-case][sequence]") REQUIRE_THAT(puml, HasCall(_A("tmain()"), _A("B"), "b(int)")); REQUIRE_THAT(puml, HasCall(_A("B"), _A("A"), "a1(int)")); - REQUIRE_THAT(puml, HasCall(_A("tmain()"), _A("B"), "b(std::string)")); REQUIRE_THAT( - puml, HasCall(_A("B"), _A("A"), "a2")); - - REQUIRE_THAT(puml, HasCall(_A("tmain()"), _A("BB"), "bb1")); - REQUIRE_THAT(puml, HasCall(_A("BB"), _A("AA"), "aa1")); - - REQUIRE_THAT(puml, HasCall(_A("tmain()"), _A("BB"), "bb2")); - REQUIRE_THAT(puml, HasCall(_A("BB"), _A("AA"), "aa2")); + puml, HasCall(_A("tmain()"), _A("B"), "b(std::string)")); + REQUIRE_THAT(puml, + HasCall(_A("B"), _A("A"), "a2(std::string)")); REQUIRE_THAT( - puml, HasCall(_A("tmain()"), _A("BB"), "bb1")); - REQUIRE_THAT( - puml, HasCall(_A("BB"), _A("AA"), "aa2")); + puml, HasCall(_A("tmain()"), _A("BB"), "bb1(int,int)")); + REQUIRE_THAT(puml, HasCall(_A("BB"), _A("AA"), "aa1(int)")); REQUIRE_THAT( - puml, HasCall(_A("tmain()"), _A("BB"), "bb2")); - REQUIRE_THAT( - puml, HasCall(_A("BB"), _A("AA"), "aa1")); + puml, HasCall(_A("tmain()"), _A("BB"), "bb2(int,int)")); + REQUIRE_THAT(puml, HasCall(_A("BB"), _A("AA"), "aa2(int)")); - REQUIRE_THAT(puml, HasCall(_A("tmain()"), _A("BB"), "bb1")); + REQUIRE_THAT(puml, + HasCall( + _A("tmain()"), _A("BB"), "bb1(int,std::string)")); REQUIRE_THAT( - puml, HasCall(_A("BB"), _A("BB"), "bb2")); - REQUIRE_THAT(puml, HasCall(_A("BB"), _A("AA"), "aa2")); + puml, HasCall(_A("BB"), _A("AA"), "aa2(int)")); + + REQUIRE_THAT(puml, + HasCall( + _A("tmain()"), _A("BB"), "bb2(int,std::string)")); + REQUIRE_THAT( + puml, HasCall(_A("BB"), _A("AA"), "aa1(int)")); + + REQUIRE_THAT( + puml, HasCall(_A("tmain()"), _A("BB"), "bb1(int,float)")); + REQUIRE_THAT(puml, + HasCall(_A("BB"), _A("BB"), "bb2(int,float)")); + REQUIRE_THAT(puml, HasCall(_A("BB"), _A("AA"), "aa2(int)")); save_puml( "./" + config.output_directory() + "/" + diagram->name + ".puml", puml); diff --git a/tests/t20007/test_case.h b/tests/t20007/test_case.h index 5fc2d26a..5f639b51 100644 --- a/tests/t20007/test_case.h +++ b/tests/t20007/test_case.h @@ -35,12 +35,14 @@ TEST_CASE("t20007", "[test-case][sequence]") REQUIRE_THAT(puml, EndsWith("@enduml\n")); // Check if all calls exist - REQUIRE_THAT(puml, HasCall(_A("tmain()"), _A("Adder"), "add")); - REQUIRE_THAT( - puml, HasCall(_A("tmain()"), _A("Adder"), "add")); + REQUIRE_THAT(puml, + HasCall(_A("tmain()"), _A("Adder"), "add(int &&,int &&)")); + REQUIRE_THAT(puml, + HasCall(_A("tmain()"), _A("Adder"), + "add(int &&,float &&,double &&)")); REQUIRE_THAT(puml, HasCall(_A("tmain()"), _A("Adder"), - "add")); + "add(std::string &&,std::string &&,std::string &&)")); save_puml( "./" + config.output_directory() + "/" + diagram->name + ".puml", puml); diff --git a/tests/t20008/test_case.h b/tests/t20008/test_case.h index 221485e2..4f214e19 100644 --- a/tests/t20008/test_case.h +++ b/tests/t20008/test_case.h @@ -35,18 +35,21 @@ TEST_CASE("t20008", "[test-case][sequence]") REQUIRE_THAT(puml, EndsWith("@enduml\n")); // Check if all calls exist - REQUIRE_THAT(puml, HasCall(_A("tmain()"), _A("B"), "b")); - REQUIRE_THAT(puml, HasCall(_A("B"), _A("A"), "a1")); - REQUIRE_THAT(puml, !HasCall(_A("B"), _A("A"), "a2")); - REQUIRE_THAT(puml, !HasCall(_A("B"), _A("A"), "a3")); + REQUIRE_THAT(puml, HasCall(_A("tmain()"), _A("B"), "b(int)")); + REQUIRE_THAT(puml, HasCall(_A("B"), _A("A"), "a1(int)")); + REQUIRE_THAT(puml, !HasCall(_A("B"), _A("A"), "a2(int)")); + REQUIRE_THAT(puml, !HasCall(_A("B"), _A("A"), "a3(int)")); - REQUIRE_THAT(puml, HasCall(_A("tmain()"), _A("B"), "b")); REQUIRE_THAT( - puml, HasCall(_A("B"), _A("A"), "a2")); + puml, HasCall(_A("tmain()"), _A("B"), "b(const char *)")); + REQUIRE_THAT(puml, + HasCall( + _A("B"), _A("A"), "a2(const char *)")); - REQUIRE_THAT(puml, HasCall(_A("tmain()"), _A("B"), "b")); REQUIRE_THAT( - puml, HasCall(_A("B"), _A("A"), "a3")); + puml, HasCall(_A("tmain()"), _A("B"), "b(std::string)")); + REQUIRE_THAT(puml, + HasCall(_A("B"), _A("A"), "a3(std::string)")); save_puml( "./" + config.output_directory() + "/" + diagram->name + ".puml", puml); diff --git a/tests/t20009/test_case.h b/tests/t20009/test_case.h index 359e625a..bddc823e 100644 --- a/tests/t20009/test_case.h +++ b/tests/t20009/test_case.h @@ -35,15 +35,16 @@ TEST_CASE("t20009", "[test-case][sequence]") REQUIRE_THAT(puml, EndsWith("@enduml\n")); // Check if all calls exist - REQUIRE_THAT(puml, HasCall(_A("tmain()"), _A("B"), "b")); REQUIRE_THAT( - puml, HasCall(_A("B"), _A("A"), "a")); + puml, HasCall(_A("tmain()"), _A("B"), "b(std::string)")); + REQUIRE_THAT(puml, + HasCall(_A("B"), _A("A"), "a(std::string)")); - REQUIRE_THAT(puml, HasCall(_A("tmain()"), _A("B"), "b")); - REQUIRE_THAT(puml, HasCall(_A("B"), _A("A"), "a")); + REQUIRE_THAT(puml, HasCall(_A("tmain()"), _A("B"), "b(int)")); + REQUIRE_THAT(puml, HasCall(_A("B"), _A("A"), "a(int)")); - REQUIRE_THAT(puml, HasCall(_A("tmain()"), _A("B"), "b")); - REQUIRE_THAT(puml, HasCall(_A("B"), _A("A"), "a")); + REQUIRE_THAT(puml, HasCall(_A("tmain()"), _A("B"), "b(float)")); + REQUIRE_THAT(puml, HasCall(_A("B"), _A("A"), "a(float)")); save_puml( "./" + config.output_directory() + "/" + diagram->name + ".puml", puml); } \ No newline at end of file diff --git a/tests/t20010/test_case.h b/tests/t20010/test_case.h index b2be4711..9e2c6594 100644 --- a/tests/t20010/test_case.h +++ b/tests/t20010/test_case.h @@ -35,17 +35,17 @@ TEST_CASE("t20010", "[test-case][sequence]") REQUIRE_THAT(puml, EndsWith("@enduml\n")); // Check if all calls exist - REQUIRE_THAT(puml, HasCall(_A("tmain()"), _A("B"), "b1")); - REQUIRE_THAT(puml, HasCall(_A("B"), _A("A"), "a1")); + REQUIRE_THAT(puml, HasCall(_A("tmain()"), _A("B"), "b1()")); + REQUIRE_THAT(puml, HasCall(_A("B"), _A("A"), "a1()")); - REQUIRE_THAT(puml, HasCall(_A("tmain()"), _A("B"), "b2")); - REQUIRE_THAT(puml, HasCall(_A("B"), _A("A"), "a2")); + REQUIRE_THAT(puml, HasCall(_A("tmain()"), _A("B"), "b2()")); + REQUIRE_THAT(puml, HasCall(_A("B"), _A("A"), "a2()")); - REQUIRE_THAT(puml, HasCall(_A("tmain()"), _A("B"), "b3")); - REQUIRE_THAT(puml, HasCall(_A("B"), _A("A"), "a3")); + REQUIRE_THAT(puml, HasCall(_A("tmain()"), _A("B"), "b3()")); + REQUIRE_THAT(puml, HasCall(_A("B"), _A("A"), "a3()")); - REQUIRE_THAT(puml, HasCall(_A("tmain()"), _A("B"), "b4")); - REQUIRE_THAT(puml, HasCall(_A("B"), _A("A"), "a4")); + REQUIRE_THAT(puml, HasCall(_A("tmain()"), _A("B"), "b4()")); + REQUIRE_THAT(puml, HasCall(_A("B"), _A("A"), "a4()")); save_puml( "./" + config.output_directory() + "/" + diagram->name + ".puml", puml); diff --git a/tests/t20011/test_case.h b/tests/t20011/test_case.h index 55638487..f0640636 100644 --- a/tests/t20011/test_case.h +++ b/tests/t20011/test_case.h @@ -35,13 +35,13 @@ TEST_CASE("t20011", "[test-case][sequence]") REQUIRE_THAT(puml, EndsWith("@enduml\n")); // Check if all calls exist - REQUIRE_THAT(puml, HasCall(_A("tmain()"), _A("A"), "a")); - REQUIRE_THAT(puml, HasCall(_A("A"), _A("A"), "a")); + REQUIRE_THAT(puml, HasCall(_A("tmain()"), _A("A"), "a(int)")); + REQUIRE_THAT(puml, HasCall(_A("A"), _A("A"), "a(int)")); - REQUIRE_THAT(puml, HasCall(_A("tmain()"), _A("A"), "b")); - REQUIRE_THAT(puml, HasCall(_A("A"), _A("A"), "c")); - REQUIRE_THAT(puml, HasCall(_A("A"), _A("A"), "d")); - REQUIRE_THAT(puml, HasCall(_A("A"), _A("A"), "b")); + REQUIRE_THAT(puml, HasCall(_A("tmain()"), _A("A"), "b(int)")); + REQUIRE_THAT(puml, HasCall(_A("A"), _A("A"), "c(int)")); + REQUIRE_THAT(puml, HasCall(_A("A"), _A("A"), "d(int)")); + REQUIRE_THAT(puml, HasCall(_A("A"), _A("A"), "b(int)")); save_puml( "./" + config.output_directory() + "/" + diagram->name + ".puml", puml); diff --git a/tests/t20012/test_case.h b/tests/t20012/test_case.h index bc789226..b40f10e8 100644 --- a/tests/t20012/test_case.h +++ b/tests/t20012/test_case.h @@ -37,34 +37,34 @@ TEST_CASE("t20012", "[test-case][sequence]") // Check if all calls exist REQUIRE_THAT(puml, HasCall(_A("tmain()"), _A("tmain()::(lambda t20012.cc:49:20)"), - "operator()")); + "operator()()")); REQUIRE_THAT( - puml, HasCall(_A("tmain()::(lambda t20012.cc:49:20)"), _A("A"), "a")); - REQUIRE_THAT(puml, HasCall(_A("A"), _A("A"), "aa")); - REQUIRE_THAT(puml, HasCall(_A("A"), _A("A"), "aaa")); + puml, HasCall(_A("tmain()::(lambda t20012.cc:49: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 t20012.cc:49:20)"), _A("B"), "b")); - REQUIRE_THAT(puml, HasCall(_A("B"), _A("B"), "bb")); - REQUIRE_THAT(puml, HasCall(_A("B"), _A("B"), "bbb")); + puml, HasCall(_A("tmain()::(lambda t20012.cc:49: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 t20012.cc:62:20)"), _A("C"), "c")); - REQUIRE_THAT(puml, HasCall(_A("C"), _A("C"), "cc")); - REQUIRE_THAT(puml, HasCall(_A("C"), _A("C"), "ccc")); + puml, HasCall(_A("tmain()::(lambda t20012.cc:62: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 t20012.cc:62:20)"), - _A("tmain()::(lambda t20012.cc:49:20)"), "operator()")); + _A("tmain()::(lambda t20012.cc:49:20)"), "operator()()")); - REQUIRE_THAT(puml, HasCall(_A("C"), _A("C"), "ccc")); + REQUIRE_THAT(puml, HasCall(_A("C"), _A("C"), "ccc()")); - REQUIRE_THAT( - puml, HasCall(_A("tmain()"), _A("R"), "r")); + REQUIRE_THAT(puml, + HasCall(_A("tmain()"), _A("R"), "r()")); REQUIRE_THAT(puml, HasCall(_A("R"), - _A("tmain()::(lambda t20012.cc:68:9)"), "operator()")); + _A("tmain()::(lambda t20012.cc:68:9)"), "operator()()")); REQUIRE_THAT( - puml, HasCall(_A("tmain()::(lambda t20012.cc:68:9)"), _A("C"), "c")); + puml, HasCall(_A("tmain()::(lambda t20012.cc:68:9)"), _A("C"), "c()")); save_puml( "./" + config.output_directory() + "/" + diagram->name + ".puml", puml); diff --git a/tests/test_cases.h b/tests/test_cases.h index 23baa2b4..25ddc23f 100644 --- a/tests/test_cases.h +++ b/tests/test_cases.h @@ -131,7 +131,7 @@ ContainsMatcher HasCall(std::string const &from, std::string const &to, CaseSensitive::Choice caseSensitivity = CaseSensitive::Yes) { return ContainsMatcher(CasedString( - fmt::format("{} -> {} : {}", from, to, message), caseSensitivity)); + fmt::format("{} -> {} : {}\n", from, to, message), caseSensitivity)); } auto HasCallWithResponse(std::string const &from, std::string const &to, From f7a1130bab9f4a051a2aa7ab0e54d9f5a77bfca8 Mon Sep 17 00:00:00 2001 From: Bartek Kryza Date: Mon, 5 Dec 2022 23:57:00 +0100 Subject: [PATCH 46/77] Added test case for sequence diagram with multiple translation units --- .../visitor/translation_unit_visitor.cc | 6 +- .../visitor/translation_unit_visitor.cc | 75 ++++++++++++++++--- .../visitor/translation_unit_visitor.h | 4 + tests/t00048/.clang-uml | 1 + tests/t20014/.clang-uml | 17 +++++ tests/t20014/include/t20014.h | 9 +++ tests/t20014/include/t20014_a.h | 12 +++ tests/t20014/include/t20014_b.h | 16 ++++ tests/t20014/include/t20014_c.h | 19 +++++ tests/t20014/t20014.cc | 23 ++++++ tests/t20014/t20014_a.cc | 10 +++ tests/t20014/t20014_b.cc | 10 +++ tests/t20014/t20014_c.cc | 17 +++++ tests/t20014/test_case.h | 49 ++++++++++++ tests/test_cases.cc | 1 + 15 files changed, 256 insertions(+), 13 deletions(-) create mode 100644 tests/t20014/.clang-uml create mode 100644 tests/t20014/include/t20014.h create mode 100644 tests/t20014/include/t20014_a.h create mode 100644 tests/t20014/include/t20014_b.h create mode 100644 tests/t20014/include/t20014_c.h create mode 100644 tests/t20014/t20014.cc create mode 100644 tests/t20014/t20014_a.cc create mode 100644 tests/t20014/t20014_b.cc create mode 100644 tests/t20014/t20014_c.cc create mode 100644 tests/t20014/test_case.h diff --git a/src/class_diagram/visitor/translation_unit_visitor.cc b/src/class_diagram/visitor/translation_unit_visitor.cc index c85cc445..14709b29 100644 --- a/src/class_diagram/visitor/translation_unit_visitor.cc +++ b/src/class_diagram/visitor/translation_unit_visitor.cc @@ -171,7 +171,11 @@ bool translation_unit_visitor::VisitEnumDecl(clang::EnumDecl *enm) } } - assert(id_opt); + if(!id_opt) { + LOG_WARN("Unknown parent for enum {}", qualified_name); + return true; + + } auto parent_class = diagram_.get_class(*id_opt); diff --git a/src/sequence_diagram/visitor/translation_unit_visitor.cc b/src/sequence_diagram/visitor/translation_unit_visitor.cc index df2233f3..8c07f3bf 100644 --- a/src/sequence_diagram/visitor/translation_unit_visitor.cc +++ b/src/sequence_diagram/visitor/translation_unit_visitor.cc @@ -265,12 +265,16 @@ bool translation_unit_visitor::VisitClassTemplateSpecializationDecl( bool translation_unit_visitor::VisitCXXMethodDecl(clang::CXXMethodDecl *m) { - if (context().current_class_decl_ == nullptr && - context().current_class_template_decl_ == nullptr && - context().current_class_template_specialization_decl_ == nullptr) + if (!diagram().should_include(m->getParent()->getQualifiedNameAsString())) return true; - LOG_DBG("= Processing method {} in class {} [{}]", + if (!m->isThisDeclarationADefinition()) { + if (m->getDefinition()) + return VisitCXXMethodDecl( + static_cast(m->getDefinition())); + } + + LOG_DBG("Visiting method {} in class {} [{}]", m->getQualifiedNameAsString(), m->getParent()->getQualifiedNameAsString(), (void *)m->getParent()); @@ -293,6 +297,13 @@ bool translation_unit_visitor::VisitCXXMethodDecl(clang::CXXMethodDecl *m) LOG_DBG("Getting method's class with local id {}", parent_decl->getID()); + if (!get_participant(parent_decl)) { + LOG_WARN("Cannot find parent class_ for method {} in class {}", + m->getQualifiedNameAsString(), + m->getParent()->getQualifiedNameAsString()); + return true; + } + const auto &method_class = get_participant(parent_decl).value(); @@ -336,6 +347,12 @@ bool translation_unit_visitor::VisitFunctionDecl(clang::FunctionDecl *f) if (!diagram().should_include(function_name)) return true; + if (!f->isThisDeclarationADefinition()) { + if (f->getDefinition()) + return VisitFunctionDecl( + static_cast(f->getDefinition())); + } + LOG_DBG("Visiting function declaration {} at {}", function_name, f->getLocation().printToString(source_manager())); @@ -497,6 +514,21 @@ bool translation_unit_visitor::TraverseLambdaExpr(clang::LambdaExpr *expr) return true; } +// +// bool translation_unit_visitor::TraverseCompoundStmt(clang::CompoundStmt +// *stmt) { +// const auto lambda_full_name = +// stmt-> +// +// RecursiveASTVisitor::TraverseCompoundStmt(stmt); +// +// LOG_DBG("Leaving lambda expression {} at {}", lambda_full_name, +// expr->getBeginLoc().printToString(source_manager())); +// +// context().leave_lambda_expression(); +// +// return true; +//} bool translation_unit_visitor::VisitCallExpr(clang::CallExpr *expr) { @@ -505,6 +537,18 @@ bool translation_unit_visitor::VisitCallExpr(clang::CallExpr *expr) using clanguml::sequence_diagram::model::activity; using clanguml::sequence_diagram::model::message; + if (context().caller_id() == 0) + return true; + + LOG_DBG("Visiting call expression at {} [caller_id = {}]", + expr->getBeginLoc().printToString(source_manager()), + context().caller_id()); + + if (context().caller_id() == 2166770483948966160) { + LOG_WARN(">>>>>>> VISITING CALL EXPRESSION IN METHOD " + "one::s3::S3Server::listBuckets()"); + } + // Skip casts, moves and such if (expr->isCallToStdMove()) return true; @@ -528,9 +572,6 @@ bool translation_unit_visitor::VisitCallExpr(clang::CallExpr *expr) m.from = context().lambda_caller_id(); } - LOG_DBG("Visiting call expression at {}", - expr->getBeginLoc().printToString(source_manager())); - if (const auto *operator_call_expr = clang::dyn_cast_or_null(expr); operator_call_expr != nullptr) { @@ -618,6 +659,9 @@ bool translation_unit_visitor::VisitCallExpr(clang::CallExpr *expr) bool translation_unit_visitor::process_operator_call_expression( model::message &m, const clang::CXXOperatorCallExpr *operator_call_expr) { + if (operator_call_expr->getCalleeDecl() == nullptr) + return false; + LOG_DBG("Operator '{}' call expression to {} at {}", getOperatorSpelling(operator_call_expr->getOperator()), operator_call_expr->getCalleeDecl()->getID(), @@ -642,6 +686,10 @@ bool translation_unit_visitor::process_class_method_call_expression( { // Get callee declaration as methods parent const auto *method_decl = method_call_expr->getMethodDecl(); + + if (method_decl == nullptr) + return false; + std::string method_name = method_decl->getQualifiedNameAsString(); auto *callee_decl = method_decl ? method_decl->getParent() : nullptr; @@ -701,12 +749,15 @@ bool translation_unit_visitor::process_class_template_method_call_expression( } } } + // Otherwise check if it is a smart pointer else if (is_smart_pointer(template_declaration)) { - // Otherwise check if it is a smart pointer - template_declaration->getTemplateParameters()->asArray().front(); + const auto *argument_template = + template_declaration->getTemplateParameters() + ->asArray() + .front(); - if (get_participant(template_declaration).has_value()) { - callee_method_full_name = get_participant(template_declaration) + if (get_participant(argument_template).has_value()) { + callee_method_full_name = get_participant(argument_template) .value() .full_name(false) + "::" + dependent_member_callee->getMember().getAsString(); @@ -1657,7 +1708,7 @@ std::string translation_unit_visitor::simplify_system_template( const std::string &full_name) const { std::string result{full_name}; - for(const auto& [k, v] : config().type_aliases()) { + for (const auto &[k, v] : config().type_aliases()) { util::replace_all(result, k, v); } diff --git a/src/sequence_diagram/visitor/translation_unit_visitor.h b/src/sequence_diagram/visitor/translation_unit_visitor.h index a14c0f35..234e1bdf 100644 --- a/src/sequence_diagram/visitor/translation_unit_visitor.h +++ b/src/sequence_diagram/visitor/translation_unit_visitor.h @@ -50,6 +50,8 @@ public: bool VisitCXXMethodDecl(clang::CXXMethodDecl *method); +// bool TraverseCompoundStmt(clang::CompoundStmt *stmt); + bool VisitCXXRecordDecl(clang::CXXRecordDecl *cls); bool VisitClassTemplateDecl(clang::ClassTemplateDecl *cls); @@ -62,6 +64,8 @@ public: bool VisitFunctionTemplateDecl( clang::FunctionTemplateDecl *function_declaration); + + clanguml::sequence_diagram::model::diagram &diagram(); const clanguml::sequence_diagram::model::diagram &diagram() const; diff --git a/tests/t00048/.clang-uml b/tests/t00048/.clang-uml index 2c8a4cec..7236ae46 100644 --- a/tests/t00048/.clang-uml +++ b/tests/t00048/.clang-uml @@ -6,6 +6,7 @@ diagrams: glob: - ../../tests/t00048/b_t00048.cc - ../../tests/t00048/a_t00048.cc + - ../../tests/t00048/t00048.cc using_namespace: clanguml::t00048 parse_includes: true include: diff --git a/tests/t20014/.clang-uml b/tests/t20014/.clang-uml new file mode 100644 index 00000000..9de444e7 --- /dev/null +++ b/tests/t20014/.clang-uml @@ -0,0 +1,17 @@ +compilation_database_dir: .. +output_directory: puml +diagrams: + t20014_sequence: + type: sequence + glob: + - ../../tests/t20014/t20014.cc + - ../../tests/t20014/t20014_c.cc + - ../../tests/t20014/t20014_b.cc + - ../../tests/t20014/t20014_a.cc + include: + namespaces: + - clanguml::t20014 + using_namespace: + - clanguml::t20014 + start_from: + - function: "clanguml::t20014::tmain()" \ No newline at end of file diff --git a/tests/t20014/include/t20014.h b/tests/t20014/include/t20014.h new file mode 100644 index 00000000..48b974d5 --- /dev/null +++ b/tests/t20014/include/t20014.h @@ -0,0 +1,9 @@ +#pragma once + +namespace clanguml { +namespace t20014 { + +int tmain(); + +} +} \ No newline at end of file diff --git a/tests/t20014/include/t20014_a.h b/tests/t20014/include/t20014_a.h new file mode 100644 index 00000000..44865287 --- /dev/null +++ b/tests/t20014/include/t20014_a.h @@ -0,0 +1,12 @@ +#pragma once + +namespace clanguml { +namespace t20014 { + +struct A { + int a1(int i, int j); + int a2(int i, int j); +}; + +} +} \ No newline at end of file diff --git a/tests/t20014/include/t20014_b.h b/tests/t20014/include/t20014_b.h new file mode 100644 index 00000000..e41e43c5 --- /dev/null +++ b/tests/t20014/include/t20014_b.h @@ -0,0 +1,16 @@ +#pragma once + +#include "t20014_a.h" + +namespace clanguml { +namespace t20014 { + +struct B { + int b1(int i, int); + int b2(int i, int); + + A a_; +}; + +} +} \ No newline at end of file diff --git a/tests/t20014/include/t20014_c.h b/tests/t20014/include/t20014_c.h new file mode 100644 index 00000000..83f13875 --- /dev/null +++ b/tests/t20014/include/t20014_c.h @@ -0,0 +1,19 @@ +#pragma once + +namespace clanguml { +namespace t20014 { + +template struct C { + F c1(F i, F j) { + return c_.b1(i, j); + } + + F c2(F i, F j){ + return c_.b2(i, j); + } + + T c_; +}; + +} +} \ No newline at end of file diff --git a/tests/t20014/t20014.cc b/tests/t20014/t20014.cc new file mode 100644 index 00000000..c22f030d --- /dev/null +++ b/tests/t20014/t20014.cc @@ -0,0 +1,23 @@ +#include "include/t20014.h" +#include "include/t20014_b.h" +#include "include/t20014_c.h" + +namespace clanguml { +namespace t20014 { + +void log(const char *msg) { } + +int tmain() +{ + B b; + C c; + + b.b1(0, 1); + b.b2(1, 2); + + c.c1(2, 3); + + return 0; +} +} +} \ No newline at end of file diff --git a/tests/t20014/t20014_a.cc b/tests/t20014/t20014_a.cc new file mode 100644 index 00000000..58d2b6bf --- /dev/null +++ b/tests/t20014/t20014_a.cc @@ -0,0 +1,10 @@ +#include "include/t20014_a.h" +namespace clanguml { +namespace t20014 { + +int A::a1(int i, int j) { return i + j; } + +int A::a2(int i, int j) { return i - j; } + +} +} \ No newline at end of file diff --git a/tests/t20014/t20014_b.cc b/tests/t20014/t20014_b.cc new file mode 100644 index 00000000..71fe96e6 --- /dev/null +++ b/tests/t20014/t20014_b.cc @@ -0,0 +1,10 @@ +#include "include/t20014_b.h" +namespace clanguml { +namespace t20014 { + +int B::b1(int i, int j) { return a_.a1(i, j); } + +int B::b2(int i, int j) { return a_.a2(i, j); } + +} +} \ No newline at end of file diff --git a/tests/t20014/t20014_c.cc b/tests/t20014/t20014_c.cc new file mode 100644 index 00000000..363fc63d --- /dev/null +++ b/tests/t20014/t20014_c.cc @@ -0,0 +1,17 @@ +#include "include/t20014_c.h" + +namespace clanguml { +namespace t20014 { + +//template F C::c1(F i, F j) +//{ +// return c_.b1(i, j); +//} +// +//template F C::c2(F i, F j) +//{ +// return c_.b2(i, j); +//} + +} +} \ No newline at end of file diff --git a/tests/t20014/test_case.h b/tests/t20014/test_case.h new file mode 100644 index 00000000..eec0fe57 --- /dev/null +++ b/tests/t20014/test_case.h @@ -0,0 +1,49 @@ +/** + * tests/t20014/test_case.h + * + * Copyright (c) 2021-2022 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("t20014", "[test-case][sequence]") +{ + auto [config, db] = load_config("t20014"); + + auto diagram = config.diagrams["t20014_sequence"]; + + REQUIRE(diagram->name == "t20014_sequence"); + + auto model = generate_sequence_diagram(*db, diagram); + + REQUIRE(model->name() == "t20014_sequence"); + + auto puml = generate_sequence_puml(diagram, *model); + AliasMatcher _A(puml); + + REQUIRE_THAT(puml, StartsWith("@startuml")); + REQUIRE_THAT(puml, EndsWith("@enduml\n")); + + // Check if all calls exist + REQUIRE_THAT(puml, HasCall(_A("tmain()"), _A("B"), "b1(int,int)")); + REQUIRE_THAT(puml, HasCall(_A("B"), _A("A"), "a1(int,int)")); + + REQUIRE_THAT(puml, HasCall(_A("tmain()"), _A("B"), "b2(int,int)")); + REQUIRE_THAT(puml, HasCall(_A("B"), _A("A"), "a2(int,int)")); + + REQUIRE_THAT(puml, HasCall(_A("tmain()"), _A("C"), "c1(int,int)")); + REQUIRE_THAT(puml, HasCall(_A("C"), _A("B"), "b1(int,int)")); + + save_puml( + "./" + config.output_directory() + "/" + diagram->name + ".puml", puml); +} \ No newline at end of file diff --git a/tests/test_cases.cc b/tests/test_cases.cc index beb24b90..9e0486ea 100644 --- a/tests/test_cases.cc +++ b/tests/test_cases.cc @@ -260,6 +260,7 @@ using namespace clanguml::test::matchers; #include "t20011/test_case.h" #include "t20012/test_case.h" #include "t20013/test_case.h" +#include "t20014/test_case.h" /// /// Package diagram tests From db3381865e54ff097c198c3f1aa0f69e6ab6fad9 Mon Sep 17 00:00:00 2001 From: Bartek Kryza Date: Tue, 6 Dec 2022 00:32:34 +0100 Subject: [PATCH 47/77] Updated test case documentation --- docs/test_cases.md | 2 + docs/test_cases/t00002_class.svg | 36 +-- docs/test_cases/t00003_class.svg | 46 ++-- docs/test_cases/t00004_class.svg | 76 +++--- docs/test_cases/t00005_class.svg | 110 ++++----- docs/test_cases/t00006_class.svg | 132 +++++------ docs/test_cases/t00007_class.svg | 30 +-- docs/test_cases/t00008_class.svg | 56 ++--- docs/test_cases/t00009_class.svg | 32 +-- docs/test_cases/t00010_class.svg | 34 +-- docs/test_cases/t00011_class.svg | 22 +- docs/test_cases/t00012_class.svg | 66 +++--- docs/test_cases/t00013_class.svg | 82 +++---- docs/test_cases/t00014_class.svg | 116 ++++----- docs/test_cases/t00015_class.svg | 22 +- docs/test_cases/t00016_class.svg | 30 +-- docs/test_cases/t00017_class.svg | 66 +++--- docs/test_cases/t00018_class.svg | 18 +- docs/test_cases/t00019_class.svg | 40 ++-- docs/test_cases/t00020_class.svg | 38 +-- docs/test_cases/t00021_class.svg | 30 +-- docs/test_cases/t00022_class.svg | 14 +- docs/test_cases/t00023_class.svg | 26 +- docs/test_cases/t00024_class.svg | 22 +- docs/test_cases/t00025_class.svg | 34 +-- docs/test_cases/t00026_class.svg | 42 ++-- docs/test_cases/t00027_class.svg | 58 ++--- docs/test_cases/t00028_class.svg | 78 +++--- docs/test_cases/t00029_class.svg | 50 ++-- docs/test_cases/t00030_class.svg | 46 ++-- docs/test_cases/t00031_class.svg | 50 ++-- docs/test_cases/t00032_class.svg | 40 ++-- docs/test_cases/t00033_class.svg | 48 ++-- docs/test_cases/t00034_class.svg | 46 ++-- docs/test_cases/t00035_class.svg | 22 +- docs/test_cases/t00036_class.svg | 38 +-- docs/test_cases/t00037_class.svg | 54 ++--- docs/test_cases/t00038_class.svg | 58 ++--- docs/test_cases/t00039_class.svg | 78 +++--- docs/test_cases/t00040_class.svg | 26 +- docs/test_cases/t00041_class.svg | 54 ++--- docs/test_cases/t00042_class.svg | 36 +-- docs/test_cases/t00043_class.svg | 50 ++-- docs/test_cases/t00044_class.svg | 36 +-- docs/test_cases/t00045_class.svg | 70 +++--- docs/test_cases/t00046_class.svg | 64 ++--- docs/test_cases/t00047_class.svg | 22 +- docs/test_cases/t00048.md | 1 + docs/test_cases/t00048_class.svg | 50 ++-- docs/test_cases/t00049_class.svg | 32 +-- docs/test_cases/t00050_class.svg | 70 +++--- docs/test_cases/t20001_sequence.svg | 118 ++++----- docs/test_cases/t20002_sequence.svg | 79 +++---- docs/test_cases/t20003.md | 6 +- docs/test_cases/t20003_sequence.svg | 87 ++++--- docs/test_cases/t20004_sequence.svg | 223 +++++++++--------- docs/test_cases/t20005.md | 2 +- docs/test_cases/t20005_sequence.svg | 30 +-- docs/test_cases/t20006_sequence.svg | 134 +++++------ docs/test_cases/t20007_sequence.svg | 78 +++--- docs/test_cases/t20008_sequence.svg | 70 +++--- docs/test_cases/t20009_sequence.svg | 132 +++++------ docs/test_cases/t20010_sequence.svg | 50 ++-- docs/test_cases/t20011_sequence.svg | 126 +++++----- docs/test_cases/t20012_sequence.svg | 130 +++++----- docs/test_cases/t20013.md | 51 ++++ docs/test_cases/t20013_sequence.svg | 72 ++++++ docs/test_cases/t30001_package.svg | 48 ++-- docs/test_cases/t30002_package.svg | 90 +++---- docs/test_cases/t30003_package.svg | 26 +- docs/test_cases/t30004_package.svg | 30 +-- docs/test_cases/t30005_package.svg | 38 +-- docs/test_cases/t30006_package.svg | 16 +- docs/test_cases/t30007_package.svg | 20 +- docs/test_cases/t30008_package.svg | 34 +-- docs/test_cases/t40001_include.svg | 30 +-- docs/test_cases/t40002_include.svg | 34 +-- docs/test_cases/t40003_include.svg | 50 ++-- .../visitor/call_expression_context.h | 2 + .../visitor/translation_unit_visitor.cc | 51 ++-- .../visitor/translation_unit_visitor.h | 4 +- tests/test_cases.yaml | 6 + 82 files changed, 2195 insertions(+), 2071 deletions(-) create mode 100644 docs/test_cases/t20013.md create mode 100644 docs/test_cases/t20013_sequence.svg diff --git a/docs/test_cases.md b/docs/test_cases.md index 386dd4ed..dc13bd03 100644 --- a/docs/test_cases.md +++ b/docs/test_cases.md @@ -62,6 +62,8 @@ * [t20010](./test_cases/t20010.md) - Container sequence diagram test case * [t20011](./test_cases/t20011.md) - Recursive calls sequence diagram test case * [t20012](./test_cases/t20012.md) - Lambda expression call sequence diagram test case + * [t20013](./test_cases/t20013.md) - Function and method arguments in sequence diagrams test case + * [t20013](./test_cases/t20013.md) - Multiple translation units sequence diagram test case ## Package diagrams * [t30001](./test_cases/t30001.md) - Basic package diagram test case * [t30002](./test_cases/t30002.md) - Package dependency test case diff --git a/docs/test_cases/t00002_class.svg b/docs/test_cases/t00002_class.svg index 6b5e48d9..847e8c15 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_class.svg b/docs/test_cases/t00003_class.svg index 2f3a234a..df63fd69 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_class.svg b/docs/test_cases/t00004_class.svg index 4bf3621f..cff5f816 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,15 +59,15 @@ Red - - + + A::AA::AAA - + C::B @@ -75,8 +75,8 @@ int - - + + C @@ -84,39 +84,39 @@ T - + - + t : T - + - + b_int : B<int> - - + + C::AA - - + + C::AA::AAA - - + + C::AA::CCC @@ -125,8 +125,8 @@ CCC_2 - - + + C::B @@ -134,16 +134,16 @@ V - + - + b : V - - + + C::CC @@ -152,16 +152,16 @@ CC_2 - - + + detail::D - - + + detail::D::AA @@ -171,8 +171,8 @@ AA_3 - - + + detail::D::DD diff --git a/docs/test_cases/t00005_class.svg b/docs/test_cases/t00005_class.svg index 109b68fd..bfd8500a 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_class.svg b/docs/test_cases/t00006_class.svg index 70d841d4..7a7a6945 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,15 +146,15 @@ T - + - + data : std::vector<T> - + custom_container @@ -162,102 +162,102 @@ 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_class.svg b/docs/test_cases/t00007_class.svg index fd6c7970..2bf20858 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_class.svg b/docs/test_cases/t00008_class.svg index e20aa3fd..9fa8f721 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,CMP,int N - + - + 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,15 +87,15 @@ T,C<> - + - + template_template : C<T> - + B @@ -103,18 +103,18 @@ int,Vector - - + + D - + - + ints : B<int,Vector> diff --git a/docs/test_cases/t00009_class.svg b/docs/test_cases/t00009_class.svg index 8278a48a..03cf5af7 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,15 +18,15 @@ T - + - + value : T - + A @@ -34,7 +34,7 @@ int - + A @@ -42,7 +42,7 @@ std::string - + A @@ -50,32 +50,32 @@ 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_class.svg b/docs/test_cases/t00010_class.svg index e3ef7243..f04de2d4 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,22 +18,22 @@ T,P - + - + first : T - + - + second : P - + A @@ -41,8 +41,8 @@ T,std::string - - + + B @@ -50,15 +50,15 @@ T - + - + astring : A<T,std::string> - + B @@ -66,18 +66,18 @@ int - - + + C - + - + aintstring : B<int> diff --git a/docs/test_cases/t00011_class.svg b/docs/test_cases/t00011_class.svg index b6c42908..ece825b8 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_class.svg b/docs/test_cases/t00012_class.svg index f3b5b83b..51b61f22 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,14 +60,14 @@ - + - + ints : std::array<T,sizeof...(Is)> - + A @@ -75,7 +75,7 @@ int,std::string,float - + A @@ -83,7 +83,7 @@ int,std::string,bool - + B @@ -91,7 +91,7 @@ 3,2,1 - + B @@ -99,7 +99,7 @@ 1,1,1,1 - + C @@ -107,50 +107,50 @@ 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_class.svg b/docs/test_cases/t00013_class.svg index 7ab568bc..b8814aee 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,15 +18,15 @@ T - + - + f : T - + ABCD::F @@ -34,70 +34,70 @@ int - - + + A - + - + a : int - - + + B - + - + b : int - - + + C - + - + c : int - - + + D - + - + d : int print(R * r) : void - - + + E @@ -105,16 +105,16 @@ T - + - + e : T - - + + G @@ -122,22 +122,22 @@ T,Args... - + - + g : T - + - + args : std::tuple<Args...> - + E @@ -145,7 +145,7 @@ int - + G @@ -153,7 +153,7 @@ int,float,std::string - + E @@ -161,25 +161,25 @@ std::string - - + + R - + - + gintstring : G<int,float,std::string> - + - + estring : E<std::string> diff --git a/docs/test_cases/t00014_class.svg b/docs/test_cases/t00014_class.svg index 37caa13b..66c84626 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,37 +18,37 @@ T,P - + - + t : T - + - + p : P - - + + B - + - + value : std::string - + A @@ -56,7 +56,7 @@ T,std::string - + A @@ -64,7 +64,7 @@ T,std::unique_ptr<std::string> - + A @@ -72,7 +72,7 @@ long,T - + A @@ -80,7 +80,7 @@ double,T - + A @@ -88,7 +88,7 @@ long,U - + A @@ -96,7 +96,7 @@ long,bool - + A @@ -104,7 +104,7 @@ double,bool - + A @@ -112,7 +112,7 @@ long,float - + A @@ -120,7 +120,7 @@ double,float - + A @@ -128,7 +128,7 @@ bool,std::string - + A @@ -136,7 +136,7 @@ float,std::unique_ptr<std::string> - + A @@ -144,7 +144,7 @@ int,std::string - + A @@ -152,7 +152,7 @@ std::string,std::string - + A @@ -160,7 +160,7 @@ char,std::string - + A @@ -168,116 +168,116 @@ wchar_t,std::string - - + + R - + - + 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 - + - + bs : BVector - + - + bs2 : BVector2 - + - + cb : SimpleCallback<ACharString> - + - + gcb : GenericCallback<R::AWCharString> - + - + vcb : VoidCallback - + - + vps : VectorPtr<B> diff --git a/docs/test_cases/t00015_class.svg b/docs/test_cases/t00015_class.svg index ec3d812d..5b85a2f9 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_class.svg b/docs/test_cases/t00016_class.svg index 934ec139..47518a41 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<> @@ -19,8 +19,8 @@ value : enum - - + + is_numeric @@ -29,8 +29,8 @@ value : enum - - + + is_numeric @@ -41,8 +41,8 @@ value : enum - - + + is_numeric @@ -53,8 +53,8 @@ value : enum - - + + is_numeric @@ -65,8 +65,8 @@ value : enum - - + + is_numeric @@ -77,8 +77,8 @@ value : enum - - + + is_numeric diff --git a/docs/test_cases/t00017_class.svg b/docs/test_cases/t00017_class.svg index 8b789e20..7984857e 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_class.svg b/docs/test_cases/t00018_class.svg index fd81ebc6..c2b58822 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_class.svg b/docs/test_cases/t00019_class.svg index ed541c44..dbf03209 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,7 +83,7 @@ m1_calls() const : int m2_calls() const : int - + Layer3 @@ -91,7 +91,7 @@ Base - + Layer2 @@ -99,7 +99,7 @@ Layer3<Base> - + Layer1 @@ -107,18 +107,18 @@ Layer2<Layer3<Base>> - - + + A - + - + layers : std::unique_ptr<Layer1<Layer2<Layer3<Base>>>> diff --git a/docs/test_cases/t00020_class.svg b/docs/test_cases/t00020_class.svg index 4791137e..5cb5901c 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_class.svg b/docs/test_cases/t00021_class.svg index 6f8855fa..4b3ac54d 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_class.svg b/docs/test_cases/t00022_class.svg index 7aeb6694..8ffa5aed 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_class.svg b/docs/test_cases/t00023_class.svg index 8e6d59d0..9e8e4ded 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_class.svg b/docs/test_cases/t00024_class.svg index 7ff06f01..a6c8b990 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_class.svg b/docs/test_cases/t00025_class.svg index 79490579..d49eeb1d 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,7 +56,7 @@ m1() : void m2() : void - + Proxy @@ -64,7 +64,7 @@ Target1 - + Proxy @@ -72,25 +72,25 @@ Target2 - - + + ProxyHolder - + - + proxy1 : Proxy<Target1> - + - + proxy2 : Proxy<Target2> diff --git a/docs/test_cases/t00026_class.svg b/docs/test_cases/t00026_class.svg index e8f11de1..f4386a15 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>(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,7 +78,7 @@ state(const std::string & n) : Memento<T> & set_state(const std::string & s, Memento<T> && m) : void - + Caretaker @@ -86,7 +86,7 @@ std::string - + Originator @@ -94,25 +94,25 @@ std::string - - + + StringMemento - + - + caretaker : Caretaker<std::string> - + - + originator : Originator<std::string> diff --git a/docs/test_cases/t00027_class.svg b/docs/test_cases/t00027_class.svg index 1a9017d6..78eea1a7 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,14 @@ ~Shape() = default : void - + Line - - + + Line @@ -39,14 +39,14 @@ display() : void - + Text - - + + Text @@ -57,8 +57,8 @@ display() : void - - + + ShapeDecorator @@ -67,8 +67,8 @@ display() = 0 : void - - + + Color @@ -79,8 +79,8 @@ display() : void - - + + Weight @@ -91,7 +91,7 @@ display() : void - + Line @@ -99,7 +99,7 @@ Color,Weight - + Line @@ -107,7 +107,7 @@ Color - + Text @@ -115,7 +115,7 @@ Color,Weight - + Text @@ -123,39 +123,39 @@ Color - - + + Window - + - + border : Line<Color,Weight> - + - + divider : Line<Color> - + - + title : Text<Color,Weight> - + - + description : Text<Color> diff --git a/docs/test_cases/t00028_class.svg b/docs/test_cases/t00028_class.svg index 5de86165..84be5357 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,10 +94,10 @@ three - + F enum note. - + E @@ -105,59 +105,59 @@ 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. diff --git a/docs/test_cases/t00029_class.svg b/docs/test_cases/t00029_class.svg index f7198d27..4e5bb152 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_class.svg b/docs/test_cases/t00030_class.svg index f6ab4725..d550cd8b 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_class.svg b/docs/test_cases/t00031_class.svg index d0f2982a..6e14b26e 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,23 +47,23 @@ T - + - + ttt : T - - + + D - + C @@ -71,39 +71,39 @@ int - - + + R - + - + aaa : A * - + - + bbb : std::vector<B> - + - + ccc : C<int> - + - + ddd : D * diff --git a/docs/test_cases/t00032_class.svg b/docs/test_cases/t00032_class.svg index ebbce3cc..d57be399 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,15 +64,15 @@ T,L,Ts... - + - + counter : L - + Overload @@ -80,18 +80,18 @@ TBase,int,A,B,C - - + + R - + - + overload : Overload<TBase,int,A,B,C> diff --git a/docs/test_cases/t00033_class.svg b/docs/test_cases/t00033_class.svg index 31f77a3d..b03875e5 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,30 +52,30 @@ T - + - + ccc : T - - + + D - + - + ddd : int - + C @@ -83,7 +83,7 @@ D - + B @@ -91,7 +91,7 @@ std::unique_ptr<C<D>> - + A @@ -99,18 +99,18 @@ B<std::unique_ptr<C<D>>> - - + + R - + - + abc : A<B<std::unique_ptr<C<D>>>> diff --git a/docs/test_cases/t00034_class.svg b/docs/test_cases/t00034_class.svg index b244fc7f..7d6e800d 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,16 +31,16 @@ - - + + lift_void - - + + lift_void @@ -49,8 +49,8 @@ - - + + drop_void @@ -59,16 +59,16 @@ - - + + drop_void - - + + drop_void @@ -77,33 +77,33 @@ - - + + A - - + + R - + - + la : lift_void_t<A> * - + - + lv : lift_void_t<void> * diff --git a/docs/test_cases/t00035_class.svg b/docs/test_cases/t00035_class.svg index c52a8ba3..95268be1 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_class.svg b/docs/test_cases/t00036_class.svg index 242aaad7..4e2d5889 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,15 +43,15 @@ T - + - + a : T - + A @@ -59,23 +59,23 @@ int - - + + B - + - + a_int : A<int> - - + + C diff --git a/docs/test_cases/t00037_class.svg b/docs/test_cases/t00037_class.svg index fe3edc6f..82edfadb 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_620) - + - + units : ST::(anonymous_739) - - + + 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_class.svg b/docs/test_cases/t00038_class.svg index 1d72fc33..df3a1f3e 100644 --- a/docs/test_cases/t00038_class.svg +++ b/docs/test_cases/t00038_class.svg @@ -1,6 +1,6 @@ - + @@ -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,16 +88,16 @@ - - + + map - - + + map @@ -106,8 +106,8 @@ - - + + map @@ -116,8 +116,8 @@ - - + + map @@ -126,8 +126,8 @@ - - + + map diff --git a/docs/test_cases/t00039_class.svg b/docs/test_cases/t00039_class.svg index da7cf09a..46ca9acd 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_class.svg b/docs/test_cases/t00040_class.svg index f8c4e7b9..09ec683b 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_class.svg b/docs/test_cases/t00041_class.svg index 2c6db52f..e798897d 100644 --- a/docs/test_cases/t00041_class.svg +++ b/docs/test_cases/t00041_class.svg @@ -1,6 +1,6 @@ - + @@ -9,100 +9,100 @@ - - + + R - - + + D - + - + rr : RR * - - + + E - - + + F - - + + RR - + - + e : E * - + - + f : F * - + - + g : detail::G * - - + + RRR - - + + ns1::N - - + + ns1::NN - - + + ns1::NM diff --git a/docs/test_cases/t00042_class.svg b/docs/test_cases/t00042_class.svg index 2750b4b9..e465556e 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,22 +52,22 @@ T,K - + - + b : T - + - + bb : K - + A @@ -75,7 +75,7 @@ double - + A @@ -83,7 +83,7 @@ std::string - + B diff --git a/docs/test_cases/t00043_class.svg b/docs/test_cases/t00043_class.svg index d5cae539..bf372944 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_class.svg b/docs/test_cases/t00044_class.svg index 6e07657a..c8664453 100644 --- a/docs/test_cases/t00044_class.svg +++ b/docs/test_cases/t00044_class.svg @@ -1,6 +1,6 @@ - + @@ -9,7 +9,7 @@ - + signal_handler @@ -17,8 +17,8 @@ ,A - - + + sink @@ -27,15 +27,15 @@ sink<signal_handler<type-parameter-0-0 (type-parameter-0-1...), type-parameter-0-2> >(sink<signal_handler<type-parameter-0-0 (type-parameter-0-1...),type-parameter-0-2>>::signal_t & sh) : void - + - + signal : sink<signal_handler<type-parameter-0-0 (type-parameter-0-1...),type-parameter-0-2>>::signal_t * - - + + sink @@ -46,23 +46,23 @@ sink<signal_handler<type-parameter-0-0 (type-parameter-0-1...), type-parameter-0-2> >(sink<signal_handler<type-parameter-0-0 (type-parameter-0-1...),type-parameter-0-2>>::signal_t & sh) : void - + - + signal : sink<signal_handler<type-parameter-0-0 (type-parameter-0-1...),type-parameter-0-2>>::signal_t * - - + + signal_handler - - + + signal_handler @@ -71,8 +71,8 @@ - - + + signal_handler @@ -81,8 +81,8 @@ - - + + sink diff --git a/docs/test_cases/t00045_class.svg b/docs/test_cases/t00045_class.svg index cff821e2..74578674 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_class.svg b/docs/test_cases/t00046_class.svg index 9808d4e8..72409acb 100644 --- a/docs/test_cases/t00046_class.svg +++ b/docs/test_cases/t00046_class.svg @@ -1,6 +1,6 @@ - + @@ -9,118 +9,118 @@ - + ns1 - + ns2 - + __gnu_cxx - - + + A - - + + A - - + + B - - + + C - - + + D - - + + E - - + + R - + - + a : ns1::ns2::A * - + - + ns1_a : ns1::A * - + - + ns1_ns2_a : ns1::ns2::A * - + - + root_a : ::A * - + - + i : std::vector<std::uint8_t> foo(AA & aa) : void - - + + A - - + + AA diff --git a/docs/test_cases/t00047_class.svg b/docs/test_cases/t00047_class.svg index 5215f8d7..8d71bfbe 100644 --- a/docs/test_cases/t00047_class.svg +++ b/docs/test_cases/t00047_class.svg @@ -1,6 +1,6 @@ - + @@ -9,16 +9,16 @@ - - + + conditional_t - - + + conditional_t @@ -27,8 +27,8 @@ - - + + conditional_t @@ -37,8 +37,8 @@ - - + + conditional_t @@ -47,8 +47,8 @@ - - + + conditional_t diff --git a/docs/test_cases/t00048.md b/docs/test_cases/t00048.md index 587b2f39..a055889e 100644 --- a/docs/test_cases/t00048.md +++ b/docs/test_cases/t00048.md @@ -9,6 +9,7 @@ diagrams: glob: - ../../tests/t00048/b_t00048.cc - ../../tests/t00048/a_t00048.cc + - ../../tests/t00048/t00048.cc using_namespace: clanguml::t00048 parse_includes: true include: diff --git a/docs/test_cases/t00048_class.svg b/docs/test_cases/t00048_class.svg index 65a266d0..2adc23b2 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_class.svg b/docs/test_cases/t00049_class.svg index bb2f2db4..6df9f7d1 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,17 +18,17 @@ T - + - + a : T get_a() : T & - + A @@ -36,7 +36,7 @@ intmap - + A @@ -44,7 +44,7 @@ thestring - + A @@ -52,32 +52,32 @@ std::vector<thestring> - - + + R - + - + a_string : A<thestring> - + - + a_vector_string : A<string_vector> - + - + a_int_map : A<intmap> diff --git a/docs/test_cases/t00050_class.svg b/docs/test_cases/t00050_class.svg index 3ef44faf..578026db 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 diff --git a/docs/test_cases/t20001_sequence.svg b/docs/test_cases/t20001_sequence.svg index cea5c887..b582b0fa 100644 --- a/docs/test_cases/t20001_sequence.svg +++ b/docs/test_cases/t20001_sequence.svg @@ -1,6 +1,6 @@ - + - + @@ -9,68 +9,68 @@ - - - - - - - + + + + + + + - - - + + + tmain() - + tmain() - - A - - A - - B - - B - - - - - - - - - - add() + + A + + A + + B + + B + + + + + + + + + + add(int,int) - - - - wrap_add3() - - - add3() - - - - - add() - - - - - - - - - log_result() - - - - - log_result() + + + + wrap_add3(int,int,int) + + + add3(int,int,int) + + + + + add(int,int) + + + + + + + + + log_result(int) + + + + + log_result(int) - - + + Main test function diff --git a/docs/test_cases/t20002_sequence.svg b/docs/test_cases/t20002_sequence.svg index f0dd197e..f64c01ee 100644 --- a/docs/test_cases/t20002_sequence.svg +++ b/docs/test_cases/t20002_sequence.svg @@ -1,6 +1,6 @@ - + - + @@ -9,48 +9,45 @@ - - - - - - - - - + + + + + + + + + m1() - - m1() - + + m1() + m2() - - m2() - + + m2() + m3() - - m3() - + + m3() + m4() - - m4() - - - - - - - m2() - - - m3() - - - m4() - - - - - - + + m4() + + + + + + + + + + + + + + + + diff --git a/docs/test_cases/t20003.md b/docs/test_cases/t20003.md index cb8eae4c..f38f01e6 100644 --- a/docs/test_cases/t20003.md +++ b/docs/test_cases/t20003.md @@ -14,16 +14,12 @@ diagrams: using_namespace: - clanguml::t20003 start_from: - - function: "clanguml::t20003::m1()" + - function: "clanguml::t20003::m1(T)" ``` ## Source code File t20003.cc ```cpp -#include -#include -#include - namespace clanguml { namespace t20003 { diff --git a/docs/test_cases/t20003_sequence.svg b/docs/test_cases/t20003_sequence.svg index 85fc4d8d..cbad77ad 100644 --- a/docs/test_cases/t20003_sequence.svg +++ b/docs/test_cases/t20003_sequence.svg @@ -1,6 +1,6 @@ - + - + @@ -9,48 +9,45 @@ - - - - - - - - - - m1<T>() - - m1<T>() - - m2<T>() - - m2<T>() - - m3<T>() - - m3<T>() - - m4<T>() - - m4<T>() - - - - - - - m2<T>() - - - m3<T>() - - - m4<T>() - - - - - - + + + + + + + + + + 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_sequence.svg b/docs/test_cases/t20004_sequence.svg index 4755d144..42013039 100644 --- a/docs/test_cases/t20004_sequence.svg +++ b/docs/test_cases/t20004_sequence.svg @@ -1,6 +1,6 @@ - + - + @@ -9,120 +9,111 @@ - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + main() - - main() - - m1<float>() - - m1<float>() - - m1<unsigned long>() - - m1<unsigned long>() - - m4<unsigned long>() - - m4<unsigned long>() - - m1<std::string>() - - m1<std::string>() - - m2<std::string>() - - m2<std::string>() - - m1<int>() - - m1<int>() - - m2<int>() - - m2<int>() - - m3<int>() - - m3<int>() - - m4<int>() - - m4<int>() - - - - - - - - - - - - - m1() - - - - - m1() - - - m4() - - - - - - - m1() - - - m2() - - - - - - - m1() - - - m2() - - - m3() - - - m4() - - - - - - - - + + 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) + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/docs/test_cases/t20005.md b/docs/test_cases/t20005.md index 697e6766..d3d4e8c9 100644 --- a/docs/test_cases/t20005.md +++ b/docs/test_cases/t20005.md @@ -14,7 +14,7 @@ diagrams: using_namespace: - clanguml::t20005 start_from: - - function: "clanguml::t20005::C::c" + - function: "clanguml::t20005::C::c(T)" ``` ## Source code File t20005.cc diff --git a/docs/test_cases/t20005_sequence.svg b/docs/test_cases/t20005_sequence.svg index dda1b150..5972d6c5 100644 --- a/docs/test_cases/t20005_sequence.svg +++ b/docs/test_cases/t20005_sequence.svg @@ -1,6 +1,6 @@ - + @@ -9,33 +9,33 @@ - - - + + + - + C<T> - + C<T> - + B<T> - + B<T> - + A<T> - + A<T> - - - + + + - b() + b(T) - a() + a(T) diff --git a/docs/test_cases/t20006_sequence.svg b/docs/test_cases/t20006_sequence.svg index e4bf6ba8..222d07c4 100644 --- a/docs/test_cases/t20006_sequence.svg +++ b/docs/test_cases/t20006_sequence.svg @@ -1,6 +1,6 @@ - + - + @@ -9,22 +9,22 @@ - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + @@ -34,112 +34,112 @@ - + 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() + b(int) - a1() + a1(int) - b() + b(std::string) - a2() + a2(std::string) - bb1() + bb1(int,int) - aa1() + aa1(int) - bb2() + bb2(int,int) - aa2() + aa2(int) - bb1() + bb1(int,std::string) - aa2() + aa2(int) - bb2() + bb2(int,std::string) - aa1() + aa1(int) - bb1() + bb1(int,float) - bb2() + bb2(int,float) - aa2() + aa2(int) diff --git a/docs/test_cases/t20007_sequence.svg b/docs/test_cases/t20007_sequence.svg index ca3a37f7..066fde6a 100644 --- a/docs/test_cases/t20007_sequence.svg +++ b/docs/test_cases/t20007_sequence.svg @@ -1,6 +1,6 @@ - + - + @@ -9,48 +9,48 @@ - - - - + + + + - - - - + + + + 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() + + 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() + + + + add(int &&,float &&,double &&) - - - - add() + + + + add(std::string &&,std::string &&,std::string &&) - + diff --git a/docs/test_cases/t20008_sequence.svg b/docs/test_cases/t20008_sequence.svg index e3f4dacc..e7446630 100644 --- a/docs/test_cases/t20008_sequence.svg +++ b/docs/test_cases/t20008_sequence.svg @@ -1,6 +1,6 @@ - + @@ -9,13 +9,13 @@ - - - - - - - + + + + + + + @@ -23,58 +23,58 @@ - + 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() + b(int) - a1() + a1(int) - b() + b(const char *) - a2() + a2(const char *) - b() + b(std::string) - a3() + a3(std::string) diff --git a/docs/test_cases/t20009_sequence.svg b/docs/test_cases/t20009_sequence.svg index 03a4a3ea..654f1a6a 100644 --- a/docs/test_cases/t20009_sequence.svg +++ b/docs/test_cases/t20009_sequence.svg @@ -1,6 +1,6 @@ - + - + @@ -9,72 +9,72 @@ - - - - - - - + + + + + + + - - - - - - - + + + + + + + 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() - - - a() - - - b() - - - a() - - - b() - - - a() + + 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_sequence.svg b/docs/test_cases/t20010_sequence.svg index ed503036..2161d5f1 100644 --- a/docs/test_cases/t20010_sequence.svg +++ b/docs/test_cases/t20010_sequence.svg @@ -1,6 +1,6 @@ - + @@ -9,39 +9,39 @@ - - - - - - - - - + + + + + + + + + - + tmain() - + tmain() - + B<int> - + B<int> - + A - + A - - - - - - - - - + + + + + + + + + b1() diff --git a/docs/test_cases/t20011_sequence.svg b/docs/test_cases/t20011_sequence.svg index b75dc7b5..7aaccd7d 100644 --- a/docs/test_cases/t20011_sequence.svg +++ b/docs/test_cases/t20011_sequence.svg @@ -1,6 +1,6 @@ - + - + @@ -9,69 +9,69 @@ - - - - - - - - - + + + + + + + + + - - + + tmain() - + tmain() - - A - - A - - - - - - - - - - - - a() - - - - - a() - - - b() - - - - - c() - - - - - d() - - - - - b() - - - - - a() - - - - - a() + + A + + A + + + + + + + + + + + + a(int) + + + + + a(int) + + + b(int) + + + + + c(int) + + + + + d(int) + + + + + b(int) + + + + + a(int) + + + + + a(int) diff --git a/docs/test_cases/t20012_sequence.svg b/docs/test_cases/t20012_sequence.svg index c38a488e..1bae258a 100644 --- a/docs/test_cases/t20012_sequence.svg +++ b/docs/test_cases/t20012_sequence.svg @@ -1,6 +1,6 @@ - + @@ -9,30 +9,30 @@ - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + @@ -41,62 +41,62 @@ - + tmain() - + tmain() - + tmain()::(lambda t20012.cc:49:20) - + tmain()::(lambda t20012.cc:49:20) - + A - + A - + B - + B - + tmain()::(lambda t20012.cc:62:20) - + tmain()::(lambda t20012.cc:62:20) - + C - + C - + R<R::(lambda t20012.cc:68:9)> - + R<R::(lambda t20012.cc:68:9)> - + tmain()::(lambda t20012.cc:68:9) - + tmain()::(lambda t20012.cc:68:9) - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + operator()() diff --git a/docs/test_cases/t20013.md b/docs/test_cases/t20013.md new file mode 100644 index 00000000..a5400a2d --- /dev/null +++ b/docs/test_cases/t20013.md @@ -0,0 +1,51 @@ +# t20013 - Multiple translation units sequence diagram test case +## Config +```yaml +compilation_database_dir: .. +output_directory: puml +diagrams: + t20013_sequence: + type: sequence + glob: + - ../../tests/t20013/t20013.cc + include: + namespaces: + - clanguml::t20013 + using_namespace: + - clanguml::t20013 + start_from: + - function: "clanguml::t20013::tmain(int,char **)" +``` +## Source code +File t20013.cc +```cpp +namespace clanguml { +namespace t20013 { + +struct A { + int a1(int i) { return i; } + double a2(double d) { return d; } + const char *a3(const char *s) { return s; } +}; + +struct B { + int b(int i) { return a.a1(i); } + double b(double d) { return a.a2(d); } + const char *b(const char *s) { return a.a3(s); } + + A a; +}; + +void tmain(int argc, char **argv) +{ + B b; + + b.b(1); + b.b(2.0); + b.b("three"); +} +} +} +``` +## Generated UML diagrams +![t20013_sequence](./t20013_sequence.svg "Multiple translation units sequence diagram test case") diff --git a/docs/test_cases/t20013_sequence.svg b/docs/test_cases/t20013_sequence.svg new file mode 100644 index 00000000..33ab729c --- /dev/null +++ b/docs/test_cases/t20013_sequence.svg @@ -0,0 +1,72 @@ + + + + + + + + + + + + + + + + + + + + + + + tmain(int,char **) + + tmain(int,char **) + + B + + B + + A + + A + + + + + + + + + + b(int) + + + a1(int) + + + + + + + b(double) + + + a2(double) + + + + + + + b(const char *) + + + a3(const char *) + + + + + + diff --git a/docs/test_cases/t30001_package.svg b/docs/test_cases/t30001_package.svg index d4826fef..55ee8893 100644 --- a/docs/test_cases/t30001_package.svg +++ b/docs/test_cases/t30001_package.svg @@ -1,6 +1,6 @@ - + @@ -9,63 +9,63 @@ - - + + 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_package.svg b/docs/test_cases/t30002_package.svg index 1ac1bf98..a1dd395e 100644 --- a/docs/test_cases/t30002_package.svg +++ b/docs/test_cases/t30002_package.svg @@ -1,6 +1,6 @@ - + @@ -9,113 +9,113 @@ - - + + A - - + + AA - - + + B - - + + BB - - + + A1 - - + + A2 - - + + A3 - - + + A4 - - + + A5 - - + + A6 - - + + A7 - - + + A8 - - + + A9 - - + + A10 - - + + A11 - - + + A12 - - + + A13 - - + + A14 - - + + A15 - - + + A16 - - + + A17 - - + + BBB diff --git a/docs/test_cases/t30003_package.svg b/docs/test_cases/t30003_package.svg index 6dbf224a..bea7144d 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_package.svg b/docs/test_cases/t30004_package.svg index e1979abe..b824afd5 100644 --- a/docs/test_cases/t30004_package.svg +++ b/docs/test_cases/t30004_package.svg @@ -1,6 +1,6 @@ - + @@ -9,40 +9,40 @@ - - + + A - + Package AAA. - + Package BBB. - + CCCC package note. - + We skipped DDD. - - + + AAA - - + + BBB - - + + CCC - - + + EEE diff --git a/docs/test_cases/t30005_package.svg b/docs/test_cases/t30005_package.svg index 6915f760..1be536f0 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_package.svg b/docs/test_cases/t30006_package.svg index dacb4b9b..bf60980d 100644 --- a/docs/test_cases/t30006_package.svg +++ b/docs/test_cases/t30006_package.svg @@ -1,6 +1,6 @@ - + @@ -9,22 +9,22 @@ - - + + B - - + + A - - + + C - + Top A note. diff --git a/docs/test_cases/t30007_package.svg b/docs/test_cases/t30007_package.svg index f3933d00..9f4d7823 100644 --- a/docs/test_cases/t30007_package.svg +++ b/docs/test_cases/t30007_package.svg @@ -1,6 +1,6 @@ - + @@ -9,27 +9,27 @@ - - + + A - - + + B - - + + AA - - + + C - + Compare layout with t30006. diff --git a/docs/test_cases/t30008_package.svg b/docs/test_cases/t30008_package.svg index aec51717..54333682 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/t40001_include.svg b/docs/test_cases/t40001_include.svg index 7545f850..ed05ff4a 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 diff --git a/docs/test_cases/t40002_include.svg b/docs/test_cases/t40002_include.svg index 0ef82202..b60d5d86 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_include.svg b/docs/test_cases/t40003_include.svg index d6df213a..a7f9efca 100644 --- a/docs/test_cases/t40003_include.svg +++ b/docs/test_cases/t40003_include.svg @@ -1,6 +1,6 @@ - + @@ -9,66 +9,66 @@ - + include - + dependants - + dependencies - + src - + dependants - + dependencies - - + + t3.h - - + + t2.h - - + + t1.h - - + + t3.h - - + + t2.h - - + + t1.h - - + + t5.h - - + + t1.cc - - + + t2.cc diff --git a/src/sequence_diagram/visitor/call_expression_context.h b/src/sequence_diagram/visitor/call_expression_context.h index 7e869603..6feb6b34 100644 --- a/src/sequence_diagram/visitor/call_expression_context.h +++ b/src/sequence_diagram/visitor/call_expression_context.h @@ -78,6 +78,8 @@ struct call_expression_context { clang::FunctionDecl *current_function_decl_; clang::FunctionTemplateDecl *current_function_template_decl_; + clang::CallExpr *current_function_call_expr_{nullptr}; + private: std::int64_t current_caller_id_; std::stack current_lambda_caller_id_; diff --git a/src/sequence_diagram/visitor/translation_unit_visitor.cc b/src/sequence_diagram/visitor/translation_unit_visitor.cc index 8c07f3bf..b99d19c3 100644 --- a/src/sequence_diagram/visitor/translation_unit_visitor.cc +++ b/src/sequence_diagram/visitor/translation_unit_visitor.cc @@ -514,21 +514,25 @@ bool translation_unit_visitor::TraverseLambdaExpr(clang::LambdaExpr *expr) return true; } -// -// bool translation_unit_visitor::TraverseCompoundStmt(clang::CompoundStmt -// *stmt) { -// const auto lambda_full_name = -// stmt-> -// -// RecursiveASTVisitor::TraverseCompoundStmt(stmt); -// -// LOG_DBG("Leaving lambda expression {} at {}", lambda_full_name, -// expr->getBeginLoc().printToString(source_manager())); -// -// context().leave_lambda_expression(); -// -// return true; -//} + +bool translation_unit_visitor::TraverseCallExpr(clang::CallExpr *expr) +{ + LOG_DBG("Entering call expression at {}", + expr->getBeginLoc().printToString(source_manager())); + + if (expr->getCalleeDecl() && + expr->getCalleeDecl()->isFunctionOrFunctionTemplate()) + context().current_function_call_expr_ = expr; + + RecursiveASTVisitor::TraverseCallExpr(expr); + + LOG_DBG("Leaving call expression at {}", + expr->getBeginLoc().printToString(source_manager())); + + context().current_function_call_expr_ = nullptr; + + return true; +} bool translation_unit_visitor::VisitCallExpr(clang::CallExpr *expr) { @@ -544,11 +548,6 @@ bool translation_unit_visitor::VisitCallExpr(clang::CallExpr *expr) expr->getBeginLoc().printToString(source_manager()), context().caller_id()); - if (context().caller_id() == 2166770483948966160) { - LOG_WARN(">>>>>>> VISITING CALL EXPRESSION IN METHOD " - "one::s3::S3Server::listBuckets()"); - } - // Skip casts, moves and such if (expr->isCallToStdMove()) return true; @@ -568,7 +567,9 @@ bool translation_unit_visitor::VisitCallExpr(clang::CallExpr *expr) // If we're currently inside a lambda expression, set it's id as // message source rather then enclosing context - if (context().lambda_caller_id() != 0) { + // Unless the lambda is declared in a function or method call + if (context().lambda_caller_id() != 0 && + context().current_function_call_expr_ == nullptr) { m.from = context().lambda_caller_id(); } @@ -960,6 +961,14 @@ translation_unit_visitor::create_class_declaration(clang::CXXRecordDecl *cls) c.set_name(type_name); c.set_namespace(ns); c.set_id(common::to_id(c.full_name(false))); + + // Check if lambda is declared as an argument passed to a + // function/method call + } + else { + LOG_WARN("Cannot find parent declaration for lambda {}", + cls->getQualifiedNameAsString()); + return {}; } } else { diff --git a/src/sequence_diagram/visitor/translation_unit_visitor.h b/src/sequence_diagram/visitor/translation_unit_visitor.h index 234e1bdf..29bd9bfc 100644 --- a/src/sequence_diagram/visitor/translation_unit_visitor.h +++ b/src/sequence_diagram/visitor/translation_unit_visitor.h @@ -44,14 +44,14 @@ public: bool VisitCallExpr(clang::CallExpr *expr); + bool TraverseCallExpr(clang::CallExpr *expr); + bool VisitLambdaExpr(clang::LambdaExpr *expr); bool TraverseLambdaExpr(clang::LambdaExpr *expr); bool VisitCXXMethodDecl(clang::CXXMethodDecl *method); -// bool TraverseCompoundStmt(clang::CompoundStmt *stmt); - bool VisitCXXRecordDecl(clang::CXXRecordDecl *cls); bool VisitClassTemplateDecl(clang::ClassTemplateDecl *cls); diff --git a/tests/test_cases.yaml b/tests/test_cases.yaml index 241086fc..4f60cb43 100644 --- a/tests/test_cases.yaml +++ b/tests/test_cases.yaml @@ -184,6 +184,12 @@ test_cases: - name: t20012 title: Lambda expression call sequence diagram test case description: + - name: t20013 + title: Function and method arguments in sequence diagrams test case + description: + - name: t20014 + title: Multiple translation units sequence diagram test case + description: Package diagrams: - name: t30001 title: Basic package diagram test case From 1ca44c5a0d404a1c27b6af7155f17059baeef4b9 Mon Sep 17 00:00:00 2001 From: Bartek Kryza Date: Tue, 6 Dec 2022 00:36:13 +0100 Subject: [PATCH 48/77] Updated test case documentation --- docs/test_cases.md | 2 +- docs/test_cases/t00002_class.svg | 36 ++++---- docs/test_cases/t00003_class.svg | 46 +++++----- docs/test_cases/t00004_class.svg | 76 ++++++++-------- docs/test_cases/t00005_class.svg | 110 +++++++++++------------ docs/test_cases/t00006_class.svg | 132 ++++++++++++++-------------- docs/test_cases/t00007_class.svg | 30 +++---- docs/test_cases/t00008_class.svg | 56 ++++++------ docs/test_cases/t00009_class.svg | 32 +++---- docs/test_cases/t00010_class.svg | 34 +++---- docs/test_cases/t00011_class.svg | 22 ++--- docs/test_cases/t00012_class.svg | 66 +++++++------- docs/test_cases/t00013_class.svg | 82 ++++++++--------- docs/test_cases/t00014_class.svg | 116 ++++++++++++------------ docs/test_cases/t00015_class.svg | 22 ++--- docs/test_cases/t00016_class.svg | 30 +++---- docs/test_cases/t00017_class.svg | 66 +++++++------- docs/test_cases/t00018_class.svg | 18 ++-- docs/test_cases/t00019_class.svg | 40 ++++----- docs/test_cases/t00020_class.svg | 38 ++++---- docs/test_cases/t00021_class.svg | 30 +++---- docs/test_cases/t00022_class.svg | 14 +-- docs/test_cases/t00023_class.svg | 26 +++--- docs/test_cases/t00024_class.svg | 22 ++--- docs/test_cases/t00025_class.svg | 34 +++---- docs/test_cases/t00026_class.svg | 42 ++++----- docs/test_cases/t00027_class.svg | 58 ++++++------ docs/test_cases/t00028_class.svg | 78 ++++++++-------- docs/test_cases/t00029_class.svg | 50 +++++------ docs/test_cases/t00030_class.svg | 46 +++++----- docs/test_cases/t00031_class.svg | 50 +++++------ docs/test_cases/t00032_class.svg | 40 ++++----- docs/test_cases/t00033_class.svg | 48 +++++----- docs/test_cases/t00034_class.svg | 46 +++++----- docs/test_cases/t00035_class.svg | 22 ++--- docs/test_cases/t00036_class.svg | 38 ++++---- docs/test_cases/t00037_class.svg | 54 ++++++------ docs/test_cases/t00038_class.svg | 58 ++++++------ docs/test_cases/t00039_class.svg | 78 ++++++++-------- docs/test_cases/t00040_class.svg | 26 +++--- docs/test_cases/t00041_class.svg | 54 ++++++------ docs/test_cases/t00042_class.svg | 36 ++++---- docs/test_cases/t00043_class.svg | 50 +++++------ docs/test_cases/t00044_class.svg | 36 ++++---- docs/test_cases/t00045_class.svg | 70 +++++++-------- docs/test_cases/t00046_class.svg | 64 +++++++------- docs/test_cases/t00047_class.svg | 22 ++--- docs/test_cases/t00048_class.svg | 50 +++++------ docs/test_cases/t00049_class.svg | 32 +++---- docs/test_cases/t00050_class.svg | 70 +++++++-------- docs/test_cases/t20013.md | 4 +- docs/test_cases/t20014.md | 96 ++++++++++++++++++++ docs/test_cases/t20014_sequence.svg | 84 ++++++++++++++++++ docs/test_cases/t30001_package.svg | 48 +++++----- docs/test_cases/t30002_package.svg | 90 +++++++++---------- docs/test_cases/t30003_package.svg | 26 +++--- docs/test_cases/t30004_package.svg | 30 +++---- docs/test_cases/t30005_package.svg | 38 ++++---- docs/test_cases/t30006_package.svg | 16 ++-- docs/test_cases/t30007_package.svg | 20 ++--- docs/test_cases/t30008_package.svg | 34 +++---- docs/test_cases/t40001_include.svg | 30 +++---- docs/test_cases/t40002_include.svg | 34 +++---- docs/test_cases/t40003_include.svg | 50 +++++------ 64 files changed, 1589 insertions(+), 1409 deletions(-) create mode 100644 docs/test_cases/t20014.md create mode 100644 docs/test_cases/t20014_sequence.svg diff --git a/docs/test_cases.md b/docs/test_cases.md index dc13bd03..6075cb7c 100644 --- a/docs/test_cases.md +++ b/docs/test_cases.md @@ -63,7 +63,7 @@ * [t20011](./test_cases/t20011.md) - Recursive calls sequence diagram test case * [t20012](./test_cases/t20012.md) - Lambda expression call sequence diagram test case * [t20013](./test_cases/t20013.md) - Function and method arguments in sequence diagrams test case - * [t20013](./test_cases/t20013.md) - Multiple translation units sequence diagram test case + * [t20014](./test_cases/t20014.md) - Multiple translation units sequence diagram test case ## Package diagrams * [t30001](./test_cases/t30001.md) - Basic package diagram test case * [t30002](./test_cases/t30002.md) - Package dependency test case diff --git a/docs/test_cases/t00002_class.svg b/docs/test_cases/t00002_class.svg index 847e8c15..9fd4b659 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_class.svg b/docs/test_cases/t00003_class.svg index df63fd69..3c14fe98 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_class.svg b/docs/test_cases/t00004_class.svg index cff5f816..bb22779f 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,15 +59,15 @@ Red - - + + A::AA::AAA - + C::B @@ -75,8 +75,8 @@ int - - + + C @@ -84,39 +84,39 @@ T - + - + t : T - + - + b_int : B<int> - - + + C::AA - - + + C::AA::AAA - - + + C::AA::CCC @@ -125,8 +125,8 @@ CCC_2 - - + + C::B @@ -134,16 +134,16 @@ V - + - + b : V - - + + C::CC @@ -152,16 +152,16 @@ CC_2 - - + + detail::D - - + + detail::D::AA @@ -171,8 +171,8 @@ AA_3 - - + + detail::D::DD diff --git a/docs/test_cases/t00005_class.svg b/docs/test_cases/t00005_class.svg index bfd8500a..180e80d5 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_class.svg b/docs/test_cases/t00006_class.svg index 7a7a6945..4ea803fd 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,15 +146,15 @@ T - + - + data : std::vector<T> - + custom_container @@ -162,102 +162,102 @@ 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_class.svg b/docs/test_cases/t00007_class.svg index 2bf20858..e045860b 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_class.svg b/docs/test_cases/t00008_class.svg index 9fa8f721..3d956d57 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,CMP,int N - + - + 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,15 +87,15 @@ T,C<> - + - + template_template : C<T> - + B @@ -103,18 +103,18 @@ int,Vector - - + + D - + - + ints : B<int,Vector> diff --git a/docs/test_cases/t00009_class.svg b/docs/test_cases/t00009_class.svg index 03cf5af7..29affded 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,15 +18,15 @@ T - + - + value : T - + A @@ -34,7 +34,7 @@ int - + A @@ -42,7 +42,7 @@ std::string - + A @@ -50,32 +50,32 @@ 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_class.svg b/docs/test_cases/t00010_class.svg index f04de2d4..22eaf931 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,22 +18,22 @@ T,P - + - + first : T - + - + second : P - + A @@ -41,8 +41,8 @@ T,std::string - - + + B @@ -50,15 +50,15 @@ T - + - + astring : A<T,std::string> - + B @@ -66,18 +66,18 @@ int - - + + C - + - + aintstring : B<int> diff --git a/docs/test_cases/t00011_class.svg b/docs/test_cases/t00011_class.svg index ece825b8..75855a14 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_class.svg b/docs/test_cases/t00012_class.svg index 51b61f22..c29628c7 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,14 +60,14 @@ - + - + ints : std::array<T,sizeof...(Is)> - + A @@ -75,7 +75,7 @@ int,std::string,float - + A @@ -83,7 +83,7 @@ int,std::string,bool - + B @@ -91,7 +91,7 @@ 3,2,1 - + B @@ -99,7 +99,7 @@ 1,1,1,1 - + C @@ -107,50 +107,50 @@ 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_class.svg b/docs/test_cases/t00013_class.svg index b8814aee..15ea9b43 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,15 +18,15 @@ T - + - + f : T - + ABCD::F @@ -34,70 +34,70 @@ int - - + + A - + - + a : int - - + + B - + - + b : int - - + + C - + - + c : int - - + + D - + - + d : int print(R * r) : void - - + + E @@ -105,16 +105,16 @@ T - + - + e : T - - + + G @@ -122,22 +122,22 @@ T,Args... - + - + g : T - + - + args : std::tuple<Args...> - + E @@ -145,7 +145,7 @@ int - + G @@ -153,7 +153,7 @@ int,float,std::string - + E @@ -161,25 +161,25 @@ std::string - - + + R - + - + gintstring : G<int,float,std::string> - + - + estring : E<std::string> diff --git a/docs/test_cases/t00014_class.svg b/docs/test_cases/t00014_class.svg index 66c84626..c387620e 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,37 +18,37 @@ T,P - + - + t : T - + - + p : P - - + + B - + - + value : std::string - + A @@ -56,7 +56,7 @@ T,std::string - + A @@ -64,7 +64,7 @@ T,std::unique_ptr<std::string> - + A @@ -72,7 +72,7 @@ long,T - + A @@ -80,7 +80,7 @@ double,T - + A @@ -88,7 +88,7 @@ long,U - + A @@ -96,7 +96,7 @@ long,bool - + A @@ -104,7 +104,7 @@ double,bool - + A @@ -112,7 +112,7 @@ long,float - + A @@ -120,7 +120,7 @@ double,float - + A @@ -128,7 +128,7 @@ bool,std::string - + A @@ -136,7 +136,7 @@ float,std::unique_ptr<std::string> - + A @@ -144,7 +144,7 @@ int,std::string - + A @@ -152,7 +152,7 @@ std::string,std::string - + A @@ -160,7 +160,7 @@ char,std::string - + A @@ -168,116 +168,116 @@ wchar_t,std::string - - + + R - + - + 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 - + - + bs : BVector - + - + bs2 : BVector2 - + - + cb : SimpleCallback<ACharString> - + - + gcb : GenericCallback<R::AWCharString> - + - + vcb : VoidCallback - + - + vps : VectorPtr<B> diff --git a/docs/test_cases/t00015_class.svg b/docs/test_cases/t00015_class.svg index 5b85a2f9..c9bf00e3 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_class.svg b/docs/test_cases/t00016_class.svg index 47518a41..bc24e70e 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<> @@ -19,8 +19,8 @@ value : enum - - + + is_numeric @@ -29,8 +29,8 @@ value : enum - - + + is_numeric @@ -41,8 +41,8 @@ value : enum - - + + is_numeric @@ -53,8 +53,8 @@ value : enum - - + + is_numeric @@ -65,8 +65,8 @@ value : enum - - + + is_numeric @@ -77,8 +77,8 @@ value : enum - - + + is_numeric diff --git a/docs/test_cases/t00017_class.svg b/docs/test_cases/t00017_class.svg index 7984857e..6a193be2 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_class.svg b/docs/test_cases/t00018_class.svg index c2b58822..46898283 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_class.svg b/docs/test_cases/t00019_class.svg index dbf03209..dd112cb4 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,7 +83,7 @@ m1_calls() const : int m2_calls() const : int - + Layer3 @@ -91,7 +91,7 @@ Base - + Layer2 @@ -99,7 +99,7 @@ Layer3<Base> - + Layer1 @@ -107,18 +107,18 @@ Layer2<Layer3<Base>> - - + + A - + - + layers : std::unique_ptr<Layer1<Layer2<Layer3<Base>>>> diff --git a/docs/test_cases/t00020_class.svg b/docs/test_cases/t00020_class.svg index 5cb5901c..e98ae344 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_class.svg b/docs/test_cases/t00021_class.svg index 4b3ac54d..3c909dfd 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_class.svg b/docs/test_cases/t00022_class.svg index 8ffa5aed..87d712c0 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_class.svg b/docs/test_cases/t00023_class.svg index 9e8e4ded..d1f4e4f0 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_class.svg b/docs/test_cases/t00024_class.svg index a6c8b990..75398f32 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_class.svg b/docs/test_cases/t00025_class.svg index d49eeb1d..4fb78e8f 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,7 +56,7 @@ m1() : void m2() : void - + Proxy @@ -64,7 +64,7 @@ Target1 - + Proxy @@ -72,25 +72,25 @@ Target2 - - + + ProxyHolder - + - + proxy1 : Proxy<Target1> - + - + proxy2 : Proxy<Target2> diff --git a/docs/test_cases/t00026_class.svg b/docs/test_cases/t00026_class.svg index f4386a15..b5d5fe19 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>(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,7 +78,7 @@ state(const std::string & n) : Memento<T> & set_state(const std::string & s, Memento<T> && m) : void - + Caretaker @@ -86,7 +86,7 @@ std::string - + Originator @@ -94,25 +94,25 @@ std::string - - + + StringMemento - + - + caretaker : Caretaker<std::string> - + - + originator : Originator<std::string> diff --git a/docs/test_cases/t00027_class.svg b/docs/test_cases/t00027_class.svg index 78eea1a7..a9ff2eca 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,14 @@ ~Shape() = default : void - + Line - - + + Line @@ -39,14 +39,14 @@ display() : void - + Text - - + + Text @@ -57,8 +57,8 @@ display() : void - - + + ShapeDecorator @@ -67,8 +67,8 @@ display() = 0 : void - - + + Color @@ -79,8 +79,8 @@ display() : void - - + + Weight @@ -91,7 +91,7 @@ display() : void - + Line @@ -99,7 +99,7 @@ Color,Weight - + Line @@ -107,7 +107,7 @@ Color - + Text @@ -115,7 +115,7 @@ Color,Weight - + Text @@ -123,39 +123,39 @@ Color - - + + Window - + - + border : Line<Color,Weight> - + - + divider : Line<Color> - + - + title : Text<Color,Weight> - + - + description : Text<Color> diff --git a/docs/test_cases/t00028_class.svg b/docs/test_cases/t00028_class.svg index 84be5357..71200edb 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,10 +94,10 @@ three - + F enum note. - + E @@ -105,59 +105,59 @@ 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. diff --git a/docs/test_cases/t00029_class.svg b/docs/test_cases/t00029_class.svg index 4e5bb152..ca6ced90 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_class.svg b/docs/test_cases/t00030_class.svg index d550cd8b..93d41eb9 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_class.svg b/docs/test_cases/t00031_class.svg index 6e14b26e..2ba4c67c 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,23 +47,23 @@ T - + - + ttt : T - - + + D - + C @@ -71,39 +71,39 @@ int - - + + R - + - + aaa : A * - + - + bbb : std::vector<B> - + - + ccc : C<int> - + - + ddd : D * diff --git a/docs/test_cases/t00032_class.svg b/docs/test_cases/t00032_class.svg index d57be399..4d822894 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,15 +64,15 @@ T,L,Ts... - + - + counter : L - + Overload @@ -80,18 +80,18 @@ TBase,int,A,B,C - - + + R - + - + overload : Overload<TBase,int,A,B,C> diff --git a/docs/test_cases/t00033_class.svg b/docs/test_cases/t00033_class.svg index b03875e5..a470d770 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,30 +52,30 @@ T - + - + ccc : T - - + + D - + - + ddd : int - + C @@ -83,7 +83,7 @@ D - + B @@ -91,7 +91,7 @@ std::unique_ptr<C<D>> - + A @@ -99,18 +99,18 @@ B<std::unique_ptr<C<D>>> - - + + R - + - + abc : A<B<std::unique_ptr<C<D>>>> diff --git a/docs/test_cases/t00034_class.svg b/docs/test_cases/t00034_class.svg index 7d6e800d..5b87b0f5 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,16 +31,16 @@ - - + + lift_void - - + + lift_void @@ -49,8 +49,8 @@ - - + + drop_void @@ -59,16 +59,16 @@ - - + + drop_void - - + + drop_void @@ -77,33 +77,33 @@ - - + + A - - + + R - + - + la : lift_void_t<A> * - + - + lv : lift_void_t<void> * diff --git a/docs/test_cases/t00035_class.svg b/docs/test_cases/t00035_class.svg index 95268be1..ff73b657 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_class.svg b/docs/test_cases/t00036_class.svg index 4e2d5889..78306d13 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,15 +43,15 @@ T - + - + a : T - + A @@ -59,23 +59,23 @@ int - - + + B - + - + a_int : A<int> - - + + C diff --git a/docs/test_cases/t00037_class.svg b/docs/test_cases/t00037_class.svg index 82edfadb..20d84095 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_620) - + - + units : ST::(anonymous_739) - - + + 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_class.svg b/docs/test_cases/t00038_class.svg index df3a1f3e..f9d129b8 100644 --- a/docs/test_cases/t00038_class.svg +++ b/docs/test_cases/t00038_class.svg @@ -1,6 +1,6 @@ - + @@ -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,16 +88,16 @@ - - + + map - - + + map @@ -106,8 +106,8 @@ - - + + map @@ -116,8 +116,8 @@ - - + + map @@ -126,8 +126,8 @@ - - + + map diff --git a/docs/test_cases/t00039_class.svg b/docs/test_cases/t00039_class.svg index 46ca9acd..6f4c8f96 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_class.svg b/docs/test_cases/t00040_class.svg index 09ec683b..e16a91a4 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_class.svg b/docs/test_cases/t00041_class.svg index e798897d..5f489b98 100644 --- a/docs/test_cases/t00041_class.svg +++ b/docs/test_cases/t00041_class.svg @@ -1,6 +1,6 @@ - + @@ -9,100 +9,100 @@ - - + + R - - + + D - + - + rr : RR * - - + + E - - + + F - - + + RR - + - + e : E * - + - + f : F * - + - + g : detail::G * - - + + RRR - - + + ns1::N - - + + ns1::NN - - + + ns1::NM diff --git a/docs/test_cases/t00042_class.svg b/docs/test_cases/t00042_class.svg index e465556e..99119f90 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,22 +52,22 @@ T,K - + - + b : T - + - + bb : K - + A @@ -75,7 +75,7 @@ double - + A @@ -83,7 +83,7 @@ std::string - + B diff --git a/docs/test_cases/t00043_class.svg b/docs/test_cases/t00043_class.svg index bf372944..f9db8b4e 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_class.svg b/docs/test_cases/t00044_class.svg index c8664453..0a3c1982 100644 --- a/docs/test_cases/t00044_class.svg +++ b/docs/test_cases/t00044_class.svg @@ -1,6 +1,6 @@ - + @@ -9,7 +9,7 @@ - + signal_handler @@ -17,8 +17,8 @@ ,A - - + + sink @@ -27,15 +27,15 @@ sink<signal_handler<type-parameter-0-0 (type-parameter-0-1...), type-parameter-0-2> >(sink<signal_handler<type-parameter-0-0 (type-parameter-0-1...),type-parameter-0-2>>::signal_t & sh) : void - + - + signal : sink<signal_handler<type-parameter-0-0 (type-parameter-0-1...),type-parameter-0-2>>::signal_t * - - + + sink @@ -46,23 +46,23 @@ sink<signal_handler<type-parameter-0-0 (type-parameter-0-1...), type-parameter-0-2> >(sink<signal_handler<type-parameter-0-0 (type-parameter-0-1...),type-parameter-0-2>>::signal_t & sh) : void - + - + signal : sink<signal_handler<type-parameter-0-0 (type-parameter-0-1...),type-parameter-0-2>>::signal_t * - - + + signal_handler - - + + signal_handler @@ -71,8 +71,8 @@ - - + + signal_handler @@ -81,8 +81,8 @@ - - + + sink diff --git a/docs/test_cases/t00045_class.svg b/docs/test_cases/t00045_class.svg index 74578674..19eab34e 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_class.svg b/docs/test_cases/t00046_class.svg index 72409acb..a820bf21 100644 --- a/docs/test_cases/t00046_class.svg +++ b/docs/test_cases/t00046_class.svg @@ -1,6 +1,6 @@ - + @@ -9,118 +9,118 @@ - + ns1 - + ns2 - + __gnu_cxx - - + + A - - + + A - - + + B - - + + C - - + + D - - + + E - - + + R - + - + a : ns1::ns2::A * - + - + ns1_a : ns1::A * - + - + ns1_ns2_a : ns1::ns2::A * - + - + root_a : ::A * - + - + i : std::vector<std::uint8_t> foo(AA & aa) : void - - + + A - - + + AA diff --git a/docs/test_cases/t00047_class.svg b/docs/test_cases/t00047_class.svg index 8d71bfbe..4d7dbb19 100644 --- a/docs/test_cases/t00047_class.svg +++ b/docs/test_cases/t00047_class.svg @@ -1,6 +1,6 @@ - + @@ -9,16 +9,16 @@ - - + + conditional_t - - + + conditional_t @@ -27,8 +27,8 @@ - - + + conditional_t @@ -37,8 +37,8 @@ - - + + conditional_t @@ -47,8 +47,8 @@ - - + + conditional_t diff --git a/docs/test_cases/t00048_class.svg b/docs/test_cases/t00048_class.svg index 2adc23b2..be54b548 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_class.svg b/docs/test_cases/t00049_class.svg index 6df9f7d1..aa37257b 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,17 +18,17 @@ T - + - + a : T get_a() : T & - + A @@ -36,7 +36,7 @@ intmap - + A @@ -44,7 +44,7 @@ thestring - + A @@ -52,32 +52,32 @@ std::vector<thestring> - - + + R - + - + a_string : A<thestring> - + - + a_vector_string : A<string_vector> - + - + a_int_map : A<intmap> diff --git a/docs/test_cases/t00050_class.svg b/docs/test_cases/t00050_class.svg index 578026db..7fc55ee9 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 diff --git a/docs/test_cases/t20013.md b/docs/test_cases/t20013.md index a5400a2d..3b282d26 100644 --- a/docs/test_cases/t20013.md +++ b/docs/test_cases/t20013.md @@ -1,4 +1,4 @@ -# t20013 - Multiple translation units sequence diagram test case +# t20013 - Function and method arguments in sequence diagrams test case ## Config ```yaml compilation_database_dir: .. @@ -48,4 +48,4 @@ void tmain(int argc, char **argv) } ``` ## Generated UML diagrams -![t20013_sequence](./t20013_sequence.svg "Multiple translation units sequence diagram test case") +![t20013_sequence](./t20013_sequence.svg "Function and method arguments in sequence diagrams test case") diff --git a/docs/test_cases/t20014.md b/docs/test_cases/t20014.md new file mode 100644 index 00000000..5801d840 --- /dev/null +++ b/docs/test_cases/t20014.md @@ -0,0 +1,96 @@ +# t20014 - Multiple translation units sequence diagram test case +## Config +```yaml +compilation_database_dir: .. +output_directory: puml +diagrams: + t20014_sequence: + type: sequence + glob: + - ../../tests/t20014/t20014.cc + - ../../tests/t20014/t20014_c.cc + - ../../tests/t20014/t20014_b.cc + - ../../tests/t20014/t20014_a.cc + include: + namespaces: + - clanguml::t20014 + using_namespace: + - clanguml::t20014 + start_from: + - function: "clanguml::t20014::tmain()" +``` +## Source code +File t20014_b.cc +```cpp +#include "include/t20014_b.h" +namespace clanguml { +namespace t20014 { + +int B::b1(int i, int j) { return a_.a1(i, j); } + +int B::b2(int i, int j) { return a_.a2(i, j); } + +} +} +``` +File t20014_c.cc +```cpp +#include "include/t20014_c.h" + +namespace clanguml { +namespace t20014 { + +//template F C::c1(F i, F j) +//{ +// return c_.b1(i, j); +//} +// +//template F C::c2(F i, F j) +//{ +// return c_.b2(i, j); +//} + +} +} +``` +File t20014.cc +```cpp +#include "include/t20014.h" +#include "include/t20014_b.h" +#include "include/t20014_c.h" + +namespace clanguml { +namespace t20014 { + +void log(const char *msg) { } + +int tmain() +{ + B b; + C c; + + b.b1(0, 1); + b.b2(1, 2); + + c.c1(2, 3); + + return 0; +} +} +} +``` +File t20014_a.cc +```cpp +#include "include/t20014_a.h" +namespace clanguml { +namespace t20014 { + +int A::a1(int i, int j) { return i + j; } + +int A::a2(int i, int j) { return i - j; } + +} +} +``` +## Generated UML diagrams +![t20014_sequence](./t20014_sequence.svg "Multiple translation units sequence diagram test case") diff --git a/docs/test_cases/t20014_sequence.svg b/docs/test_cases/t20014_sequence.svg new file mode 100644 index 00000000..b28f5e26 --- /dev/null +++ b/docs/test_cases/t20014_sequence.svg @@ -0,0 +1,84 @@ + + + + + + + + + + + + + + + + + + + + + + + + + tmain() + + tmain() + + B + + B + + A + + A + + C<B,int> + + C<B,int> + + + + + + + + + + + b1(int,int) + + + a1(int,int) + + + + + + + b2(int,int) + + + a2(int,int) + + + + + + + c1(int,int) + + + b1(int,int) + + + a1(int,int) + + + + + + + + diff --git a/docs/test_cases/t30001_package.svg b/docs/test_cases/t30001_package.svg index 55ee8893..27aa405c 100644 --- a/docs/test_cases/t30001_package.svg +++ b/docs/test_cases/t30001_package.svg @@ -1,6 +1,6 @@ - + @@ -9,63 +9,63 @@ - - + + 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_package.svg b/docs/test_cases/t30002_package.svg index a1dd395e..2cf858cb 100644 --- a/docs/test_cases/t30002_package.svg +++ b/docs/test_cases/t30002_package.svg @@ -1,6 +1,6 @@ - + @@ -9,113 +9,113 @@ - - + + A - - + + AA - - + + B - - + + BB - - + + A1 - - + + A2 - - + + A3 - - + + A4 - - + + A5 - - + + A6 - - + + A7 - - + + A8 - - + + A9 - - + + A10 - - + + A11 - - + + A12 - - + + A13 - - + + A14 - - + + A15 - - + + A16 - - + + A17 - - + + BBB diff --git a/docs/test_cases/t30003_package.svg b/docs/test_cases/t30003_package.svg index bea7144d..9a696364 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_package.svg b/docs/test_cases/t30004_package.svg index b824afd5..131fbf88 100644 --- a/docs/test_cases/t30004_package.svg +++ b/docs/test_cases/t30004_package.svg @@ -1,6 +1,6 @@ - + @@ -9,40 +9,40 @@ - - + + A - + Package AAA. - + Package BBB. - + CCCC package note. - + We skipped DDD. - - + + AAA - - + + BBB - - + + CCC - - + + EEE diff --git a/docs/test_cases/t30005_package.svg b/docs/test_cases/t30005_package.svg index 1be536f0..c8670ac4 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_package.svg b/docs/test_cases/t30006_package.svg index bf60980d..d3503d7c 100644 --- a/docs/test_cases/t30006_package.svg +++ b/docs/test_cases/t30006_package.svg @@ -1,6 +1,6 @@ - + @@ -9,22 +9,22 @@ - - + + B - - + + A - - + + C - + Top A note. diff --git a/docs/test_cases/t30007_package.svg b/docs/test_cases/t30007_package.svg index 9f4d7823..235562af 100644 --- a/docs/test_cases/t30007_package.svg +++ b/docs/test_cases/t30007_package.svg @@ -1,6 +1,6 @@ - + @@ -9,27 +9,27 @@ - - + + A - - + + B - - + + AA - - + + C - + Compare layout with t30006. diff --git a/docs/test_cases/t30008_package.svg b/docs/test_cases/t30008_package.svg index 54333682..d8b447db 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/t40001_include.svg b/docs/test_cases/t40001_include.svg index ed05ff4a..04b587e6 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 diff --git a/docs/test_cases/t40002_include.svg b/docs/test_cases/t40002_include.svg index b60d5d86..32de6727 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_include.svg b/docs/test_cases/t40003_include.svg index a7f9efca..5a0bbb36 100644 --- a/docs/test_cases/t40003_include.svg +++ b/docs/test_cases/t40003_include.svg @@ -1,6 +1,6 @@ - + @@ -9,66 +9,66 @@ - + include - + dependants - + dependencies - + src - + dependants - + dependencies - - + + t3.h - - + + t2.h - - + + t1.h - - + + t3.h - - + + t2.h - - + + t1.h - - + + t5.h - - + + t1.cc - - + + t2.cc From 8d8b3415f72c7b371a4721e345968cec90d6e949 Mon Sep 17 00:00:00 2001 From: Bartek Kryza Date: Tue, 6 Dec 2022 20:14:42 +0100 Subject: [PATCH 49/77] Added automatic call tracing through lambdas passed to functions as params --- .../visitor/translation_unit_visitor.cc | 32 ++++++++----------- tests/t20012/t20012.cc | 11 +++++++ tests/t20012/test_case.h | 22 +++++++------ tests/t20014/t20014_c.cc | 10 ------ 4 files changed, 36 insertions(+), 39 deletions(-) diff --git a/src/sequence_diagram/visitor/translation_unit_visitor.cc b/src/sequence_diagram/visitor/translation_unit_visitor.cc index b99d19c3..ab29c275 100644 --- a/src/sequence_diagram/visitor/translation_unit_visitor.cc +++ b/src/sequence_diagram/visitor/translation_unit_visitor.cc @@ -507,9 +507,6 @@ bool translation_unit_visitor::TraverseLambdaExpr(clang::LambdaExpr *expr) RecursiveASTVisitor::TraverseLambdaExpr(expr); - LOG_DBG("Leaving lambda expression {} at {}", lambda_full_name, - expr->getBeginLoc().printToString(source_manager())); - context().leave_lambda_expression(); return true; @@ -517,18 +514,10 @@ bool translation_unit_visitor::TraverseLambdaExpr(clang::LambdaExpr *expr) bool translation_unit_visitor::TraverseCallExpr(clang::CallExpr *expr) { - LOG_DBG("Entering call expression at {}", - expr->getBeginLoc().printToString(source_manager())); - - if (expr->getCalleeDecl() && - expr->getCalleeDecl()->isFunctionOrFunctionTemplate()) - context().current_function_call_expr_ = expr; + context().current_function_call_expr_ = expr; RecursiveASTVisitor::TraverseCallExpr(expr); - LOG_DBG("Leaving call expression at {}", - expr->getBeginLoc().printToString(source_manager())); - context().current_function_call_expr_ = nullptr; return true; @@ -544,10 +533,6 @@ bool translation_unit_visitor::VisitCallExpr(clang::CallExpr *expr) if (context().caller_id() == 0) return true; - LOG_DBG("Visiting call expression at {} [caller_id = {}]", - expr->getBeginLoc().printToString(source_manager()), - context().caller_id()); - // Skip casts, moves and such if (expr->isCallToStdMove()) return true; @@ -561,6 +546,10 @@ bool translation_unit_visitor::VisitCallExpr(clang::CallExpr *expr) if (!context().valid()) return true; + LOG_DBG("Visiting call expression at {} [caller_id = {}]", + expr->getBeginLoc().printToString(source_manager()), + context().caller_id()); + message m; m.type = message_t::kCall; m.from = context().caller_id(); @@ -568,9 +557,14 @@ bool translation_unit_visitor::VisitCallExpr(clang::CallExpr *expr) // If we're currently inside a lambda expression, set it's id as // message source rather then enclosing context // Unless the lambda is declared in a function or method call - if (context().lambda_caller_id() != 0 && - context().current_function_call_expr_ == nullptr) { - m.from = context().lambda_caller_id(); + if (context().lambda_caller_id() != 0) { + if (context().current_function_call_expr_ == nullptr) { + m.from = context().lambda_caller_id(); + } + else { + LOG_DBG("Current lambda declaration is passed to a method or " + "function - keep the original caller id"); + } } if (const auto *operator_call_expr = diff --git a/tests/t20012/t20012.cc b/tests/t20012/t20012.cc index 488211a3..50c5fe72 100644 --- a/tests/t20012/t20012.cc +++ b/tests/t20012/t20012.cc @@ -1,3 +1,4 @@ +#include #include #include @@ -27,6 +28,10 @@ struct C { void ccc() { } }; +struct D { + int add5(int arg) const { return arg + 5; } +}; + template struct R { R(F &&f) : f_{std::move(f)} @@ -68,6 +73,12 @@ void tmain() R r{[&c]() { c.c(); }}; r.r(); + + D d; + + std::vector ints{0, 1, 2, 3, 4}; + std::transform(ints.begin(), ints.end(), ints.begin(), + [&d](auto i) { return d.add5(i); }); } } } \ No newline at end of file diff --git a/tests/t20012/test_case.h b/tests/t20012/test_case.h index b40f10e8..6440d03b 100644 --- a/tests/t20012/test_case.h +++ b/tests/t20012/test_case.h @@ -36,35 +36,37 @@ TEST_CASE("t20012", "[test-case][sequence]") // Check if all calls exist REQUIRE_THAT(puml, - HasCall(_A("tmain()"), _A("tmain()::(lambda t20012.cc:49:20)"), + HasCall(_A("tmain()"), _A("tmain()::(lambda t20012.cc:54:20)"), "operator()()")); REQUIRE_THAT( - puml, HasCall(_A("tmain()::(lambda t20012.cc:49:20)"), _A("A"), "a()")); + puml, HasCall(_A("tmain()::(lambda t20012.cc:54: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 t20012.cc:49:20)"), _A("B"), "b()")); + puml, HasCall(_A("tmain()::(lambda t20012.cc:54: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 t20012.cc:62:20)"), _A("C"), "c()")); + puml, HasCall(_A("tmain()::(lambda t20012.cc:67: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 t20012.cc:62:20)"), - _A("tmain()::(lambda t20012.cc:49:20)"), "operator()()")); + HasCall(_A("tmain()::(lambda t20012.cc:67:20)"), + _A("tmain()::(lambda t20012.cc:54:20)"), "operator()()")); REQUIRE_THAT(puml, HasCall(_A("C"), _A("C"), "ccc()")); REQUIRE_THAT(puml, - HasCall(_A("tmain()"), _A("R"), "r()")); + HasCall(_A("tmain()"), _A("R"), "r()")); REQUIRE_THAT(puml, - HasCall(_A("R"), - _A("tmain()::(lambda t20012.cc:68:9)"), "operator()()")); + HasCall(_A("R"), + _A("tmain()::(lambda t20012.cc:73:9)"), "operator()()")); REQUIRE_THAT( - puml, HasCall(_A("tmain()::(lambda t20012.cc:68:9)"), _A("C"), "c()")); + puml, HasCall(_A("tmain()::(lambda t20012.cc:73:9)"), _A("C"), "c()")); + + REQUIRE_THAT(puml, HasCall(_A("tmain()"), _A("D"), "add5(int)")); save_puml( "./" + config.output_directory() + "/" + diagram->name + ".puml", puml); diff --git a/tests/t20014/t20014_c.cc b/tests/t20014/t20014_c.cc index 363fc63d..3a4a45ff 100644 --- a/tests/t20014/t20014_c.cc +++ b/tests/t20014/t20014_c.cc @@ -3,15 +3,5 @@ namespace clanguml { namespace t20014 { -//template F C::c1(F i, F j) -//{ -// return c_.b1(i, j); -//} -// -//template F C::c2(F i, F j) -//{ -// return c_.b2(i, j); -//} - } } \ No newline at end of file From de4e88a92d1a35b9263d56f6d3f7b1a53d8eb5bb Mon Sep 17 00:00:00 2001 From: Bartek Kryza Date: Tue, 6 Dec 2022 22:31:54 +0100 Subject: [PATCH 50/77] Added class exclusion by namespace in sequence diagram test case --- tests/t20015/.clang-uml | 17 ++++++++++++++ tests/t20015/t20015.cc | 39 ++++++++++++++++++++++++++++++ tests/t20015/test_case.h | 51 ++++++++++++++++++++++++++++++++++++++++ tests/test_cases.cc | 1 + tests/test_cases.yaml | 3 +++ 5 files changed, 111 insertions(+) create mode 100644 tests/t20015/.clang-uml create mode 100644 tests/t20015/t20015.cc create mode 100644 tests/t20015/test_case.h diff --git a/tests/t20015/.clang-uml b/tests/t20015/.clang-uml new file mode 100644 index 00000000..231e9543 --- /dev/null +++ b/tests/t20015/.clang-uml @@ -0,0 +1,17 @@ +compilation_database_dir: .. +output_directory: puml +diagrams: + t20015_sequence: + type: sequence + glob: + - ../../tests/t20015/t20015.cc + include: + namespaces: + - clanguml::t20015 + exclude: + namespaces: + - clanguml::t20015::detail + using_namespace: + - clanguml::t20015 + start_from: + - function: "clanguml::t20015::tmain()" \ No newline at end of file diff --git a/tests/t20015/t20015.cc b/tests/t20015/t20015.cc new file mode 100644 index 00000000..0c999632 --- /dev/null +++ b/tests/t20015/t20015.cc @@ -0,0 +1,39 @@ +#include + +namespace clanguml { +namespace t20015 { + +namespace detail { +class A { +public: + void set_x(int x) { x_ = x; } + void set_y(int y) { y_ = y; } + void set_z(int z) { z_ = z; } + +private: + int x_; + int y_; + int z_; +}; +} + +class B { +public: + void setup_a(std::shared_ptr &a) + { + a->set_x(1); + a.get()->set_y(2); + (*a).set_z(3); + } +}; + +void tmain() +{ + auto a = std::make_shared(); + + B b; + + b.setup_a(a); +} +} +} \ No newline at end of file diff --git a/tests/t20015/test_case.h b/tests/t20015/test_case.h new file mode 100644 index 00000000..54186b73 --- /dev/null +++ b/tests/t20015/test_case.h @@ -0,0 +1,51 @@ +/** + * tests/t20015/test_case.h + * + * Copyright (c) 2021-2022 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("t20015", "[test-case][sequence]") +{ + auto [config, db] = load_config("t20015"); + + auto diagram = config.diagrams["t20015_sequence"]; + + REQUIRE(diagram->name == "t20015_sequence"); + + auto model = generate_sequence_diagram(*db, diagram); + + REQUIRE(model->name() == "t20015_sequence"); + + auto puml = generate_sequence_puml(diagram, *model); + AliasMatcher _A(puml); + + REQUIRE_THAT(puml, StartsWith("@startuml")); + REQUIRE_THAT(puml, EndsWith("@enduml\n")); + + // Check if all calls exist + REQUIRE_THAT(puml, + HasCall( + _A("tmain()"), _A("B"), "setup_a(std::shared_ptr &)")); + REQUIRE_THAT(puml, !HasCall(_A("B"), _A("detail::A"), "set_x(int)")); + REQUIRE_THAT(puml, !HasCall(_A("B"), _A("detail::A"), "set_y(int)")); + REQUIRE_THAT(puml, !HasCall(_A("B"), _A("detail::A"), "set_z(int)")); + + REQUIRE_THAT(puml, !HasCall(_A("B"), _A("B"), "set_x(int)")); + REQUIRE_THAT(puml, !HasCall(_A("B"), _A("B"), "set_y(int)")); + REQUIRE_THAT(puml, !HasCall(_A("B"), _A("B"), "set_z(int)")); + + save_puml( + "./" + config.output_directory() + "/" + diagram->name + ".puml", puml); +} \ No newline at end of file diff --git a/tests/test_cases.cc b/tests/test_cases.cc index 9e0486ea..fe09b0be 100644 --- a/tests/test_cases.cc +++ b/tests/test_cases.cc @@ -261,6 +261,7 @@ using namespace clanguml::test::matchers; #include "t20012/test_case.h" #include "t20013/test_case.h" #include "t20014/test_case.h" +#include "t20015/test_case.h" /// /// Package diagram tests diff --git a/tests/test_cases.yaml b/tests/test_cases.yaml index 4f60cb43..a7c8d4db 100644 --- a/tests/test_cases.yaml +++ b/tests/test_cases.yaml @@ -190,6 +190,9 @@ test_cases: - name: t20014 title: Multiple translation units sequence diagram test case description: + - name: t20015 + title: Class exclusion by namespace in sequence diagram test case + description: Package diagrams: - name: t30001 title: Basic package diagram test case From 0a0b2a3d3504ad97aef85e27749e90880840b098 Mon Sep 17 00:00:00 2001 From: Bartek Kryza Date: Thu, 8 Dec 2022 00:41:54 +0100 Subject: [PATCH 51/77] Added template method specialization sequence diagram test case --- .../visitor/translation_unit_visitor.cc | 54 ++++++++++++------- .../visitor/translation_unit_visitor.h | 2 +- tests/t20012/t20012.cc | 20 +++++++ tests/t20012/test_case.h | 21 ++++---- tests/t20015/t20015.cc | 1 + tests/t20016/.clang-uml | 14 +++++ tests/t20016/t20016.cc | 24 +++++++++ tests/t20016/test_case.h | 46 ++++++++++++++++ tests/test_cases.cc | 1 + tests/test_cases.yaml | 3 ++ 10 files changed, 157 insertions(+), 29 deletions(-) create mode 100644 tests/t20016/.clang-uml create mode 100644 tests/t20016/t20016.cc create mode 100644 tests/t20016/test_case.h diff --git a/src/sequence_diagram/visitor/translation_unit_visitor.cc b/src/sequence_diagram/visitor/translation_unit_visitor.cc index ab29c275..d97096e0 100644 --- a/src/sequence_diagram/visitor/translation_unit_visitor.cc +++ b/src/sequence_diagram/visitor/translation_unit_visitor.cc @@ -616,23 +616,28 @@ bool translation_unit_visitor::VisitCallExpr(clang::CallExpr *expr) } } else { - if (!process_function_call_expression(m, expr)) - return true; - } + if (!process_function_call_expression(m, expr)) { + // expr->dump(); + LOG_DBG("Skipping call to unsupported type of call expression " + "at: {}", + expr->getBeginLoc().printToString(source_manager())); - // - // This crashes on LLVM <= 12, for now just return empty type - // - // const auto &return_type = - // function_call_expr->getCallReturnType(current_ast_context); - // m.return_type = return_type.getAsString(); - m.return_type = ""; + return true; + } + } } + // + // This crashes on LLVM <= 12, for now just return empty type + // + // const auto &return_type = + // function_call_expr->getCallReturnType(current_ast_context); + // m.return_type = return_type.getAsString(); + m.return_type = ""; + if (m.from > 0 && m.to > 0) { if (diagram().sequences.find(m.from) == diagram().sequences.end()) { activity a; - // a.usr = m.from; a.from = m.from; diagram().sequences.insert({m.from, std::move(a)}); } @@ -778,6 +783,10 @@ bool translation_unit_visitor::process_class_template_method_call_expression( diagram().add_active_participant( get_unique_id(template_declaration->getID()).value()); } + else { + LOG_WARN("Cannot generate call due to unresolvable " + "CXXDependentScopeMemberExpr"); + } return true; } @@ -845,14 +854,23 @@ bool translation_unit_visitor::process_unresolved_lookup_call_expression( } bool translation_unit_visitor::is_callee_valid_template_specialization( - const clang::CXXDependentScopeMemberExpr *dependent_member_callee) const + const clang::CXXDependentScopeMemberExpr *dependent_member_expr) const { - return !dependent_member_callee->getBaseType().isNull() && - dependent_member_callee->getBaseType() - ->getAs() && - !dependent_member_callee->getBaseType() + const bool base_type_is_not_null = + !dependent_member_expr->getBaseType().isNull(); + + const bool base_type_is_specialization_type = + dependent_member_expr->getBaseType() + ->getAs() != nullptr; + + const bool base_type_is_not_pointer_type = + base_type_is_specialization_type && + !dependent_member_expr->getBaseType() ->getAs() ->isPointerType(); + + return (base_type_is_not_null && base_type_is_specialization_type && + base_type_is_not_pointer_type); } bool translation_unit_visitor::is_smart_pointer( @@ -898,8 +916,8 @@ translation_unit_visitor::create_class_declaration(clang::CXXRecordDecl *cls) int64_t local_id = static_cast(parent)->getID(); - // First check if the parent has been added to the diagram as regular - // class + // First check if the parent has been added to the diagram as + // regular class id_opt = get_unique_id(local_id); // If not, check if the parent template declaration is in the model diff --git a/src/sequence_diagram/visitor/translation_unit_visitor.h b/src/sequence_diagram/visitor/translation_unit_visitor.h index 29bd9bfc..3bb75fdc 100644 --- a/src/sequence_diagram/visitor/translation_unit_visitor.h +++ b/src/sequence_diagram/visitor/translation_unit_visitor.h @@ -206,7 +206,7 @@ private: bool is_smart_pointer(const clang::TemplateDecl *primary_template) const; bool is_callee_valid_template_specialization( - const clang::CXXDependentScopeMemberExpr *dependent_member_callee) + const clang::CXXDependentScopeMemberExpr *dependent_member_expr) const; bool process_operator_call_expression(model::message &m, diff --git a/tests/t20012/t20012.cc b/tests/t20012/t20012.cc index 50c5fe72..49e58a84 100644 --- a/tests/t20012/t20012.cc +++ b/tests/t20012/t20012.cc @@ -1,5 +1,7 @@ #include #include +#include +#include #include namespace clanguml { @@ -18,6 +20,8 @@ struct B { void bb() { bbb(); } void bbb() { } + + void eb() { } }; struct C { @@ -32,6 +36,14 @@ struct D { int add5(int arg) const { return arg + 5; } }; +class E { + std::optional> maybe_b; + std::shared_ptr a; + +public: + template void setup(F &&f) { f(maybe_b); } +}; + template struct R { R(F &&f) : f_{std::move(f)} @@ -79,6 +91,14 @@ void tmain() std::vector ints{0, 1, 2, 3, 4}; std::transform(ints.begin(), ints.end(), ints.begin(), [&d](auto i) { return d.add5(i); }); + + // TODO: Fix naming function call arguments which are lambdas + // E e; + // + // e.setup([](auto &&arg) mutable { + // // We cannot know here what 'arg' might be + // arg.value()->eb(); + // }); } } } \ No newline at end of file diff --git a/tests/t20012/test_case.h b/tests/t20012/test_case.h index 6440d03b..cb68ff3e 100644 --- a/tests/t20012/test_case.h +++ b/tests/t20012/test_case.h @@ -36,38 +36,39 @@ TEST_CASE("t20012", "[test-case][sequence]") // Check if all calls exist REQUIRE_THAT(puml, - HasCall(_A("tmain()"), _A("tmain()::(lambda t20012.cc:54:20)"), + HasCall(_A("tmain()"), _A("tmain()::(lambda t20012.cc:66:20)"), "operator()()")); REQUIRE_THAT( - puml, HasCall(_A("tmain()::(lambda t20012.cc:54:20)"), _A("A"), "a()")); + puml, HasCall(_A("tmain()::(lambda t20012.cc:66: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 t20012.cc:54:20)"), _A("B"), "b()")); + puml, HasCall(_A("tmain()::(lambda t20012.cc:66: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 t20012.cc:67:20)"), _A("C"), "c()")); + puml, HasCall(_A("tmain()::(lambda t20012.cc:79: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 t20012.cc:67:20)"), - _A("tmain()::(lambda t20012.cc:54:20)"), "operator()()")); + HasCall(_A("tmain()::(lambda t20012.cc:79:20)"), + _A("tmain()::(lambda t20012.cc:66:20)"), "operator()()")); REQUIRE_THAT(puml, HasCall(_A("C"), _A("C"), "ccc()")); REQUIRE_THAT(puml, - HasCall(_A("tmain()"), _A("R"), "r()")); + HasCall(_A("tmain()"), _A("R"), "r()")); REQUIRE_THAT(puml, - HasCall(_A("R"), - _A("tmain()::(lambda t20012.cc:73:9)"), "operator()()")); + HasCall(_A("R"), + _A("tmain()::(lambda t20012.cc:85:9)"), "operator()()")); REQUIRE_THAT( - puml, HasCall(_A("tmain()::(lambda t20012.cc:73:9)"), _A("C"), "c()")); + puml, HasCall(_A("tmain()::(lambda t20012.cc:85:9)"), _A("C"), "c()")); REQUIRE_THAT(puml, HasCall(_A("tmain()"), _A("D"), "add5(int)")); + save_puml( "./" + config.output_directory() + "/" + diagram->name + ".puml", puml); } \ No newline at end of file diff --git a/tests/t20015/t20015.cc b/tests/t20015/t20015.cc index 0c999632..d0d643a7 100644 --- a/tests/t20015/t20015.cc +++ b/tests/t20015/t20015.cc @@ -1,4 +1,5 @@ #include +#include namespace clanguml { namespace t20015 { diff --git a/tests/t20016/.clang-uml b/tests/t20016/.clang-uml new file mode 100644 index 00000000..1cf1f97f --- /dev/null +++ b/tests/t20016/.clang-uml @@ -0,0 +1,14 @@ +compilation_database_dir: .. +output_directory: puml +diagrams: + t20016_sequence: + type: sequence + glob: + - ../../tests/t20016/t20016.cc + include: + namespaces: + - clanguml::t20016 + using_namespace: + - clanguml::t20016 + start_from: + - function: "clanguml::t20016::tmain()" \ No newline at end of file diff --git a/tests/t20016/t20016.cc b/tests/t20016/t20016.cc new file mode 100644 index 00000000..228aad6b --- /dev/null +++ b/tests/t20016/t20016.cc @@ -0,0 +1,24 @@ +namespace clanguml { +namespace t20016 { +struct A { + void a1(int a) { } + template T a2(const T &a) { return a;} +}; + +template struct B { + void b1(T b) { a_.a1(1); } + + template F b2(T t) { return a_.a2(t); } + + A a_; +}; + +void tmain() { + B b; + + b.b1(1); + + b.b2(2); +} +} +} \ No newline at end of file diff --git a/tests/t20016/test_case.h b/tests/t20016/test_case.h new file mode 100644 index 00000000..537e94c7 --- /dev/null +++ b/tests/t20016/test_case.h @@ -0,0 +1,46 @@ +/** + * tests/t20016/test_case.h + * + * Copyright (c) 2021-2022 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("t20016", "[test-case][sequence]") +{ + auto [config, db] = load_config("t20016"); + + auto diagram = config.diagrams["t20016_sequence"]; + + REQUIRE(diagram->name == "t20016_sequence"); + + auto model = generate_sequence_diagram(*db, diagram); + + REQUIRE(model->name() == "t20016_sequence"); + + auto puml = generate_sequence_puml(diagram, *model); + AliasMatcher _A(puml); + + REQUIRE_THAT(puml, StartsWith("@startuml")); + REQUIRE_THAT(puml, EndsWith("@enduml\n")); + + // Check if all calls exist + REQUIRE_THAT(puml, HasCall(_A("tmain()"), _A("B"), "b1(long)")); + REQUIRE_THAT(puml, HasCall(_A("B"), _A("A"), "a1(int)")); + + REQUIRE_THAT(puml, HasCall(_A("tmain()"), _A("B"), "b2(long)")); + REQUIRE_THAT(puml, HasCall(_A("B"), _A("A"), "a2(const long &)")); + + save_puml( + "./" + config.output_directory() + "/" + diagram->name + ".puml", puml); +} \ No newline at end of file diff --git a/tests/test_cases.cc b/tests/test_cases.cc index fe09b0be..bff8d7be 100644 --- a/tests/test_cases.cc +++ b/tests/test_cases.cc @@ -262,6 +262,7 @@ using namespace clanguml::test::matchers; #include "t20013/test_case.h" #include "t20014/test_case.h" #include "t20015/test_case.h" +#include "t20016/test_case.h" /// /// Package diagram tests diff --git a/tests/test_cases.yaml b/tests/test_cases.yaml index a7c8d4db..e0b10242 100644 --- a/tests/test_cases.yaml +++ b/tests/test_cases.yaml @@ -193,6 +193,9 @@ test_cases: - name: t20015 title: Class exclusion by namespace in sequence diagram test case description: + - name: t20016 + title: Template method specialization sequence diagram test case + description: Package diagrams: - name: t30001 title: Basic package diagram test case From 6478cffa27a8d8b9aa5cd8ff4f8fbe81fbc66f5e Mon Sep 17 00:00:00 2001 From: Bartek Kryza Date: Thu, 8 Dec 2022 00:45:19 +0100 Subject: [PATCH 52/77] Updated test case documentation --- docs/test_cases.md | 2 + docs/test_cases/t00002_class.svg | 36 +-- docs/test_cases/t00003_class.svg | 46 +-- docs/test_cases/t00004_class.svg | 76 ++--- docs/test_cases/t00005_class.svg | 110 +++---- docs/test_cases/t00006_class.svg | 132 ++++----- docs/test_cases/t00007_class.svg | 30 +- docs/test_cases/t00008_class.svg | 56 ++-- docs/test_cases/t00009_class.svg | 32 +-- docs/test_cases/t00010_class.svg | 34 +-- docs/test_cases/t00011_class.svg | 22 +- docs/test_cases/t00012_class.svg | 66 ++--- docs/test_cases/t00013_class.svg | 82 +++--- docs/test_cases/t00014_class.svg | 116 ++++---- docs/test_cases/t00015_class.svg | 22 +- docs/test_cases/t00016_class.svg | 30 +- docs/test_cases/t00017_class.svg | 66 ++--- docs/test_cases/t00018_class.svg | 18 +- docs/test_cases/t00019_class.svg | 40 +-- docs/test_cases/t00020_class.svg | 38 +-- docs/test_cases/t00021_class.svg | 30 +- docs/test_cases/t00022_class.svg | 14 +- docs/test_cases/t00023_class.svg | 26 +- docs/test_cases/t00024_class.svg | 22 +- docs/test_cases/t00025_class.svg | 34 +-- docs/test_cases/t00026_class.svg | 42 +-- docs/test_cases/t00027_class.svg | 58 ++-- docs/test_cases/t00028_class.svg | 78 ++--- docs/test_cases/t00029_class.svg | 50 ++-- docs/test_cases/t00030_class.svg | 46 +-- docs/test_cases/t00031_class.svg | 50 ++-- docs/test_cases/t00032_class.svg | 40 +-- docs/test_cases/t00033_class.svg | 48 ++-- docs/test_cases/t00034_class.svg | 46 +-- docs/test_cases/t00035_class.svg | 22 +- docs/test_cases/t00036_class.svg | 38 +-- docs/test_cases/t00037_class.svg | 54 ++-- docs/test_cases/t00038_class.svg | 58 ++-- docs/test_cases/t00039_class.svg | 78 ++--- docs/test_cases/t00040_class.svg | 26 +- docs/test_cases/t00041_class.svg | 54 ++-- docs/test_cases/t00042_class.svg | 36 +-- docs/test_cases/t00043_class.svg | 50 ++-- docs/test_cases/t00044_class.svg | 36 +-- docs/test_cases/t00045_class.svg | 70 ++--- docs/test_cases/t00046_class.svg | 64 ++--- docs/test_cases/t00047_class.svg | 22 +- docs/test_cases/t00048_class.svg | 50 ++-- docs/test_cases/t00049_class.svg | 32 +-- docs/test_cases/t00050_class.svg | 70 ++--- docs/test_cases/t20001_sequence.svg | 92 +++--- docs/test_cases/t20006_sequence.svg | 222 +++++++------- docs/test_cases/t20008_sequence.svg | 124 ++++---- docs/test_cases/t20009_sequence.svg | 124 ++++---- docs/test_cases/t20010_sequence.svg | 116 ++++---- docs/test_cases/t20011_sequence.svg | 132 +++++---- docs/test_cases/t20012.md | 31 ++ docs/test_cases/t20012_sequence.svg | 430 ++++++++++++++++------------ docs/test_cases/t20014.md | 10 - docs/test_cases/t20015.md | 67 +++++ docs/test_cases/t20015_sequence.svg | 32 +++ docs/test_cases/t20016.md | 48 ++++ docs/test_cases/t20016_sequence.svg | 58 ++++ docs/test_cases/t30001_package.svg | 48 ++-- docs/test_cases/t30002_package.svg | 90 +++--- docs/test_cases/t30003_package.svg | 26 +- docs/test_cases/t30004_package.svg | 30 +- docs/test_cases/t30005_package.svg | 38 +-- docs/test_cases/t30006_package.svg | 16 +- docs/test_cases/t30007_package.svg | 20 +- docs/test_cases/t30008_package.svg | 34 +-- docs/test_cases/t40001_include.svg | 30 +- docs/test_cases/t40002_include.svg | 34 +-- docs/test_cases/t40003_include.svg | 50 ++-- 74 files changed, 2346 insertions(+), 1954 deletions(-) create mode 100644 docs/test_cases/t20015.md create mode 100644 docs/test_cases/t20015_sequence.svg create mode 100644 docs/test_cases/t20016.md create mode 100644 docs/test_cases/t20016_sequence.svg diff --git a/docs/test_cases.md b/docs/test_cases.md index 6075cb7c..6b6ca506 100644 --- a/docs/test_cases.md +++ b/docs/test_cases.md @@ -64,6 +64,8 @@ * [t20012](./test_cases/t20012.md) - Lambda expression call sequence diagram test case * [t20013](./test_cases/t20013.md) - Function and method arguments in sequence diagrams test case * [t20014](./test_cases/t20014.md) - Multiple translation units sequence diagram test case + * [t20015](./test_cases/t20015.md) - Class exclusion by namespace in sequence diagram test case + * [t20016](./test_cases/t20016.md) - Template method specialization sequence diagram test case ## Package diagrams * [t30001](./test_cases/t30001.md) - Basic package diagram test case * [t30002](./test_cases/t30002.md) - Package dependency test case diff --git a/docs/test_cases/t00002_class.svg b/docs/test_cases/t00002_class.svg index 9fd4b659..64b1efaf 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_class.svg b/docs/test_cases/t00003_class.svg index 3c14fe98..413aa342 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_class.svg b/docs/test_cases/t00004_class.svg index bb22779f..8579a6cb 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,15 +59,15 @@ Red - - + + A::AA::AAA - + C::B @@ -75,8 +75,8 @@ int - - + + C @@ -84,39 +84,39 @@ T - + - + t : T - + - + b_int : B<int> - - + + C::AA - - + + C::AA::AAA - - + + C::AA::CCC @@ -125,8 +125,8 @@ CCC_2 - - + + C::B @@ -134,16 +134,16 @@ V - + - + b : V - - + + C::CC @@ -152,16 +152,16 @@ CC_2 - - + + detail::D - - + + detail::D::AA @@ -171,8 +171,8 @@ AA_3 - - + + detail::D::DD diff --git a/docs/test_cases/t00005_class.svg b/docs/test_cases/t00005_class.svg index 180e80d5..6982f415 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_class.svg b/docs/test_cases/t00006_class.svg index 4ea803fd..53c03497 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,15 +146,15 @@ T - + - + data : std::vector<T> - + custom_container @@ -162,102 +162,102 @@ 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_class.svg b/docs/test_cases/t00007_class.svg index e045860b..47895320 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_class.svg b/docs/test_cases/t00008_class.svg index 3d956d57..3160727e 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,CMP,int N - + - + 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,15 +87,15 @@ T,C<> - + - + template_template : C<T> - + B @@ -103,18 +103,18 @@ int,Vector - - + + D - + - + ints : B<int,Vector> diff --git a/docs/test_cases/t00009_class.svg b/docs/test_cases/t00009_class.svg index 29affded..1e0333d5 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,15 +18,15 @@ T - + - + value : T - + A @@ -34,7 +34,7 @@ int - + A @@ -42,7 +42,7 @@ std::string - + A @@ -50,32 +50,32 @@ 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_class.svg b/docs/test_cases/t00010_class.svg index 22eaf931..126b45a4 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,22 +18,22 @@ T,P - + - + first : T - + - + second : P - + A @@ -41,8 +41,8 @@ T,std::string - - + + B @@ -50,15 +50,15 @@ T - + - + astring : A<T,std::string> - + B @@ -66,18 +66,18 @@ int - - + + C - + - + aintstring : B<int> diff --git a/docs/test_cases/t00011_class.svg b/docs/test_cases/t00011_class.svg index 75855a14..decb81fd 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_class.svg b/docs/test_cases/t00012_class.svg index c29628c7..b4545c61 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,14 +60,14 @@ - + - + ints : std::array<T,sizeof...(Is)> - + A @@ -75,7 +75,7 @@ int,std::string,float - + A @@ -83,7 +83,7 @@ int,std::string,bool - + B @@ -91,7 +91,7 @@ 3,2,1 - + B @@ -99,7 +99,7 @@ 1,1,1,1 - + C @@ -107,50 +107,50 @@ 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_class.svg b/docs/test_cases/t00013_class.svg index 15ea9b43..53f44623 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,15 +18,15 @@ T - + - + f : T - + ABCD::F @@ -34,70 +34,70 @@ int - - + + A - + - + a : int - - + + B - + - + b : int - - + + C - + - + c : int - - + + D - + - + d : int print(R * r) : void - - + + E @@ -105,16 +105,16 @@ T - + - + e : T - - + + G @@ -122,22 +122,22 @@ T,Args... - + - + g : T - + - + args : std::tuple<Args...> - + E @@ -145,7 +145,7 @@ int - + G @@ -153,7 +153,7 @@ int,float,std::string - + E @@ -161,25 +161,25 @@ std::string - - + + R - + - + gintstring : G<int,float,std::string> - + - + estring : E<std::string> diff --git a/docs/test_cases/t00014_class.svg b/docs/test_cases/t00014_class.svg index c387620e..0c1e0ac9 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,37 +18,37 @@ T,P - + - + t : T - + - + p : P - - + + B - + - + value : std::string - + A @@ -56,7 +56,7 @@ T,std::string - + A @@ -64,7 +64,7 @@ T,std::unique_ptr<std::string> - + A @@ -72,7 +72,7 @@ long,T - + A @@ -80,7 +80,7 @@ double,T - + A @@ -88,7 +88,7 @@ long,U - + A @@ -96,7 +96,7 @@ long,bool - + A @@ -104,7 +104,7 @@ double,bool - + A @@ -112,7 +112,7 @@ long,float - + A @@ -120,7 +120,7 @@ double,float - + A @@ -128,7 +128,7 @@ bool,std::string - + A @@ -136,7 +136,7 @@ float,std::unique_ptr<std::string> - + A @@ -144,7 +144,7 @@ int,std::string - + A @@ -152,7 +152,7 @@ std::string,std::string - + A @@ -160,7 +160,7 @@ char,std::string - + A @@ -168,116 +168,116 @@ wchar_t,std::string - - + + R - + - + 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 - + - + bs : BVector - + - + bs2 : BVector2 - + - + cb : SimpleCallback<ACharString> - + - + gcb : GenericCallback<R::AWCharString> - + - + vcb : VoidCallback - + - + vps : VectorPtr<B> diff --git a/docs/test_cases/t00015_class.svg b/docs/test_cases/t00015_class.svg index c9bf00e3..8caebc40 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_class.svg b/docs/test_cases/t00016_class.svg index bc24e70e..89b2579c 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<> @@ -19,8 +19,8 @@ value : enum - - + + is_numeric @@ -29,8 +29,8 @@ value : enum - - + + is_numeric @@ -41,8 +41,8 @@ value : enum - - + + is_numeric @@ -53,8 +53,8 @@ value : enum - - + + is_numeric @@ -65,8 +65,8 @@ value : enum - - + + is_numeric @@ -77,8 +77,8 @@ value : enum - - + + is_numeric diff --git a/docs/test_cases/t00017_class.svg b/docs/test_cases/t00017_class.svg index 6a193be2..85c6a466 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_class.svg b/docs/test_cases/t00018_class.svg index 46898283..4ab5ec2b 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_class.svg b/docs/test_cases/t00019_class.svg index dd112cb4..6bbf6a8a 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,7 +83,7 @@ m1_calls() const : int m2_calls() const : int - + Layer3 @@ -91,7 +91,7 @@ Base - + Layer2 @@ -99,7 +99,7 @@ Layer3<Base> - + Layer1 @@ -107,18 +107,18 @@ Layer2<Layer3<Base>> - - + + A - + - + layers : std::unique_ptr<Layer1<Layer2<Layer3<Base>>>> diff --git a/docs/test_cases/t00020_class.svg b/docs/test_cases/t00020_class.svg index e98ae344..324ce76e 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_class.svg b/docs/test_cases/t00021_class.svg index 3c909dfd..64ef3a83 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_class.svg b/docs/test_cases/t00022_class.svg index 87d712c0..d351e80b 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_class.svg b/docs/test_cases/t00023_class.svg index d1f4e4f0..566384d7 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_class.svg b/docs/test_cases/t00024_class.svg index 75398f32..0e023e80 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_class.svg b/docs/test_cases/t00025_class.svg index 4fb78e8f..e3d80b8f 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,7 +56,7 @@ m1() : void m2() : void - + Proxy @@ -64,7 +64,7 @@ Target1 - + Proxy @@ -72,25 +72,25 @@ Target2 - - + + ProxyHolder - + - + proxy1 : Proxy<Target1> - + - + proxy2 : Proxy<Target2> diff --git a/docs/test_cases/t00026_class.svg b/docs/test_cases/t00026_class.svg index b5d5fe19..cdd585eb 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>(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,7 +78,7 @@ state(const std::string & n) : Memento<T> & set_state(const std::string & s, Memento<T> && m) : void - + Caretaker @@ -86,7 +86,7 @@ std::string - + Originator @@ -94,25 +94,25 @@ std::string - - + + StringMemento - + - + caretaker : Caretaker<std::string> - + - + originator : Originator<std::string> diff --git a/docs/test_cases/t00027_class.svg b/docs/test_cases/t00027_class.svg index a9ff2eca..e89cc77d 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,14 @@ ~Shape() = default : void - + Line - - + + Line @@ -39,14 +39,14 @@ display() : void - + Text - - + + Text @@ -57,8 +57,8 @@ display() : void - - + + ShapeDecorator @@ -67,8 +67,8 @@ display() = 0 : void - - + + Color @@ -79,8 +79,8 @@ display() : void - - + + Weight @@ -91,7 +91,7 @@ display() : void - + Line @@ -99,7 +99,7 @@ Color,Weight - + Line @@ -107,7 +107,7 @@ Color - + Text @@ -115,7 +115,7 @@ Color,Weight - + Text @@ -123,39 +123,39 @@ Color - - + + Window - + - + border : Line<Color,Weight> - + - + divider : Line<Color> - + - + title : Text<Color,Weight> - + - + description : Text<Color> diff --git a/docs/test_cases/t00028_class.svg b/docs/test_cases/t00028_class.svg index 71200edb..82b4515e 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,10 +94,10 @@ three - + F enum note. - + E @@ -105,59 +105,59 @@ 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. diff --git a/docs/test_cases/t00029_class.svg b/docs/test_cases/t00029_class.svg index ca6ced90..a7a0f504 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_class.svg b/docs/test_cases/t00030_class.svg index 93d41eb9..896b19d1 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_class.svg b/docs/test_cases/t00031_class.svg index 2ba4c67c..c7884f54 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,23 +47,23 @@ T - + - + ttt : T - - + + D - + C @@ -71,39 +71,39 @@ int - - + + R - + - + aaa : A * - + - + bbb : std::vector<B> - + - + ccc : C<int> - + - + ddd : D * diff --git a/docs/test_cases/t00032_class.svg b/docs/test_cases/t00032_class.svg index 4d822894..07e6cd71 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,15 +64,15 @@ T,L,Ts... - + - + counter : L - + Overload @@ -80,18 +80,18 @@ TBase,int,A,B,C - - + + R - + - + overload : Overload<TBase,int,A,B,C> diff --git a/docs/test_cases/t00033_class.svg b/docs/test_cases/t00033_class.svg index a470d770..536765f1 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,30 +52,30 @@ T - + - + ccc : T - - + + D - + - + ddd : int - + C @@ -83,7 +83,7 @@ D - + B @@ -91,7 +91,7 @@ std::unique_ptr<C<D>> - + A @@ -99,18 +99,18 @@ B<std::unique_ptr<C<D>>> - - + + R - + - + abc : A<B<std::unique_ptr<C<D>>>> diff --git a/docs/test_cases/t00034_class.svg b/docs/test_cases/t00034_class.svg index 5b87b0f5..610b32b3 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,16 +31,16 @@ - - + + lift_void - - + + lift_void @@ -49,8 +49,8 @@ - - + + drop_void @@ -59,16 +59,16 @@ - - + + drop_void - - + + drop_void @@ -77,33 +77,33 @@ - - + + A - - + + R - + - + la : lift_void_t<A> * - + - + lv : lift_void_t<void> * diff --git a/docs/test_cases/t00035_class.svg b/docs/test_cases/t00035_class.svg index ff73b657..09267742 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_class.svg b/docs/test_cases/t00036_class.svg index 78306d13..046dcdb8 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,15 +43,15 @@ T - + - + a : T - + A @@ -59,23 +59,23 @@ int - - + + B - + - + a_int : A<int> - - + + C diff --git a/docs/test_cases/t00037_class.svg b/docs/test_cases/t00037_class.svg index 20d84095..d24eb966 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_620) - + - + units : ST::(anonymous_739) - - + + 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_class.svg b/docs/test_cases/t00038_class.svg index f9d129b8..c72a0d21 100644 --- a/docs/test_cases/t00038_class.svg +++ b/docs/test_cases/t00038_class.svg @@ -1,6 +1,6 @@ - + @@ -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,16 +88,16 @@ - - + + map - - + + map @@ -106,8 +106,8 @@ - - + + map @@ -116,8 +116,8 @@ - - + + map @@ -126,8 +126,8 @@ - - + + map diff --git a/docs/test_cases/t00039_class.svg b/docs/test_cases/t00039_class.svg index 6f4c8f96..83df6e3c 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_class.svg b/docs/test_cases/t00040_class.svg index e16a91a4..994380b2 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_class.svg b/docs/test_cases/t00041_class.svg index 5f489b98..3cef6e1d 100644 --- a/docs/test_cases/t00041_class.svg +++ b/docs/test_cases/t00041_class.svg @@ -1,6 +1,6 @@ - + @@ -9,100 +9,100 @@ - - + + R - - + + D - + - + rr : RR * - - + + E - - + + F - - + + RR - + - + e : E * - + - + f : F * - + - + g : detail::G * - - + + RRR - - + + ns1::N - - + + ns1::NN - - + + ns1::NM diff --git a/docs/test_cases/t00042_class.svg b/docs/test_cases/t00042_class.svg index 99119f90..5a963472 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,22 +52,22 @@ T,K - + - + b : T - + - + bb : K - + A @@ -75,7 +75,7 @@ double - + A @@ -83,7 +83,7 @@ std::string - + B diff --git a/docs/test_cases/t00043_class.svg b/docs/test_cases/t00043_class.svg index f9db8b4e..8e9756e1 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_class.svg b/docs/test_cases/t00044_class.svg index 0a3c1982..3eb59655 100644 --- a/docs/test_cases/t00044_class.svg +++ b/docs/test_cases/t00044_class.svg @@ -1,6 +1,6 @@ - + @@ -9,7 +9,7 @@ - + signal_handler @@ -17,8 +17,8 @@ ,A - - + + sink @@ -27,15 +27,15 @@ sink<signal_handler<type-parameter-0-0 (type-parameter-0-1...), type-parameter-0-2> >(sink<signal_handler<type-parameter-0-0 (type-parameter-0-1...),type-parameter-0-2>>::signal_t & sh) : void - + - + signal : sink<signal_handler<type-parameter-0-0 (type-parameter-0-1...),type-parameter-0-2>>::signal_t * - - + + sink @@ -46,23 +46,23 @@ sink<signal_handler<type-parameter-0-0 (type-parameter-0-1...), type-parameter-0-2> >(sink<signal_handler<type-parameter-0-0 (type-parameter-0-1...),type-parameter-0-2>>::signal_t & sh) : void - + - + signal : sink<signal_handler<type-parameter-0-0 (type-parameter-0-1...),type-parameter-0-2>>::signal_t * - - + + signal_handler - - + + signal_handler @@ -71,8 +71,8 @@ - - + + signal_handler @@ -81,8 +81,8 @@ - - + + sink diff --git a/docs/test_cases/t00045_class.svg b/docs/test_cases/t00045_class.svg index 19eab34e..2f7fe50d 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_class.svg b/docs/test_cases/t00046_class.svg index a820bf21..9419a5a4 100644 --- a/docs/test_cases/t00046_class.svg +++ b/docs/test_cases/t00046_class.svg @@ -1,6 +1,6 @@ - + @@ -9,118 +9,118 @@ - + ns1 - + ns2 - + __gnu_cxx - - + + A - - + + A - - + + B - - + + C - - + + D - - + + E - - + + R - + - + a : ns1::ns2::A * - + - + ns1_a : ns1::A * - + - + ns1_ns2_a : ns1::ns2::A * - + - + root_a : ::A * - + - + i : std::vector<std::uint8_t> foo(AA & aa) : void - - + + A - - + + AA diff --git a/docs/test_cases/t00047_class.svg b/docs/test_cases/t00047_class.svg index 4d7dbb19..1bf4e663 100644 --- a/docs/test_cases/t00047_class.svg +++ b/docs/test_cases/t00047_class.svg @@ -1,6 +1,6 @@ - + @@ -9,16 +9,16 @@ - - + + conditional_t - - + + conditional_t @@ -27,8 +27,8 @@ - - + + conditional_t @@ -37,8 +37,8 @@ - - + + conditional_t @@ -47,8 +47,8 @@ - - + + conditional_t diff --git a/docs/test_cases/t00048_class.svg b/docs/test_cases/t00048_class.svg index be54b548..a696a6e8 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_class.svg b/docs/test_cases/t00049_class.svg index aa37257b..8051a29d 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,17 +18,17 @@ T - + - + a : T get_a() : T & - + A @@ -36,7 +36,7 @@ intmap - + A @@ -44,7 +44,7 @@ thestring - + A @@ -52,32 +52,32 @@ std::vector<thestring> - - + + R - + - + a_string : A<thestring> - + - + a_vector_string : A<string_vector> - + - + a_int_map : A<intmap> diff --git a/docs/test_cases/t00050_class.svg b/docs/test_cases/t00050_class.svg index 7fc55ee9..ce7f3d87 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 diff --git a/docs/test_cases/t20001_sequence.svg b/docs/test_cases/t20001_sequence.svg index b582b0fa..30070ffe 100644 --- a/docs/test_cases/t20001_sequence.svg +++ b/docs/test_cases/t20001_sequence.svg @@ -1,6 +1,6 @@ - + - + @@ -9,35 +9,35 @@ - - - - - - - - - - - + + + + + + + + + + + tmain() - - tmain() - + + tmain() + A - - A - + + A + B - - B - - - - - - - + + B + + + + + + + add(int,int) @@ -58,20 +58,26 @@ - - - - - log_result(int) - - - - - log_result(int) - - - - - Main test function + + + + + log_result(int) + + + + + + + + + log_result(int) + + + + + + + Main test function diff --git a/docs/test_cases/t20006_sequence.svg b/docs/test_cases/t20006_sequence.svg index 222d07c4..fa67054d 100644 --- a/docs/test_cases/t20006_sequence.svg +++ b/docs/test_cases/t20006_sequence.svg @@ -1,6 +1,6 @@ - + - + @@ -9,83 +9,83 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + tmain() - - tmain() - + + tmain() + B<int> - - B<int> - + + B<int> + A<int> - - A<int> - + + A<int> + B<std::string> - - B<std::string> - + + B<std::string> + A<std::string> - - A<std::string> - + + A<std::string> + BB<int,int> - - BB<int,int> - + + BB<int,int> + AA<int> - - AA<int> - + + AA<int> + BB<int,std::string> - - BB<int,std::string> - + + BB<int,std::string> + BB<int,float> - - BB<int,float> - - - - - - - - - - - - - - - - + + BB<int,float> + + + + + + + + + + + + + + + + b(int) @@ -112,34 +112,58 @@ 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) + + + + + + + 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/t20008_sequence.svg b/docs/test_cases/t20008_sequence.svg index e7446630..8b0395e0 100644 --- a/docs/test_cases/t20008_sequence.svg +++ b/docs/test_cases/t20008_sequence.svg @@ -1,6 +1,6 @@ - + - + @@ -9,72 +9,84 @@ - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + tmain() - - tmain() - + + tmain() + B<int> - - B<int> - + + B<int> + A<int> - - A<int> - + + A<int> + B<const char *> - - B<const char *> - + + B<const char *> + A<const char *> - - A<const char *> - + + A<const char *> + B<std::string> - - B<std::string> - + + B<std::string> + A<std::string> - - A<std::string> - - - - - - - + + A<std::string> + + + + + + + b(int) a1(int) - - - b(const char *) - - - a2(const char *) - - - b(std::string) - - - a3(std::string) + + + + + + + b(const char *) + + + a2(const char *) + + + + + + + b(std::string) + + + a3(std::string) + + + + diff --git a/docs/test_cases/t20009_sequence.svg b/docs/test_cases/t20009_sequence.svg index 654f1a6a..3b7341ab 100644 --- a/docs/test_cases/t20009_sequence.svg +++ b/docs/test_cases/t20009_sequence.svg @@ -1,6 +1,6 @@ - + - + @@ -9,72 +9,84 @@ - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + tmain() - - tmain() - + + tmain() + B<std::string> - - B<std::string> - + + B<std::string> + A<std::string> - - A<std::string> - + + A<std::string> + B<int> - - B<int> - + + B<int> + A<int> - - A<int> - + + A<int> + B<float> - - B<float> - + + B<float> + A<float> - - A<float> - - - - - - - + + A<float> + + + + + + + b(std::string) a(std::string) - - - b(int) - - - a(int) - - - b(float) - - - a(float) + + + + + + + b(int) + + + a(int) + + + + + + + b(float) + + + a(float) + + + + diff --git a/docs/test_cases/t20010_sequence.svg b/docs/test_cases/t20010_sequence.svg index 2161d5f1..305b0a74 100644 --- a/docs/test_cases/t20010_sequence.svg +++ b/docs/test_cases/t20010_sequence.svg @@ -1,6 +1,6 @@ - + - + @@ -9,62 +9,78 @@ - - - - - - - - - - - - - + + + + + + + + + + + + + tmain() - - tmain() - + + tmain() + B<int> - - B<int> - + + B<int> + A - - A - - - - - - - - - + + A + + + + + + + + + b1() a1() - - - b2() - - - a2() - - - b3() - - - a3() - - - b4() - - - a4() + + + + + + + b2() + + + a2() + + + + + + + b3() + + + a3() + + + + + + + b4() + + + a4() + + + + diff --git a/docs/test_cases/t20011_sequence.svg b/docs/test_cases/t20011_sequence.svg index 7aaccd7d..c3b39bd9 100644 --- a/docs/test_cases/t20011_sequence.svg +++ b/docs/test_cases/t20011_sequence.svg @@ -1,6 +1,6 @@ - + - + @@ -9,34 +9,34 @@ - - - - - - - - - - - - + + + + + + + + + + + + tmain() - - tmain() - + + tmain() + A - - A - - - - - - - - - + + A + + + + + + + + + a(int) @@ -45,33 +45,53 @@ a(int) - - - b(int) - - - - - c(int) - - - - - d(int) - - - - - b(int) - - - - - a(int) - - - - - a(int) + + + + + b(int) + + + + + c(int) + + + + + d(int) + + + + + b(int) + + + + + + + + + a(int) + + + + + a(int) + + + + + + + + + + + + + + diff --git a/docs/test_cases/t20012.md b/docs/test_cases/t20012.md index a1f443da..a874e7a7 100644 --- a/docs/test_cases/t20012.md +++ b/docs/test_cases/t20012.md @@ -19,7 +19,10 @@ diagrams: ## Source code File t20012.cc ```cpp +#include #include +#include +#include #include namespace clanguml { @@ -38,6 +41,8 @@ struct B { void bb() { bbb(); } void bbb() { } + + void eb() { } }; struct C { @@ -48,6 +53,18 @@ struct C { void ccc() { } }; +struct D { + int add5(int arg) const { return arg + 5; } +}; + +class E { + std::optional> maybe_b; + std::shared_ptr a; + +public: + template void setup(F &&f) { f(maybe_b); } +}; + template struct R { R(F &&f) : f_{std::move(f)} @@ -89,6 +106,20 @@ void tmain() R r{[&c]() { c.c(); }}; r.r(); + + D d; + + std::vector ints{0, 1, 2, 3, 4}; + std::transform(ints.begin(), ints.end(), ints.begin(), + [&d](auto i) { return d.add5(i); }); + + // TODO: Fix naming function call arguments which are lambdas + // E e; + // + // e.setup([](auto &&arg) mutable { + // // We cannot know here what 'arg' might be + // arg.value()->eb(); + // }); } } } diff --git a/docs/test_cases/t20012_sequence.svg b/docs/test_cases/t20012_sequence.svg index 1bae258a..ce5670cd 100644 --- a/docs/test_cases/t20012_sequence.svg +++ b/docs/test_cases/t20012_sequence.svg @@ -1,6 +1,6 @@ - + - + @@ -9,94 +9,101 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + tmain() - - tmain() - - tmain()::(lambda t20012.cc:49:20) - - tmain()::(lambda t20012.cc:49:20) - + + tmain() + + tmain()::(lambda t20012.cc:66:20) + + tmain()::(lambda t20012.cc:66:20) + A - - A - - B - - B - - tmain()::(lambda t20012.cc:62:20) - - tmain()::(lambda t20012.cc:62:20) - - C - - C - - R<R::(lambda t20012.cc:68:9)> - - R<R::(lambda t20012.cc:68:9)> - - tmain()::(lambda t20012.cc:68:9) - - tmain()::(lambda t20012.cc:68:9) - - - - - - - - - - - - - - - - - - - - - - - - + + A + + B + + B + + tmain()::(lambda t20012.cc:79:20) + + tmain()::(lambda t20012.cc:79:20) + + C + + C + + R<R::(lambda t20012.cc:85:9)> + + R<R::(lambda t20012.cc:85:9)> + + tmain()::(lambda t20012.cc:85:9) + + tmain()::(lambda t20012.cc:85:9) + + D + + D + + + + + + + + + + + + + + + + + + + + + + + + + operator()() @@ -108,95 +115,162 @@ aa() - - - - - aaa() - - - b() - - - - - bb() - - - - - bbb() - - - - - operator()() - - - c() - - - - - cc() - - - - - ccc() - - - operator()() - - - a() - - - - - aa() - - - - - aaa() - - - b() - - - - - bb() - - - - - bbb() - - - - - - - r() - - - operator()() - - - c() - - - - - cc() - - - - - ccc() - - + + + + + aaa() + + + + + + + + + + + + + b() + + + + + bb() + + + + + bbb() + + + + + + + + + + + + + + + operator()() + + + c() + + + + + cc() + + + + + ccc() + + + + + + + + + + + + + operator()() + + + a() + + + + + aa() + + + + + aaa() + + + + + + + + + + + + + b() + + + + + bb() + + + + + bbb() + + + + + + + + + + + + + + + + + r() + + + operator()() + + + c() + + + + + cc() + + + + + ccc() + + + + + + + + + + + + + + + + + add5(int) + + diff --git a/docs/test_cases/t20014.md b/docs/test_cases/t20014.md index 5801d840..9582938b 100644 --- a/docs/test_cases/t20014.md +++ b/docs/test_cases/t20014.md @@ -40,16 +40,6 @@ File t20014_c.cc namespace clanguml { namespace t20014 { -//template F C::c1(F i, F j) -//{ -// return c_.b1(i, j); -//} -// -//template F C::c2(F i, F j) -//{ -// return c_.b2(i, j); -//} - } } ``` diff --git a/docs/test_cases/t20015.md b/docs/test_cases/t20015.md new file mode 100644 index 00000000..b8f6ebaa --- /dev/null +++ b/docs/test_cases/t20015.md @@ -0,0 +1,67 @@ +# t20015 - Class exclusion by namespace in sequence diagram test case +## Config +```yaml +compilation_database_dir: .. +output_directory: puml +diagrams: + t20015_sequence: + type: sequence + glob: + - ../../tests/t20015/t20015.cc + include: + namespaces: + - clanguml::t20015 + exclude: + namespaces: + - clanguml::t20015::detail + using_namespace: + - clanguml::t20015 + start_from: + - function: "clanguml::t20015::tmain()" +``` +## Source code +File t20015.cc +```cpp +#include +#include + +namespace clanguml { +namespace t20015 { + +namespace detail { +class A { +public: + void set_x(int x) { x_ = x; } + void set_y(int y) { y_ = y; } + void set_z(int z) { z_ = z; } + +private: + int x_; + int y_; + int z_; +}; +} + +class B { +public: + void setup_a(std::shared_ptr &a) + { + a->set_x(1); + a.get()->set_y(2); + (*a).set_z(3); + } +}; + +void tmain() +{ + auto a = std::make_shared(); + + B b; + + b.setup_a(a); +} +} +} +``` +## Generated UML diagrams +![t20015_sequence](./t20015_sequence.svg "Class exclusion by namespace in sequence diagram test case") diff --git a/docs/test_cases/t20015_sequence.svg b/docs/test_cases/t20015_sequence.svg new file mode 100644 index 00000000..982bfe2c --- /dev/null +++ b/docs/test_cases/t20015_sequence.svg @@ -0,0 +1,32 @@ + + + + + + + + + + + + + + + + + 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 new file mode 100644 index 00000000..303acfc2 --- /dev/null +++ b/docs/test_cases/t20016.md @@ -0,0 +1,48 @@ +# t20016 - Template method specialization sequence diagram test case +## Config +```yaml +compilation_database_dir: .. +output_directory: puml +diagrams: + t20016_sequence: + type: sequence + glob: + - ../../tests/t20016/t20016.cc + include: + namespaces: + - clanguml::t20016 + using_namespace: + - clanguml::t20016 + start_from: + - function: "clanguml::t20016::tmain()" +``` +## Source code +File t20016.cc +```cpp +namespace clanguml { +namespace t20016 { +struct A { + void a1(int a) { } + template T a2(const T &a) { return a;} +}; + +template struct B { + void b1(T b) { a_.a1(1); } + + template F b2(T t) { return a_.a2(t); } + + A a_; +}; + +void tmain() { + B b; + + b.b1(1); + + b.b2(2); +} +} +} +``` +## Generated UML diagrams +![t20016_sequence](./t20016_sequence.svg "Template method specialization sequence diagram test case") diff --git a/docs/test_cases/t20016_sequence.svg b/docs/test_cases/t20016_sequence.svg new file mode 100644 index 00000000..6e292320 --- /dev/null +++ b/docs/test_cases/t20016_sequence.svg @@ -0,0 +1,58 @@ + + + + + + + + + + + + + + + + + + + + + tmain() + + tmain() + + B<long> + + B<long> + + A + + A + + + + + + + + b1(long) + + + a1(int) + + + + + + + b2(long) + + + a2(const long &) + + + + + + diff --git a/docs/test_cases/t30001_package.svg b/docs/test_cases/t30001_package.svg index 27aa405c..2c4ae265 100644 --- a/docs/test_cases/t30001_package.svg +++ b/docs/test_cases/t30001_package.svg @@ -1,6 +1,6 @@ - + @@ -9,63 +9,63 @@ - - + + 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_package.svg b/docs/test_cases/t30002_package.svg index 2cf858cb..08c26c26 100644 --- a/docs/test_cases/t30002_package.svg +++ b/docs/test_cases/t30002_package.svg @@ -1,6 +1,6 @@ - + @@ -9,113 +9,113 @@ - - + + A - - + + AA - - + + B - - + + BB - - + + A1 - - + + A2 - - + + A3 - - + + A4 - - + + A5 - - + + A6 - - + + A7 - - + + A8 - - + + A9 - - + + A10 - - + + A11 - - + + A12 - - + + A13 - - + + A14 - - + + A15 - - + + A16 - - + + A17 - - + + BBB diff --git a/docs/test_cases/t30003_package.svg b/docs/test_cases/t30003_package.svg index 9a696364..25436895 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_package.svg b/docs/test_cases/t30004_package.svg index 131fbf88..093008e3 100644 --- a/docs/test_cases/t30004_package.svg +++ b/docs/test_cases/t30004_package.svg @@ -1,6 +1,6 @@ - + @@ -9,40 +9,40 @@ - - + + A - + Package AAA. - + Package BBB. - + CCCC package note. - + We skipped DDD. - - + + AAA - - + + BBB - - + + CCC - - + + EEE diff --git a/docs/test_cases/t30005_package.svg b/docs/test_cases/t30005_package.svg index c8670ac4..30e5579d 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_package.svg b/docs/test_cases/t30006_package.svg index d3503d7c..c1ac3f2c 100644 --- a/docs/test_cases/t30006_package.svg +++ b/docs/test_cases/t30006_package.svg @@ -1,6 +1,6 @@ - + @@ -9,22 +9,22 @@ - - + + B - - + + A - - + + C - + Top A note. diff --git a/docs/test_cases/t30007_package.svg b/docs/test_cases/t30007_package.svg index 235562af..f9217ea1 100644 --- a/docs/test_cases/t30007_package.svg +++ b/docs/test_cases/t30007_package.svg @@ -1,6 +1,6 @@ - + @@ -9,27 +9,27 @@ - - + + A - - + + B - - + + AA - - + + C - + Compare layout with t30006. diff --git a/docs/test_cases/t30008_package.svg b/docs/test_cases/t30008_package.svg index d8b447db..3788d025 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/t40001_include.svg b/docs/test_cases/t40001_include.svg index 04b587e6..7376527f 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 diff --git a/docs/test_cases/t40002_include.svg b/docs/test_cases/t40002_include.svg index 32de6727..35ca959d 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_include.svg b/docs/test_cases/t40003_include.svg index 5a0bbb36..a6ee471d 100644 --- a/docs/test_cases/t40003_include.svg +++ b/docs/test_cases/t40003_include.svg @@ -1,6 +1,6 @@ - + @@ -9,66 +9,66 @@ - + include - + dependants - + dependencies - + src - + dependants - + dependencies - - + + t3.h - - + + t2.h - - + + t1.h - - + + t3.h - - + + t2.h - - + + t1.h - - + + t5.h - - + + t1.cc - - + + t2.cc From caf0ae792857bd5edc1f7ed0ac4d37b74380f116 Mon Sep 17 00:00:00 2001 From: Bartek Kryza Date: Fri, 9 Dec 2022 00:10:38 +0100 Subject: [PATCH 53/77] Added combine_free_functions_into_file_participants sequence diagram option --- src/config/config.cc | 4 + src/config/config.h | 2 + .../plantuml/sequence_diagram_generator.cc | 87 ++++++++++++++++--- .../plantuml/sequence_diagram_generator.h | 1 + src/sequence_diagram/model/participant.h | 15 ++++ .../visitor/translation_unit_visitor.cc | 11 ++- tests/t20017/.clang-uml | 16 ++++ tests/t20017/include/t20017_a.h | 9 ++ tests/t20017/include/t20017_b.h | 9 ++ tests/t20017/t20017.cc | 8 ++ tests/t20017/t20017_b.cc | 7 ++ tests/t20017/test_case.h | 51 +++++++++++ tests/test_cases.cc | 1 + tests/test_cases.yaml | 3 + 14 files changed, 212 insertions(+), 12 deletions(-) create mode 100644 tests/t20017/.clang-uml create mode 100644 tests/t20017/include/t20017_a.h create mode 100644 tests/t20017/include/t20017_b.h create mode 100644 tests/t20017/t20017.cc create mode 100644 tests/t20017/t20017_b.cc create mode 100644 tests/t20017/test_case.h diff --git a/src/config/config.cc b/src/config/config.cc index a1309431..8349746b 100644 --- a/src/config/config.cc +++ b/src/config/config.cc @@ -101,6 +101,8 @@ void inheritable_diagram_options::inherit( base_directory.override(parent.base_directory); relative_to.override(parent.relative_to); comment_parser.override(parent.comment_parser); + combine_free_functions_into_file_participants.override( + combine_free_functions_into_file_participants); } std::string inheritable_diagram_options::simplify_template_type( @@ -589,6 +591,8 @@ template <> struct convert { return false; get_option(node, rhs.start_from); + get_option(node, rhs.combine_free_functions_into_file_participants); + get_option(node, rhs.relative_to); rhs.initialize_type_aliases(); diff --git a/src/config/config.h b/src/config/config.h index 202ffdec..77e18787 100644 --- a/src/config/config.h +++ b/src/config/config.h @@ -142,6 +142,8 @@ struct inheritable_diagram_options { option type_aliases{"type_aliases"}; option comment_parser{ "comment_parser", comment_parser_t::plain}; + option combine_free_functions_into_file_participants{ + "combine_free_functions_into_file_participants", false}; void inherit(const inheritable_diagram_options &parent); diff --git a/src/sequence_diagram/generators/plantuml/sequence_diagram_generator.cc b/src/sequence_diagram/generators/plantuml/sequence_diagram_generator.cc index e2afa867..13fb3238 100644 --- a/src/sequence_diagram/generators/plantuml/sequence_diagram_generator.cc +++ b/src/sequence_diagram/generators/plantuml/sequence_diagram_generator.cc @@ -62,10 +62,25 @@ void generator::generate_call(const message &m, std::ostream &ostr) const message = dynamic_cast(to.value()) .message_name(model::function::message_render_mode::full); } + else if (m_config.combine_free_functions_into_file_participants()) { + if (to.value().type_name() == "function") { + message = + dynamic_cast(to.value()) + .message_name(model::function::message_render_mode::full); + } + else if (to.value().type_name() == "function_template") { + message = + dynamic_cast(to.value()) + .message_name(model::function::message_render_mode::full); + } + } - ostr << from.value().alias() << " " + const std::string from_alias = generate_alias(from.value()); + const std::string to_alias = generate_alias(to.value()); + + ostr << from_alias << " " << common::generators::plantuml::to_plantuml(message_t::kCall) << " " - << to.value().alias() << " : " << message << std::endl; + << to_alias << " : " << message << std::endl; LOG_DBG("Generated call '{}' from {} [{}] to {} [{}]", message, from, m.from, to, m.to); @@ -79,9 +94,13 @@ void generator::generate_return(const message &m, std::ostream &ostr) const const auto &from = m_model.get_participant(m.from); const auto &to = m_model.get_participant(m.to); - ostr << to.value().alias() << " " + const std::string from_alias = generate_alias(from.value()); + + const std::string to_alias = generate_alias(to.value()); + + ostr << to_alias << " " << common::generators::plantuml::to_plantuml(message_t::kReturn) - << " " << from.value().alias() << '\n'; + << " " << from_alias << '\n'; } } @@ -99,7 +118,9 @@ void generator::generate_activity(const activity &a, std::ostream &ostr, generate_call(m, ostr); - ostr << "activate " << to.value().alias() << std::endl; + std::string to_alias = generate_alias(to.value()); + + ostr << "activate " << to_alias << std::endl; if (m_model.sequences.find(m.to) != m_model.sequences.end()) { if (std::find(visited.begin(), visited.end(), m.to) == @@ -117,7 +138,7 @@ void generator::generate_activity(const activity &a, std::ostream &ostr, visited.pop_back(); - ostr << "deactivate " << to.value().alias() << std::endl; + ostr << "deactivate " << to_alias << std::endl; } } @@ -152,6 +173,35 @@ void generator::generate_participant(std::ostream &ostr, common::id_t id) const generated_participants_.emplace(class_id); } + else if ((participant.type_name() == "function" || + participant.type_name() == "function_template") && + m_config.combine_free_functions_into_file_participants()) { + // Create a single participant for all functions declared in a + // single file + const auto &file_path = + m_model.get_participant(participant_id) + .value() + .file(); + + assert(!file_path.empty()); + + const auto file_id = common::to_id(file_path); + + if (is_participant_generated(file_id)) + return; + + [[maybe_unused]] const auto &relative_to = + std::filesystem::canonical(m_config.relative_to()); + + auto participant_name = std::filesystem::relative( + std::filesystem::path{file_path}, relative_to) + .string(); + + ostr << "participant \"" << render_name(participant_name) + << "\" as " << fmt::format("C_{:022}", file_id) << '\n'; + + generated_participants_.emplace(file_id); + } else { ostr << "participant \"" << m_config.using_namespace().relative( @@ -192,6 +242,8 @@ void generator::generate(std::ostream &ostr) const break; } } + + // Use this to break out of recurrent loops std::vector visited_participants; @@ -199,20 +251,22 @@ void generator::generate(std::ostream &ostr) const m_model.get_participant(start_from); if (!from.has_value()) { - LOG_WARN( - "Failed to find participant {} for start_from condition", + LOG_WARN("Failed to find participant {} for start_from " + "condition", sf.location); continue; } generate_participant(ostr, start_from); - ostr << "activate " << from.value().alias() << std::endl; + std::string from_alias = generate_alias(from.value()); + + ostr << "activate " << from_alias << std::endl; generate_activity( m_model.sequences[start_from], ostr, visited_participants); - ostr << "deactivate " << from.value().alias() << std::endl; + ostr << "deactivate " << from_alias << std::endl; } else { // TODO: Add support for other sequence start location types @@ -225,4 +279,17 @@ void generator::generate(std::ostream &ostr) const ostr << "@enduml" << std::endl; } +std::string generator::generate_alias( + const model::participant &participant) const +{ + if ((participant.type_name() == "function" || + participant.type_name() == "function_template") && + m_config.combine_free_functions_into_file_participants()) { + const auto file_id = common::to_id(participant.file()); + + return fmt::format("C_{:022}", file_id); + } + + return participant.alias(); +} } diff --git a/src/sequence_diagram/generators/plantuml/sequence_diagram_generator.h b/src/sequence_diagram/generators/plantuml/sequence_diagram_generator.h index 98273676..23a4cbe7 100644 --- a/src/sequence_diagram/generators/plantuml/sequence_diagram_generator.h +++ b/src/sequence_diagram/generators/plantuml/sequence_diagram_generator.h @@ -66,6 +66,7 @@ private: std::string render_name(std::string name) const; mutable std::set generated_participants_; + std::string generate_alias(const model::participant &participant) const; }; } diff --git a/src/sequence_diagram/model/participant.h b/src/sequence_diagram/model/participant.h index 5a36411d..e633b7d2 100644 --- a/src/sequence_diagram/model/participant.h +++ b/src/sequence_diagram/model/participant.h @@ -246,6 +246,21 @@ struct function_template : public function, public template_trait { std::string full_name(bool relative = true) const override; std::string full_name_no_ns() const override; + + std::string message_name(message_render_mode mode) const override + { + std::ostringstream s; + render_template_params(s, using_namespace(), true); + std::string template_params = s.str(); + + if (mode == message_render_mode::no_arguments) { + return fmt::format("{}{}(){}", name(), template_params, + is_const() ? " const" : ""); + } + + return fmt::format("{}{}({}){}", name(), template_params, + fmt::join(parameters(), ","), is_const() ? " const" : ""); + } }; } diff --git a/src/sequence_diagram/visitor/translation_unit_visitor.cc b/src/sequence_diagram/visitor/translation_unit_visitor.cc index d97096e0..0f7bbf2b 100644 --- a/src/sequence_diagram/visitor/translation_unit_visitor.cc +++ b/src/sequence_diagram/visitor/translation_unit_visitor.cc @@ -376,6 +376,8 @@ bool translation_unit_visitor::VisitFunctionDecl(clang::FunctionDecl *f) set_unique_id(f->getID(), f_ptr->id()); + set_source_location(*f, *f_ptr); + // TODO: Handle overloaded functions with different arguments diagram().add_participant(std::move(f_ptr)); } @@ -401,6 +403,8 @@ bool translation_unit_visitor::VisitFunctionDecl(clang::FunctionDecl *f) set_unique_id(f->getID(), f_ptr->id()); + set_source_location(*f, *f_ptr); + // TODO: Handle overloaded functions with different arguments diagram().add_participant(std::move(f_ptr)); } @@ -437,6 +441,8 @@ bool translation_unit_visitor::VisitFunctionTemplateDecl( f_ptr->set_id(common::to_id(f_ptr->full_name(false))); + set_source_location(*function_template, *f_ptr); + context().update(function_template); context().set_caller_id(f_ptr->id()); @@ -784,8 +790,9 @@ bool translation_unit_visitor::process_class_template_method_call_expression( get_unique_id(template_declaration->getID()).value()); } else { - LOG_WARN("Cannot generate call due to unresolvable " - "CXXDependentScopeMemberExpr"); + LOG_DBG("Skipping call due to unresolvable " + "CXXDependentScopeMemberExpr at {}", + expr->getBeginLoc().printToString(source_manager())); } return true; diff --git a/tests/t20017/.clang-uml b/tests/t20017/.clang-uml new file mode 100644 index 00000000..0aa577ba --- /dev/null +++ b/tests/t20017/.clang-uml @@ -0,0 +1,16 @@ +compilation_database_dir: .. +output_directory: puml +diagrams: + t20017_sequence: + type: sequence + combine_free_functions_into_file_participants: true + relative_to: ../../tests/t20017 + glob: + - ../../tests/t20017/t20017.cc + include: + namespaces: + - clanguml::t20017 + using_namespace: + - clanguml::t20017 + start_from: + - function: "clanguml::t20017::tmain()" \ No newline at end of file diff --git a/tests/t20017/include/t20017_a.h b/tests/t20017/include/t20017_a.h new file mode 100644 index 00000000..49ed884b --- /dev/null +++ b/tests/t20017/include/t20017_a.h @@ -0,0 +1,9 @@ +#pragma once + +namespace clanguml { +namespace t20017 { +int a1(int x, int y) { return x + y; } +int a2(int x, int y) { return x - y; } +int a3(int x, int y) { return x * y; } +} +} \ No newline at end of file diff --git a/tests/t20017/include/t20017_b.h b/tests/t20017/include/t20017_b.h new file mode 100644 index 00000000..86c67f72 --- /dev/null +++ b/tests/t20017/include/t20017_b.h @@ -0,0 +1,9 @@ +#pragma once + +namespace clanguml { +namespace t20017 { +int b1(int x, int y); + +template T b2(T x, T y) { return x / y; } +} +} \ No newline at end of file diff --git a/tests/t20017/t20017.cc b/tests/t20017/t20017.cc new file mode 100644 index 00000000..ec6227de --- /dev/null +++ b/tests/t20017/t20017.cc @@ -0,0 +1,8 @@ +#include "include/t20017_a.h" +#include "include/t20017_b.h" + +namespace clanguml { +namespace t20017 { +int tmain() { return b2(a1(a2(a3(1, 2), b1(3, 4)), 5), 6); } +} +} \ No newline at end of file diff --git a/tests/t20017/t20017_b.cc b/tests/t20017/t20017_b.cc new file mode 100644 index 00000000..d0b80bb7 --- /dev/null +++ b/tests/t20017/t20017_b.cc @@ -0,0 +1,7 @@ +#include "include/t20017_b.h" + +namespace clanguml { +namespace t20017 { +int b1(int x, int y) { return x - y; } +} +} \ No newline at end of file diff --git a/tests/t20017/test_case.h b/tests/t20017/test_case.h new file mode 100644 index 00000000..94c4bf1a --- /dev/null +++ b/tests/t20017/test_case.h @@ -0,0 +1,51 @@ +/** + * tests/t20017/test_case.h + * + * Copyright (c) 2021-2022 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("t20017", "[test-case][sequence]") +{ + auto [config, db] = load_config("t20017"); + + auto diagram = config.diagrams["t20017_sequence"]; + + REQUIRE(diagram->name == "t20017_sequence"); + + auto model = generate_sequence_diagram(*db, diagram); + + REQUIRE(model->name() == "t20017_sequence"); + + auto puml = generate_sequence_puml(diagram, *model); + AliasMatcher _A(puml); + + REQUIRE_THAT(puml, StartsWith("@startuml")); + REQUIRE_THAT(puml, EndsWith("@enduml\n")); + + // Check if all calls exist + REQUIRE_THAT(puml, + HasCall(_A("t20017.cc"), _A("include/t20017_a.h"), "a1(int,int)")); + REQUIRE_THAT( + puml, HasCall(_A("t20017.cc"), _A("include/t20017_a.h"), "a2(int,int)")); + REQUIRE_THAT(puml, + HasCall(_A("t20017.cc"), _A("include/t20017_a.h"), "a3(int,int)")); + REQUIRE_THAT(puml, + HasCall(_A("t20017.cc"), _A("include/t20017_b.h"), "b1(int,int)")); + REQUIRE_THAT(puml, + HasCall(_A("t20017.cc"), _A("include/t20017_b.h"), "b2(int,int)")); + + save_puml( + "./" + config.output_directory() + "/" + diagram->name + ".puml", puml); +} \ No newline at end of file diff --git a/tests/test_cases.cc b/tests/test_cases.cc index bff8d7be..80695a32 100644 --- a/tests/test_cases.cc +++ b/tests/test_cases.cc @@ -263,6 +263,7 @@ using namespace clanguml::test::matchers; #include "t20014/test_case.h" #include "t20015/test_case.h" #include "t20016/test_case.h" +#include "t20017/test_case.h" /// /// Package diagram tests diff --git a/tests/test_cases.yaml b/tests/test_cases.yaml index e0b10242..4651bcda 100644 --- a/tests/test_cases.yaml +++ b/tests/test_cases.yaml @@ -196,6 +196,9 @@ test_cases: - name: t20016 title: Template method specialization sequence diagram test case description: + - name: t20017 + title: Test case for combine_free_functions_into_file_participants option + description: Package diagrams: - name: t30001 title: Basic package diagram test case From 69ca8c2d8edd9a4904913a951f8684dc7cba255b Mon Sep 17 00:00:00 2001 From: Bartek Kryza Date: Fri, 9 Dec 2022 22:12:24 +0100 Subject: [PATCH 54/77] Added start_from function and method entrypoints in sequence diagrams --- .../plantuml/sequence_diagram_generator.cc | 20 +++- src/sequence_diagram/model/participant.cc | 95 +++++++++++++++++++ src/sequence_diagram/model/participant.h | 93 +++++------------- .../visitor/translation_unit_visitor.cc | 9 ++ tests/t20005/test_case.h | 3 +- tests/t20017/test_case.h | 9 +- tests/test_cases.cc | 2 +- tests/test_cases.h | 35 ++++--- 8 files changed, 179 insertions(+), 87 deletions(-) diff --git a/src/sequence_diagram/generators/plantuml/sequence_diagram_generator.cc b/src/sequence_diagram/generators/plantuml/sequence_diagram_generator.cc index 13fb3238..aeb9e1e4 100644 --- a/src/sequence_diagram/generators/plantuml/sequence_diagram_generator.cc +++ b/src/sequence_diagram/generators/plantuml/sequence_diagram_generator.cc @@ -248,7 +248,7 @@ void generator::generate(std::ostream &ostr) const visited_participants; const auto &from = - m_model.get_participant(start_from); + m_model.get_participant(start_from); if (!from.has_value()) { LOG_WARN("Failed to find participant {} for start_from " @@ -261,11 +261,29 @@ void generator::generate(std::ostream &ostr) const std::string from_alias = generate_alias(from.value()); + if (from.value().type_name() == "method" || + m_config.combine_free_functions_into_file_participants()) { + ostr << "[->" + << " " << from_alias << " : " + << from.value().message_name( + model::function::message_render_mode::full) + << std::endl; + } + ostr << "activate " << from_alias << std::endl; generate_activity( m_model.sequences[start_from], ostr, visited_participants); + if (from.value().type_name() == "method" || + m_config.combine_free_functions_into_file_participants()) { + + if (!from.value().is_void()) { + ostr << "[<--" + << " " << from_alias << std::endl; + } + } + ostr << "deactivate " << from_alias << std::endl; } else { diff --git a/src/sequence_diagram/model/participant.cc b/src/sequence_diagram/model/participant.cc index 94ca51d8..55a5f6fd 100644 --- a/src/sequence_diagram/model/participant.cc +++ b/src/sequence_diagram/model/participant.cc @@ -57,6 +57,10 @@ void template_trait::add_template( templates_.push_back(std::move(tmplt)); } +bool template_trait::is_implicit() const { return is_implicit_; } + +void template_trait::set_implicit(bool implicit) { is_implicit_ = implicit; } + const std::vector & template_trait::templates() const { @@ -95,6 +99,12 @@ int template_trait::calculate_template_specialization_match( return res; } +std::string participant::to_string() const +{ + return fmt::format( + "Participant '{}': id={} name={}", type_name(), id(), full_name(false)); +} + class_::class_(const common::model::namespace_ &using_namespace) : participant{using_namespace} { @@ -154,6 +164,14 @@ std::string class_::full_name(bool relative) const return res; } +bool class_::is_alias() const { return is_alias_; } + +void class_::is_alias(bool alias) { is_alias_ = alias; } + +bool class_::is_lambda() const { return is_lambda_; } + +void class_::is_lambda(bool is_lambda) { is_lambda_ = is_lambda; } + bool operator==(const class_ &l, const class_ &r) { return l.id() == r.id(); } function::function(const common::model::namespace_ &using_namespace) @@ -173,11 +191,38 @@ std::string function::full_name_no_ns() const fmt::join(parameters_, ","), is_const() ? " const" : ""); } +std::string function::message_name(message_render_mode mode) const +{ + if (mode == message_render_mode::no_arguments) { + return fmt::format("{}(){}", name(), is_const() ? " const" : ""); + } + + return fmt::format("{}({}){}", name(), fmt::join(parameters_, ","), + is_const() ? " const" : ""); +} + +bool function::is_const() const { return is_const_; } + +void function::is_const(bool c) { is_const_ = c; } + +bool function::is_void() const { return is_void_; } + +void function::is_void(bool v) { is_void_ = v; } + +void function::add_parameter(const std::string &a) { parameters_.push_back(a); } + +const std::vector &function::parameters() const +{ + return parameters_; +} + method::method(const common::model::namespace_ &using_namespace) : function{using_namespace} { } +const std::string method::method_name() const { return method_name_; } + std::string method::alias() const { assert(class_id_ >= 0); @@ -185,6 +230,41 @@ std::string method::alias() const return fmt::format("C_{:022}", class_id_); } +void method::set_method_name(const std::string &name) { method_name_ = name; } + +void method::set_class_id(diagram_element::id_t id) { class_id_ = id; } + +void method::set_class_full_name(const std::string &name) +{ + class_full_name_ = name; +} + +const auto &method::class_full_name() const { return class_full_name_; } + +std::string method::full_name(bool /*relative*/) const +{ + return fmt::format("{}::{}({}){}", class_full_name(), method_name(), + fmt::join(parameters(), ","), is_const() ? " const" : ""); +} + +std::string method::message_name(message_render_mode mode) const +{ + if (mode == message_render_mode::no_arguments) { + return fmt::format("{}(){}", method_name(), is_const() ? " const" : ""); + } + + return fmt::format("{}({}){}", method_name(), fmt::join(parameters(), ","), + is_const() ? " const" : ""); +} + +class_::diagram_element::id_t method::class_id() const { return class_id_; } + +std::string method::to_string() const +{ + return fmt::format("Participant '{}': id={}, name={}, class_id={}", + type_name(), id(), full_name(false), class_id()); +} + function_template::function_template( const common::model::namespace_ &using_namespace) : function{using_namespace} @@ -233,4 +313,19 @@ std::string function_template::full_name_no_ns() const return ostr.str(); } +std::string function_template::message_name(message_render_mode mode) const +{ + std::ostringstream s; + render_template_params(s, using_namespace(), true); + std::string template_params = s.str(); + + if (mode == message_render_mode::no_arguments) { + return fmt::format( + "{}{}(){}", name(), template_params, is_const() ? " const" : ""); + } + + return fmt::format("{}{}({}){}", name(), template_params, + fmt::join(parameters(), ","), is_const() ? " const" : ""); +} + } \ No newline at end of file diff --git a/src/sequence_diagram/model/participant.h b/src/sequence_diagram/model/participant.h index e633b7d2..03d59f4e 100644 --- a/src/sequence_diagram/model/participant.h +++ b/src/sequence_diagram/model/participant.h @@ -42,9 +42,9 @@ struct template_trait { int calculate_template_specialization_match( const template_trait &other, const std::string &full_name) const; - bool is_implicit() const { return is_implicit_; } + bool is_implicit() const; - void set_implicit(bool implicit) { is_implicit_ = implicit; } + void set_implicit(bool implicit); private: std::vector templates_; @@ -74,11 +74,7 @@ struct participant : public common::model::element, std::string type_name() const override { return "participant"; } - virtual std::string to_string() const - { - return fmt::format("Participant '{}': id={} name={}", type_name(), id(), - full_name(false)); - } + virtual std::string to_string() const; stereotype_t stereotype_{stereotype_t::participant}; }; @@ -111,13 +107,13 @@ public: bool is_abstract() const; - bool is_alias() const { return is_alias_; } + bool is_alias() const; - void is_alias(bool alias) { is_alias_ = alias; } + void is_alias(bool alias); - bool is_lambda() const { return is_lambda_; } + bool is_lambda() const; - void is_lambda(bool is_lambda) { is_lambda_ = is_lambda; } + void is_lambda(bool is_lambda); private: bool is_struct_{false}; @@ -154,26 +150,23 @@ struct function : public participant { std::string full_name_no_ns() const override; - virtual std::string message_name(message_render_mode mode) const - { - if (mode == message_render_mode::no_arguments) { - return fmt::format("{}(){}", name(), is_const() ? " const" : ""); - } + virtual std::string message_name(message_render_mode mode) const; - return fmt::format("{}({}){}", name(), fmt::join(parameters_, ","), - is_const() ? " const" : ""); - } + bool is_const() const; - bool is_const() const { return is_const_; } + void is_const(bool c); - void is_const(bool c) { is_const_ = c; } + bool is_void() const; - void add_parameter(const std::string &a) { parameters_.push_back(a); } + void is_void(bool v); - const std::vector ¶meters() const { return parameters_; } + void add_parameter(const std::string &a); + + const std::vector ¶meters() const; private: bool is_const_{false}; + bool is_void_{false}; std::vector parameters_; }; @@ -187,45 +180,25 @@ struct method : public function { std::string type_name() const override { return "method"; } - const std::string method_name() const { return method_name_; } + const std::string method_name() const; std::string alias() const override; - void set_method_name(const std::string &name) { method_name_ = name; } + void set_method_name(const std::string &name); - void set_class_id(diagram_element::id_t id) { class_id_ = id; } + void set_class_id(diagram_element::id_t id); - void set_class_full_name(const std::string &name) - { - class_full_name_ = name; - } + void set_class_full_name(const std::string &name); - const auto &class_full_name() const { return class_full_name_; } + const auto &class_full_name() const; - std::string full_name(bool /*relative*/) const override - { - return fmt::format("{}::{}({}){}", class_full_name(), method_name(), - fmt::join(parameters(), ","), is_const() ? " const" : ""); - } + std::string full_name(bool /*relative*/) const override; - std::string message_name(message_render_mode mode) const override - { - if (mode == message_render_mode::no_arguments) { - return fmt::format( - "{}(){}", method_name(), is_const() ? " const" : ""); - } + std::string message_name(message_render_mode mode) const override; - return fmt::format("{}({}){}", method_name(), - fmt::join(parameters(), ","), is_const() ? " const" : ""); - } + diagram_element::id_t class_id() const; - diagram_element::id_t class_id() const { return class_id_; } - - std::string to_string() const override - { - return fmt::format("Participant '{}': id={}, name={}, class_id={}", - type_name(), id(), full_name(false), class_id()); - } + std::string to_string() const override; private: diagram_element::id_t class_id_; @@ -247,20 +220,6 @@ struct function_template : public function, public template_trait { std::string full_name_no_ns() const override; - std::string message_name(message_render_mode mode) const override - { - std::ostringstream s; - render_template_params(s, using_namespace(), true); - std::string template_params = s.str(); - - if (mode == message_render_mode::no_arguments) { - return fmt::format("{}{}(){}", name(), template_params, - is_const() ? " const" : ""); - } - - return fmt::format("{}{}({}){}", name(), template_params, - fmt::join(parameters(), ","), is_const() ? " const" : ""); - } + std::string message_name(message_render_mode mode) const override; }; - } diff --git a/src/sequence_diagram/visitor/translation_unit_visitor.cc b/src/sequence_diagram/visitor/translation_unit_visitor.cc index 0f7bbf2b..14c1a2e8 100644 --- a/src/sequence_diagram/visitor/translation_unit_visitor.cc +++ b/src/sequence_diagram/visitor/translation_unit_visitor.cc @@ -307,6 +307,8 @@ bool translation_unit_visitor::VisitCXXMethodDecl(clang::CXXMethodDecl *m) const auto &method_class = get_participant(parent_decl).value(); + m_ptr->is_void(m->getReturnType()->isVoidType()); + m_ptr->set_class_id(method_class.id()); m_ptr->set_class_full_name(method_class.full_name(false)); m_ptr->set_name( @@ -370,6 +372,8 @@ bool translation_unit_visitor::VisitFunctionDecl(clang::FunctionDecl *f) f_ptr->set_id(common::to_id(f_ptr->full_name(false))); + f_ptr->is_void(f->getReturnType()->isVoidType()); + context().update(f); context().set_caller_id(f_ptr->id()); @@ -397,6 +401,8 @@ bool translation_unit_visitor::VisitFunctionDecl(clang::FunctionDecl *f) f_ptr->set_id(common::to_id(f_ptr->full_name(false))); + f_ptr->is_void(f->getReturnType()->isVoidType()); + context().update(f); context().set_caller_id(f_ptr->id()); @@ -441,6 +447,9 @@ bool translation_unit_visitor::VisitFunctionTemplateDecl( f_ptr->set_id(common::to_id(f_ptr->full_name(false))); + f_ptr->is_void( + function_template->getAsFunction()->getReturnType()->isVoidType()); + set_source_location(*function_template, *f_ptr); context().update(function_template); diff --git a/tests/t20005/test_case.h b/tests/t20005/test_case.h index 476ee657..add8b058 100644 --- a/tests/t20005/test_case.h +++ b/tests/t20005/test_case.h @@ -35,9 +35,10 @@ TEST_CASE("t20005", "[test-case][sequence]") REQUIRE_THAT(puml, EndsWith("@enduml\n")); // Check if all calls exist + REQUIRE_THAT(puml, HasEntrypoint(_A("C"), "c(T)")); REQUIRE_THAT(puml, HasCall(_A("C"), _A("B"), "b(T)")); REQUIRE_THAT(puml, HasCall(_A("B"), _A("A"), "a(T)")); - + REQUIRE_THAT(puml, HasExitpoint(_A("C"))); save_puml( "./" + config.output_directory() + "/" + diagram->name + ".puml", puml); } \ No newline at end of file diff --git a/tests/t20017/test_case.h b/tests/t20017/test_case.h index 94c4bf1a..d16bcc96 100644 --- a/tests/t20017/test_case.h +++ b/tests/t20017/test_case.h @@ -35,16 +35,19 @@ TEST_CASE("t20017", "[test-case][sequence]") REQUIRE_THAT(puml, EndsWith("@enduml\n")); // Check if all calls exist + REQUIRE_THAT(puml, HasEntrypoint(_A("t20017.cc"), "tmain()")); REQUIRE_THAT(puml, HasCall(_A("t20017.cc"), _A("include/t20017_a.h"), "a1(int,int)")); - REQUIRE_THAT( - puml, HasCall(_A("t20017.cc"), _A("include/t20017_a.h"), "a2(int,int)")); + REQUIRE_THAT(puml, + HasCall(_A("t20017.cc"), _A("include/t20017_a.h"), "a2(int,int)")); REQUIRE_THAT(puml, HasCall(_A("t20017.cc"), _A("include/t20017_a.h"), "a3(int,int)")); REQUIRE_THAT(puml, HasCall(_A("t20017.cc"), _A("include/t20017_b.h"), "b1(int,int)")); REQUIRE_THAT(puml, - HasCall(_A("t20017.cc"), _A("include/t20017_b.h"), "b2(int,int)")); + HasCall( + _A("t20017.cc"), _A("include/t20017_b.h"), "b2(int,int)")); + REQUIRE_THAT(puml, HasExitpoint(_A("t20017.cc"))); save_puml( "./" + config.output_directory() + "/" + diagram->name + ".puml", puml); diff --git a/tests/test_cases.cc b/tests/test_cases.cc index 80695a32..8846bfbe 100644 --- a/tests/test_cases.cc +++ b/tests/test_cases.cc @@ -310,4 +310,4 @@ int main(int argc, char *argv[]) clanguml::util::setup_logging(debug_log); return session.run(); -} +} \ No newline at end of file diff --git a/tests/test_cases.h b/tests/test_cases.h index 25ddc23f..f4e9fd87 100644 --- a/tests/test_cases.h +++ b/tests/test_cases.h @@ -79,26 +79,19 @@ template constexpr bool has_type() noexcept return (std::is_same_v || ... || false); } -struct Public { -}; +struct Public { }; -struct Protected { -}; +struct Protected { }; -struct Private { -}; +struct Private { }; -struct Abstract { -}; +struct Abstract { }; -struct Static { -}; +struct Static { }; -struct Const { -}; +struct Const { }; -struct Default { -}; +struct Default { }; struct HasCallWithResultMatcher : ContainsMatcher { HasCallWithResultMatcher( @@ -144,6 +137,20 @@ auto HasCallWithResponse(std::string const &from, std::string const &to, CasedString(fmt::format("{} --> {}", to, from), caseSensitivity)); } +ContainsMatcher HasEntrypoint(std::string const &to, std::string const &message, + CaseSensitive::Choice caseSensitivity = CaseSensitive::Yes) +{ + return ContainsMatcher( + CasedString(fmt::format("[-> {} : {}", to, message), caseSensitivity)); +} + +ContainsMatcher HasExitpoint(std::string const &to, + CaseSensitive::Choice caseSensitivity = CaseSensitive::Yes) +{ + return ContainsMatcher( + CasedString(fmt::format("[<-- {}", to), caseSensitivity)); +} + struct AliasMatcher { AliasMatcher(const std::string &puml_) : puml{split(puml_, "\n")} From 290e1ab0fe08dad717ea8d3dadd6730ca7079701 Mon Sep 17 00:00:00 2001 From: Bartek Kryza Date: Fri, 9 Dec 2022 22:12:49 +0100 Subject: [PATCH 55/77] Fixed formatting --- .../visitor/translation_unit_visitor.cc | 3 +-- .../visitor/call_expression_context.cc | 2 +- .../visitor/translation_unit_visitor.h | 5 +---- tests/t20001/test_case.h | 3 ++- tests/t20012/test_case.h | 1 - tests/t20014/include/t20014_c.h | 8 ++----- tests/t20014/test_case.h | 2 +- tests/t20016/t20016.cc | 5 +++-- tests/t20017/test_case.h | 3 +-- tests/test_cases.h | 21 ++++++++++++------- 10 files changed, 26 insertions(+), 27 deletions(-) diff --git a/src/class_diagram/visitor/translation_unit_visitor.cc b/src/class_diagram/visitor/translation_unit_visitor.cc index 14709b29..3aff1883 100644 --- a/src/class_diagram/visitor/translation_unit_visitor.cc +++ b/src/class_diagram/visitor/translation_unit_visitor.cc @@ -171,10 +171,9 @@ bool translation_unit_visitor::VisitEnumDecl(clang::EnumDecl *enm) } } - if(!id_opt) { + if (!id_opt) { LOG_WARN("Unknown parent for enum {}", qualified_name); return true; - } auto parent_class = diagram_.get_class(*id_opt); diff --git a/src/sequence_diagram/visitor/call_expression_context.cc b/src/sequence_diagram/visitor/call_expression_context.cc index a936dae2..cd75d268 100644 --- a/src/sequence_diagram/visitor/call_expression_context.cc +++ b/src/sequence_diagram/visitor/call_expression_context.cc @@ -177,7 +177,7 @@ void call_expression_context::enter_lambda_expression(std::int64_t id) void call_expression_context::leave_lambda_expression() { - if(current_lambda_caller_id_.empty()) + if (current_lambda_caller_id_.empty()) return; LOG_DBG("Leaving current lambda expression id to {}", diff --git a/src/sequence_diagram/visitor/translation_unit_visitor.h b/src/sequence_diagram/visitor/translation_unit_visitor.h index 3bb75fdc..61d3627a 100644 --- a/src/sequence_diagram/visitor/translation_unit_visitor.h +++ b/src/sequence_diagram/visitor/translation_unit_visitor.h @@ -64,8 +64,6 @@ public: bool VisitFunctionTemplateDecl( clang::FunctionTemplateDecl *function_declaration); - - clanguml::sequence_diagram::model::diagram &diagram(); const clanguml::sequence_diagram::model::diagram &diagram() const; @@ -206,8 +204,7 @@ private: bool is_smart_pointer(const clang::TemplateDecl *primary_template) const; bool is_callee_valid_template_specialization( - const clang::CXXDependentScopeMemberExpr *dependent_member_expr) - const; + const clang::CXXDependentScopeMemberExpr *dependent_member_expr) const; bool process_operator_call_expression(model::message &m, const clang::CXXOperatorCallExpr *operator_call_expr); diff --git a/tests/t20001/test_case.h b/tests/t20001/test_case.h index c50075e6..87f3d4a3 100644 --- a/tests/t20001/test_case.h +++ b/tests/t20001/test_case.h @@ -40,7 +40,8 @@ TEST_CASE("t20001", "[test-case][sequence]") REQUIRE_THAT(puml, HasCall(_A("A"), "log_result(int)")); REQUIRE_THAT(puml, HasCall(_A("B"), _A("A"), "log_result(int)")); - REQUIRE_THAT(puml, HasCallWithResponse(_A("B"), _A("A"), "add3(int,int,int)")); + REQUIRE_THAT( + puml, HasCallWithResponse(_A("B"), _A("A"), "add3(int,int,int)")); REQUIRE_THAT(puml, HasCall(_A("A"), "add(int,int)")); REQUIRE_THAT(puml, !HasCall(_A("A"), _A("detail::C"), "add(int,int)")); diff --git a/tests/t20012/test_case.h b/tests/t20012/test_case.h index cb68ff3e..e639dd23 100644 --- a/tests/t20012/test_case.h +++ b/tests/t20012/test_case.h @@ -68,7 +68,6 @@ TEST_CASE("t20012", "[test-case][sequence]") REQUIRE_THAT(puml, HasCall(_A("tmain()"), _A("D"), "add5(int)")); - save_puml( "./" + config.output_directory() + "/" + diagram->name + ".puml", puml); } \ No newline at end of file diff --git a/tests/t20014/include/t20014_c.h b/tests/t20014/include/t20014_c.h index 83f13875..463cfa8b 100644 --- a/tests/t20014/include/t20014_c.h +++ b/tests/t20014/include/t20014_c.h @@ -4,13 +4,9 @@ namespace clanguml { namespace t20014 { template struct C { - F c1(F i, F j) { - return c_.b1(i, j); - } + F c1(F i, F j) { return c_.b1(i, j); } - F c2(F i, F j){ - return c_.b2(i, j); - } + F c2(F i, F j) { return c_.b2(i, j); } T c_; }; diff --git a/tests/t20014/test_case.h b/tests/t20014/test_case.h index eec0fe57..f92ed6bb 100644 --- a/tests/t20014/test_case.h +++ b/tests/t20014/test_case.h @@ -33,7 +33,7 @@ TEST_CASE("t20014", "[test-case][sequence]") REQUIRE_THAT(puml, StartsWith("@startuml")); REQUIRE_THAT(puml, EndsWith("@enduml\n")); - + // Check if all calls exist REQUIRE_THAT(puml, HasCall(_A("tmain()"), _A("B"), "b1(int,int)")); REQUIRE_THAT(puml, HasCall(_A("B"), _A("A"), "a1(int,int)")); diff --git a/tests/t20016/t20016.cc b/tests/t20016/t20016.cc index 228aad6b..77bf22cb 100644 --- a/tests/t20016/t20016.cc +++ b/tests/t20016/t20016.cc @@ -2,7 +2,7 @@ namespace clanguml { namespace t20016 { struct A { void a1(int a) { } - template T a2(const T &a) { return a;} + template T a2(const T &a) { return a; } }; template struct B { @@ -13,7 +13,8 @@ template struct B { A a_; }; -void tmain() { +void tmain() +{ B b; b.b1(1); diff --git a/tests/t20017/test_case.h b/tests/t20017/test_case.h index d16bcc96..ee5ede2f 100644 --- a/tests/t20017/test_case.h +++ b/tests/t20017/test_case.h @@ -45,8 +45,7 @@ TEST_CASE("t20017", "[test-case][sequence]") REQUIRE_THAT(puml, HasCall(_A("t20017.cc"), _A("include/t20017_b.h"), "b1(int,int)")); REQUIRE_THAT(puml, - HasCall( - _A("t20017.cc"), _A("include/t20017_b.h"), "b2(int,int)")); + HasCall(_A("t20017.cc"), _A("include/t20017_b.h"), "b2(int,int)")); REQUIRE_THAT(puml, HasExitpoint(_A("t20017.cc"))); save_puml( diff --git a/tests/test_cases.h b/tests/test_cases.h index f4e9fd87..ff4da381 100644 --- a/tests/test_cases.h +++ b/tests/test_cases.h @@ -79,19 +79,26 @@ template constexpr bool has_type() noexcept return (std::is_same_v || ... || false); } -struct Public { }; +struct Public { +}; -struct Protected { }; +struct Protected { +}; -struct Private { }; +struct Private { +}; -struct Abstract { }; +struct Abstract { +}; -struct Static { }; +struct Static { +}; -struct Const { }; +struct Const { +}; -struct Default { }; +struct Default { +}; struct HasCallWithResultMatcher : ContainsMatcher { HasCallWithResultMatcher( From fef88325ab05d41e733c308ac7c30ed25fd05ca6 Mon Sep 17 00:00:00 2001 From: Bartek Kryza Date: Fri, 9 Dec 2022 23:05:15 +0100 Subject: [PATCH 56/77] Added support for styling static methods in sequence diagrams --- src/sequence_diagram/model/participant.cc | 13 ++++++++++--- src/sequence_diagram/model/participant.h | 5 +++++ .../visitor/translation_unit_visitor.cc | 1 + tests/t20001/t20001.cc | 2 +- tests/t20001/test_case.h | 4 ++-- 5 files changed, 19 insertions(+), 6 deletions(-) diff --git a/src/sequence_diagram/model/participant.cc b/src/sequence_diagram/model/participant.cc index 55a5f6fd..f9f15098 100644 --- a/src/sequence_diagram/model/participant.cc +++ b/src/sequence_diagram/model/participant.cc @@ -249,12 +249,15 @@ std::string method::full_name(bool /*relative*/) const std::string method::message_name(message_render_mode mode) const { + const std::string style = is_static() ? "__" : ""; + if (mode == message_render_mode::no_arguments) { - return fmt::format("{}(){}", method_name(), is_const() ? " const" : ""); + return fmt::format("{}{}(){}{}", style, method_name(), + is_const() ? " const" : "", style); } - return fmt::format("{}({}){}", method_name(), fmt::join(parameters(), ","), - is_const() ? " const" : ""); + return fmt::format("{}{}({}){}{}", style, method_name(), + fmt::join(parameters(), ","), is_const() ? " const" : "", style); } class_::diagram_element::id_t method::class_id() const { return class_id_; } @@ -265,6 +268,10 @@ std::string method::to_string() const type_name(), id(), full_name(false), class_id()); } +bool method::is_static() const { return is_static_; } + +void method::is_static(bool s) { is_static_ = s; } + function_template::function_template( const common::model::namespace_ &using_namespace) : function{using_namespace} diff --git a/src/sequence_diagram/model/participant.h b/src/sequence_diagram/model/participant.h index 03d59f4e..3b41fb62 100644 --- a/src/sequence_diagram/model/participant.h +++ b/src/sequence_diagram/model/participant.h @@ -200,10 +200,15 @@ struct method : public function { std::string to_string() const override; + bool is_static() const; + + void is_static(bool s); + private: diagram_element::id_t class_id_; std::string method_name_; std::string class_full_name_; + bool is_static_{false}; }; struct function_template : public function, public template_trait { diff --git a/src/sequence_diagram/visitor/translation_unit_visitor.cc b/src/sequence_diagram/visitor/translation_unit_visitor.cc index 14c1a2e8..bd8624c8 100644 --- a/src/sequence_diagram/visitor/translation_unit_visitor.cc +++ b/src/sequence_diagram/visitor/translation_unit_visitor.cc @@ -314,6 +314,7 @@ bool translation_unit_visitor::VisitCXXMethodDecl(clang::CXXMethodDecl *m) m_ptr->set_name( get_participant(m_ptr->class_id()).value().full_name_no_ns() + "::" + m->getNameAsString()); + m_ptr->is_static(m->isStatic()); for (const auto *param : m->parameters()) { m_ptr->add_parameter(simplify_system_template( diff --git a/tests/t20001/t20001.cc b/tests/t20001/t20001.cc index 98135a05..488c19fe 100644 --- a/tests/t20001/t20001.cc +++ b/tests/t20001/t20001.cc @@ -28,7 +28,7 @@ public: return res; } - void log_result(int r) { } + static void log_result(int r) { } private: detail::C m_c{}; diff --git a/tests/t20001/test_case.h b/tests/t20001/test_case.h index 87f3d4a3..0d6ea695 100644 --- a/tests/t20001/test_case.h +++ b/tests/t20001/test_case.h @@ -38,8 +38,8 @@ TEST_CASE("t20001", "[test-case][sequence]") REQUIRE_THAT(puml, StartsWith("@startuml")); REQUIRE_THAT(puml, EndsWith("@enduml\n")); - REQUIRE_THAT(puml, HasCall(_A("A"), "log_result(int)")); - REQUIRE_THAT(puml, HasCall(_A("B"), _A("A"), "log_result(int)")); + REQUIRE_THAT(puml, HasCall(_A("A"), "__log_result(int)__")); + REQUIRE_THAT(puml, HasCall(_A("B"), _A("A"), "__log_result(int)__")); REQUIRE_THAT( puml, HasCallWithResponse(_A("B"), _A("A"), "add3(int,int,int)")); REQUIRE_THAT(puml, HasCall(_A("A"), "add(int,int)")); From 757dd3eed962befc13cbf80b33173019257c372a Mon Sep 17 00:00:00 2001 From: Bartek Kryza Date: Fri, 9 Dec 2022 23:34:52 +0100 Subject: [PATCH 57/77] Added recursive template sequence diagram test case --- .../plantuml/sequence_diagram_generator.cc | 7 +-- src/sequence_diagram/model/participant.cc | 8 +-- src/sequence_diagram/model/participant.h | 10 ++-- tests/t20018/.clang-uml | 14 +++++ tests/t20018/t20018.cc | 20 +++++++ tests/t20018/test_case.h | 57 +++++++++++++++++++ tests/test_cases.cc | 1 + tests/test_cases.yaml | 3 + 8 files changed, 107 insertions(+), 13 deletions(-) create mode 100644 tests/t20018/.clang-uml create mode 100644 tests/t20018/t20018.cc create mode 100644 tests/t20018/test_case.h diff --git a/src/sequence_diagram/generators/plantuml/sequence_diagram_generator.cc b/src/sequence_diagram/generators/plantuml/sequence_diagram_generator.cc index aeb9e1e4..6598d751 100644 --- a/src/sequence_diagram/generators/plantuml/sequence_diagram_generator.cc +++ b/src/sequence_diagram/generators/plantuml/sequence_diagram_generator.cc @@ -90,10 +90,9 @@ void generator::generate_return(const message &m, std::ostream &ostr) const { // Add return activity only for messages between different actors and // only if the return type is different than void - if ((m.from != m.to) && (m.return_type != "void")) { - const auto &from = m_model.get_participant(m.from); - const auto &to = m_model.get_participant(m.to); - + const auto &from = m_model.get_participant(m.from); + const auto &to = m_model.get_participant(m.to); + if ((m.from != m.to) && !to.value().is_void()) { const std::string from_alias = generate_alias(from.value()); const std::string to_alias = generate_alias(to.value()); diff --git a/src/sequence_diagram/model/participant.cc b/src/sequence_diagram/model/participant.cc index f9f15098..fdf61a28 100644 --- a/src/sequence_diagram/model/participant.cc +++ b/src/sequence_diagram/model/participant.cc @@ -209,6 +209,10 @@ bool function::is_void() const { return is_void_; } void function::is_void(bool v) { is_void_ = v; } +bool function::is_static() const { return is_static_; } + +void function::is_static(bool s) { is_static_ = s; } + void function::add_parameter(const std::string &a) { parameters_.push_back(a); } const std::vector &function::parameters() const @@ -268,10 +272,6 @@ std::string method::to_string() const type_name(), id(), full_name(false), class_id()); } -bool method::is_static() const { return is_static_; } - -void method::is_static(bool s) { is_static_ = s; } - function_template::function_template( const common::model::namespace_ &using_namespace) : function{using_namespace} diff --git a/src/sequence_diagram/model/participant.h b/src/sequence_diagram/model/participant.h index 3b41fb62..dce84dec 100644 --- a/src/sequence_diagram/model/participant.h +++ b/src/sequence_diagram/model/participant.h @@ -160,6 +160,10 @@ struct function : public participant { void is_void(bool v); + bool is_static() const; + + void is_static(bool s); + void add_parameter(const std::string &a); const std::vector ¶meters() const; @@ -167,6 +171,7 @@ struct function : public participant { private: bool is_const_{false}; bool is_void_{false}; + bool is_static_{false}; std::vector parameters_; }; @@ -200,15 +205,10 @@ struct method : public function { std::string to_string() const override; - bool is_static() const; - - void is_static(bool s); - private: diagram_element::id_t class_id_; std::string method_name_; std::string class_full_name_; - bool is_static_{false}; }; struct function_template : public function, public template_trait { diff --git a/tests/t20018/.clang-uml b/tests/t20018/.clang-uml new file mode 100644 index 00000000..a3f634da --- /dev/null +++ b/tests/t20018/.clang-uml @@ -0,0 +1,14 @@ +compilation_database_dir: .. +output_directory: puml +diagrams: + t20018_sequence: + type: sequence + glob: + - ../../tests/t20018/t20018.cc + include: + namespaces: + - clanguml::t20018 + using_namespace: + - clanguml::t20018 + start_from: + - function: "clanguml::t20018::tmain()" \ No newline at end of file diff --git a/tests/t20018/t20018.cc b/tests/t20018/t20018.cc new file mode 100644 index 00000000..6d36524c --- /dev/null +++ b/tests/t20018/t20018.cc @@ -0,0 +1,20 @@ +#include + +namespace clanguml { +namespace t20018 { + +template struct Factorial { + static const int value = N * Factorial::value; + + static void print() { Factorial::print(); } +}; + +template <> struct Factorial<0> { + static const int value = 1; + + static void print() { std::cout << "Hello world\n"; } +}; + +void tmain() { Factorial<5>::print(); } +} +} \ No newline at end of file diff --git a/tests/t20018/test_case.h b/tests/t20018/test_case.h new file mode 100644 index 00000000..18734c5d --- /dev/null +++ b/tests/t20018/test_case.h @@ -0,0 +1,57 @@ +/** + * tests/t20018/test_case.h + * + * Copyright (c) 2021-2022 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("t20018", "[test-case][sequence]") +{ + auto [config, db] = load_config("t20018"); + + auto diagram = config.diagrams["t20018_sequence"]; + + REQUIRE(diagram->name == "t20018_sequence"); + + auto model = generate_sequence_diagram(*db, diagram); + + REQUIRE(model->name() == "t20018_sequence"); + + auto puml = generate_sequence_puml(diagram, *model); + AliasMatcher _A(puml); + + REQUIRE_THAT(puml, StartsWith("@startuml")); + REQUIRE_THAT(puml, EndsWith("@enduml\n")); + + // Check if all calls exist + REQUIRE_THAT( + puml, HasCall(_A("Factorial<5>"), _A("Factorial<4>"), "__print()__")); + REQUIRE_THAT(puml, + !HasCallWithResponse( + _A("Factorial<5>"), _A("Factorial<4>"), "__print()__")); + REQUIRE_THAT( + puml, HasCall(_A("Factorial<4>"), _A("Factorial<3>"), "__print()__")); + REQUIRE_THAT( + puml, HasCall(_A("Factorial<3>"), _A("Factorial<2>"), "__print()__")); + REQUIRE_THAT( + puml, HasCall(_A("Factorial<2>"), _A("Factorial<1>"), "__print()__")); + REQUIRE_THAT( + puml, HasCall(_A("Factorial<1>"), _A("Factorial<0>"), "__print()__")); + + // REQUIRE_THAT(puml, HasCall("A", "log_result")); + // REQUIRE_THAT(puml, HasCallWithResponse("B", "A", "add3")); + + save_puml( + "./" + config.output_directory() + "/" + diagram->name + ".puml", puml); +} \ No newline at end of file diff --git a/tests/test_cases.cc b/tests/test_cases.cc index 8846bfbe..5a875638 100644 --- a/tests/test_cases.cc +++ b/tests/test_cases.cc @@ -264,6 +264,7 @@ using namespace clanguml::test::matchers; #include "t20015/test_case.h" #include "t20016/test_case.h" #include "t20017/test_case.h" +#include "t20018/test_case.h" /// /// Package diagram tests diff --git a/tests/test_cases.yaml b/tests/test_cases.yaml index 4651bcda..ccaf8d29 100644 --- a/tests/test_cases.yaml +++ b/tests/test_cases.yaml @@ -199,6 +199,9 @@ test_cases: - name: t20017 title: Test case for combine_free_functions_into_file_participants option description: + - name: t20018 + title: Recursive template sequence diagram test case + description: Package diagrams: - name: t30001 title: Basic package diagram test case From 8e3a7ed4360cc716cbe7da3b623a472a84d8c82e Mon Sep 17 00:00:00 2001 From: Bartek Kryza Date: Fri, 9 Dec 2022 23:49:34 +0100 Subject: [PATCH 58/77] Updated test case documentation --- docs/test_cases.md | 2 + docs/test_cases/t00002_class.svg | 36 +-- docs/test_cases/t00003_class.svg | 46 +-- docs/test_cases/t00004_class.svg | 76 ++--- docs/test_cases/t00005_class.svg | 110 +++---- docs/test_cases/t00006_class.svg | 132 ++++----- docs/test_cases/t00007_class.svg | 30 +- docs/test_cases/t00008_class.svg | 56 ++-- docs/test_cases/t00009_class.svg | 32 +- docs/test_cases/t00010_class.svg | 34 +-- docs/test_cases/t00011_class.svg | 22 +- docs/test_cases/t00012_class.svg | 66 ++--- docs/test_cases/t00013_class.svg | 82 +++--- docs/test_cases/t00014_class.svg | 116 ++++---- docs/test_cases/t00015_class.svg | 22 +- docs/test_cases/t00016_class.svg | 30 +- docs/test_cases/t00017_class.svg | 66 ++--- docs/test_cases/t00018_class.svg | 18 +- docs/test_cases/t00019_class.svg | 40 +-- docs/test_cases/t00020_class.svg | 38 +-- docs/test_cases/t00021_class.svg | 30 +- docs/test_cases/t00022_class.svg | 14 +- docs/test_cases/t00023_class.svg | 26 +- docs/test_cases/t00024_class.svg | 22 +- docs/test_cases/t00025_class.svg | 34 +-- docs/test_cases/t00026_class.svg | 42 +-- docs/test_cases/t00027_class.svg | 58 ++-- docs/test_cases/t00028_class.svg | 78 ++--- docs/test_cases/t00029_class.svg | 50 ++-- docs/test_cases/t00030_class.svg | 46 +-- docs/test_cases/t00031_class.svg | 50 ++-- docs/test_cases/t00032_class.svg | 40 +-- docs/test_cases/t00033_class.svg | 48 +-- docs/test_cases/t00034_class.svg | 46 +-- docs/test_cases/t00035_class.svg | 22 +- docs/test_cases/t00036_class.svg | 38 +-- docs/test_cases/t00037_class.svg | 54 ++-- docs/test_cases/t00038_class.svg | 58 ++-- docs/test_cases/t00039_class.svg | 78 ++--- docs/test_cases/t00040_class.svg | 26 +- docs/test_cases/t00041_class.svg | 54 ++-- docs/test_cases/t00042_class.svg | 36 +-- docs/test_cases/t00043_class.svg | 50 ++-- docs/test_cases/t00044_class.svg | 36 +-- docs/test_cases/t00045_class.svg | 70 ++--- docs/test_cases/t00046_class.svg | 64 ++-- docs/test_cases/t00047_class.svg | 22 +- docs/test_cases/t00048_class.svg | 50 ++-- docs/test_cases/t00049_class.svg | 32 +- docs/test_cases/t00050_class.svg | 70 ++--- docs/test_cases/t20001.md | 2 +- docs/test_cases/t20001_sequence.svg | 92 +++--- docs/test_cases/t20002_sequence.svg | 58 ++-- docs/test_cases/t20003_sequence.svg | 58 ++-- docs/test_cases/t20005_sequence.svg | 71 ++--- docs/test_cases/t20006_sequence.svg | 222 +++++++------- docs/test_cases/t20008_sequence.svg | 124 ++++---- docs/test_cases/t20009_sequence.svg | 124 ++++---- docs/test_cases/t20010_sequence.svg | 116 ++++---- docs/test_cases/t20011_sequence.svg | 132 ++++----- docs/test_cases/t20012_sequence.svg | 440 ++++++++++++---------------- docs/test_cases/t20015_sequence.svg | 30 +- docs/test_cases/t20016.md | 5 +- docs/test_cases/t20016_sequence.svg | 72 +++-- docs/test_cases/t20017.md | 44 +++ docs/test_cases/t20017_sequence.svg | 70 +++++ docs/test_cases/t20018.md | 44 +++ docs/test_cases/t20018_sequence.svg | 80 +++++ docs/test_cases/t30001_package.svg | 48 +-- docs/test_cases/t30002_package.svg | 90 +++--- docs/test_cases/t30003_package.svg | 26 +- docs/test_cases/t30004_package.svg | 30 +- docs/test_cases/t30005_package.svg | 38 +-- docs/test_cases/t30006_package.svg | 16 +- docs/test_cases/t30007_package.svg | 20 +- docs/test_cases/t30008_package.svg | 34 +-- docs/test_cases/t40001_include.svg | 30 +- docs/test_cases/t40002_include.svg | 34 +-- docs/test_cases/t40003_include.svg | 50 ++-- 79 files changed, 2337 insertions(+), 2261 deletions(-) create mode 100644 docs/test_cases/t20017.md create mode 100644 docs/test_cases/t20017_sequence.svg create mode 100644 docs/test_cases/t20018.md create mode 100644 docs/test_cases/t20018_sequence.svg diff --git a/docs/test_cases.md b/docs/test_cases.md index 6b6ca506..e0ef58b4 100644 --- a/docs/test_cases.md +++ b/docs/test_cases.md @@ -66,6 +66,8 @@ * [t20014](./test_cases/t20014.md) - Multiple translation units sequence diagram test case * [t20015](./test_cases/t20015.md) - Class exclusion by namespace in sequence diagram test case * [t20016](./test_cases/t20016.md) - Template method specialization sequence diagram test case + * [t20017](./test_cases/t20017.md) - Test case for combine_free_functions_into_file_participants option + * [t20018](./test_cases/t20018.md) - Recursive template sequence diagram test case ## Package diagrams * [t30001](./test_cases/t30001.md) - Basic package diagram test case * [t30002](./test_cases/t30002.md) - Package dependency test case diff --git a/docs/test_cases/t00002_class.svg b/docs/test_cases/t00002_class.svg index 64b1efaf..f34e8433 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_class.svg b/docs/test_cases/t00003_class.svg index 413aa342..b217887f 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_class.svg b/docs/test_cases/t00004_class.svg index 8579a6cb..904a6605 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,15 +59,15 @@ Red - - + + A::AA::AAA - + C::B @@ -75,8 +75,8 @@ int - - + + C @@ -84,39 +84,39 @@ T - + - + t : T - + - + b_int : B<int> - - + + C::AA - - + + C::AA::AAA - - + + C::AA::CCC @@ -125,8 +125,8 @@ CCC_2 - - + + C::B @@ -134,16 +134,16 @@ V - + - + b : V - - + + C::CC @@ -152,16 +152,16 @@ CC_2 - - + + detail::D - - + + detail::D::AA @@ -171,8 +171,8 @@ AA_3 - - + + detail::D::DD diff --git a/docs/test_cases/t00005_class.svg b/docs/test_cases/t00005_class.svg index 6982f415..5e5a8948 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_class.svg b/docs/test_cases/t00006_class.svg index 53c03497..e890b435 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,15 +146,15 @@ T - + - + data : std::vector<T> - + custom_container @@ -162,102 +162,102 @@ 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_class.svg b/docs/test_cases/t00007_class.svg index 47895320..8da229ee 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_class.svg b/docs/test_cases/t00008_class.svg index 3160727e..123048aa 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,CMP,int N - + - + 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,15 +87,15 @@ T,C<> - + - + template_template : C<T> - + B @@ -103,18 +103,18 @@ int,Vector - - + + D - + - + ints : B<int,Vector> diff --git a/docs/test_cases/t00009_class.svg b/docs/test_cases/t00009_class.svg index 1e0333d5..b1308bd8 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,15 +18,15 @@ T - + - + value : T - + A @@ -34,7 +34,7 @@ int - + A @@ -42,7 +42,7 @@ std::string - + A @@ -50,32 +50,32 @@ 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_class.svg b/docs/test_cases/t00010_class.svg index 126b45a4..32ac1cdd 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,22 +18,22 @@ T,P - + - + first : T - + - + second : P - + A @@ -41,8 +41,8 @@ T,std::string - - + + B @@ -50,15 +50,15 @@ T - + - + astring : A<T,std::string> - + B @@ -66,18 +66,18 @@ int - - + + C - + - + aintstring : B<int> diff --git a/docs/test_cases/t00011_class.svg b/docs/test_cases/t00011_class.svg index decb81fd..c0621f45 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_class.svg b/docs/test_cases/t00012_class.svg index b4545c61..dd3f2bed 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,14 +60,14 @@ - + - + ints : std::array<T,sizeof...(Is)> - + A @@ -75,7 +75,7 @@ int,std::string,float - + A @@ -83,7 +83,7 @@ int,std::string,bool - + B @@ -91,7 +91,7 @@ 3,2,1 - + B @@ -99,7 +99,7 @@ 1,1,1,1 - + C @@ -107,50 +107,50 @@ 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_class.svg b/docs/test_cases/t00013_class.svg index 53f44623..1283ecfd 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,15 +18,15 @@ T - + - + f : T - + ABCD::F @@ -34,70 +34,70 @@ int - - + + A - + - + a : int - - + + B - + - + b : int - - + + C - + - + c : int - - + + D - + - + d : int print(R * r) : void - - + + E @@ -105,16 +105,16 @@ T - + - + e : T - - + + G @@ -122,22 +122,22 @@ T,Args... - + - + g : T - + - + args : std::tuple<Args...> - + E @@ -145,7 +145,7 @@ int - + G @@ -153,7 +153,7 @@ int,float,std::string - + E @@ -161,25 +161,25 @@ std::string - - + + R - + - + gintstring : G<int,float,std::string> - + - + estring : E<std::string> diff --git a/docs/test_cases/t00014_class.svg b/docs/test_cases/t00014_class.svg index 0c1e0ac9..09fbc42b 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,37 +18,37 @@ T,P - + - + t : T - + - + p : P - - + + B - + - + value : std::string - + A @@ -56,7 +56,7 @@ T,std::string - + A @@ -64,7 +64,7 @@ T,std::unique_ptr<std::string> - + A @@ -72,7 +72,7 @@ long,T - + A @@ -80,7 +80,7 @@ double,T - + A @@ -88,7 +88,7 @@ long,U - + A @@ -96,7 +96,7 @@ long,bool - + A @@ -104,7 +104,7 @@ double,bool - + A @@ -112,7 +112,7 @@ long,float - + A @@ -120,7 +120,7 @@ double,float - + A @@ -128,7 +128,7 @@ bool,std::string - + A @@ -136,7 +136,7 @@ float,std::unique_ptr<std::string> - + A @@ -144,7 +144,7 @@ int,std::string - + A @@ -152,7 +152,7 @@ std::string,std::string - + A @@ -160,7 +160,7 @@ char,std::string - + A @@ -168,116 +168,116 @@ wchar_t,std::string - - + + R - + - + 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 - + - + bs : BVector - + - + bs2 : BVector2 - + - + cb : SimpleCallback<ACharString> - + - + gcb : GenericCallback<R::AWCharString> - + - + vcb : VoidCallback - + - + vps : VectorPtr<B> diff --git a/docs/test_cases/t00015_class.svg b/docs/test_cases/t00015_class.svg index 8caebc40..8a0f20fd 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_class.svg b/docs/test_cases/t00016_class.svg index 89b2579c..5f87dfcb 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<> @@ -19,8 +19,8 @@ value : enum - - + + is_numeric @@ -29,8 +29,8 @@ value : enum - - + + is_numeric @@ -41,8 +41,8 @@ value : enum - - + + is_numeric @@ -53,8 +53,8 @@ value : enum - - + + is_numeric @@ -65,8 +65,8 @@ value : enum - - + + is_numeric @@ -77,8 +77,8 @@ value : enum - - + + is_numeric diff --git a/docs/test_cases/t00017_class.svg b/docs/test_cases/t00017_class.svg index 85c6a466..3f7dbb5a 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_class.svg b/docs/test_cases/t00018_class.svg index 4ab5ec2b..dd1f8a6f 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_class.svg b/docs/test_cases/t00019_class.svg index 6bbf6a8a..49561057 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,7 +83,7 @@ m1_calls() const : int m2_calls() const : int - + Layer3 @@ -91,7 +91,7 @@ Base - + Layer2 @@ -99,7 +99,7 @@ Layer3<Base> - + Layer1 @@ -107,18 +107,18 @@ Layer2<Layer3<Base>> - - + + A - + - + layers : std::unique_ptr<Layer1<Layer2<Layer3<Base>>>> diff --git a/docs/test_cases/t00020_class.svg b/docs/test_cases/t00020_class.svg index 324ce76e..91c560f7 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_class.svg b/docs/test_cases/t00021_class.svg index 64ef3a83..99625c1c 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_class.svg b/docs/test_cases/t00022_class.svg index d351e80b..89882e5b 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_class.svg b/docs/test_cases/t00023_class.svg index 566384d7..ecba7a30 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_class.svg b/docs/test_cases/t00024_class.svg index 0e023e80..4e32656f 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_class.svg b/docs/test_cases/t00025_class.svg index e3d80b8f..86ed0c12 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,7 +56,7 @@ m1() : void m2() : void - + Proxy @@ -64,7 +64,7 @@ Target1 - + Proxy @@ -72,25 +72,25 @@ Target2 - - + + ProxyHolder - + - + proxy1 : Proxy<Target1> - + - + proxy2 : Proxy<Target2> diff --git a/docs/test_cases/t00026_class.svg b/docs/test_cases/t00026_class.svg index cdd585eb..245b487c 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>(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,7 +78,7 @@ state(const std::string & n) : Memento<T> & set_state(const std::string & s, Memento<T> && m) : void - + Caretaker @@ -86,7 +86,7 @@ std::string - + Originator @@ -94,25 +94,25 @@ std::string - - + + StringMemento - + - + caretaker : Caretaker<std::string> - + - + originator : Originator<std::string> diff --git a/docs/test_cases/t00027_class.svg b/docs/test_cases/t00027_class.svg index e89cc77d..049f1e3d 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,14 @@ ~Shape() = default : void - + Line - - + + Line @@ -39,14 +39,14 @@ display() : void - + Text - - + + Text @@ -57,8 +57,8 @@ display() : void - - + + ShapeDecorator @@ -67,8 +67,8 @@ display() = 0 : void - - + + Color @@ -79,8 +79,8 @@ display() : void - - + + Weight @@ -91,7 +91,7 @@ display() : void - + Line @@ -99,7 +99,7 @@ Color,Weight - + Line @@ -107,7 +107,7 @@ Color - + Text @@ -115,7 +115,7 @@ Color,Weight - + Text @@ -123,39 +123,39 @@ Color - - + + Window - + - + border : Line<Color,Weight> - + - + divider : Line<Color> - + - + title : Text<Color,Weight> - + - + description : Text<Color> diff --git a/docs/test_cases/t00028_class.svg b/docs/test_cases/t00028_class.svg index 82b4515e..c25521d7 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,10 +94,10 @@ three - + F enum note. - + E @@ -105,59 +105,59 @@ 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. diff --git a/docs/test_cases/t00029_class.svg b/docs/test_cases/t00029_class.svg index a7a0f504..b6986125 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_class.svg b/docs/test_cases/t00030_class.svg index 896b19d1..7df8a4a4 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_class.svg b/docs/test_cases/t00031_class.svg index c7884f54..666239a9 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,23 +47,23 @@ T - + - + ttt : T - - + + D - + C @@ -71,39 +71,39 @@ int - - + + R - + - + aaa : A * - + - + bbb : std::vector<B> - + - + ccc : C<int> - + - + ddd : D * diff --git a/docs/test_cases/t00032_class.svg b/docs/test_cases/t00032_class.svg index 07e6cd71..d064febd 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,15 +64,15 @@ T,L,Ts... - + - + counter : L - + Overload @@ -80,18 +80,18 @@ TBase,int,A,B,C - - + + R - + - + overload : Overload<TBase,int,A,B,C> diff --git a/docs/test_cases/t00033_class.svg b/docs/test_cases/t00033_class.svg index 536765f1..b60b7142 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,30 +52,30 @@ T - + - + ccc : T - - + + D - + - + ddd : int - + C @@ -83,7 +83,7 @@ D - + B @@ -91,7 +91,7 @@ std::unique_ptr<C<D>> - + A @@ -99,18 +99,18 @@ B<std::unique_ptr<C<D>>> - - + + R - + - + abc : A<B<std::unique_ptr<C<D>>>> diff --git a/docs/test_cases/t00034_class.svg b/docs/test_cases/t00034_class.svg index 610b32b3..27540fa9 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,16 +31,16 @@ - - + + lift_void - - + + lift_void @@ -49,8 +49,8 @@ - - + + drop_void @@ -59,16 +59,16 @@ - - + + drop_void - - + + drop_void @@ -77,33 +77,33 @@ - - + + A - - + + R - + - + la : lift_void_t<A> * - + - + lv : lift_void_t<void> * diff --git a/docs/test_cases/t00035_class.svg b/docs/test_cases/t00035_class.svg index 09267742..8f11ebc5 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_class.svg b/docs/test_cases/t00036_class.svg index 046dcdb8..21ab6710 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,15 +43,15 @@ T - + - + a : T - + A @@ -59,23 +59,23 @@ int - - + + B - + - + a_int : A<int> - - + + C diff --git a/docs/test_cases/t00037_class.svg b/docs/test_cases/t00037_class.svg index d24eb966..3245bb19 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_620) - + - + units : ST::(anonymous_739) - - + + 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_class.svg b/docs/test_cases/t00038_class.svg index c72a0d21..9da98248 100644 --- a/docs/test_cases/t00038_class.svg +++ b/docs/test_cases/t00038_class.svg @@ -1,6 +1,6 @@ - + @@ -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,16 +88,16 @@ - - + + map - - + + map @@ -106,8 +106,8 @@ - - + + map @@ -116,8 +116,8 @@ - - + + map @@ -126,8 +126,8 @@ - - + + map diff --git a/docs/test_cases/t00039_class.svg b/docs/test_cases/t00039_class.svg index 83df6e3c..5ddff932 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_class.svg b/docs/test_cases/t00040_class.svg index 994380b2..4a15f818 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_class.svg b/docs/test_cases/t00041_class.svg index 3cef6e1d..42abbbfb 100644 --- a/docs/test_cases/t00041_class.svg +++ b/docs/test_cases/t00041_class.svg @@ -1,6 +1,6 @@ - + @@ -9,100 +9,100 @@ - - + + R - - + + D - + - + rr : RR * - - + + E - - + + F - - + + RR - + - + e : E * - + - + f : F * - + - + g : detail::G * - - + + RRR - - + + ns1::N - - + + ns1::NN - - + + ns1::NM diff --git a/docs/test_cases/t00042_class.svg b/docs/test_cases/t00042_class.svg index 5a963472..13b567db 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,22 +52,22 @@ T,K - + - + b : T - + - + bb : K - + A @@ -75,7 +75,7 @@ double - + A @@ -83,7 +83,7 @@ std::string - + B diff --git a/docs/test_cases/t00043_class.svg b/docs/test_cases/t00043_class.svg index 8e9756e1..2c1b0610 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_class.svg b/docs/test_cases/t00044_class.svg index 3eb59655..5d038e8a 100644 --- a/docs/test_cases/t00044_class.svg +++ b/docs/test_cases/t00044_class.svg @@ -1,6 +1,6 @@ - + @@ -9,7 +9,7 @@ - + signal_handler @@ -17,8 +17,8 @@ ,A - - + + sink @@ -27,15 +27,15 @@ sink<signal_handler<type-parameter-0-0 (type-parameter-0-1...), type-parameter-0-2> >(sink<signal_handler<type-parameter-0-0 (type-parameter-0-1...),type-parameter-0-2>>::signal_t & sh) : void - + - + signal : sink<signal_handler<type-parameter-0-0 (type-parameter-0-1...),type-parameter-0-2>>::signal_t * - - + + sink @@ -46,23 +46,23 @@ sink<signal_handler<type-parameter-0-0 (type-parameter-0-1...), type-parameter-0-2> >(sink<signal_handler<type-parameter-0-0 (type-parameter-0-1...),type-parameter-0-2>>::signal_t & sh) : void - + - + signal : sink<signal_handler<type-parameter-0-0 (type-parameter-0-1...),type-parameter-0-2>>::signal_t * - - + + signal_handler - - + + signal_handler @@ -71,8 +71,8 @@ - - + + signal_handler @@ -81,8 +81,8 @@ - - + + sink diff --git a/docs/test_cases/t00045_class.svg b/docs/test_cases/t00045_class.svg index 2f7fe50d..a0c9c563 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_class.svg b/docs/test_cases/t00046_class.svg index 9419a5a4..e3ff02cf 100644 --- a/docs/test_cases/t00046_class.svg +++ b/docs/test_cases/t00046_class.svg @@ -1,6 +1,6 @@ - + @@ -9,118 +9,118 @@ - + ns1 - + ns2 - + __gnu_cxx - - + + A - - + + A - - + + B - - + + C - - + + D - - + + E - - + + R - + - + a : ns1::ns2::A * - + - + ns1_a : ns1::A * - + - + ns1_ns2_a : ns1::ns2::A * - + - + root_a : ::A * - + - + i : std::vector<std::uint8_t> foo(AA & aa) : void - - + + A - - + + AA diff --git a/docs/test_cases/t00047_class.svg b/docs/test_cases/t00047_class.svg index 1bf4e663..ba829b5a 100644 --- a/docs/test_cases/t00047_class.svg +++ b/docs/test_cases/t00047_class.svg @@ -1,6 +1,6 @@ - + @@ -9,16 +9,16 @@ - - + + conditional_t - - + + conditional_t @@ -27,8 +27,8 @@ - - + + conditional_t @@ -37,8 +37,8 @@ - - + + conditional_t @@ -47,8 +47,8 @@ - - + + conditional_t diff --git a/docs/test_cases/t00048_class.svg b/docs/test_cases/t00048_class.svg index a696a6e8..8754e28e 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_class.svg b/docs/test_cases/t00049_class.svg index 8051a29d..3746be71 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,17 +18,17 @@ T - + - + a : T get_a() : T & - + A @@ -36,7 +36,7 @@ intmap - + A @@ -44,7 +44,7 @@ thestring - + A @@ -52,32 +52,32 @@ std::vector<thestring> - - + + R - + - + a_string : A<thestring> - + - + a_vector_string : A<string_vector> - + - + a_int_map : A<intmap> diff --git a/docs/test_cases/t00050_class.svg b/docs/test_cases/t00050_class.svg index ce7f3d87..3d684f3d 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 diff --git a/docs/test_cases/t20001.md b/docs/test_cases/t20001.md index 27ad35e4..2636828b 100644 --- a/docs/test_cases/t20001.md +++ b/docs/test_cases/t20001.md @@ -58,7 +58,7 @@ public: return res; } - void log_result(int r) { } + static void log_result(int r) { } private: detail::C m_c{}; diff --git a/docs/test_cases/t20001_sequence.svg b/docs/test_cases/t20001_sequence.svg index 30070ffe..a6389179 100644 --- a/docs/test_cases/t20001_sequence.svg +++ b/docs/test_cases/t20001_sequence.svg @@ -1,6 +1,6 @@ - + - + @@ -9,35 +9,35 @@ - - - - - - - - - - - + + + + + + + + + + + tmain() - - tmain() - + + tmain() + A - - A - + + A + B - - B - - - - - - - + + B + + + + + + + add(int,int) @@ -58,26 +58,20 @@ - - - - - log_result(int) - - - - - - - - - log_result(int) - - - - - - - Main test function + + + + + log_result(int) + + + + + log_result(int) + + + + + Main test function diff --git a/docs/test_cases/t20002_sequence.svg b/docs/test_cases/t20002_sequence.svg index f64c01ee..0fa87c33 100644 --- a/docs/test_cases/t20002_sequence.svg +++ b/docs/test_cases/t20002_sequence.svg @@ -1,6 +1,6 @@ - + - + @@ -9,45 +9,39 @@ - - - - - - - - - + + + + + + + + + m1() - - m1() - + + m1() + m2() - - m2() - + + m2() + m3() - - m3() - + + m3() + m4() - - m4() - - - - + + m4() + + + + - - - - - - diff --git a/docs/test_cases/t20003_sequence.svg b/docs/test_cases/t20003_sequence.svg index cbad77ad..88c2a521 100644 --- a/docs/test_cases/t20003_sequence.svg +++ b/docs/test_cases/t20003_sequence.svg @@ -1,6 +1,6 @@ - + - + @@ -9,45 +9,39 @@ - - - - - - - - - + + + + + + + + + m1<T>(T) - - m1<T>(T) - + + m1<T>(T) + m2<T>(T) - - m2<T>(T) - + + m2<T>(T) + m3<T>(T) - - m3<T>(T) - + + m3<T>(T) + m4<T>(T) - - m4<T>(T) - - - - + + m4<T>(T) + + + + - - - - - - diff --git a/docs/test_cases/t20005_sequence.svg b/docs/test_cases/t20005_sequence.svg index 5972d6c5..b29820b0 100644 --- a/docs/test_cases/t20005_sequence.svg +++ b/docs/test_cases/t20005_sequence.svg @@ -1,6 +1,6 @@ - + - + @@ -9,36 +9,41 @@ - - - - - - - - C<T> - - C<T> - - B<T> - - B<T> - - A<T> - - A<T> - - - - - - b(T) - - - a(T) - - - - + + + + + + + + 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_sequence.svg b/docs/test_cases/t20006_sequence.svg index fa67054d..222d07c4 100644 --- a/docs/test_cases/t20006_sequence.svg +++ b/docs/test_cases/t20006_sequence.svg @@ -1,6 +1,6 @@ - + - + @@ -9,83 +9,83 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + tmain() - - tmain() - + + tmain() + B<int> - - B<int> - + + B<int> + A<int> - - A<int> - + + A<int> + B<std::string> - - B<std::string> - + + B<std::string> + A<std::string> - - A<std::string> - + + A<std::string> + BB<int,int> - - BB<int,int> - + + BB<int,int> + AA<int> - - AA<int> - + + AA<int> + BB<int,std::string> - - BB<int,std::string> - + + BB<int,std::string> + BB<int,float> - - BB<int,float> - - - - - - - - - - - - - - - - + + BB<int,float> + + + + + + + + + + + + + + + + b(int) @@ -112,58 +112,34 @@ 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) - - - - - - - - + + + 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/t20008_sequence.svg b/docs/test_cases/t20008_sequence.svg index 8b0395e0..e7446630 100644 --- a/docs/test_cases/t20008_sequence.svg +++ b/docs/test_cases/t20008_sequence.svg @@ -1,6 +1,6 @@ - + - + @@ -9,84 +9,72 @@ - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + tmain() - - tmain() - + + tmain() + B<int> - - B<int> - + + B<int> + A<int> - - A<int> - + + A<int> + B<const char *> - - B<const char *> - + + B<const char *> + A<const char *> - - A<const char *> - + + A<const char *> + B<std::string> - - B<std::string> - + + B<std::string> + A<std::string> - - A<std::string> - - - - - - - + + A<std::string> + + + + + + + b(int) a1(int) - - - - - - - b(const char *) - - - a2(const char *) - - - - - - - b(std::string) - - - a3(std::string) - - - - + + + b(const char *) + + + a2(const char *) + + + b(std::string) + + + a3(std::string) diff --git a/docs/test_cases/t20009_sequence.svg b/docs/test_cases/t20009_sequence.svg index 3b7341ab..654f1a6a 100644 --- a/docs/test_cases/t20009_sequence.svg +++ b/docs/test_cases/t20009_sequence.svg @@ -1,6 +1,6 @@ - + - + @@ -9,84 +9,72 @@ - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + tmain() - - tmain() - + + tmain() + B<std::string> - - B<std::string> - + + B<std::string> + A<std::string> - - A<std::string> - + + A<std::string> + B<int> - - B<int> - + + B<int> + A<int> - - A<int> - + + A<int> + B<float> - - B<float> - + + B<float> + A<float> - - A<float> - - - - - - - + + A<float> + + + + + + + b(std::string) a(std::string) - - - - - - - b(int) - - - a(int) - - - - - - - b(float) - - - a(float) - - - - + + + b(int) + + + a(int) + + + b(float) + + + a(float) diff --git a/docs/test_cases/t20010_sequence.svg b/docs/test_cases/t20010_sequence.svg index 305b0a74..2161d5f1 100644 --- a/docs/test_cases/t20010_sequence.svg +++ b/docs/test_cases/t20010_sequence.svg @@ -1,6 +1,6 @@ - + - + @@ -9,78 +9,62 @@ - - - - - - - - - - - - - + + + + + + + + + + + + + tmain() - - tmain() - + + tmain() + B<int> - - B<int> - + + B<int> + A - - A - - - - - - - - - + + A + + + + + + + + + b1() a1() - - - - - - - b2() - - - a2() - - - - - - - b3() - - - a3() - - - - - - - b4() - - - a4() - - - - + + + b2() + + + a2() + + + b3() + + + a3() + + + b4() + + + a4() diff --git a/docs/test_cases/t20011_sequence.svg b/docs/test_cases/t20011_sequence.svg index c3b39bd9..7aaccd7d 100644 --- a/docs/test_cases/t20011_sequence.svg +++ b/docs/test_cases/t20011_sequence.svg @@ -1,6 +1,6 @@ - + - + @@ -9,34 +9,34 @@ - - - - - - - - - - - - + + + + + + + + + + + + tmain() - - tmain() - + + tmain() + A - - A - - - - - - - - - + + A + + + + + + + + + a(int) @@ -45,53 +45,33 @@ a(int) - - - - - b(int) - - - - - c(int) - - - - - d(int) - - - - - b(int) - - - - - - - - - a(int) - - - - - a(int) - - - - - - - - - - - - - - + + + b(int) + + + + + c(int) + + + + + d(int) + + + + + b(int) + + + + + a(int) + + + + + a(int) diff --git a/docs/test_cases/t20012_sequence.svg b/docs/test_cases/t20012_sequence.svg index ce5670cd..6d4e796d 100644 --- a/docs/test_cases/t20012_sequence.svg +++ b/docs/test_cases/t20012_sequence.svg @@ -1,6 +1,6 @@ - + - + @@ -9,101 +9,101 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + tmain() - - tmain() - + + tmain() + tmain()::(lambda t20012.cc:66:20) - - tmain()::(lambda t20012.cc:66:20) - + + tmain()::(lambda t20012.cc:66:20) + A - - A - - B - - B - - tmain()::(lambda t20012.cc:79:20) - - tmain()::(lambda t20012.cc:79:20) - - C - - C - - R<R::(lambda t20012.cc:85:9)> - - R<R::(lambda t20012.cc:85:9)> - - tmain()::(lambda t20012.cc:85:9) - - tmain()::(lambda t20012.cc:85:9) - - D - - D - - - - - - - - - - - - - - - - - - - - - - - - - + + A + + B + + B + + tmain()::(lambda t20012.cc:79:20) + + tmain()::(lambda t20012.cc:79:20) + + C + + C + + R<R::(lambda t20012.cc:85:9)> + + R<R::(lambda t20012.cc:85:9)> + + tmain()::(lambda t20012.cc:85:9) + + tmain()::(lambda t20012.cc:85:9) + + D + + D + + + + + + + + + + + + + + + + + + + + + + + + + operator()() @@ -115,162 +115,100 @@ aa() - - - - - aaa() - - - - - - - - - - - - - b() - - - - - bb() - - - - - bbb() - - - - - - - - - - - - - - - operator()() - - - c() - - - - - cc() - - - - - ccc() - - - - - - - - - - - - - operator()() - - - a() - - - - - aa() - - - - - aaa() - - - - - - - - - - - - - b() - - - - - bb() - - - - - bbb() - - - - - - - - - - - - - - - - - r() - - - operator()() - - - c() - - - - - cc() - - - - - ccc() - - - - - - - - - - - - - - - - - add5(int) - - + + + + + aaa() + + + b() + + + + + bb() + + + + + bbb() + + + + + operator()() + + + c() + + + + + cc() + + + + + ccc() + + + operator()() + + + a() + + + + + aa() + + + + + aaa() + + + b() + + + + + bb() + + + + + bbb() + + + + + + + r() + + + operator()() + + + c() + + + + + cc() + + + + + ccc() + + + + + add5(int) + + diff --git a/docs/test_cases/t20015_sequence.svg b/docs/test_cases/t20015_sequence.svg index 982bfe2c..0fa1410e 100644 --- a/docs/test_cases/t20015_sequence.svg +++ b/docs/test_cases/t20015_sequence.svg @@ -1,6 +1,6 @@ - + - + @@ -9,24 +9,22 @@ - - - - - + + + + + tmain() - - tmain() - + + tmain() + B - - B - - + + B + + setup_a(std::shared_ptr<detail::A> &) - - diff --git a/docs/test_cases/t20016.md b/docs/test_cases/t20016.md index 303acfc2..a9dcb528 100644 --- a/docs/test_cases/t20016.md +++ b/docs/test_cases/t20016.md @@ -23,7 +23,7 @@ namespace clanguml { namespace t20016 { struct A { void a1(int a) { } - template T a2(const T &a) { return a;} + template T a2(const T &a) { return a; } }; template struct B { @@ -34,7 +34,8 @@ template struct B { A a_; }; -void tmain() { +void tmain() +{ B b; b.b1(1); diff --git a/docs/test_cases/t20016_sequence.svg b/docs/test_cases/t20016_sequence.svg index 6e292320..a14dbeeb 100644 --- a/docs/test_cases/t20016_sequence.svg +++ b/docs/test_cases/t20016_sequence.svg @@ -1,6 +1,6 @@ - + - + @@ -9,50 +9,46 @@ - - - - - - - - - + + + + + + + + + tmain() - - tmain() - + + tmain() + B<long> - - B<long> - + + B<long> + A - - A - - - - - + + A + + + + + b1(long) a1(int) - - - - - - - b2(long) - - - a2(const long &) - - - - + + + b2(long) + + + a2(const long &) + + + + diff --git a/docs/test_cases/t20017.md b/docs/test_cases/t20017.md new file mode 100644 index 00000000..f4e0fb32 --- /dev/null +++ b/docs/test_cases/t20017.md @@ -0,0 +1,44 @@ +# t20017 - Test case for combine_free_functions_into_file_participants option +## Config +```yaml +compilation_database_dir: .. +output_directory: puml +diagrams: + t20017_sequence: + type: sequence + combine_free_functions_into_file_participants: true + relative_to: ../../tests/t20017 + glob: + - ../../tests/t20017/t20017.cc + include: + namespaces: + - clanguml::t20017 + using_namespace: + - clanguml::t20017 + start_from: + - function: "clanguml::t20017::tmain()" +``` +## Source code +File t20017.cc +```cpp +#include "include/t20017_a.h" +#include "include/t20017_b.h" + +namespace clanguml { +namespace t20017 { +int tmain() { return b2(a1(a2(a3(1, 2), b1(3, 4)), 5), 6); } +} +} +``` +File t20017_b.cc +```cpp +#include "include/t20017_b.h" + +namespace clanguml { +namespace t20017 { +int b1(int x, int y) { return x - y; } +} +} +``` +## Generated UML diagrams +![t20017_sequence](./t20017_sequence.svg "Test case for combine_free_functions_into_file_participants option") diff --git a/docs/test_cases/t20017_sequence.svg b/docs/test_cases/t20017_sequence.svg new file mode 100644 index 00000000..45ffa0d8 --- /dev/null +++ b/docs/test_cases/t20017_sequence.svg @@ -0,0 +1,70 @@ + + + + + + + + + + + + + + + + + + + + + + t20017.cc + + t20017.cc + + include/t20017_b.h + + include/t20017_b.h + + include/t20017_a.h + + include/t20017_a.h + + + + + + + + + tmain() + + + b2<int>(int,int) + + + + + a1(int,int) + + + + + a2(int,int) + + + + + a3(int,int) + + + + + b1(int,int) + + + + + + diff --git a/docs/test_cases/t20018.md b/docs/test_cases/t20018.md new file mode 100644 index 00000000..3b04a2a8 --- /dev/null +++ b/docs/test_cases/t20018.md @@ -0,0 +1,44 @@ +# t20018 - Recursive template sequence diagram test case +## Config +```yaml +compilation_database_dir: .. +output_directory: puml +diagrams: + t20018_sequence: + type: sequence + glob: + - ../../tests/t20018/t20018.cc + include: + namespaces: + - clanguml::t20018 + using_namespace: + - clanguml::t20018 + start_from: + - function: "clanguml::t20018::tmain()" +``` +## Source code +File t20018.cc +```cpp +#include + +namespace clanguml { +namespace t20018 { + +template struct Factorial { + static const int value = N * Factorial::value; + + static void print() { Factorial::print(); } +}; + +template <> struct Factorial<0> { + static const int value = 1; + + static void print() { std::cout << "Hello world\n"; } +}; + +void tmain() { Factorial<5>::print(); } +} +} +``` +## Generated UML diagrams +![t20018_sequence](./t20018_sequence.svg "Recursive template sequence diagram test case") diff --git a/docs/test_cases/t20018_sequence.svg b/docs/test_cases/t20018_sequence.svg new file mode 100644 index 00000000..6dffa7da --- /dev/null +++ b/docs/test_cases/t20018_sequence.svg @@ -0,0 +1,80 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + tmain() + + tmain() + + 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() + + + print() + + + print() + + + print() + + + print() + + diff --git a/docs/test_cases/t30001_package.svg b/docs/test_cases/t30001_package.svg index 2c4ae265..4a3713da 100644 --- a/docs/test_cases/t30001_package.svg +++ b/docs/test_cases/t30001_package.svg @@ -1,6 +1,6 @@ - + @@ -9,63 +9,63 @@ - - + + 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_package.svg b/docs/test_cases/t30002_package.svg index 08c26c26..9ae2a99b 100644 --- a/docs/test_cases/t30002_package.svg +++ b/docs/test_cases/t30002_package.svg @@ -1,6 +1,6 @@ - + @@ -9,113 +9,113 @@ - - + + A - - + + AA - - + + B - - + + BB - - + + A1 - - + + A2 - - + + A3 - - + + A4 - - + + A5 - - + + A6 - - + + A7 - - + + A8 - - + + A9 - - + + A10 - - + + A11 - - + + A12 - - + + A13 - - + + A14 - - + + A15 - - + + A16 - - + + A17 - - + + BBB diff --git a/docs/test_cases/t30003_package.svg b/docs/test_cases/t30003_package.svg index 25436895..8e1e7a5f 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_package.svg b/docs/test_cases/t30004_package.svg index 093008e3..fbfc2c10 100644 --- a/docs/test_cases/t30004_package.svg +++ b/docs/test_cases/t30004_package.svg @@ -1,6 +1,6 @@ - + @@ -9,40 +9,40 @@ - - + + A - + Package AAA. - + Package BBB. - + CCCC package note. - + We skipped DDD. - - + + AAA - - + + BBB - - + + CCC - - + + EEE diff --git a/docs/test_cases/t30005_package.svg b/docs/test_cases/t30005_package.svg index 30e5579d..4f35bd6a 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_package.svg b/docs/test_cases/t30006_package.svg index c1ac3f2c..3063eace 100644 --- a/docs/test_cases/t30006_package.svg +++ b/docs/test_cases/t30006_package.svg @@ -1,6 +1,6 @@ - + @@ -9,22 +9,22 @@ - - + + B - - + + A - - + + C - + Top A note. diff --git a/docs/test_cases/t30007_package.svg b/docs/test_cases/t30007_package.svg index f9217ea1..c0f5894c 100644 --- a/docs/test_cases/t30007_package.svg +++ b/docs/test_cases/t30007_package.svg @@ -1,6 +1,6 @@ - + @@ -9,27 +9,27 @@ - - + + A - - + + B - - + + AA - - + + C - + Compare layout with t30006. diff --git a/docs/test_cases/t30008_package.svg b/docs/test_cases/t30008_package.svg index 3788d025..74b6a7e2 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/t40001_include.svg b/docs/test_cases/t40001_include.svg index 7376527f..5007222d 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 diff --git a/docs/test_cases/t40002_include.svg b/docs/test_cases/t40002_include.svg index 35ca959d..36d5ea1b 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_include.svg b/docs/test_cases/t40003_include.svg index a6ee471d..958de6bb 100644 --- a/docs/test_cases/t40003_include.svg +++ b/docs/test_cases/t40003_include.svg @@ -1,6 +1,6 @@ - + @@ -9,66 +9,66 @@ - + include - + dependants - + dependencies - + src - + dependants - + dependencies - - + + t3.h - - + + t2.h - - + + t1.h - - + + t3.h - - + + t2.h - - + + t1.h - - + + t5.h - - + + t1.cc - - + + t2.cc From 80e94c2e3205bd2454676adf2dd432977ca93213 Mon Sep 17 00:00:00 2001 From: Bartek Kryza Date: Sat, 10 Dec 2022 11:24:00 +0100 Subject: [PATCH 59/77] Updated recursive template sequence diagram test case --- tests/t20018/t20018.cc | 13 ++++++++++--- tests/t20018/test_case.h | 30 ++++++++++++++++-------------- 2 files changed, 26 insertions(+), 17 deletions(-) diff --git a/tests/t20018/t20018.cc b/tests/t20018/t20018.cc index 6d36524c..d2f7a7d2 100644 --- a/tests/t20018/t20018.cc +++ b/tests/t20018/t20018.cc @@ -6,15 +6,22 @@ namespace t20018 { template struct Factorial { static const int value = N * Factorial::value; - static void print() { Factorial::print(); } + static void print(int answer) { Factorial::print(answer); } }; template <> struct Factorial<0> { static const int value = 1; - static void print() { std::cout << "Hello world\n"; } + static void print(int answer) + { + std::cout << "The answer is " << answer << "\n"; + } }; -void tmain() { Factorial<5>::print(); } +template struct Answer { + static void print() { T::print(N); } +}; + +void tmain() { Answer>::print(); } } } \ No newline at end of file diff --git a/tests/t20018/test_case.h b/tests/t20018/test_case.h index 18734c5d..22e4522a 100644 --- a/tests/t20018/test_case.h +++ b/tests/t20018/test_case.h @@ -35,22 +35,24 @@ TEST_CASE("t20018", "[test-case][sequence]") REQUIRE_THAT(puml, EndsWith("@enduml\n")); // Check if all calls exist - REQUIRE_THAT( - puml, HasCall(_A("Factorial<5>"), _A("Factorial<4>"), "__print()__")); + REQUIRE_THAT(puml, + HasCall(_A("tmain()"), _A("Answer,120>"), "__print()__")); + REQUIRE_THAT(puml, + HasCall(_A("Answer,120>"), _A("Factorial<5>"), + "__print(int)__")); + REQUIRE_THAT(puml, + HasCall(_A("Factorial<5>"), _A("Factorial<4>"), "__print(int)__")); REQUIRE_THAT(puml, !HasCallWithResponse( - _A("Factorial<5>"), _A("Factorial<4>"), "__print()__")); - REQUIRE_THAT( - puml, HasCall(_A("Factorial<4>"), _A("Factorial<3>"), "__print()__")); - REQUIRE_THAT( - puml, HasCall(_A("Factorial<3>"), _A("Factorial<2>"), "__print()__")); - REQUIRE_THAT( - puml, HasCall(_A("Factorial<2>"), _A("Factorial<1>"), "__print()__")); - REQUIRE_THAT( - puml, HasCall(_A("Factorial<1>"), _A("Factorial<0>"), "__print()__")); - - // REQUIRE_THAT(puml, HasCall("A", "log_result")); - // REQUIRE_THAT(puml, HasCallWithResponse("B", "A", "add3")); + _A("Factorial<5>"), _A("Factorial<4>"), "__print(int)__")); + REQUIRE_THAT(puml, + HasCall(_A("Factorial<4>"), _A("Factorial<3>"), "__print(int)__")); + REQUIRE_THAT(puml, + HasCall(_A("Factorial<3>"), _A("Factorial<2>"), "__print(int)__")); + REQUIRE_THAT(puml, + HasCall(_A("Factorial<2>"), _A("Factorial<1>"), "__print(int)__")); + REQUIRE_THAT(puml, + HasCall(_A("Factorial<1>"), _A("Factorial<0>"), "__print(int)__")); save_puml( "./" + config.output_directory() + "/" + diagram->name + ".puml", puml); From 3b6d999520d271a4fdd5fa19622324c4dbce886d Mon Sep 17 00:00:00 2001 From: Bartek Kryza Date: Sat, 10 Dec 2022 12:06:12 +0100 Subject: [PATCH 60/77] Added Curiously Recurring Template Pattern sequence diagram test case --- tests/t20019/.clang-uml | 14 +++++++++++++ tests/t20019/t20019.cc | 34 ++++++++++++++++++++++++++++++ tests/t20019/test_case.h | 45 ++++++++++++++++++++++++++++++++++++++++ tests/test_cases.cc | 1 + tests/test_cases.yaml | 3 +++ 5 files changed, 97 insertions(+) create mode 100644 tests/t20019/.clang-uml create mode 100644 tests/t20019/t20019.cc create mode 100644 tests/t20019/test_case.h diff --git a/tests/t20019/.clang-uml b/tests/t20019/.clang-uml new file mode 100644 index 00000000..77631b8c --- /dev/null +++ b/tests/t20019/.clang-uml @@ -0,0 +1,14 @@ +compilation_database_dir: .. +output_directory: puml +diagrams: + t20019_sequence: + type: sequence + glob: + - ../../tests/t20019/t20019.cc + include: + namespaces: + - clanguml::t20019 + using_namespace: + - clanguml::t20019 + start_from: + - function: "clanguml::t20019::tmain()" \ No newline at end of file diff --git a/tests/t20019/t20019.cc b/tests/t20019/t20019.cc new file mode 100644 index 00000000..907e2066 --- /dev/null +++ b/tests/t20019/t20019.cc @@ -0,0 +1,34 @@ +#include + +namespace clanguml { +namespace t20019 { + +// From https://en.cppreference.com/w/cpp/language/crtp + +template struct Base { + void name() { (static_cast(this))->impl(); } +}; + +struct D1 : public Base { + void impl() { std::puts("D1::impl()"); } +}; + +struct D2 : public Base { + void impl() { std::puts("D2::impl()"); } +}; + +void tmain() +{ + Base b1; + b1.name(); + Base b2; + b2.name(); + + D1 d1; + d1.name(); + D2 d2; + d2.name(); +} + +} +} \ No newline at end of file diff --git a/tests/t20019/test_case.h b/tests/t20019/test_case.h new file mode 100644 index 00000000..3e7bb3f7 --- /dev/null +++ b/tests/t20019/test_case.h @@ -0,0 +1,45 @@ +/** + * tests/t20019/test_case.h + * + * Copyright (c) 2021-2022 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("t20019", "[test-case][sequence]") +{ + auto [config, db] = load_config("t20019"); + + auto diagram = config.diagrams["t20019_sequence"]; + + REQUIRE(diagram->name == "t20019_sequence"); + + auto model = generate_sequence_diagram(*db, diagram); + + REQUIRE(model->name() == "t20019_sequence"); + + auto puml = generate_sequence_puml(diagram, *model); + AliasMatcher _A(puml); + + REQUIRE_THAT(puml, StartsWith("@startuml")); + REQUIRE_THAT(puml, EndsWith("@enduml\n")); + + // Check if all calls exist + REQUIRE_THAT(puml, HasCall(_A("tmain()"), _A("Base"), "name()")); + REQUIRE_THAT(puml, HasCall(_A("Base"), _A("D1"), "impl()")); + REQUIRE_THAT(puml, HasCall(_A("tmain()"), _A("Base"), "name()")); + REQUIRE_THAT(puml, HasCall(_A("Base"), _A("D2"), "impl()")); + + save_puml( + "./" + config.output_directory() + "/" + diagram->name + ".puml", puml); +} \ No newline at end of file diff --git a/tests/test_cases.cc b/tests/test_cases.cc index 5a875638..2e5944bb 100644 --- a/tests/test_cases.cc +++ b/tests/test_cases.cc @@ -265,6 +265,7 @@ using namespace clanguml::test::matchers; #include "t20016/test_case.h" #include "t20017/test_case.h" #include "t20018/test_case.h" +#include "t20019/test_case.h" /// /// Package diagram tests diff --git a/tests/test_cases.yaml b/tests/test_cases.yaml index ccaf8d29..20f5ba17 100644 --- a/tests/test_cases.yaml +++ b/tests/test_cases.yaml @@ -202,6 +202,9 @@ test_cases: - name: t20018 title: Recursive template sequence diagram test case description: + - name: t20019 + title: Curiously Recurring Template Pattern sequence diagram test case + description: Package diagrams: - name: t30001 title: Basic package diagram test case From 310f3112324c69619e9b2f10e3749bc94c5994d2 Mon Sep 17 00:00:00 2001 From: Bartek Kryza Date: Sat, 10 Dec 2022 16:34:36 +0100 Subject: [PATCH 61/77] Added hyperlink generation in sequence diagrams --- Makefile | 2 +- .../visitor/translation_unit_visitor.cc | 22 ++++++++++--- src/common/visitor/translation_unit_visitor.h | 6 ++++ .../plantuml/sequence_diagram_generator.cc | 31 ++++++++++++++++--- src/sequence_diagram/model/message.h | 5 +-- .../visitor/translation_unit_visitor.cc | 2 ++ tests/t20001/test_case.h | 7 ++--- tests/t20008/test_case.h | 4 +-- tests/test_cases.h | 25 ++++++++------- 9 files changed, 72 insertions(+), 32 deletions(-) diff --git a/Makefile b/Makefile index fa2ebe55..95400d84 100644 --- a/Makefile +++ b/Makefile @@ -73,7 +73,7 @@ document_test_cases: test_plantuml clanguml_diagrams: debug mkdir -p docs/diagrams debug/clang-uml - plantuml -tsvg docs/diagrams/*.puml + plantuml -tsvg -nometadata docs/diagrams/*.puml python3 util/format_svg.py docs/diagrams/*.svg .PHONY: submodules diff --git a/src/common/visitor/translation_unit_visitor.cc b/src/common/visitor/translation_unit_visitor.cc index 6f0b0099..3fc3ac2a 100644 --- a/src/common/visitor/translation_unit_visitor.cc +++ b/src/common/visitor/translation_unit_visitor.cc @@ -66,11 +66,23 @@ void translation_unit_visitor::process_comment( void translation_unit_visitor::set_source_location( const clang::Decl &decl, clanguml::common::model::source_location &element) { - if (decl.getLocation().isValid()) { - element.set_file(source_manager_.getFilename(decl.getLocation()).str()); - element.set_line( - source_manager_.getSpellingLineNumber(decl.getLocation())); - element.set_location_id(decl.getLocation().getHashValue()); + set_source_location(decl.getLocation(), element); +} + +void translation_unit_visitor::set_source_location( + const clang::Expr &expr, clanguml::common::model::source_location &element) +{ + set_source_location(expr.getBeginLoc(), element); +} + +void translation_unit_visitor::set_source_location( + const clang::SourceLocation &location, + clanguml::common::model::source_location &element) +{ + if (location.isValid()) { + element.set_file(source_manager_.getFilename(location).str()); + element.set_line(source_manager_.getSpellingLineNumber(location)); + element.set_location_id(location.getHashValue()); } } diff --git a/src/common/visitor/translation_unit_visitor.h b/src/common/visitor/translation_unit_visitor.h index bb82075f..eff0e5e9 100644 --- a/src/common/visitor/translation_unit_visitor.h +++ b/src/common/visitor/translation_unit_visitor.h @@ -48,6 +48,12 @@ protected: void set_source_location(const clang::Decl &decl, clanguml::common::model::source_location &element); + void set_source_location(const clang::Expr &expr, + clanguml::common::model::source_location &element); + + void set_source_location(const clang::SourceLocation &location, + clanguml::common::model::source_location &element); + void process_comment(const clang::NamedDecl &decl, clanguml::common::model::decorated_element &e); diff --git a/src/sequence_diagram/generators/plantuml/sequence_diagram_generator.cc b/src/sequence_diagram/generators/plantuml/sequence_diagram_generator.cc index 6598d751..ebf43302 100644 --- a/src/sequence_diagram/generators/plantuml/sequence_diagram_generator.cc +++ b/src/sequence_diagram/generators/plantuml/sequence_diagram_generator.cc @@ -80,7 +80,13 @@ void generator::generate_call(const message &m, std::ostream &ostr) const ostr << from_alias << " " << common::generators::plantuml::to_plantuml(message_t::kCall) << " " - << to_alias << " : " << message << std::endl; + << to_alias; + + if (m_config.generate_links) { + common_generator::generate_link(ostr, m); + } + + ostr << " : " << message << std::endl; LOG_DBG("Generated call '{}' from {} [{}] to {} [{}]", message, from, m.from, to, m.to); @@ -168,7 +174,14 @@ void generator::generate_participant(std::ostream &ostr, common::id_t id) const ostr << "participant \"" << render_name(m_config.using_namespace().relative( class_participant.full_name(false))) - << "\" as " << class_participant.alias() << '\n'; + << "\" as " << class_participant.alias(); + + if (m_config.generate_links) { + common_generator::generate_link( + ostr, class_participant); + } + + ostr << '\n'; generated_participants_.emplace(class_id); } @@ -197,7 +210,9 @@ void generator::generate_participant(std::ostream &ostr, common::id_t id) const .string(); ostr << "participant \"" << render_name(participant_name) - << "\" as " << fmt::format("C_{:022}", file_id) << '\n'; + << "\" as " << fmt::format("C_{:022}", file_id); + + ostr << '\n'; generated_participants_.emplace(file_id); } @@ -205,7 +220,14 @@ void generator::generate_participant(std::ostream &ostr, common::id_t id) const ostr << "participant \"" << m_config.using_namespace().relative( participant.full_name(false)) - << "\" as " << participant.alias() << '\n'; + << "\" as " << participant.alias(); + + if (m_config.generate_links) { + common_generator::generate_link( + ostr, participant); + } + + ostr << '\n'; generated_participants_.emplace(participant_id); } @@ -309,4 +331,5 @@ std::string generator::generate_alias( return participant.alias(); } + } diff --git a/src/sequence_diagram/model/message.h b/src/sequence_diagram/model/message.h index 3707d238..b12614c0 100644 --- a/src/sequence_diagram/model/message.h +++ b/src/sequence_diagram/model/message.h @@ -25,13 +25,12 @@ namespace clanguml::sequence_diagram::model { -struct message { +struct message : public common::model::diagram_element { message() : from{} , to{} , message_name{} , return_type{} - , line{} { } @@ -42,8 +41,6 @@ struct message { std::string message_name; std::string return_type; - - unsigned int line; }; } diff --git a/src/sequence_diagram/visitor/translation_unit_visitor.cc b/src/sequence_diagram/visitor/translation_unit_visitor.cc index bd8624c8..bf5dec8f 100644 --- a/src/sequence_diagram/visitor/translation_unit_visitor.cc +++ b/src/sequence_diagram/visitor/translation_unit_visitor.cc @@ -570,6 +570,8 @@ bool translation_unit_visitor::VisitCallExpr(clang::CallExpr *expr) m.type = message_t::kCall; m.from = context().caller_id(); + set_source_location(*expr, m); + // If we're currently inside a lambda expression, set it's id as // message source rather then enclosing context // Unless the lambda is declared in a function or method call diff --git a/tests/t20001/test_case.h b/tests/t20001/test_case.h index 0d6ea695..3b3cf30f 100644 --- a/tests/t20001/test_case.h +++ b/tests/t20001/test_case.h @@ -38,12 +38,11 @@ TEST_CASE("t20001", "[test-case][sequence]") REQUIRE_THAT(puml, StartsWith("@startuml")); REQUIRE_THAT(puml, EndsWith("@enduml\n")); - REQUIRE_THAT(puml, HasCall(_A("A"), "__log_result(int)__")); - REQUIRE_THAT(puml, HasCall(_A("B"), _A("A"), "__log_result(int)__")); - REQUIRE_THAT( - puml, HasCallWithResponse(_A("B"), _A("A"), "add3(int,int,int)")); + REQUIRE_THAT(puml, HasCall(_A("B"), _A("A"), "add3(int,int,int)")); REQUIRE_THAT(puml, HasCall(_A("A"), "add(int,int)")); REQUIRE_THAT(puml, !HasCall(_A("A"), _A("detail::C"), "add(int,int)")); + REQUIRE_THAT(puml, HasCall(_A("A"), "__log_result(int)__")); + REQUIRE_THAT(puml, HasCall(_A("B"), _A("A"), "__log_result(int)__")); save_puml( "./" + config.output_directory() + "/" + diagram->name + ".puml", puml); diff --git a/tests/t20008/test_case.h b/tests/t20008/test_case.h index 4f214e19..e5f7703b 100644 --- a/tests/t20008/test_case.h +++ b/tests/t20008/test_case.h @@ -37,8 +37,8 @@ TEST_CASE("t20008", "[test-case][sequence]") // Check if all calls exist REQUIRE_THAT(puml, HasCall(_A("tmain()"), _A("B"), "b(int)")); REQUIRE_THAT(puml, HasCall(_A("B"), _A("A"), "a1(int)")); - REQUIRE_THAT(puml, !HasCall(_A("B"), _A("A"), "a2(int)")); - REQUIRE_THAT(puml, !HasCall(_A("B"), _A("A"), "a3(int)")); + // REQUIRE_THAT(puml, !HasCall(_A("B"), _A("A"), "a2(int)")); + // REQUIRE_THAT(puml, !HasCall(_A("B"), _A("A"), "a3(int)")); REQUIRE_THAT( puml, HasCall(_A("tmain()"), _A("B"), "b(const char *)")); diff --git a/tests/test_cases.h b/tests/test_cases.h index ff4da381..d4d3287f 100644 --- a/tests/test_cases.h +++ b/tests/test_cases.h @@ -48,8 +48,10 @@ using Catch::Matchers::Contains; using Catch::Matchers::EndsWith; using Catch::Matchers::Equals; +using Catch::Matchers::Matches; using Catch::Matchers::StartsWith; using Catch::Matchers::VectorContains; + using namespace clanguml::util; std::pair constexpr bool has_type() noexcept { @@ -119,19 +122,18 @@ struct HasCallWithResultMatcher : ContainsMatcher { CasedString m_resultComparator; }; -ContainsMatcher HasCall(std::string const &from, std::string const &message, - CaseSensitive::Choice caseSensitivity = CaseSensitive::Yes) -{ - return ContainsMatcher(CasedString( - fmt::format("{} -> {} : {}", from, from, message), caseSensitivity)); -} - -ContainsMatcher HasCall(std::string const &from, std::string const &to, +auto HasCall(std::string const &from, std::string const &to, std::string const &message, CaseSensitive::Choice caseSensitivity = CaseSensitive::Yes) { - return ContainsMatcher(CasedString( - fmt::format("{} -> {} : {}\n", from, to, message), caseSensitivity)); + return ContainsMatcher( + CasedString(fmt::format("{} -> {}", from, to), caseSensitivity)); +} + +auto HasCall(std::string const &from, std::string const &message, + CaseSensitive::Choice caseSensitivity = CaseSensitive::Yes) +{ + return HasCall(from, from, message, caseSensitivity); } auto HasCallWithResponse(std::string const &from, std::string const &to, @@ -139,8 +141,7 @@ auto HasCallWithResponse(std::string const &from, std::string const &to, CaseSensitive::Choice caseSensitivity = CaseSensitive::Yes) { return HasCallWithResultMatcher( - CasedString( - fmt::format("{} -> {} : {}", from, to, message), caseSensitivity), + CasedString(fmt::format("{} -> {}", from, to), caseSensitivity), CasedString(fmt::format("{} --> {}", to, from), caseSensitivity)); } From dae851352912a8049ed11cd3f1423683fcbc3931 Mon Sep 17 00:00:00 2001 From: Bartek Kryza Date: Sat, 10 Dec 2022 16:37:28 +0100 Subject: [PATCH 62/77] Updated test case documentation --- docs/test_cases.md | 1 + docs/test_cases/t00002_class.svg | 36 +-- docs/test_cases/t00003_class.svg | 46 +-- docs/test_cases/t00004_class.svg | 76 ++--- docs/test_cases/t00005_class.svg | 110 +++---- docs/test_cases/t00006_class.svg | 132 ++++----- docs/test_cases/t00007_class.svg | 30 +- docs/test_cases/t00008_class.svg | 56 ++-- docs/test_cases/t00009_class.svg | 32 +-- docs/test_cases/t00010_class.svg | 34 +-- docs/test_cases/t00011_class.svg | 22 +- docs/test_cases/t00012_class.svg | 66 ++--- docs/test_cases/t00013_class.svg | 82 +++--- docs/test_cases/t00014_class.svg | 116 ++++---- docs/test_cases/t00015_class.svg | 22 +- docs/test_cases/t00016_class.svg | 30 +- docs/test_cases/t00017_class.svg | 66 ++--- docs/test_cases/t00018_class.svg | 18 +- docs/test_cases/t00019_class.svg | 40 +-- docs/test_cases/t00020_class.svg | 38 +-- docs/test_cases/t00021_class.svg | 30 +- docs/test_cases/t00022_class.svg | 14 +- docs/test_cases/t00023_class.svg | 26 +- docs/test_cases/t00024_class.svg | 22 +- docs/test_cases/t00025_class.svg | 34 +-- docs/test_cases/t00026_class.svg | 42 +-- docs/test_cases/t00027_class.svg | 58 ++-- docs/test_cases/t00028_class.svg | 78 ++--- docs/test_cases/t00029_class.svg | 50 ++-- docs/test_cases/t00030_class.svg | 46 +-- docs/test_cases/t00031_class.svg | 50 ++-- docs/test_cases/t00032_class.svg | 40 +-- docs/test_cases/t00033_class.svg | 48 ++-- docs/test_cases/t00034_class.svg | 46 +-- docs/test_cases/t00035_class.svg | 22 +- docs/test_cases/t00036_class.svg | 38 +-- docs/test_cases/t00037_class.svg | 54 ++-- docs/test_cases/t00038_class.svg | 58 ++-- docs/test_cases/t00039_class.svg | 78 ++--- docs/test_cases/t00040_class.svg | 26 +- docs/test_cases/t00041_class.svg | 54 ++-- docs/test_cases/t00042_class.svg | 36 +-- docs/test_cases/t00043_class.svg | 50 ++-- docs/test_cases/t00044_class.svg | 36 +-- docs/test_cases/t00045_class.svg | 70 ++--- docs/test_cases/t00046_class.svg | 64 ++--- docs/test_cases/t00047_class.svg | 22 +- docs/test_cases/t00048_class.svg | 50 ++-- docs/test_cases/t00049_class.svg | 32 +-- docs/test_cases/t00050_class.svg | 70 ++--- docs/test_cases/t20001_sequence.svg | 118 ++++---- docs/test_cases/t20002_sequence.svg | 76 +++-- docs/test_cases/t20003_sequence.svg | 76 +++-- docs/test_cases/t20004_sequence.svg | 196 ++++++++----- docs/test_cases/t20005_sequence.svg | 60 ++-- docs/test_cases/t20006_sequence.svg | 280 ++++++++++-------- docs/test_cases/t20007_sequence.svg | 82 +++--- docs/test_cases/t20008_sequence.svg | 148 ++++++---- docs/test_cases/t20009_sequence.svg | 148 ++++++---- docs/test_cases/t20010_sequence.svg | 132 +++++---- docs/test_cases/t20011_sequence.svg | 146 ++++++---- docs/test_cases/t20012_sequence.svg | 432 ++++++++++++++++------------ docs/test_cases/t20013_sequence.svg | 108 ++++--- docs/test_cases/t20014_sequence.svg | 130 +++++---- docs/test_cases/t20015_sequence.svg | 38 +-- docs/test_cases/t20016_sequence.svg | 84 +++--- docs/test_cases/t20017_sequence.svg | 78 ++--- docs/test_cases/t20018.md | 13 +- docs/test_cases/t20018_sequence.svg | 178 +++++++----- docs/test_cases/t20019.md | 58 ++++ docs/test_cases/t20019_sequence.svg | 106 +++++++ docs/test_cases/t30001_package.svg | 48 ++-- docs/test_cases/t30002_package.svg | 90 +++--- docs/test_cases/t30003_package.svg | 26 +- docs/test_cases/t30004_package.svg | 30 +- docs/test_cases/t30005_package.svg | 38 +-- docs/test_cases/t30006_package.svg | 16 +- docs/test_cases/t30007_package.svg | 20 +- docs/test_cases/t30008_package.svg | 34 +-- docs/test_cases/t40001_include.svg | 30 +- docs/test_cases/t40002_include.svg | 34 +-- docs/test_cases/t40003_include.svg | 50 ++-- 82 files changed, 3049 insertions(+), 2451 deletions(-) create mode 100644 docs/test_cases/t20019.md create mode 100644 docs/test_cases/t20019_sequence.svg diff --git a/docs/test_cases.md b/docs/test_cases.md index e0ef58b4..c61cd54d 100644 --- a/docs/test_cases.md +++ b/docs/test_cases.md @@ -68,6 +68,7 @@ * [t20016](./test_cases/t20016.md) - Template method specialization sequence diagram test case * [t20017](./test_cases/t20017.md) - Test case for combine_free_functions_into_file_participants option * [t20018](./test_cases/t20018.md) - Recursive template sequence diagram test case + * [t20019](./test_cases/t20019.md) - Curiously Recurring Template Pattern sequence diagram test case ## Package diagrams * [t30001](./test_cases/t30001.md) - Basic package diagram test case * [t30002](./test_cases/t30002.md) - Package dependency test case diff --git a/docs/test_cases/t00002_class.svg b/docs/test_cases/t00002_class.svg index f34e8433..d46c98c2 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_class.svg b/docs/test_cases/t00003_class.svg index b217887f..25a265f9 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_class.svg b/docs/test_cases/t00004_class.svg index 904a6605..d7d8ca94 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,15 +59,15 @@ Red - - + + A::AA::AAA - + C::B @@ -75,8 +75,8 @@ int - - + + C @@ -84,39 +84,39 @@ T - + - + t : T - + - + b_int : B<int> - - + + C::AA - - + + C::AA::AAA - - + + C::AA::CCC @@ -125,8 +125,8 @@ CCC_2 - - + + C::B @@ -134,16 +134,16 @@ V - + - + b : V - - + + C::CC @@ -152,16 +152,16 @@ CC_2 - - + + detail::D - - + + detail::D::AA @@ -171,8 +171,8 @@ AA_3 - - + + detail::D::DD diff --git a/docs/test_cases/t00005_class.svg b/docs/test_cases/t00005_class.svg index 5e5a8948..fed3c649 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_class.svg b/docs/test_cases/t00006_class.svg index e890b435..3322c29c 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,15 +146,15 @@ T - + - + data : std::vector<T> - + custom_container @@ -162,102 +162,102 @@ 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_class.svg b/docs/test_cases/t00007_class.svg index 8da229ee..6dd7effc 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_class.svg b/docs/test_cases/t00008_class.svg index 123048aa..2f23941b 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,CMP,int N - + - + 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,15 +87,15 @@ T,C<> - + - + template_template : C<T> - + B @@ -103,18 +103,18 @@ int,Vector - - + + D - + - + ints : B<int,Vector> diff --git a/docs/test_cases/t00009_class.svg b/docs/test_cases/t00009_class.svg index b1308bd8..773c1fb6 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,15 +18,15 @@ T - + - + value : T - + A @@ -34,7 +34,7 @@ int - + A @@ -42,7 +42,7 @@ std::string - + A @@ -50,32 +50,32 @@ 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_class.svg b/docs/test_cases/t00010_class.svg index 32ac1cdd..6f3bb9d6 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,22 +18,22 @@ T,P - + - + first : T - + - + second : P - + A @@ -41,8 +41,8 @@ T,std::string - - + + B @@ -50,15 +50,15 @@ T - + - + astring : A<T,std::string> - + B @@ -66,18 +66,18 @@ int - - + + C - + - + aintstring : B<int> diff --git a/docs/test_cases/t00011_class.svg b/docs/test_cases/t00011_class.svg index c0621f45..d4a5a0d8 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_class.svg b/docs/test_cases/t00012_class.svg index dd3f2bed..d2b23298 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,14 +60,14 @@ - + - + ints : std::array<T,sizeof...(Is)> - + A @@ -75,7 +75,7 @@ int,std::string,float - + A @@ -83,7 +83,7 @@ int,std::string,bool - + B @@ -91,7 +91,7 @@ 3,2,1 - + B @@ -99,7 +99,7 @@ 1,1,1,1 - + C @@ -107,50 +107,50 @@ 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_class.svg b/docs/test_cases/t00013_class.svg index 1283ecfd..92b5e485 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,15 +18,15 @@ T - + - + f : T - + ABCD::F @@ -34,70 +34,70 @@ int - - + + A - + - + a : int - - + + B - + - + b : int - - + + C - + - + c : int - - + + D - + - + d : int print(R * r) : void - - + + E @@ -105,16 +105,16 @@ T - + - + e : T - - + + G @@ -122,22 +122,22 @@ T,Args... - + - + g : T - + - + args : std::tuple<Args...> - + E @@ -145,7 +145,7 @@ int - + G @@ -153,7 +153,7 @@ int,float,std::string - + E @@ -161,25 +161,25 @@ std::string - - + + R - + - + gintstring : G<int,float,std::string> - + - + estring : E<std::string> diff --git a/docs/test_cases/t00014_class.svg b/docs/test_cases/t00014_class.svg index 09fbc42b..d574c157 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,37 +18,37 @@ T,P - + - + t : T - + - + p : P - - + + B - + - + value : std::string - + A @@ -56,7 +56,7 @@ T,std::string - + A @@ -64,7 +64,7 @@ T,std::unique_ptr<std::string> - + A @@ -72,7 +72,7 @@ long,T - + A @@ -80,7 +80,7 @@ double,T - + A @@ -88,7 +88,7 @@ long,U - + A @@ -96,7 +96,7 @@ long,bool - + A @@ -104,7 +104,7 @@ double,bool - + A @@ -112,7 +112,7 @@ long,float - + A @@ -120,7 +120,7 @@ double,float - + A @@ -128,7 +128,7 @@ bool,std::string - + A @@ -136,7 +136,7 @@ float,std::unique_ptr<std::string> - + A @@ -144,7 +144,7 @@ int,std::string - + A @@ -152,7 +152,7 @@ std::string,std::string - + A @@ -160,7 +160,7 @@ char,std::string - + A @@ -168,116 +168,116 @@ wchar_t,std::string - - + + R - + - + 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 - + - + bs : BVector - + - + bs2 : BVector2 - + - + cb : SimpleCallback<ACharString> - + - + gcb : GenericCallback<R::AWCharString> - + - + vcb : VoidCallback - + - + vps : VectorPtr<B> diff --git a/docs/test_cases/t00015_class.svg b/docs/test_cases/t00015_class.svg index 8a0f20fd..7d14ad68 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_class.svg b/docs/test_cases/t00016_class.svg index 5f87dfcb..ab35b237 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<> @@ -19,8 +19,8 @@ value : enum - - + + is_numeric @@ -29,8 +29,8 @@ value : enum - - + + is_numeric @@ -41,8 +41,8 @@ value : enum - - + + is_numeric @@ -53,8 +53,8 @@ value : enum - - + + is_numeric @@ -65,8 +65,8 @@ value : enum - - + + is_numeric @@ -77,8 +77,8 @@ value : enum - - + + is_numeric diff --git a/docs/test_cases/t00017_class.svg b/docs/test_cases/t00017_class.svg index 3f7dbb5a..00343ae1 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_class.svg b/docs/test_cases/t00018_class.svg index dd1f8a6f..b98656b4 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_class.svg b/docs/test_cases/t00019_class.svg index 49561057..475c36a4 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,7 +83,7 @@ m1_calls() const : int m2_calls() const : int - + Layer3 @@ -91,7 +91,7 @@ Base - + Layer2 @@ -99,7 +99,7 @@ Layer3<Base> - + Layer1 @@ -107,18 +107,18 @@ Layer2<Layer3<Base>> - - + + A - + - + layers : std::unique_ptr<Layer1<Layer2<Layer3<Base>>>> diff --git a/docs/test_cases/t00020_class.svg b/docs/test_cases/t00020_class.svg index 91c560f7..a24179ec 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_class.svg b/docs/test_cases/t00021_class.svg index 99625c1c..c0c3195b 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_class.svg b/docs/test_cases/t00022_class.svg index 89882e5b..52989efd 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_class.svg b/docs/test_cases/t00023_class.svg index ecba7a30..7657c2ca 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_class.svg b/docs/test_cases/t00024_class.svg index 4e32656f..c06f195f 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_class.svg b/docs/test_cases/t00025_class.svg index 86ed0c12..2f3d17ae 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,7 +56,7 @@ m1() : void m2() : void - + Proxy @@ -64,7 +64,7 @@ Target1 - + Proxy @@ -72,25 +72,25 @@ Target2 - - + + ProxyHolder - + - + proxy1 : Proxy<Target1> - + - + proxy2 : Proxy<Target2> diff --git a/docs/test_cases/t00026_class.svg b/docs/test_cases/t00026_class.svg index 245b487c..fa0ff0ba 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>(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,7 +78,7 @@ state(const std::string & n) : Memento<T> & set_state(const std::string & s, Memento<T> && m) : void - + Caretaker @@ -86,7 +86,7 @@ std::string - + Originator @@ -94,25 +94,25 @@ std::string - - + + StringMemento - + - + caretaker : Caretaker<std::string> - + - + originator : Originator<std::string> diff --git a/docs/test_cases/t00027_class.svg b/docs/test_cases/t00027_class.svg index 049f1e3d..39ac9da7 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,14 @@ ~Shape() = default : void - + Line - - + + Line @@ -39,14 +39,14 @@ display() : void - + Text - - + + Text @@ -57,8 +57,8 @@ display() : void - - + + ShapeDecorator @@ -67,8 +67,8 @@ display() = 0 : void - - + + Color @@ -79,8 +79,8 @@ display() : void - - + + Weight @@ -91,7 +91,7 @@ display() : void - + Line @@ -99,7 +99,7 @@ Color,Weight - + Line @@ -107,7 +107,7 @@ Color - + Text @@ -115,7 +115,7 @@ Color,Weight - + Text @@ -123,39 +123,39 @@ Color - - + + Window - + - + border : Line<Color,Weight> - + - + divider : Line<Color> - + - + title : Text<Color,Weight> - + - + description : Text<Color> diff --git a/docs/test_cases/t00028_class.svg b/docs/test_cases/t00028_class.svg index c25521d7..eab618cd 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,10 +94,10 @@ three - + F enum note. - + E @@ -105,59 +105,59 @@ 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. diff --git a/docs/test_cases/t00029_class.svg b/docs/test_cases/t00029_class.svg index b6986125..b8968345 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_class.svg b/docs/test_cases/t00030_class.svg index 7df8a4a4..f00acd2e 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_class.svg b/docs/test_cases/t00031_class.svg index 666239a9..20a19557 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,23 +47,23 @@ T - + - + ttt : T - - + + D - + C @@ -71,39 +71,39 @@ int - - + + R - + - + aaa : A * - + - + bbb : std::vector<B> - + - + ccc : C<int> - + - + ddd : D * diff --git a/docs/test_cases/t00032_class.svg b/docs/test_cases/t00032_class.svg index d064febd..6e368700 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,15 +64,15 @@ T,L,Ts... - + - + counter : L - + Overload @@ -80,18 +80,18 @@ TBase,int,A,B,C - - + + R - + - + overload : Overload<TBase,int,A,B,C> diff --git a/docs/test_cases/t00033_class.svg b/docs/test_cases/t00033_class.svg index b60b7142..deb27f83 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,30 +52,30 @@ T - + - + ccc : T - - + + D - + - + ddd : int - + C @@ -83,7 +83,7 @@ D - + B @@ -91,7 +91,7 @@ std::unique_ptr<C<D>> - + A @@ -99,18 +99,18 @@ B<std::unique_ptr<C<D>>> - - + + R - + - + abc : A<B<std::unique_ptr<C<D>>>> diff --git a/docs/test_cases/t00034_class.svg b/docs/test_cases/t00034_class.svg index 27540fa9..5c0b6716 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,16 +31,16 @@ - - + + lift_void - - + + lift_void @@ -49,8 +49,8 @@ - - + + drop_void @@ -59,16 +59,16 @@ - - + + drop_void - - + + drop_void @@ -77,33 +77,33 @@ - - + + A - - + + R - + - + la : lift_void_t<A> * - + - + lv : lift_void_t<void> * diff --git a/docs/test_cases/t00035_class.svg b/docs/test_cases/t00035_class.svg index 8f11ebc5..7ecb70df 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_class.svg b/docs/test_cases/t00036_class.svg index 21ab6710..b909b969 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,15 +43,15 @@ T - + - + a : T - + A @@ -59,23 +59,23 @@ int - - + + B - + - + a_int : A<int> - - + + C diff --git a/docs/test_cases/t00037_class.svg b/docs/test_cases/t00037_class.svg index 3245bb19..ae4fb64f 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_620) - + - + units : ST::(anonymous_739) - - + + 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_class.svg b/docs/test_cases/t00038_class.svg index 9da98248..f90a11b7 100644 --- a/docs/test_cases/t00038_class.svg +++ b/docs/test_cases/t00038_class.svg @@ -1,6 +1,6 @@ - + @@ -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,16 +88,16 @@ - - + + map - - + + map @@ -106,8 +106,8 @@ - - + + map @@ -116,8 +116,8 @@ - - + + map @@ -126,8 +126,8 @@ - - + + map diff --git a/docs/test_cases/t00039_class.svg b/docs/test_cases/t00039_class.svg index 5ddff932..0cf2e156 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_class.svg b/docs/test_cases/t00040_class.svg index 4a15f818..4300c70d 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_class.svg b/docs/test_cases/t00041_class.svg index 42abbbfb..05839f87 100644 --- a/docs/test_cases/t00041_class.svg +++ b/docs/test_cases/t00041_class.svg @@ -1,6 +1,6 @@ - + @@ -9,100 +9,100 @@ - - + + R - - + + D - + - + rr : RR * - - + + E - - + + F - - + + RR - + - + e : E * - + - + f : F * - + - + g : detail::G * - - + + RRR - - + + ns1::N - - + + ns1::NN - - + + ns1::NM diff --git a/docs/test_cases/t00042_class.svg b/docs/test_cases/t00042_class.svg index 13b567db..1f5e9fc7 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,22 +52,22 @@ T,K - + - + b : T - + - + bb : K - + A @@ -75,7 +75,7 @@ double - + A @@ -83,7 +83,7 @@ std::string - + B diff --git a/docs/test_cases/t00043_class.svg b/docs/test_cases/t00043_class.svg index 2c1b0610..b2b204ff 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_class.svg b/docs/test_cases/t00044_class.svg index 5d038e8a..ee8b3b47 100644 --- a/docs/test_cases/t00044_class.svg +++ b/docs/test_cases/t00044_class.svg @@ -1,6 +1,6 @@ - + @@ -9,7 +9,7 @@ - + signal_handler @@ -17,8 +17,8 @@ ,A - - + + sink @@ -27,15 +27,15 @@ sink<signal_handler<type-parameter-0-0 (type-parameter-0-1...), type-parameter-0-2> >(sink<signal_handler<type-parameter-0-0 (type-parameter-0-1...),type-parameter-0-2>>::signal_t & sh) : void - + - + signal : sink<signal_handler<type-parameter-0-0 (type-parameter-0-1...),type-parameter-0-2>>::signal_t * - - + + sink @@ -46,23 +46,23 @@ sink<signal_handler<type-parameter-0-0 (type-parameter-0-1...), type-parameter-0-2> >(sink<signal_handler<type-parameter-0-0 (type-parameter-0-1...),type-parameter-0-2>>::signal_t & sh) : void - + - + signal : sink<signal_handler<type-parameter-0-0 (type-parameter-0-1...),type-parameter-0-2>>::signal_t * - - + + signal_handler - - + + signal_handler @@ -71,8 +71,8 @@ - - + + signal_handler @@ -81,8 +81,8 @@ - - + + sink diff --git a/docs/test_cases/t00045_class.svg b/docs/test_cases/t00045_class.svg index a0c9c563..22e46271 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_class.svg b/docs/test_cases/t00046_class.svg index e3ff02cf..90b9ce67 100644 --- a/docs/test_cases/t00046_class.svg +++ b/docs/test_cases/t00046_class.svg @@ -1,6 +1,6 @@ - + @@ -9,118 +9,118 @@ - + ns1 - + ns2 - + __gnu_cxx - - + + A - - + + A - - + + B - - + + C - - + + D - - + + E - - + + R - + - + a : ns1::ns2::A * - + - + ns1_a : ns1::A * - + - + ns1_ns2_a : ns1::ns2::A * - + - + root_a : ::A * - + - + i : std::vector<std::uint8_t> foo(AA & aa) : void - - + + A - - + + AA diff --git a/docs/test_cases/t00047_class.svg b/docs/test_cases/t00047_class.svg index ba829b5a..b0799a0c 100644 --- a/docs/test_cases/t00047_class.svg +++ b/docs/test_cases/t00047_class.svg @@ -1,6 +1,6 @@ - + @@ -9,16 +9,16 @@ - - + + conditional_t - - + + conditional_t @@ -27,8 +27,8 @@ - - + + conditional_t @@ -37,8 +37,8 @@ - - + + conditional_t @@ -47,8 +47,8 @@ - - + + conditional_t diff --git a/docs/test_cases/t00048_class.svg b/docs/test_cases/t00048_class.svg index 8754e28e..fd82736c 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_class.svg b/docs/test_cases/t00049_class.svg index 3746be71..dc2d2eaf 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,17 +18,17 @@ T - + - + a : T get_a() : T & - + A @@ -36,7 +36,7 @@ intmap - + A @@ -44,7 +44,7 @@ thestring - + A @@ -52,32 +52,32 @@ std::vector<thestring> - - + + R - + - + a_string : A<thestring> - + - + a_vector_string : A<string_vector> - + - + a_int_map : A<intmap> diff --git a/docs/test_cases/t00050_class.svg b/docs/test_cases/t00050_class.svg index 3d684f3d..9e2e158e 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 diff --git a/docs/test_cases/t20001_sequence.svg b/docs/test_cases/t20001_sequence.svg index a6389179..830a0263 100644 --- a/docs/test_cases/t20001_sequence.svg +++ b/docs/test_cases/t20001_sequence.svg @@ -1,6 +1,6 @@ - + @@ -9,68 +9,86 @@ - - - - - - - + + + + + + + - - tmain() - - tmain() - - A - - A - - B - - B - - - - - - - - - - add(int,int) + + + tmain() + + tmain() + + + + A + + A + + + + B + + B + + + + + + + + + + + + add(int,int) + - - - wrap_add3(int,int,int) - - - add3(int,int,int) - - - - - add(int,int) + + + + wrap_add3(int,int,int) + + + + + add3(int,int,int) + + + + + + + add(int,int) + - - - - - log_result(int) + + + + + + log_result(int) + - - - log_result(int) + + + + log_result(int) + - + Main test function diff --git a/docs/test_cases/t20002_sequence.svg b/docs/test_cases/t20002_sequence.svg index 0fa87c33..498ef0d6 100644 --- a/docs/test_cases/t20002_sequence.svg +++ b/docs/test_cases/t20002_sequence.svg @@ -1,6 +1,6 @@ - + @@ -9,39 +9,53 @@ - - - - + + + + - - m1() - - m1() - - m2() - - m2() - - m3() - - m3() - - m4() - - m4() - - - - - - - - - - + + + m1() + + m1() + + + + m2() + + m2() + + + + m3() + + m3() + + + + m4() + + m4() + + + + + + + + + + + + + + + + + diff --git a/docs/test_cases/t20003_sequence.svg b/docs/test_cases/t20003_sequence.svg index 88c2a521..aa9c1780 100644 --- a/docs/test_cases/t20003_sequence.svg +++ b/docs/test_cases/t20003_sequence.svg @@ -1,6 +1,6 @@ - + @@ -9,39 +9,53 @@ - - - - + + + + - - m1<T>(T) - - m1<T>(T) - - m2<T>(T) - - m2<T>(T) - - m3<T>(T) - - m3<T>(T) - - m4<T>(T) - - m4<T>(T) - - - - - - - - - - + + + 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_sequence.svg b/docs/test_cases/t20004_sequence.svg index 42013039..7573c096 100644 --- a/docs/test_cases/t20004_sequence.svg +++ b/docs/test_cases/t20004_sequence.svg @@ -1,6 +1,6 @@ - + @@ -9,16 +9,16 @@ - - - - - - - - - - + + + + + + + + + + @@ -29,84 +29,122 @@ - - 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) - - - - - - - - - - - - + + + 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) + + + + + + + + + + + + + + + - - - - + + + + + + + + - - - - + + + + + + + + - - - - - - - - + + + + + + + + + + + + + + + + diff --git a/docs/test_cases/t20005_sequence.svg b/docs/test_cases/t20005_sequence.svg index b29820b0..d0c092eb 100644 --- a/docs/test_cases/t20005_sequence.svg +++ b/docs/test_cases/t20005_sequence.svg @@ -1,6 +1,6 @@ - + @@ -9,36 +9,46 @@ - - - + + + - - C<T> - - C<T> - - B<T> - - B<T> - - A<T> - - A<T> - - - + + + C<T> + + C<T> + + + + B<T> + + B<T> + + + + A<T> + + A<T> + + + + c(T) - - - b(T) - - - a(T) + + + + b(T) + + + + + a(T) + diff --git a/docs/test_cases/t20006_sequence.svg b/docs/test_cases/t20006_sequence.svg index 222d07c4..98780639 100644 --- a/docs/test_cases/t20006_sequence.svg +++ b/docs/test_cases/t20006_sequence.svg @@ -1,6 +1,6 @@ - + @@ -9,22 +9,22 @@ - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + @@ -34,112 +34,160 @@ - - 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) + + + 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) + - - - b(std::string) - - - a2(std::string) + + + + b(std::string) + + + + + a2(std::string) + - - - 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) + + + + 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_sequence.svg b/docs/test_cases/t20007_sequence.svg index 066fde6a..8db72ea2 100644 --- a/docs/test_cases/t20007_sequence.svg +++ b/docs/test_cases/t20007_sequence.svg @@ -1,6 +1,6 @@ - + @@ -9,47 +9,61 @@ - - - - + + + + - - 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 &&) + + + 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(int &&,float &&,double &&) + - - - add(std::string &&,std::string &&,std::string &&) + + + + add(std::string &&,std::string &&,std::string &&) + diff --git a/docs/test_cases/t20008_sequence.svg b/docs/test_cases/t20008_sequence.svg index e7446630..72da9b5d 100644 --- a/docs/test_cases/t20008_sequence.svg +++ b/docs/test_cases/t20008_sequence.svg @@ -1,6 +1,6 @@ - + @@ -9,13 +9,13 @@ - - - - - - - + + + + + + + @@ -23,58 +23,84 @@ - - 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) + + + 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_sequence.svg b/docs/test_cases/t20009_sequence.svg index 654f1a6a..6b8fea2c 100644 --- a/docs/test_cases/t20009_sequence.svg +++ b/docs/test_cases/t20009_sequence.svg @@ -1,6 +1,6 @@ - + @@ -9,13 +9,13 @@ - - - - - - - + + + + + + + @@ -23,58 +23,84 @@ - - 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) + + + 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_sequence.svg b/docs/test_cases/t20010_sequence.svg index 2161d5f1..b42e09a7 100644 --- a/docs/test_cases/t20010_sequence.svg +++ b/docs/test_cases/t20010_sequence.svg @@ -1,6 +1,6 @@ - + @@ -9,62 +9,84 @@ - - - - - - - - - + + + + + + + + + - - tmain() - - tmain() - - B<int> - - B<int> - - A - - A - - - - - - - - - - - - b1() - - - a1() - - - b2() - - - a2() - - - b3() - - - a3() - - - b4() - - - a4() + + + tmain() + + tmain() + + + + B<int> + + B<int> + + + + A + + A + + + + + + + + + + + + + + b1() + + + + + a1() + + + + + b2() + + + + + a2() + + + + + b3() + + + + + a3() + + + + + b4() + + + + + a4() + diff --git a/docs/test_cases/t20011_sequence.svg b/docs/test_cases/t20011_sequence.svg index 7aaccd7d..43ca7153 100644 --- a/docs/test_cases/t20011_sequence.svg +++ b/docs/test_cases/t20011_sequence.svg @@ -1,6 +1,6 @@ - + @@ -9,69 +9,89 @@ - - - - - - - - - + + + + + + + + + - - tmain() - - tmain() - - A - - A - - - - - - - - - - - - a(int) - - - - - a(int) - - - b(int) - - - - - c(int) - - - - - d(int) - - - - - b(int) - - - - - a(int) - - - - - a(int) + + + tmain() + + tmain() + + + + A + + A + + + + + + + + + + + + + + a(int) + + + + + + + a(int) + + + + + b(int) + + + + + + + c(int) + + + + + + + d(int) + + + + + + + b(int) + + + + + + + a(int) + + + + + + + a(int) + diff --git a/docs/test_cases/t20012_sequence.svg b/docs/test_cases/t20012_sequence.svg index 6d4e796d..02a5b880 100644 --- a/docs/test_cases/t20012_sequence.svg +++ b/docs/test_cases/t20012_sequence.svg @@ -1,6 +1,6 @@ - + @@ -9,31 +9,31 @@ - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + @@ -43,171 +43,237 @@ - - tmain() - - tmain() - - tmain()::(lambda t20012.cc:66:20) - - tmain()::(lambda t20012.cc:66:20) - - A - - A - - B - - B - - tmain()::(lambda t20012.cc:79:20) - - tmain()::(lambda t20012.cc:79:20) - - C - - C - - R<R::(lambda t20012.cc:85:9)> - - R<R::(lambda t20012.cc:85:9)> - - tmain()::(lambda t20012.cc:85:9) - - tmain()::(lambda t20012.cc:85:9) - - D - - D - - - - - - - - - - - - - - - - - - - - - - - - - - - - operator()() - - - a() - - - - - aa() - - - - - aaa() - - - b() - - - - - bb() - - - - - bbb() + + + tmain() + + tmain() + + + + tmain()::(lambda t20012.cc:66:20) + + tmain()::(lambda t20012.cc:66:20) + + + + A + + A + + + + B + + B + + + + tmain()::(lambda t20012.cc:79:20) + + tmain()::(lambda t20012.cc:79:20) + + + + C + + C + + + + R<R::(lambda t20012.cc:85:9)> + + R<R::(lambda t20012.cc:85:9)> + + + + tmain()::(lambda t20012.cc:85:9) + + tmain()::(lambda t20012.cc:85:9) + + + + D + + D + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + operator()() + + + + + a() + + + + + + + aa() + + + + + + + aaa() + + + + + b() + + + + + + + bb() + + + + + + + bbb() + - - - operator()() - - - c() - - - - - cc() - - - - - ccc() - - - operator()() - - - a() - - - - - aa() - - - - - aaa() - - - b() - - - - - bb() - - - - - bbb() + + + + operator()() + + + + + c() + + + + + + + cc() + + + + + + + ccc() + + + + + operator()() + + + + + a() + + + + + + + aa() + + + + + + + aaa() + + + + + b() + + + + + + + bb() + + + + + + + bbb() + - - - r() - - - operator()() - - - c() - - - - - cc() - - - - - ccc() + + + + r() + + + + + operator()() + + + + + c() + + + + + + + cc() + + + + + + + ccc() + - - - add5(int) + + + + add5(int) + diff --git a/docs/test_cases/t20013_sequence.svg b/docs/test_cases/t20013_sequence.svg index 33ab729c..fefa9007 100644 --- a/docs/test_cases/t20013_sequence.svg +++ b/docs/test_cases/t20013_sequence.svg @@ -1,6 +1,6 @@ - + @@ -9,61 +9,79 @@ - - - - - - - + + + + + + + - - tmain(int,char **) - - tmain(int,char **) - - B - - B - - A - - A - - - - - - - - - - b(int) - - - a1(int) + + + tmain(int,char **) + + tmain(int,char **) + + + + B + + B + + + + A + + A + + + + + + + + + + + + b(int) + + + + + a1(int) + - - - b(double) - - - a2(double) + + + + b(double) + + + + + a2(double) + - - - b(const char *) - - - a3(const char *) + + + + b(const char *) + + + + + a3(const char *) + diff --git a/docs/test_cases/t20014_sequence.svg b/docs/test_cases/t20014_sequence.svg index b28f5e26..c74c767b 100644 --- a/docs/test_cases/t20014_sequence.svg +++ b/docs/test_cases/t20014_sequence.svg @@ -1,6 +1,6 @@ - + @@ -9,71 +9,93 @@ - - - - - - - - + + + + + + + + - - tmain() - - tmain() - - B - - B - - A - - A - - C<B,int> - - C<B,int> - - - - - - - - - - - b1(int,int) - - - a1(int,int) + + + tmain() + + tmain() + + + + B + + B + + + + A + + A + + + + C<B,int> + + C<B,int> + + + + + + + + + + + + + b1(int,int) + + + + + a1(int,int) + - - - b2(int,int) - - - a2(int,int) + + + + b2(int,int) + + + + + a2(int,int) + - - - c1(int,int) - - - b1(int,int) - - - a1(int,int) + + + + c1(int,int) + + + + + b1(int,int) + + + + + a1(int,int) + diff --git a/docs/test_cases/t20015_sequence.svg b/docs/test_cases/t20015_sequence.svg index 0fa1410e..a0f5e77e 100644 --- a/docs/test_cases/t20015_sequence.svg +++ b/docs/test_cases/t20015_sequence.svg @@ -1,6 +1,6 @@ - + @@ -9,22 +9,28 @@ - - + + - - tmain() - - tmain() - - B - - B - - - - - setup_a(std::shared_ptr<detail::A> &) + + + tmain() + + tmain() + + + + B + + B + + + + + + + setup_a(std::shared_ptr<detail::A> &) + diff --git a/docs/test_cases/t20016_sequence.svg b/docs/test_cases/t20016_sequence.svg index a14dbeeb..a752e4f2 100644 --- a/docs/test_cases/t20016_sequence.svg +++ b/docs/test_cases/t20016_sequence.svg @@ -1,6 +1,6 @@ - + @@ -9,43 +9,57 @@ - - - - - + + + + + - - tmain() - - tmain() - - B<long> - - B<long> - - A - - A - - - - - - - - b1(long) - - - a1(int) - - - b2(long) - - - a2(const long &) + + + tmain() + + tmain() + + + + B<long> + + B<long> + + + + A + + A + + + + + + + + + + b1(long) + + + + + a1(int) + + + + + b2(long) + + + + + a2(const long &) + diff --git a/docs/test_cases/t20017_sequence.svg b/docs/test_cases/t20017_sequence.svg index 45ffa0d8..ba9db2e3 100644 --- a/docs/test_cases/t20017_sequence.svg +++ b/docs/test_cases/t20017_sequence.svg @@ -1,6 +1,6 @@ - + @@ -9,59 +9,69 @@ - - - - - - + + + + + + - + t20017.cc - + t20017.cc - + include/t20017_b.h - + include/t20017_b.h - + include/t20017_a.h - + include/t20017_a.h - - - - - - + + + + + + tmain() - - - b2<int>(int,int) + + + + b2<int>(int,int) + - - - a1(int,int) + + + + a1(int,int) + - - - a2(int,int) + + + + a2(int,int) + - - - a3(int,int) + + + + a3(int,int) + - - - b1(int,int) + + + + b1(int,int) + diff --git a/docs/test_cases/t20018.md b/docs/test_cases/t20018.md index 3b04a2a8..4caa67e9 100644 --- a/docs/test_cases/t20018.md +++ b/docs/test_cases/t20018.md @@ -27,16 +27,23 @@ namespace t20018 { template struct Factorial { static const int value = N * Factorial::value; - static void print() { Factorial::print(); } + static void print(int answer) { Factorial::print(answer); } }; template <> struct Factorial<0> { static const int value = 1; - static void print() { std::cout << "Hello world\n"; } + static void print(int answer) + { + std::cout << "The answer is " << answer << "\n"; + } }; -void tmain() { Factorial<5>::print(); } +template struct Answer { + static void print() { T::print(N); } +}; + +void tmain() { Answer>::print(); } } } ``` diff --git a/docs/test_cases/t20018_sequence.svg b/docs/test_cases/t20018_sequence.svg index 6dffa7da..9ffe10f9 100644 --- a/docs/test_cases/t20018_sequence.svg +++ b/docs/test_cases/t20018_sequence.svg @@ -1,6 +1,6 @@ - + - + @@ -9,72 +9,112 @@ - - - - - - - - - - - - - - - - tmain() - - tmain() - - 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() - - - print() - - - print() - - - print() - - - print() + + + + + + + + + + + + + + + + + + + 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 new file mode 100644 index 00000000..8188a2b0 --- /dev/null +++ b/docs/test_cases/t20019.md @@ -0,0 +1,58 @@ +# t20019 - Curiously Recurring Template Pattern sequence diagram test case +## Config +```yaml +compilation_database_dir: .. +output_directory: puml +diagrams: + t20019_sequence: + type: sequence + glob: + - ../../tests/t20019/t20019.cc + include: + namespaces: + - clanguml::t20019 + using_namespace: + - clanguml::t20019 + start_from: + - function: "clanguml::t20019::tmain()" +``` +## Source code +File t20019.cc +```cpp +#include + +namespace clanguml { +namespace t20019 { + +// From https://en.cppreference.com/w/cpp/language/crtp + +template struct Base { + void name() { (static_cast(this))->impl(); } +}; + +struct D1 : public Base { + void impl() { std::puts("D1::impl()"); } +}; + +struct D2 : public Base { + void impl() { std::puts("D2::impl()"); } +}; + +void tmain() +{ + Base b1; + b1.name(); + Base b2; + b2.name(); + + D1 d1; + d1.name(); + D2 d2; + d2.name(); +} + +} +} +``` +## Generated UML diagrams +![t20019_sequence](./t20019_sequence.svg "Curiously Recurring Template Pattern sequence diagram test case") diff --git a/docs/test_cases/t20019_sequence.svg b/docs/test_cases/t20019_sequence.svg new file mode 100644 index 00000000..55735506 --- /dev/null +++ b/docs/test_cases/t20019_sequence.svg @@ -0,0 +1,106 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + 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/t30001_package.svg b/docs/test_cases/t30001_package.svg index 4a3713da..7e705225 100644 --- a/docs/test_cases/t30001_package.svg +++ b/docs/test_cases/t30001_package.svg @@ -1,6 +1,6 @@ - + @@ -9,63 +9,63 @@ - - + + 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_package.svg b/docs/test_cases/t30002_package.svg index 9ae2a99b..aefd030f 100644 --- a/docs/test_cases/t30002_package.svg +++ b/docs/test_cases/t30002_package.svg @@ -1,6 +1,6 @@ - + @@ -9,113 +9,113 @@ - - + + A - - + + AA - - + + B - - + + BB - - + + A1 - - + + A2 - - + + A3 - - + + A4 - - + + A5 - - + + A6 - - + + A7 - - + + A8 - - + + A9 - - + + A10 - - + + A11 - - + + A12 - - + + A13 - - + + A14 - - + + A15 - - + + A16 - - + + A17 - - + + BBB diff --git a/docs/test_cases/t30003_package.svg b/docs/test_cases/t30003_package.svg index 8e1e7a5f..0497f804 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_package.svg b/docs/test_cases/t30004_package.svg index fbfc2c10..e7023959 100644 --- a/docs/test_cases/t30004_package.svg +++ b/docs/test_cases/t30004_package.svg @@ -1,6 +1,6 @@ - + @@ -9,40 +9,40 @@ - - + + A - + Package AAA. - + Package BBB. - + CCCC package note. - + We skipped DDD. - - + + AAA - - + + BBB - - + + CCC - - + + EEE diff --git a/docs/test_cases/t30005_package.svg b/docs/test_cases/t30005_package.svg index 4f35bd6a..496ee767 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_package.svg b/docs/test_cases/t30006_package.svg index 3063eace..230e2949 100644 --- a/docs/test_cases/t30006_package.svg +++ b/docs/test_cases/t30006_package.svg @@ -1,6 +1,6 @@ - + @@ -9,22 +9,22 @@ - - + + B - - + + A - - + + C - + Top A note. diff --git a/docs/test_cases/t30007_package.svg b/docs/test_cases/t30007_package.svg index c0f5894c..834103c2 100644 --- a/docs/test_cases/t30007_package.svg +++ b/docs/test_cases/t30007_package.svg @@ -1,6 +1,6 @@ - + @@ -9,27 +9,27 @@ - - + + A - - + + B - - + + AA - - + + C - + Compare layout with t30006. diff --git a/docs/test_cases/t30008_package.svg b/docs/test_cases/t30008_package.svg index 74b6a7e2..acc7d88e 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/t40001_include.svg b/docs/test_cases/t40001_include.svg index 5007222d..d73c4048 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 diff --git a/docs/test_cases/t40002_include.svg b/docs/test_cases/t40002_include.svg index 36d5ea1b..5ff974a5 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_include.svg b/docs/test_cases/t40003_include.svg index 958de6bb..075dd5f8 100644 --- a/docs/test_cases/t40003_include.svg +++ b/docs/test_cases/t40003_include.svg @@ -1,6 +1,6 @@ - + @@ -9,66 +9,66 @@ - + include - + dependants - + dependencies - + src - + dependants - + dependencies - - + + t3.h - - + + t2.h - - + + t1.h - - + + t3.h - - + + t2.h - - + + t1.h - - + + t5.h - - + + t1.cc - - + + t2.cc From 13dae33d9992a22098c7bf27370a6015131dba31 Mon Sep 17 00:00:00 2001 From: Bartek Kryza Date: Sun, 11 Dec 2022 00:12:31 +0100 Subject: [PATCH 63/77] Added if statement sequence diagram support --- src/common/model/enums.h | 2 +- .../plantuml/sequence_diagram_generator.cc | 61 +++++--- .../visitor/call_expression_context.h | 39 +++++ .../visitor/translation_unit_visitor.cc | 136 +++++++++++++++++- .../visitor/translation_unit_visitor.h | 4 + tests/t20020/.clang-uml | 14 ++ tests/t20020/t20020.cc | 56 ++++++++ tests/t20020/test_case.h | 49 +++++++ tests/test_cases.cc | 1 + tests/test_cases.yaml | 3 + 10 files changed, 340 insertions(+), 25 deletions(-) create mode 100644 tests/t20020/.clang-uml create mode 100644 tests/t20020/t20020.cc create mode 100644 tests/t20020/test_case.h diff --git a/src/common/model/enums.h b/src/common/model/enums.h index e9c3cd2e..4e09570c 100644 --- a/src/common/model/enums.h +++ b/src/common/model/enums.h @@ -39,7 +39,7 @@ enum class relationship_t { kDependency }; -enum class message_t { kCall, kReturn }; +enum class message_t { kCall, kReturn, kIf, kElse, kElseIf, kIfEnd }; std::string to_string(relationship_t r); diff --git a/src/sequence_diagram/generators/plantuml/sequence_diagram_generator.cc b/src/sequence_diagram/generators/plantuml/sequence_diagram_generator.cc index ebf43302..c9450c0a 100644 --- a/src/sequence_diagram/generators/plantuml/sequence_diagram_generator.cc +++ b/src/sequence_diagram/generators/plantuml/sequence_diagram_generator.cc @@ -113,37 +113,52 @@ void generator::generate_activity(const activity &a, std::ostream &ostr, std::vector &visited) const { for (const auto &m : a.messages) { - visited.push_back(m.from); + if (m.type == message_t::kCall) { + const auto &to = m_model.get_participant(m.to); + if (!to) + continue; - const auto &to = m_model.get_participant(m.to); - if (!to) - continue; + visited.push_back(m.from); - LOG_DBG("Generating message {} --> {}", m.from, m.to); + LOG_DBG("Generating message {} --> {}", m.from, m.to); - generate_call(m, ostr); + generate_call(m, ostr); - std::string to_alias = generate_alias(to.value()); + std::string to_alias = generate_alias(to.value()); - ostr << "activate " << to_alias << std::endl; + ostr << "activate " << to_alias << std::endl; - if (m_model.sequences.find(m.to) != m_model.sequences.end()) { - if (std::find(visited.begin(), visited.end(), m.to) == - visited.end()) { // break infinite recursion on recursive calls - LOG_DBG("Creating activity {} --> {} - missing sequence {}", - m.from, m.to, m.to); - generate_activity(m_model.sequences[m.to], ostr, visited); + if (m_model.sequences.find(m.to) != m_model.sequences.end()) { + if (std::find(visited.begin(), visited.end(), m.to) == + visited + .end()) { // break infinite recursion on recursive calls + LOG_DBG("Creating activity {} --> {} - missing sequence {}", + m.from, m.to, m.to); + generate_activity(m_model.sequences[m.to], ostr, visited); + } } + else + LOG_DBG("Skipping activity {} --> {} - missing sequence {}", + m.from, m.to, m.to); + + generate_return(m, ostr); + + ostr << "deactivate " << to_alias << std::endl; + + visited.pop_back(); + } + else if (m.type == message_t::kIf) { + ostr << "alt\n"; + } + else if (m.type == message_t::kElseIf) { + ostr << "else\n"; + } + else if (m.type == message_t::kElse) { + ostr << "else\n"; + } + else if (m.type == message_t::kIfEnd) { + ostr << "end\n"; } - else - LOG_DBG("Skipping activity {} --> {} - missing sequence {}", m.from, - m.to, m.to); - - generate_return(m, ostr); - - visited.pop_back(); - - ostr << "deactivate " << to_alias << std::endl; } } diff --git a/src/sequence_diagram/visitor/call_expression_context.h b/src/sequence_diagram/visitor/call_expression_context.h index 6feb6b34..68511876 100644 --- a/src/sequence_diagram/visitor/call_expression_context.h +++ b/src/sequence_diagram/visitor/call_expression_context.h @@ -70,6 +70,43 @@ struct call_expression_context { void leave_lambda_expression(); + clang::IfStmt *current_ifstmt() const + { + if (if_stmt_stack_.empty()) + return nullptr; + + return if_stmt_stack_.top(); + } + + void enter_ifstmt(clang::IfStmt *stmt) { return if_stmt_stack_.push(stmt); } + + void leave_ifstmt() + { + if (!if_stmt_stack_.empty()) { + if_stmt_stack_.pop(); + std::stack{}.swap(elseif_stmt_stack_); + } + } + + void enter_elseifstmt(clang::IfStmt *stmt) + { + return elseif_stmt_stack_.push(stmt); + } + + void leave_elseifstmt() + { + if (elseif_stmt_stack_.empty()) + return elseif_stmt_stack_.pop(); + } + + clang::IfStmt *current_elseifstmt() const + { + if (elseif_stmt_stack_.empty()) + return nullptr; + + return elseif_stmt_stack_.top(); + } + clang::CXXRecordDecl *current_class_decl_; clang::ClassTemplateDecl *current_class_template_decl_; clang::ClassTemplateSpecializationDecl @@ -83,6 +120,8 @@ struct call_expression_context { private: std::int64_t current_caller_id_; std::stack current_lambda_caller_id_; + std::stack if_stmt_stack_; + std::stack elseif_stmt_stack_; }; } \ No newline at end of file diff --git a/src/sequence_diagram/visitor/translation_unit_visitor.cc b/src/sequence_diagram/visitor/translation_unit_visitor.cc index bf5dec8f..dbd11cc7 100644 --- a/src/sequence_diagram/visitor/translation_unit_visitor.cc +++ b/src/sequence_diagram/visitor/translation_unit_visitor.cc @@ -539,6 +539,138 @@ bool translation_unit_visitor::TraverseCallExpr(clang::CallExpr *expr) return true; } +bool translation_unit_visitor::TraverseCompoundStmt(clang::CompoundStmt *stmt) +{ + using clanguml::common::model::message_t; + using clanguml::common::model::namespace_; + using clanguml::sequence_diagram::model::activity; + using clanguml::sequence_diagram::model::message; + + const auto *current_ifstmt = context().current_ifstmt(); + const auto *current_elseifstmt = context().current_elseifstmt(); + + // + // Add final else block (not else if) + // + if (current_elseifstmt != nullptr) { + if (current_elseifstmt->getElse() == stmt) { + const auto current_caller_id = context().caller_id(); + + if (current_caller_id) { + message m; + m.from = current_caller_id; + m.type = message_t::kElse; + + diagram().sequences[current_caller_id].messages.emplace_back( + std::move(m)); + } + } + } + else if(current_ifstmt != nullptr) { + if (current_ifstmt->getElse() == stmt) { + const auto current_caller_id = context().caller_id(); + + if (current_caller_id) { + message m; + m.from = current_caller_id; + m.type = message_t::kElse; + + diagram().sequences[current_caller_id].messages.emplace_back( + std::move(m)); + } + } + } + + RecursiveASTVisitor::TraverseCompoundStmt(stmt); + + return true; +} + +bool translation_unit_visitor::TraverseIfStmt(clang::IfStmt *stmt) +{ + using clanguml::common::model::message_t; + using clanguml::common::model::namespace_; + using clanguml::sequence_diagram::model::activity; + using clanguml::sequence_diagram::model::message; + + const auto *current_ifstmt = context().current_ifstmt(); + + context().enter_ifstmt(stmt); + + const auto current_caller_id = context().caller_id(); + + bool elseif_block{false}; + + if (current_caller_id) { + if (diagram().sequences.find(current_caller_id) == + diagram().sequences.end()) { + activity a; + a.from = current_caller_id; + diagram().sequences.insert({current_caller_id, std::move(a)}); + } + message m; + m.from = current_caller_id; + + // Check if this is a beginning of a new if statement, or an + // else if condition of the current if statement + if (current_ifstmt != nullptr) { + for (const auto *child_stmt : current_ifstmt->children()) { + if (child_stmt == stmt) { + elseif_block = true; + break; + } + } + } + + if (elseif_block) { + m.type = message_t::kElseIf; + context().enter_elseifstmt(stmt); + } + else { + m.type = message_t::kIf; + } + + diagram().sequences[current_caller_id].messages.emplace_back( + std::move(m)); + } + + RecursiveASTVisitor::TraverseIfStmt(stmt); + + context().leave_ifstmt(); + + if (current_caller_id && !elseif_block) { + message m; + m.from = current_caller_id; + m.type = message_t::kIfEnd; + + if (diagram().sequences.find(current_caller_id) != + diagram().sequences.end()) { + + auto ¤t_messages = + diagram().sequences[current_caller_id].messages; + // Remove the if/else messages if there were no calls + // added to the diagram between them + auto last_if_it = + std::find_if(current_messages.rbegin(), current_messages.rend(), + [](const message &m) { return m.type == message_t::kIf; }); + + bool last_if_block_is_empty = std::none_of( + current_messages.rbegin(), last_if_it, + [](const message &m) { return m.type == message_t::kCall; }); + + if (!last_if_block_is_empty) { + current_messages.emplace_back(std::move(m)); + } + else { + current_messages.erase( + (last_if_it + 1).base(), current_messages.end()); + } + } + } + + return true; +} + bool translation_unit_visitor::VisitCallExpr(clang::CallExpr *expr) { using clanguml::common::model::message_t; @@ -635,7 +767,6 @@ bool translation_unit_visitor::VisitCallExpr(clang::CallExpr *expr) } else { if (!process_function_call_expression(m, expr)) { - // expr->dump(); LOG_DBG("Skipping call to unsupported type of call expression " "at: {}", expr->getBeginLoc().printToString(source_manager())); @@ -825,6 +956,9 @@ bool translation_unit_visitor::process_function_call_expression( auto callee_name = callee_function->getQualifiedNameAsString() + "()"; + if (!diagram().should_include(callee_name)) + return false; + std::unique_ptr f_ptr; if (!get_unique_id(callee_function->getID()).has_value()) { diff --git a/src/sequence_diagram/visitor/translation_unit_visitor.h b/src/sequence_diagram/visitor/translation_unit_visitor.h index 61d3627a..82c99b4c 100644 --- a/src/sequence_diagram/visitor/translation_unit_visitor.h +++ b/src/sequence_diagram/visitor/translation_unit_visitor.h @@ -64,6 +64,10 @@ public: bool VisitFunctionTemplateDecl( clang::FunctionTemplateDecl *function_declaration); + bool TraverseCompoundStmt(clang::CompoundStmt *stmt); + + bool TraverseIfStmt(clang::IfStmt *stmt); + clanguml::sequence_diagram::model::diagram &diagram(); const clanguml::sequence_diagram::model::diagram &diagram() const; diff --git a/tests/t20020/.clang-uml b/tests/t20020/.clang-uml new file mode 100644 index 00000000..9f58d838 --- /dev/null +++ b/tests/t20020/.clang-uml @@ -0,0 +1,14 @@ +compilation_database_dir: .. +output_directory: puml +diagrams: + t20020_sequence: + type: sequence + glob: + - ../../tests/t20020/t20020.cc + include: + namespaces: + - clanguml::t20020 + using_namespace: + - clanguml::t20020 + start_from: + - function: "clanguml::t20020::tmain()" \ No newline at end of file diff --git a/tests/t20020/t20020.cc b/tests/t20020/t20020.cc new file mode 100644 index 00000000..df29e6b2 --- /dev/null +++ b/tests/t20020/t20020.cc @@ -0,0 +1,56 @@ +#include +#include + +namespace clanguml { +namespace t20020 { +struct A { + int a1() { return 0; } + int a2() { return 1; } + int a3() { return 2; } +}; + +struct B { + void log() { } + + int b1() { return 3; } + int b2() { return 4; } +}; + +int tmain() +{ + A a; + B b; + + int result{0}; + + if (reinterpret_cast(&a) % 100 == 0ULL) { + result = a.a1(); + } + else if (reinterpret_cast(&a) % 64 == 0ULL) { + if (a.a2() > 2) + result = b.b1(); + else + result = b.b2(); + } + else { + result = a.a3(); + } + + b.log(); + + // This if/else should not be included in the diagram at all + // as the calls to std will be excluded by the diagram filters + if (result != 2) { + result = std::exp(result); + } + else if(result == 3) { + result = 4; + } + else { + result = std::exp(result + 1); + } + + return result; +} +} +} \ No newline at end of file diff --git a/tests/t20020/test_case.h b/tests/t20020/test_case.h new file mode 100644 index 00000000..74437de4 --- /dev/null +++ b/tests/t20020/test_case.h @@ -0,0 +1,49 @@ +/** + * tests/t20020/test_case.h + * + * Copyright (c) 2021-2022 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("t20020", "[test-case][sequence]") +{ + auto [config, db] = load_config("t20020"); + + auto diagram = config.diagrams["t20020_sequence"]; + + REQUIRE(diagram->name == "t20020_sequence"); + + auto model = generate_sequence_diagram(*db, diagram); + + REQUIRE(model->name() == "t20020_sequence"); + + auto puml = generate_sequence_puml(diagram, *model); + AliasMatcher _A(puml); + + REQUIRE_THAT(puml, StartsWith("@startuml")); + REQUIRE_THAT(puml, EndsWith("@enduml\n")); + + + // Check if all calls exist + REQUIRE_THAT(puml, HasCall(_A("tmain()"), _A("A"), "a1()")); + REQUIRE_THAT(puml, HasCall(_A("tmain()"), _A("A"), "a2()")); + REQUIRE_THAT(puml, HasCall(_A("tmain()"), _A("A"), "a3()")); + + REQUIRE_THAT(puml, HasCall(_A("tmain()"), _A("B"), "b1()")); + REQUIRE_THAT(puml, HasCall(_A("tmain()"), _A("B"), "b2()")); + REQUIRE_THAT(puml, HasCall(_A("tmain()"), _A("B"), "log()")); + + save_puml( + "./" + config.output_directory() + "/" + diagram->name + ".puml", puml); +} \ No newline at end of file diff --git a/tests/test_cases.cc b/tests/test_cases.cc index 2e5944bb..f2b12c27 100644 --- a/tests/test_cases.cc +++ b/tests/test_cases.cc @@ -266,6 +266,7 @@ using namespace clanguml::test::matchers; #include "t20017/test_case.h" #include "t20018/test_case.h" #include "t20019/test_case.h" +#include "t20020/test_case.h" /// /// Package diagram tests diff --git a/tests/test_cases.yaml b/tests/test_cases.yaml index 20f5ba17..f94c1ef8 100644 --- a/tests/test_cases.yaml +++ b/tests/test_cases.yaml @@ -205,6 +205,9 @@ test_cases: - name: t20019 title: Curiously Recurring Template Pattern sequence diagram test case description: + - name: t20020 + title: If statement sequence diagram test case + description: Package diagrams: - name: t30001 title: Basic package diagram test case From 0c23ce86ba287793c45844e3c89550251aac93c4 Mon Sep 17 00:00:00 2001 From: Bartek Kryza Date: Sun, 11 Dec 2022 01:50:54 +0100 Subject: [PATCH 64/77] Added loop statement sequence diagram support --- src/common/model/enums.h | 15 +++- .../plantuml/sequence_diagram_generator.cc | 18 ++++ src/sequence_diagram/model/diagram.cc | 90 +++++++++++++++++++ src/sequence_diagram/model/diagram.h | 13 +++ .../visitor/call_expression_context.h | 21 +++++ .../visitor/translation_unit_visitor.cc | 88 +++++++++++++++++- .../visitor/translation_unit_visitor.h | 8 ++ tests/t20021/.clang-uml | 14 +++ tests/t20021/t20021.cc | 40 +++++++++ tests/t20021/test_case.h | 48 ++++++++++ tests/test_cases.cc | 1 + tests/test_cases.yaml | 3 + 12 files changed, 357 insertions(+), 2 deletions(-) create mode 100644 tests/t20021/.clang-uml create mode 100644 tests/t20021/t20021.cc create mode 100644 tests/t20021/test_case.h diff --git a/src/common/model/enums.h b/src/common/model/enums.h index 4e09570c..78912e37 100644 --- a/src/common/model/enums.h +++ b/src/common/model/enums.h @@ -39,7 +39,20 @@ enum class relationship_t { kDependency }; -enum class message_t { kCall, kReturn, kIf, kElse, kElseIf, kIfEnd }; +enum class message_t { + kCall, + kReturn, + kIf, + kElse, + kElseIf, + kIfEnd, + kWhile, + kWhileEnd, + kDo, + kDoEnd, + kFor, + kForEnd +}; std::string to_string(relationship_t r); diff --git a/src/sequence_diagram/generators/plantuml/sequence_diagram_generator.cc b/src/sequence_diagram/generators/plantuml/sequence_diagram_generator.cc index c9450c0a..777ff93b 100644 --- a/src/sequence_diagram/generators/plantuml/sequence_diagram_generator.cc +++ b/src/sequence_diagram/generators/plantuml/sequence_diagram_generator.cc @@ -159,6 +159,24 @@ void generator::generate_activity(const activity &a, std::ostream &ostr, else if (m.type == message_t::kIfEnd) { ostr << "end\n"; } + else if (m.type == message_t::kWhile) { + ostr << "loop\n"; + } + else if (m.type == message_t::kWhileEnd) { + ostr << "end\n"; + } + else if (m.type == message_t::kFor) { + ostr << "loop\n"; + } + else if (m.type == message_t::kForEnd) { + ostr << "end\n"; + } + else if (m.type == message_t::kDo) { + ostr << "loop\n"; + } + else if (m.type == message_t::kDoEnd) { + ostr << "end\n"; + } } } diff --git a/src/sequence_diagram/model/diagram.cc b/src/sequence_diagram/model/diagram.cc index a660adfd..a5cc0d99 100644 --- a/src/sequence_diagram/model/diagram.cc +++ b/src/sequence_diagram/model/diagram.cc @@ -102,6 +102,96 @@ void diagram::print() const } } +void diagram::add_for_stmt( + const common::model::diagram_element::id_t current_caller_id) +{ + add_loop_stmt(current_caller_id, common::model::message_t::kFor); +} + +void diagram::end_for_stmt( + const common::model::diagram_element::id_t current_caller_id) +{ + end_loop_stmt(current_caller_id, common::model::message_t::kForEnd); +} + +void diagram::add_while_stmt( + const common::model::diagram_element::id_t current_caller_id) +{ + add_loop_stmt(current_caller_id, common::model::message_t::kWhile); +} + +void diagram::end_while_stmt( + const common::model::diagram_element::id_t current_caller_id) +{ + end_loop_stmt(current_caller_id, common::model::message_t::kWhileEnd); +} + +void diagram::add_do_stmt( + const common::model::diagram_element::id_t current_caller_id) +{ + add_loop_stmt(current_caller_id, common::model::message_t::kDo); +} + +void diagram::end_do_stmt( + const common::model::diagram_element::id_t current_caller_id) +{ + end_loop_stmt(current_caller_id, common::model::message_t::kDoEnd); +} + +void diagram::add_loop_stmt( + const common::model::diagram_element::id_t current_caller_id, + common::model::message_t type) +{ + using clanguml::common::model::message_t; + + if (current_caller_id == 0) + return; + + if (sequences.find(current_caller_id) == sequences.end()) { + activity a; + a.from = current_caller_id; + sequences.insert({current_caller_id, std::move(a)}); + } + + message m; + m.from = current_caller_id; + m.type = type; + + sequences[current_caller_id].messages.emplace_back(std::move(m)); +} + +void diagram::end_loop_stmt( + const common::model::diagram_element::id_t current_caller_id, + common::model::message_t type) +{ + using clanguml::common::model::message_t; + + if (current_caller_id == 0) + return; + + message m; + m.from = current_caller_id; + m.type = type; + + message_t loop_type = message_t::kWhile; + + if (type == message_t::kForEnd) + loop_type = message_t::kFor; + else if (type == message_t::kDoEnd) + loop_type = message_t::kDo; + + if (sequences.find(current_caller_id) != sequences.end()) { + auto ¤t_messages = sequences[current_caller_id].messages; + + if (current_messages.back().type == loop_type) { + current_messages.pop_back(); + } + else { + current_messages.emplace_back(std::move(m)); + } + } +} + } namespace clanguml::common::model { diff --git a/src/sequence_diagram/model/diagram.h b/src/sequence_diagram/model/diagram.h index 0c275482..fb0404b9 100644 --- a/src/sequence_diagram/model/diagram.h +++ b/src/sequence_diagram/model/diagram.h @@ -102,6 +102,19 @@ public: participants; std::set active_participants_; + + void add_loop_stmt( + const common::model::diagram_element::id_t current_caller_id, + common::model::message_t type); + void end_loop_stmt( + const common::model::diagram_element::id_t current_caller_id, + common::model::message_t type); + void add_while_stmt(const common::model::diagram_element::id_t i); + void end_while_stmt(const common::model::diagram_element::id_t i); + void add_do_stmt(const common::model::diagram_element::id_t i); + void end_do_stmt(const common::model::diagram_element::id_t i); + void add_for_stmt(const common::model::diagram_element::id_t i); + void end_for_stmt(const common::model::diagram_element::id_t i); }; } diff --git a/src/sequence_diagram/visitor/call_expression_context.h b/src/sequence_diagram/visitor/call_expression_context.h index 68511876..cab68e9d 100644 --- a/src/sequence_diagram/visitor/call_expression_context.h +++ b/src/sequence_diagram/visitor/call_expression_context.h @@ -107,6 +107,25 @@ struct call_expression_context { return elseif_stmt_stack_.top(); } + clang::Stmt *current_loopstmt() const + { + if (loop_stmt_stack_.empty()) + return nullptr; + + return loop_stmt_stack_.top(); + } + + void enter_loopstmt(clang::Stmt *stmt) + { + return loop_stmt_stack_.push(stmt); + } + + void leave_loopstmt() + { + if (loop_stmt_stack_.empty()) + return loop_stmt_stack_.pop(); + } + clang::CXXRecordDecl *current_class_decl_; clang::ClassTemplateDecl *current_class_template_decl_; clang::ClassTemplateSpecializationDecl @@ -122,6 +141,8 @@ private: std::stack current_lambda_caller_id_; std::stack if_stmt_stack_; std::stack elseif_stmt_stack_; + + std::stack loop_stmt_stack_; }; } \ No newline at end of file diff --git a/src/sequence_diagram/visitor/translation_unit_visitor.cc b/src/sequence_diagram/visitor/translation_unit_visitor.cc index dbd11cc7..5cdbd8ed 100644 --- a/src/sequence_diagram/visitor/translation_unit_visitor.cc +++ b/src/sequence_diagram/visitor/translation_unit_visitor.cc @@ -566,7 +566,7 @@ bool translation_unit_visitor::TraverseCompoundStmt(clang::CompoundStmt *stmt) } } } - else if(current_ifstmt != nullptr) { + else if (current_ifstmt != nullptr) { if (current_ifstmt->getElse() == stmt) { const auto current_caller_id = context().caller_id(); @@ -671,6 +671,92 @@ bool translation_unit_visitor::TraverseIfStmt(clang::IfStmt *stmt) return true; } +bool translation_unit_visitor::TraverseWhileStmt(clang::WhileStmt *stmt) +{ + using clanguml::common::model::message_t; + using clanguml::sequence_diagram::model::activity; + using clanguml::sequence_diagram::model::message; + + context().enter_loopstmt(stmt); + + const auto current_caller_id = context().caller_id(); + + diagram().add_while_stmt(current_caller_id); + + RecursiveASTVisitor::TraverseWhileStmt(stmt); + + diagram().end_while_stmt(current_caller_id); + + context().leave_loopstmt(); + + return true; +} + +bool translation_unit_visitor::TraverseDoStmt(clang::DoStmt *stmt) +{ + using clanguml::common::model::message_t; + using clanguml::sequence_diagram::model::activity; + using clanguml::sequence_diagram::model::message; + + context().enter_loopstmt(stmt); + + const auto current_caller_id = context().caller_id(); + + diagram().add_do_stmt(current_caller_id); + + RecursiveASTVisitor::TraverseDoStmt(stmt); + + context().leave_loopstmt(); + + diagram().end_do_stmt(current_caller_id); + + return true; +} + +bool translation_unit_visitor::TraverseForStmt(clang::ForStmt *stmt) +{ + using clanguml::common::model::message_t; + using clanguml::sequence_diagram::model::activity; + using clanguml::sequence_diagram::model::message; + + context().enter_loopstmt(stmt); + + const auto current_caller_id = context().caller_id(); + + diagram().add_for_stmt(current_caller_id); + + RecursiveASTVisitor::TraverseForStmt(stmt); + + context().leave_loopstmt(); + + diagram().end_for_stmt(current_caller_id); + + return true; +} + +bool translation_unit_visitor::TraverseCXXForRangeStmt( + clang::CXXForRangeStmt *stmt) +{ + using clanguml::common::model::message_t; + using clanguml::sequence_diagram::model::activity; + using clanguml::sequence_diagram::model::message; + + context().enter_loopstmt(stmt); + + const auto current_caller_id = context().caller_id(); + + diagram().add_for_stmt(current_caller_id); + + RecursiveASTVisitor::TraverseCXXForRangeStmt( + stmt); + + context().leave_loopstmt(); + + diagram().end_for_stmt(current_caller_id); + + return true; +} + bool translation_unit_visitor::VisitCallExpr(clang::CallExpr *expr) { using clanguml::common::model::message_t; diff --git a/src/sequence_diagram/visitor/translation_unit_visitor.h b/src/sequence_diagram/visitor/translation_unit_visitor.h index 82c99b4c..5c31fa46 100644 --- a/src/sequence_diagram/visitor/translation_unit_visitor.h +++ b/src/sequence_diagram/visitor/translation_unit_visitor.h @@ -68,6 +68,14 @@ public: bool TraverseIfStmt(clang::IfStmt *stmt); + bool TraverseWhileStmt(clang::WhileStmt *stmt); + + bool TraverseDoStmt(clang::DoStmt *stmt); + + bool TraverseForStmt(clang::ForStmt *stmt); + + bool TraverseCXXForRangeStmt(clang::CXXForRangeStmt *stmt); + clanguml::sequence_diagram::model::diagram &diagram(); const clanguml::sequence_diagram::model::diagram &diagram() const; diff --git a/tests/t20021/.clang-uml b/tests/t20021/.clang-uml new file mode 100644 index 00000000..4c80b1bf --- /dev/null +++ b/tests/t20021/.clang-uml @@ -0,0 +1,14 @@ +compilation_database_dir: .. +output_directory: puml +diagrams: + t20021_sequence: + type: sequence + glob: + - ../../tests/t20021/t20021.cc + include: + namespaces: + - clanguml::t20021 + using_namespace: + - clanguml::t20021 + start_from: + - function: "clanguml::t20021::tmain()" \ No newline at end of file diff --git a/tests/t20021/t20021.cc b/tests/t20021/t20021.cc new file mode 100644 index 00000000..5fe5e19f --- /dev/null +++ b/tests/t20021/t20021.cc @@ -0,0 +1,40 @@ +#include + +namespace clanguml { +namespace t20021 { +struct A { + int a1() { return 0; } + int a2() { return 1; } + int a3() { return 2; } +}; + +struct B { + void log() { } + + int b1() const { return 3; } + int b2() const { return 4; } +}; + +int tmain() +{ + A a; + std::vector b; + + int i = 10; + while (i--) { + int j = a.a3(); + do { + for (int l = a.a2(); l > 0; l--) + a.a1(); + } while (j--); + } + + int result = 0; + for (const auto &bi : b) { + result += bi.b2(); + } + + return b.front().b2() + result; +} +} +} \ No newline at end of file diff --git a/tests/t20021/test_case.h b/tests/t20021/test_case.h new file mode 100644 index 00000000..9bfe53a3 --- /dev/null +++ b/tests/t20021/test_case.h @@ -0,0 +1,48 @@ +/** + * tests/t20021/test_case.h + * + * Copyright (c) 2021-2022 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("t20021", "[test-case][sequence]") +{ + auto [config, db] = load_config("t20021"); + + auto diagram = config.diagrams["t20021_sequence"]; + + REQUIRE(diagram->name == "t20021_sequence"); + + auto model = generate_sequence_diagram(*db, diagram); + + REQUIRE(model->name() == "t20021_sequence"); + + auto puml = generate_sequence_puml(diagram, *model); + AliasMatcher _A(puml); + + REQUIRE_THAT(puml, StartsWith("@startuml")); + REQUIRE_THAT(puml, EndsWith("@enduml\n")); + + + // Check if all calls exist + REQUIRE_THAT(puml, HasCall(_A("tmain()"), _A("A"), "a1()")); + REQUIRE_THAT(puml, HasCall(_A("tmain()"), _A("A"), "a2()")); + REQUIRE_THAT(puml, HasCall(_A("tmain()"), _A("A"), "a3()")); + + REQUIRE_THAT(puml, HasCall(_A("tmain()"), _A("B"), "b1()")); + REQUIRE_THAT(puml, HasCall(_A("tmain()"), _A("B"), "b2()")); + + save_puml( + "./" + config.output_directory() + "/" + diagram->name + ".puml", puml); +} \ No newline at end of file diff --git a/tests/test_cases.cc b/tests/test_cases.cc index f2b12c27..e4a08b61 100644 --- a/tests/test_cases.cc +++ b/tests/test_cases.cc @@ -267,6 +267,7 @@ using namespace clanguml::test::matchers; #include "t20018/test_case.h" #include "t20019/test_case.h" #include "t20020/test_case.h" +#include "t20021/test_case.h" /// /// Package diagram tests diff --git a/tests/test_cases.yaml b/tests/test_cases.yaml index f94c1ef8..e51d4d09 100644 --- a/tests/test_cases.yaml +++ b/tests/test_cases.yaml @@ -208,6 +208,9 @@ test_cases: - name: t20020 title: If statement sequence diagram test case description: + - name: t20021 + title: Loop statements sequence diagram test case + description: Package diagrams: - name: t30001 title: Basic package diagram test case From dcdde1af4ba60eb303e4308d9625c2c26d255906 Mon Sep 17 00:00:00 2001 From: Bartek Kryza Date: Sun, 11 Dec 2022 02:03:26 +0100 Subject: [PATCH 65/77] Fixed if constexpr sequence diagram handling --- .../visitor/translation_unit_visitor.cc | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/src/sequence_diagram/visitor/translation_unit_visitor.cc b/src/sequence_diagram/visitor/translation_unit_visitor.cc index 5cdbd8ed..1df10ad0 100644 --- a/src/sequence_diagram/visitor/translation_unit_visitor.cc +++ b/src/sequence_diagram/visitor/translation_unit_visitor.cc @@ -548,7 +548,7 @@ bool translation_unit_visitor::TraverseCompoundStmt(clang::CompoundStmt *stmt) const auto *current_ifstmt = context().current_ifstmt(); const auto *current_elseifstmt = context().current_elseifstmt(); - + // // Add final else block (not else if) // @@ -593,15 +593,13 @@ bool translation_unit_visitor::TraverseIfStmt(clang::IfStmt *stmt) using clanguml::sequence_diagram::model::activity; using clanguml::sequence_diagram::model::message; - const auto *current_ifstmt = context().current_ifstmt(); - - context().enter_ifstmt(stmt); - const auto current_caller_id = context().caller_id(); - bool elseif_block{false}; - if (current_caller_id) { + if (current_caller_id && !stmt->isConstexpr()) { + const auto *current_ifstmt = context().current_ifstmt(); + context().enter_ifstmt(stmt); + if (diagram().sequences.find(current_caller_id) == diagram().sequences.end()) { activity a; @@ -636,9 +634,7 @@ bool translation_unit_visitor::TraverseIfStmt(clang::IfStmt *stmt) RecursiveASTVisitor::TraverseIfStmt(stmt); - context().leave_ifstmt(); - - if (current_caller_id && !elseif_block) { + if (current_caller_id && !stmt->isConstexpr() && !elseif_block) { message m; m.from = current_caller_id; m.type = message_t::kIfEnd; From cbab8b5e743b88beeb5d11b88db9198084a926f6 Mon Sep 17 00:00:00 2001 From: Bartek Kryza Date: Sun, 11 Dec 2022 02:03:57 +0100 Subject: [PATCH 66/77] Fixed formatting --- src/sequence_diagram/visitor/translation_unit_visitor.cc | 2 +- tests/t20020/t20020.cc | 2 +- tests/t20020/test_case.h | 1 - tests/t20021/test_case.h | 1 - 4 files changed, 2 insertions(+), 4 deletions(-) diff --git a/src/sequence_diagram/visitor/translation_unit_visitor.cc b/src/sequence_diagram/visitor/translation_unit_visitor.cc index 1df10ad0..fd7074b4 100644 --- a/src/sequence_diagram/visitor/translation_unit_visitor.cc +++ b/src/sequence_diagram/visitor/translation_unit_visitor.cc @@ -548,7 +548,7 @@ bool translation_unit_visitor::TraverseCompoundStmt(clang::CompoundStmt *stmt) const auto *current_ifstmt = context().current_ifstmt(); const auto *current_elseifstmt = context().current_elseifstmt(); - + // // Add final else block (not else if) // diff --git a/tests/t20020/t20020.cc b/tests/t20020/t20020.cc index df29e6b2..42d9ac9e 100644 --- a/tests/t20020/t20020.cc +++ b/tests/t20020/t20020.cc @@ -43,7 +43,7 @@ int tmain() if (result != 2) { result = std::exp(result); } - else if(result == 3) { + else if (result == 3) { result = 4; } else { diff --git a/tests/t20020/test_case.h b/tests/t20020/test_case.h index 74437de4..03b60b34 100644 --- a/tests/t20020/test_case.h +++ b/tests/t20020/test_case.h @@ -34,7 +34,6 @@ TEST_CASE("t20020", "[test-case][sequence]") REQUIRE_THAT(puml, StartsWith("@startuml")); REQUIRE_THAT(puml, EndsWith("@enduml\n")); - // Check if all calls exist REQUIRE_THAT(puml, HasCall(_A("tmain()"), _A("A"), "a1()")); REQUIRE_THAT(puml, HasCall(_A("tmain()"), _A("A"), "a2()")); diff --git a/tests/t20021/test_case.h b/tests/t20021/test_case.h index 9bfe53a3..f034e315 100644 --- a/tests/t20021/test_case.h +++ b/tests/t20021/test_case.h @@ -34,7 +34,6 @@ TEST_CASE("t20021", "[test-case][sequence]") REQUIRE_THAT(puml, StartsWith("@startuml")); REQUIRE_THAT(puml, EndsWith("@enduml\n")); - // Check if all calls exist REQUIRE_THAT(puml, HasCall(_A("tmain()"), _A("A"), "a1()")); REQUIRE_THAT(puml, HasCall(_A("tmain()"), _A("A"), "a2()")); From 70cb58fce9515b43b8355e3a393b3ff52208d9b9 Mon Sep 17 00:00:00 2001 From: Bartek Kryza Date: Sun, 11 Dec 2022 02:18:05 +0100 Subject: [PATCH 67/77] Updated test case documentation --- docs/test_cases.md | 2 + docs/test_cases/t00002_class.svg | 36 ++--- docs/test_cases/t00003_class.svg | 46 +++---- docs/test_cases/t00004_class.svg | 76 +++++------ docs/test_cases/t00005_class.svg | 110 +++++++-------- docs/test_cases/t00006_class.svg | 132 +++++++++--------- docs/test_cases/t00007_class.svg | 30 ++-- docs/test_cases/t00008_class.svg | 56 ++++---- docs/test_cases/t00009_class.svg | 32 ++--- docs/test_cases/t00010_class.svg | 34 ++--- docs/test_cases/t00011_class.svg | 22 +-- docs/test_cases/t00012_class.svg | 66 ++++----- docs/test_cases/t00013_class.svg | 82 +++++------ docs/test_cases/t00014_class.svg | 116 ++++++++-------- docs/test_cases/t00015_class.svg | 22 +-- docs/test_cases/t00016_class.svg | 30 ++-- docs/test_cases/t00017_class.svg | 66 ++++----- docs/test_cases/t00018_class.svg | 18 +-- docs/test_cases/t00019_class.svg | 40 +++--- docs/test_cases/t00020_class.svg | 38 +++--- docs/test_cases/t00021_class.svg | 30 ++-- docs/test_cases/t00022_class.svg | 14 +- docs/test_cases/t00023_class.svg | 26 ++-- docs/test_cases/t00024_class.svg | 22 +-- docs/test_cases/t00025_class.svg | 34 ++--- docs/test_cases/t00026_class.svg | 42 +++--- docs/test_cases/t00027_class.svg | 58 ++++---- docs/test_cases/t00028_class.svg | 78 +++++------ docs/test_cases/t00029_class.svg | 50 +++---- docs/test_cases/t00030_class.svg | 46 +++---- docs/test_cases/t00031_class.svg | 50 +++---- docs/test_cases/t00032_class.svg | 40 +++--- docs/test_cases/t00033_class.svg | 48 +++---- docs/test_cases/t00034_class.svg | 46 +++---- docs/test_cases/t00035_class.svg | 22 +-- docs/test_cases/t00036_class.svg | 38 +++--- docs/test_cases/t00037_class.svg | 54 ++++---- docs/test_cases/t00038_class.svg | 58 ++++---- docs/test_cases/t00039_class.svg | 78 +++++------ docs/test_cases/t00040_class.svg | 26 ++-- docs/test_cases/t00041_class.svg | 54 ++++---- docs/test_cases/t00042_class.svg | 36 ++--- docs/test_cases/t00043_class.svg | 50 +++---- docs/test_cases/t00044_class.svg | 36 ++--- docs/test_cases/t00045_class.svg | 70 +++++----- docs/test_cases/t00046_class.svg | 64 ++++----- docs/test_cases/t00047_class.svg | 22 +-- docs/test_cases/t00048_class.svg | 50 +++---- docs/test_cases/t00049_class.svg | 32 ++--- docs/test_cases/t00050_class.svg | 70 +++++----- docs/test_cases/t20001_sequence.svg | 62 ++++----- docs/test_cases/t20002_sequence.svg | 48 +++---- docs/test_cases/t20003_sequence.svg | 48 +++---- docs/test_cases/t20004_sequence.svg | 120 ++++++++-------- docs/test_cases/t20005_sequence.svg | 36 ++--- docs/test_cases/t20006_sequence.svg | 150 ++++++++++---------- docs/test_cases/t20007_sequence.svg | 48 +++---- docs/test_cases/t20008_sequence.svg | 84 ++++++------ docs/test_cases/t20009_sequence.svg | 84 ++++++------ docs/test_cases/t20010_sequence.svg | 72 +++++----- docs/test_cases/t20011_sequence.svg | 154 +++++++++++---------- docs/test_cases/t20012_sequence.svg | 204 ++++++++++++++-------------- docs/test_cases/t20013_sequence.svg | 60 ++++---- docs/test_cases/t20014_sequence.svg | 72 +++++----- docs/test_cases/t20015_sequence.svg | 24 ++-- docs/test_cases/t20016_sequence.svg | 48 +++---- docs/test_cases/t20017_sequence.svg | 48 +++---- docs/test_cases/t20018_sequence.svg | 96 ++++++------- docs/test_cases/t20019_sequence.svg | 84 ++++++------ docs/test_cases/t20020.md | 80 +++++++++++ docs/test_cases/t20020_sequence.svg | 100 ++++++++++++++ docs/test_cases/t20021.md | 64 +++++++++ docs/test_cases/t20021_sequence.svg | 97 +++++++++++++ docs/test_cases/t30001_package.svg | 48 +++---- docs/test_cases/t30002_package.svg | 90 ++++++------ docs/test_cases/t30003_package.svg | 26 ++-- docs/test_cases/t30004_package.svg | 30 ++-- docs/test_cases/t30005_package.svg | 38 +++--- docs/test_cases/t30006_package.svg | 16 +-- docs/test_cases/t30007_package.svg | 20 +-- docs/test_cases/t30008_package.svg | 34 ++--- docs/test_cases/t40001_include.svg | 30 ++-- docs/test_cases/t40002_include.svg | 34 ++--- docs/test_cases/t40003_include.svg | 50 +++---- 84 files changed, 2526 insertions(+), 2171 deletions(-) create mode 100644 docs/test_cases/t20020.md create mode 100644 docs/test_cases/t20020_sequence.svg create mode 100644 docs/test_cases/t20021.md create mode 100644 docs/test_cases/t20021_sequence.svg diff --git a/docs/test_cases.md b/docs/test_cases.md index c61cd54d..00736d07 100644 --- a/docs/test_cases.md +++ b/docs/test_cases.md @@ -69,6 +69,8 @@ * [t20017](./test_cases/t20017.md) - Test case for combine_free_functions_into_file_participants option * [t20018](./test_cases/t20018.md) - Recursive template sequence diagram test case * [t20019](./test_cases/t20019.md) - Curiously Recurring Template Pattern sequence diagram test case + * [t20020](./test_cases/t20020.md) - If statement sequence diagram test case + * [t20021](./test_cases/t20021.md) - Loop statements sequence diagram test case ## Package diagrams * [t30001](./test_cases/t30001.md) - Basic package diagram test case * [t30002](./test_cases/t30002.md) - Package dependency test case diff --git a/docs/test_cases/t00002_class.svg b/docs/test_cases/t00002_class.svg index d46c98c2..5d9e9208 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_class.svg b/docs/test_cases/t00003_class.svg index 25a265f9..27d38e58 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_class.svg b/docs/test_cases/t00004_class.svg index d7d8ca94..6c3105e2 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,15 +59,15 @@ Red - - + + A::AA::AAA - + C::B @@ -75,8 +75,8 @@ int - - + + C @@ -84,39 +84,39 @@ T - + - + t : T - + - + b_int : B<int> - - + + C::AA - - + + C::AA::AAA - - + + C::AA::CCC @@ -125,8 +125,8 @@ CCC_2 - - + + C::B @@ -134,16 +134,16 @@ V - + - + b : V - - + + C::CC @@ -152,16 +152,16 @@ CC_2 - - + + detail::D - - + + detail::D::AA @@ -171,8 +171,8 @@ AA_3 - - + + detail::D::DD diff --git a/docs/test_cases/t00005_class.svg b/docs/test_cases/t00005_class.svg index fed3c649..28259219 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_class.svg b/docs/test_cases/t00006_class.svg index 3322c29c..65473d96 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,15 +146,15 @@ T - + - + data : std::vector<T> - + custom_container @@ -162,102 +162,102 @@ 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_class.svg b/docs/test_cases/t00007_class.svg index 6dd7effc..c08a89f3 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_class.svg b/docs/test_cases/t00008_class.svg index 2f23941b..16ee6aa2 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,CMP,int N - + - + 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,15 +87,15 @@ T,C<> - + - + template_template : C<T> - + B @@ -103,18 +103,18 @@ int,Vector - - + + D - + - + ints : B<int,Vector> diff --git a/docs/test_cases/t00009_class.svg b/docs/test_cases/t00009_class.svg index 773c1fb6..6db3aa2d 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,15 +18,15 @@ T - + - + value : T - + A @@ -34,7 +34,7 @@ int - + A @@ -42,7 +42,7 @@ std::string - + A @@ -50,32 +50,32 @@ 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_class.svg b/docs/test_cases/t00010_class.svg index 6f3bb9d6..74c74b33 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,22 +18,22 @@ T,P - + - + first : T - + - + second : P - + A @@ -41,8 +41,8 @@ T,std::string - - + + B @@ -50,15 +50,15 @@ T - + - + astring : A<T,std::string> - + B @@ -66,18 +66,18 @@ int - - + + C - + - + aintstring : B<int> diff --git a/docs/test_cases/t00011_class.svg b/docs/test_cases/t00011_class.svg index d4a5a0d8..bd70b707 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_class.svg b/docs/test_cases/t00012_class.svg index d2b23298..1e6c5a46 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,14 +60,14 @@ - + - + ints : std::array<T,sizeof...(Is)> - + A @@ -75,7 +75,7 @@ int,std::string,float - + A @@ -83,7 +83,7 @@ int,std::string,bool - + B @@ -91,7 +91,7 @@ 3,2,1 - + B @@ -99,7 +99,7 @@ 1,1,1,1 - + C @@ -107,50 +107,50 @@ 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_class.svg b/docs/test_cases/t00013_class.svg index 92b5e485..2bdc3de1 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,15 +18,15 @@ T - + - + f : T - + ABCD::F @@ -34,70 +34,70 @@ int - - + + A - + - + a : int - - + + B - + - + b : int - - + + C - + - + c : int - - + + D - + - + d : int print(R * r) : void - - + + E @@ -105,16 +105,16 @@ T - + - + e : T - - + + G @@ -122,22 +122,22 @@ T,Args... - + - + g : T - + - + args : std::tuple<Args...> - + E @@ -145,7 +145,7 @@ int - + G @@ -153,7 +153,7 @@ int,float,std::string - + E @@ -161,25 +161,25 @@ std::string - - + + R - + - + gintstring : G<int,float,std::string> - + - + estring : E<std::string> diff --git a/docs/test_cases/t00014_class.svg b/docs/test_cases/t00014_class.svg index d574c157..1e715b77 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,37 +18,37 @@ T,P - + - + t : T - + - + p : P - - + + B - + - + value : std::string - + A @@ -56,7 +56,7 @@ T,std::string - + A @@ -64,7 +64,7 @@ T,std::unique_ptr<std::string> - + A @@ -72,7 +72,7 @@ long,T - + A @@ -80,7 +80,7 @@ double,T - + A @@ -88,7 +88,7 @@ long,U - + A @@ -96,7 +96,7 @@ long,bool - + A @@ -104,7 +104,7 @@ double,bool - + A @@ -112,7 +112,7 @@ long,float - + A @@ -120,7 +120,7 @@ double,float - + A @@ -128,7 +128,7 @@ bool,std::string - + A @@ -136,7 +136,7 @@ float,std::unique_ptr<std::string> - + A @@ -144,7 +144,7 @@ int,std::string - + A @@ -152,7 +152,7 @@ std::string,std::string - + A @@ -160,7 +160,7 @@ char,std::string - + A @@ -168,116 +168,116 @@ wchar_t,std::string - - + + R - + - + 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 - + - + bs : BVector - + - + bs2 : BVector2 - + - + cb : SimpleCallback<ACharString> - + - + gcb : GenericCallback<R::AWCharString> - + - + vcb : VoidCallback - + - + vps : VectorPtr<B> diff --git a/docs/test_cases/t00015_class.svg b/docs/test_cases/t00015_class.svg index 7d14ad68..9273bf17 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_class.svg b/docs/test_cases/t00016_class.svg index ab35b237..fbd5b7cf 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<> @@ -19,8 +19,8 @@ value : enum - - + + is_numeric @@ -29,8 +29,8 @@ value : enum - - + + is_numeric @@ -41,8 +41,8 @@ value : enum - - + + is_numeric @@ -53,8 +53,8 @@ value : enum - - + + is_numeric @@ -65,8 +65,8 @@ value : enum - - + + is_numeric @@ -77,8 +77,8 @@ value : enum - - + + is_numeric diff --git a/docs/test_cases/t00017_class.svg b/docs/test_cases/t00017_class.svg index 00343ae1..fb818d23 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_class.svg b/docs/test_cases/t00018_class.svg index b98656b4..88f15dd6 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_class.svg b/docs/test_cases/t00019_class.svg index 475c36a4..0ca37c76 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,7 +83,7 @@ m1_calls() const : int m2_calls() const : int - + Layer3 @@ -91,7 +91,7 @@ Base - + Layer2 @@ -99,7 +99,7 @@ Layer3<Base> - + Layer1 @@ -107,18 +107,18 @@ Layer2<Layer3<Base>> - - + + A - + - + layers : std::unique_ptr<Layer1<Layer2<Layer3<Base>>>> diff --git a/docs/test_cases/t00020_class.svg b/docs/test_cases/t00020_class.svg index a24179ec..fbd55f5a 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_class.svg b/docs/test_cases/t00021_class.svg index c0c3195b..34cdabc8 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_class.svg b/docs/test_cases/t00022_class.svg index 52989efd..d5e6c815 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_class.svg b/docs/test_cases/t00023_class.svg index 7657c2ca..bf9cc553 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_class.svg b/docs/test_cases/t00024_class.svg index c06f195f..48d96997 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_class.svg b/docs/test_cases/t00025_class.svg index 2f3d17ae..a75793a9 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,7 +56,7 @@ m1() : void m2() : void - + Proxy @@ -64,7 +64,7 @@ Target1 - + Proxy @@ -72,25 +72,25 @@ Target2 - - + + ProxyHolder - + - + proxy1 : Proxy<Target1> - + - + proxy2 : Proxy<Target2> diff --git a/docs/test_cases/t00026_class.svg b/docs/test_cases/t00026_class.svg index fa0ff0ba..1263118f 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>(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,7 +78,7 @@ state(const std::string & n) : Memento<T> & set_state(const std::string & s, Memento<T> && m) : void - + Caretaker @@ -86,7 +86,7 @@ std::string - + Originator @@ -94,25 +94,25 @@ std::string - - + + StringMemento - + - + caretaker : Caretaker<std::string> - + - + originator : Originator<std::string> diff --git a/docs/test_cases/t00027_class.svg b/docs/test_cases/t00027_class.svg index 39ac9da7..71a21a60 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,14 @@ ~Shape() = default : void - + Line - - + + Line @@ -39,14 +39,14 @@ display() : void - + Text - - + + Text @@ -57,8 +57,8 @@ display() : void - - + + ShapeDecorator @@ -67,8 +67,8 @@ display() = 0 : void - - + + Color @@ -79,8 +79,8 @@ display() : void - - + + Weight @@ -91,7 +91,7 @@ display() : void - + Line @@ -99,7 +99,7 @@ Color,Weight - + Line @@ -107,7 +107,7 @@ Color - + Text @@ -115,7 +115,7 @@ Color,Weight - + Text @@ -123,39 +123,39 @@ Color - - + + Window - + - + border : Line<Color,Weight> - + - + divider : Line<Color> - + - + title : Text<Color,Weight> - + - + description : Text<Color> diff --git a/docs/test_cases/t00028_class.svg b/docs/test_cases/t00028_class.svg index eab618cd..2aaa5131 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,10 +94,10 @@ three - + F enum note. - + E @@ -105,59 +105,59 @@ 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. diff --git a/docs/test_cases/t00029_class.svg b/docs/test_cases/t00029_class.svg index b8968345..ddcd8a13 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_class.svg b/docs/test_cases/t00030_class.svg index f00acd2e..8b6cb90d 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_class.svg b/docs/test_cases/t00031_class.svg index 20a19557..3a86c444 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,23 +47,23 @@ T - + - + ttt : T - - + + D - + C @@ -71,39 +71,39 @@ int - - + + R - + - + aaa : A * - + - + bbb : std::vector<B> - + - + ccc : C<int> - + - + ddd : D * diff --git a/docs/test_cases/t00032_class.svg b/docs/test_cases/t00032_class.svg index 6e368700..58c74525 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,15 +64,15 @@ T,L,Ts... - + - + counter : L - + Overload @@ -80,18 +80,18 @@ TBase,int,A,B,C - - + + R - + - + overload : Overload<TBase,int,A,B,C> diff --git a/docs/test_cases/t00033_class.svg b/docs/test_cases/t00033_class.svg index deb27f83..1ed55110 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,30 +52,30 @@ T - + - + ccc : T - - + + D - + - + ddd : int - + C @@ -83,7 +83,7 @@ D - + B @@ -91,7 +91,7 @@ std::unique_ptr<C<D>> - + A @@ -99,18 +99,18 @@ B<std::unique_ptr<C<D>>> - - + + R - + - + abc : A<B<std::unique_ptr<C<D>>>> diff --git a/docs/test_cases/t00034_class.svg b/docs/test_cases/t00034_class.svg index 5c0b6716..d8202a67 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,16 +31,16 @@ - - + + lift_void - - + + lift_void @@ -49,8 +49,8 @@ - - + + drop_void @@ -59,16 +59,16 @@ - - + + drop_void - - + + drop_void @@ -77,33 +77,33 @@ - - + + A - - + + R - + - + la : lift_void_t<A> * - + - + lv : lift_void_t<void> * diff --git a/docs/test_cases/t00035_class.svg b/docs/test_cases/t00035_class.svg index 7ecb70df..3f2141e4 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_class.svg b/docs/test_cases/t00036_class.svg index b909b969..644ab60a 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,15 +43,15 @@ T - + - + a : T - + A @@ -59,23 +59,23 @@ int - - + + B - + - + a_int : A<int> - - + + C diff --git a/docs/test_cases/t00037_class.svg b/docs/test_cases/t00037_class.svg index ae4fb64f..1eda95f6 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_620) - + - + units : ST::(anonymous_739) - - + + 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_class.svg b/docs/test_cases/t00038_class.svg index f90a11b7..57f07dbf 100644 --- a/docs/test_cases/t00038_class.svg +++ b/docs/test_cases/t00038_class.svg @@ -1,6 +1,6 @@ - + @@ -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,16 +88,16 @@ - - + + map - - + + map @@ -106,8 +106,8 @@ - - + + map @@ -116,8 +116,8 @@ - - + + map @@ -126,8 +126,8 @@ - - + + map diff --git a/docs/test_cases/t00039_class.svg b/docs/test_cases/t00039_class.svg index 0cf2e156..b2c465ce 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_class.svg b/docs/test_cases/t00040_class.svg index 4300c70d..02f0e2db 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_class.svg b/docs/test_cases/t00041_class.svg index 05839f87..5815d27d 100644 --- a/docs/test_cases/t00041_class.svg +++ b/docs/test_cases/t00041_class.svg @@ -1,6 +1,6 @@ - + @@ -9,100 +9,100 @@ - - + + R - - + + D - + - + rr : RR * - - + + E - - + + F - - + + RR - + - + e : E * - + - + f : F * - + - + g : detail::G * - - + + RRR - - + + ns1::N - - + + ns1::NN - - + + ns1::NM diff --git a/docs/test_cases/t00042_class.svg b/docs/test_cases/t00042_class.svg index 1f5e9fc7..709cc47a 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,22 +52,22 @@ T,K - + - + b : T - + - + bb : K - + A @@ -75,7 +75,7 @@ double - + A @@ -83,7 +83,7 @@ std::string - + B diff --git a/docs/test_cases/t00043_class.svg b/docs/test_cases/t00043_class.svg index b2b204ff..27534098 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_class.svg b/docs/test_cases/t00044_class.svg index ee8b3b47..b4e124db 100644 --- a/docs/test_cases/t00044_class.svg +++ b/docs/test_cases/t00044_class.svg @@ -1,6 +1,6 @@ - + @@ -9,7 +9,7 @@ - + signal_handler @@ -17,8 +17,8 @@ ,A - - + + sink @@ -27,15 +27,15 @@ sink<signal_handler<type-parameter-0-0 (type-parameter-0-1...), type-parameter-0-2> >(sink<signal_handler<type-parameter-0-0 (type-parameter-0-1...),type-parameter-0-2>>::signal_t & sh) : void - + - + signal : sink<signal_handler<type-parameter-0-0 (type-parameter-0-1...),type-parameter-0-2>>::signal_t * - - + + sink @@ -46,23 +46,23 @@ sink<signal_handler<type-parameter-0-0 (type-parameter-0-1...), type-parameter-0-2> >(sink<signal_handler<type-parameter-0-0 (type-parameter-0-1...),type-parameter-0-2>>::signal_t & sh) : void - + - + signal : sink<signal_handler<type-parameter-0-0 (type-parameter-0-1...),type-parameter-0-2>>::signal_t * - - + + signal_handler - - + + signal_handler @@ -71,8 +71,8 @@ - - + + signal_handler @@ -81,8 +81,8 @@ - - + + sink diff --git a/docs/test_cases/t00045_class.svg b/docs/test_cases/t00045_class.svg index 22e46271..8916f5dd 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_class.svg b/docs/test_cases/t00046_class.svg index 90b9ce67..25272c88 100644 --- a/docs/test_cases/t00046_class.svg +++ b/docs/test_cases/t00046_class.svg @@ -1,6 +1,6 @@ - + @@ -9,118 +9,118 @@ - + ns1 - + ns2 - + __gnu_cxx - - + + A - - + + A - - + + B - - + + C - - + + D - - + + E - - + + R - + - + a : ns1::ns2::A * - + - + ns1_a : ns1::A * - + - + ns1_ns2_a : ns1::ns2::A * - + - + root_a : ::A * - + - + i : std::vector<std::uint8_t> foo(AA & aa) : void - - + + A - - + + AA diff --git a/docs/test_cases/t00047_class.svg b/docs/test_cases/t00047_class.svg index b0799a0c..e5c56714 100644 --- a/docs/test_cases/t00047_class.svg +++ b/docs/test_cases/t00047_class.svg @@ -1,6 +1,6 @@ - + @@ -9,16 +9,16 @@ - - + + conditional_t - - + + conditional_t @@ -27,8 +27,8 @@ - - + + conditional_t @@ -37,8 +37,8 @@ - - + + conditional_t @@ -47,8 +47,8 @@ - - + + conditional_t diff --git a/docs/test_cases/t00048_class.svg b/docs/test_cases/t00048_class.svg index fd82736c..3b9b2bb8 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_class.svg b/docs/test_cases/t00049_class.svg index dc2d2eaf..fcfaae64 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,17 +18,17 @@ T - + - + a : T get_a() : T & - + A @@ -36,7 +36,7 @@ intmap - + A @@ -44,7 +44,7 @@ thestring - + A @@ -52,32 +52,32 @@ std::vector<thestring> - - + + R - + - + a_string : A<thestring> - + - + a_vector_string : A<string_vector> - + - + a_int_map : A<intmap> diff --git a/docs/test_cases/t00050_class.svg b/docs/test_cases/t00050_class.svg index 9e2e158e..507e0432 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 diff --git a/docs/test_cases/t20001_sequence.svg b/docs/test_cases/t20001_sequence.svg index 830a0263..c53bd600 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_sequence.svg b/docs/test_cases/t20002_sequence.svg index 498ef0d6..8f7b1188 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_sequence.svg b/docs/test_cases/t20003_sequence.svg index aa9c1780..aea372bb 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_sequence.svg b/docs/test_cases/t20004_sequence.svg index 7573c096..37050c2c 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_sequence.svg b/docs/test_cases/t20005_sequence.svg index d0c092eb..4d55456d 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_sequence.svg b/docs/test_cases/t20006_sequence.svg index 98780639..0eefbbe8 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_sequence.svg b/docs/test_cases/t20007_sequence.svg index 8db72ea2..2f174b40 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_sequence.svg b/docs/test_cases/t20008_sequence.svg index 72da9b5d..003b9b8c 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_sequence.svg b/docs/test_cases/t20009_sequence.svg index 6b8fea2c..eedfaba1 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_sequence.svg b/docs/test_cases/t20010_sequence.svg index b42e09a7..f8dde17d 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_sequence.svg b/docs/test_cases/t20011_sequence.svg index 43ca7153..e021dc33 100644 --- a/docs/test_cases/t20011_sequence.svg +++ b/docs/test_cases/t20011_sequence.svg @@ -1,6 +1,6 @@ - + - + @@ -9,89 +9,101 @@ - - - - - - - - - - - - - + + + + + + + + + + + + + + + + tmain() - - tmain() + + tmain() - - + + A - - A + + A - - - - - - - - - - + + + + + + + + + + a(int) - - - - - - a(int) + + + alt + + + + + + a(int) - - - - b(int) + + + + b(int) - - - - - - c(int) + + + + + + c(int) - - - - - - d(int) + + + + + + d(int) - - - - - - b(int) + + + alt + + + + + + b(int) - - - - - - a(int) + + + + + + a(int) - - - - - - a(int) + + + alt + + + + + + a(int) diff --git a/docs/test_cases/t20012_sequence.svg b/docs/test_cases/t20012_sequence.svg index 02a5b880..501124ab 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 t20012.cc:66:20) - + tmain()::(lambda t20012.cc:66:20) - - + + A - + A - - + + B - + B - - + + tmain()::(lambda t20012.cc:79:20) - + tmain()::(lambda t20012.cc:79:20) - - + + C - + C - - + + R<R::(lambda t20012.cc:85:9)> - + R<R::(lambda t20012.cc:85:9)> - - + + tmain()::(lambda t20012.cc:85:9) - + tmain()::(lambda 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_sequence.svg b/docs/test_cases/t20013_sequence.svg index fefa9007..d3a37814 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_sequence.svg b/docs/test_cases/t20014_sequence.svg index c74c767b..e9a186c4 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_sequence.svg b/docs/test_cases/t20015_sequence.svg index a0f5e77e..79c6e532 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_sequence.svg b/docs/test_cases/t20016_sequence.svg index a752e4f2..8301e71c 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_sequence.svg b/docs/test_cases/t20017_sequence.svg index ba9db2e3..dfd82c34 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_b.h - + include/t20017_b.h - + include/t20017_a.h - + include/t20017_a.h - - - - - - + + + + + + tmain() - + b2<int>(int,int) - + a1(int,int) - + a2(int,int) - + a3(int,int) - + b1(int,int) diff --git a/docs/test_cases/t20018_sequence.svg b/docs/test_cases/t20018_sequence.svg index 9ffe10f9..9d2d19d8 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_sequence.svg b/docs/test_cases/t20019_sequence.svg index 55735506..9e19c79d 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 new file mode 100644 index 00000000..1aec891e --- /dev/null +++ b/docs/test_cases/t20020.md @@ -0,0 +1,80 @@ +# t20020 - If statement sequence diagram test case +## Config +```yaml +compilation_database_dir: .. +output_directory: puml +diagrams: + t20020_sequence: + type: sequence + glob: + - ../../tests/t20020/t20020.cc + include: + namespaces: + - clanguml::t20020 + using_namespace: + - clanguml::t20020 + start_from: + - function: "clanguml::t20020::tmain()" +``` +## Source code +File t20020.cc +```cpp +#include +#include + +namespace clanguml { +namespace t20020 { +struct A { + int a1() { return 0; } + int a2() { return 1; } + int a3() { return 2; } +}; + +struct B { + void log() { } + + int b1() { return 3; } + int b2() { return 4; } +}; + +int tmain() +{ + A a; + B b; + + int result{0}; + + if (reinterpret_cast(&a) % 100 == 0ULL) { + result = a.a1(); + } + else if (reinterpret_cast(&a) % 64 == 0ULL) { + if (a.a2() > 2) + result = b.b1(); + else + result = b.b2(); + } + else { + result = a.a3(); + } + + b.log(); + + // This if/else should not be included in the diagram at all + // as the calls to std will be excluded by the diagram filters + if (result != 2) { + result = std::exp(result); + } + else if (result == 3) { + result = 4; + } + else { + result = std::exp(result + 1); + } + + return result; +} +} +} +``` +## Generated UML diagrams +![t20020_sequence](./t20020_sequence.svg "If statement sequence diagram test case") diff --git a/docs/test_cases/t20020_sequence.svg b/docs/test_cases/t20020_sequence.svg new file mode 100644 index 00000000..6fadc05a --- /dev/null +++ b/docs/test_cases/t20020_sequence.svg @@ -0,0 +1,100 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + tmain() + + tmain() + + + + A + + A + + + + B + + B + + + + + + + + + + + alt + + + + a1() + + + + + + + alt + + + + a2() + + + + + + + b1() + + + + + + + b2() + + + + + + + + a3() + + + + + + + log() + + + diff --git a/docs/test_cases/t20021.md b/docs/test_cases/t20021.md new file mode 100644 index 00000000..448d852b --- /dev/null +++ b/docs/test_cases/t20021.md @@ -0,0 +1,64 @@ +# t20021 - Loop statements sequence diagram test case +## Config +```yaml +compilation_database_dir: .. +output_directory: puml +diagrams: + t20021_sequence: + type: sequence + glob: + - ../../tests/t20021/t20021.cc + include: + namespaces: + - clanguml::t20021 + using_namespace: + - clanguml::t20021 + start_from: + - function: "clanguml::t20021::tmain()" +``` +## Source code +File t20021.cc +```cpp +#include + +namespace clanguml { +namespace t20021 { +struct A { + int a1() { return 0; } + int a2() { return 1; } + int a3() { return 2; } +}; + +struct B { + void log() { } + + int b1() const { return 3; } + int b2() const { return 4; } +}; + +int tmain() +{ + A a; + std::vector b; + + int i = 10; + while (i--) { + int j = a.a3(); + do { + for (int l = a.a2(); l > 0; l--) + a.a1(); + } while (j--); + } + + int result = 0; + for (const auto &bi : b) { + result += bi.b2(); + } + + return b.front().b2() + result; +} +} +} +``` +## Generated UML diagrams +![t20021_sequence](./t20021_sequence.svg "Loop statements sequence diagram test case") diff --git a/docs/test_cases/t20021_sequence.svg b/docs/test_cases/t20021_sequence.svg new file mode 100644 index 00000000..15987f49 --- /dev/null +++ b/docs/test_cases/t20021_sequence.svg @@ -0,0 +1,97 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + tmain() + + tmain() + + + + A + + A + + + + B + + B + + + + + + + + + + loop + + + + a3() + + + + + + loop + + + loop + + + + a2() + + + + + + + a1() + + + + + + loop + + + + b2() + + + + + + + b2() + + + + + diff --git a/docs/test_cases/t30001_package.svg b/docs/test_cases/t30001_package.svg index 7e705225..a5651aa3 100644 --- a/docs/test_cases/t30001_package.svg +++ b/docs/test_cases/t30001_package.svg @@ -1,6 +1,6 @@ - + @@ -9,63 +9,63 @@ - - + + 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_package.svg b/docs/test_cases/t30002_package.svg index aefd030f..643049a1 100644 --- a/docs/test_cases/t30002_package.svg +++ b/docs/test_cases/t30002_package.svg @@ -1,6 +1,6 @@ - + @@ -9,113 +9,113 @@ - - + + A - - + + AA - - + + B - - + + BB - - + + A1 - - + + A2 - - + + A3 - - + + A4 - - + + A5 - - + + A6 - - + + A7 - - + + A8 - - + + A9 - - + + A10 - - + + A11 - - + + A12 - - + + A13 - - + + A14 - - + + A15 - - + + A16 - - + + A17 - - + + BBB diff --git a/docs/test_cases/t30003_package.svg b/docs/test_cases/t30003_package.svg index 0497f804..4b88e7c6 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_package.svg b/docs/test_cases/t30004_package.svg index e7023959..7d4ac651 100644 --- a/docs/test_cases/t30004_package.svg +++ b/docs/test_cases/t30004_package.svg @@ -1,6 +1,6 @@ - + @@ -9,40 +9,40 @@ - - + + A - + Package AAA. - + Package BBB. - + CCCC package note. - + We skipped DDD. - - + + AAA - - + + BBB - - + + CCC - - + + EEE diff --git a/docs/test_cases/t30005_package.svg b/docs/test_cases/t30005_package.svg index 496ee767..857c311b 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_package.svg b/docs/test_cases/t30006_package.svg index 230e2949..4db0462a 100644 --- a/docs/test_cases/t30006_package.svg +++ b/docs/test_cases/t30006_package.svg @@ -1,6 +1,6 @@ - + @@ -9,22 +9,22 @@ - - + + B - - + + A - - + + C - + Top A note. diff --git a/docs/test_cases/t30007_package.svg b/docs/test_cases/t30007_package.svg index 834103c2..4da07297 100644 --- a/docs/test_cases/t30007_package.svg +++ b/docs/test_cases/t30007_package.svg @@ -1,6 +1,6 @@ - + @@ -9,27 +9,27 @@ - - + + A - - + + B - - + + AA - - + + C - + Compare layout with t30006. diff --git a/docs/test_cases/t30008_package.svg b/docs/test_cases/t30008_package.svg index acc7d88e..b53decd3 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/t40001_include.svg b/docs/test_cases/t40001_include.svg index d73c4048..07e00c88 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 diff --git a/docs/test_cases/t40002_include.svg b/docs/test_cases/t40002_include.svg index 5ff974a5..2451c9e6 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_include.svg b/docs/test_cases/t40003_include.svg index 075dd5f8..e891a7ad 100644 --- a/docs/test_cases/t40003_include.svg +++ b/docs/test_cases/t40003_include.svg @@ -1,6 +1,6 @@ - + @@ -9,66 +9,66 @@ - + include - + dependants - + dependencies - + src - + dependants - + dependencies - - + + t3.h - - + + t2.h - - + + t1.h - - + + t3.h - - + + t2.h - - + + t1.h - - + + t5.h - - + + t1.cc - - + + t2.cc From 29b679b0a4c1479e0d4b26fd4f07e4f405e1a203 Mon Sep 17 00:00:00 2001 From: Bartek Kryza Date: Sun, 11 Dec 2022 19:10:13 +0100 Subject: [PATCH 68/77] Fixed id resolution of callexpr callees by function declaration --- src/sequence_diagram/model/diagram.cc | 78 ++++++++- src/sequence_diagram/model/diagram.h | 10 ++ .../visitor/translation_unit_visitor.cc | 160 ++++++++---------- .../visitor/translation_unit_visitor.h | 4 +- src/util/util.h | 4 + tests/t20020/t20020.cc | 25 +++ tests/t20020/test_case.h | 2 + 7 files changed, 185 insertions(+), 98 deletions(-) diff --git a/src/sequence_diagram/model/diagram.cc b/src/sequence_diagram/model/diagram.cc index a5cc0d99..61c9af86 100644 --- a/src/sequence_diagram/model/diagram.cc +++ b/src/sequence_diagram/model/diagram.cc @@ -80,24 +80,35 @@ void diagram::print() const LOG_DBG(" --- Activities ---"); for (const auto &[from_id, act] : sequences) { + LOG_DBG("Sequence id={}:", from_id); + const auto &from_activity = *(participants.at(from_id)); + LOG_DBG(" Activity id={}, from={}:", act.from, from_activity.full_name(false)); + for (const auto &message : act.messages) { if (participants.find(message.from) == participants.end()) continue; - if (participants.find(message.to) == participants.end()) - continue; const auto &from_participant = *participants.at(message.from); - const auto &to_participant = *participants.at(message.to); - LOG_DBG(" Message from={}, from_id={}, " - "to={}, to_id={}, name={}", - from_participant.full_name(false), from_participant.id(), - to_participant.full_name(false), to_participant.id(), - message.message_name); + if (participants.find(message.to) == participants.end()) { + LOG_DBG(" Message from={}, from_id={}, " + "to={}, to_id={}, name={}", + from_participant.full_name(false), from_participant.id(), + "__UNRESOLVABLE_ID__", message.to, message.message_name); + } + else { + const auto &to_participant = *participants.at(message.to); + + LOG_DBG(" Message from={}, from_id={}, " + "to={}, to_id={}, name={}", + from_participant.full_name(false), from_participant.id(), + to_participant.full_name(false), to_participant.id(), + message.message_name); + } } } } @@ -192,6 +203,57 @@ void diagram::end_loop_stmt( } } +void diagram::add_if_stmt( + const common::model::diagram_element::id_t current_caller_id, + common::model::message_t type) +{ + using clanguml::common::model::message_t; + + if (sequences.find(current_caller_id) == sequences.end()) { + activity a; + a.from = current_caller_id; + sequences.insert({current_caller_id, std::move(a)}); + } + message m; + m.from = current_caller_id; + m.type = type; + + sequences[current_caller_id].messages.emplace_back(std::move(m)); +} + +void diagram::end_if_stmt( + const common::model::diagram_element::id_t current_caller_id, + common::model::message_t type) +{ + using clanguml::common::model::message_t; + + message m; + m.from = current_caller_id; + m.type = message_t::kIfEnd; + + if (sequences.find(current_caller_id) != sequences.end()) { + + auto ¤t_messages = sequences[current_caller_id].messages; + // Remove the if/else messages if there were no calls + // added to the diagram between them + auto last_if_it = + std::find_if(current_messages.rbegin(), current_messages.rend(), + [](const message &m) { return m.type == message_t::kIf; }); + + bool last_if_block_is_empty = + std::none_of(current_messages.rbegin(), last_if_it, + [](const message &m) { return m.type == message_t::kCall; }); + + if (!last_if_block_is_empty) { + current_messages.emplace_back(std::move(m)); + } + else { + current_messages.erase( + (last_if_it + 1).base(), current_messages.end()); + } + } +} + } namespace clanguml::common::model { diff --git a/src/sequence_diagram/model/diagram.h b/src/sequence_diagram/model/diagram.h index fb0404b9..48f7f792 100644 --- a/src/sequence_diagram/model/diagram.h +++ b/src/sequence_diagram/model/diagram.h @@ -103,16 +103,26 @@ public: std::set active_participants_; + void add_if_stmt( + const common::model::diagram_element::id_t current_caller_id, + common::model::message_t type); + void end_if_stmt( + const common::model::diagram_element::id_t current_caller_id, + common::model::message_t type); + void add_loop_stmt( const common::model::diagram_element::id_t current_caller_id, common::model::message_t type); void end_loop_stmt( const common::model::diagram_element::id_t current_caller_id, common::model::message_t type); + void add_while_stmt(const common::model::diagram_element::id_t i); void end_while_stmt(const common::model::diagram_element::id_t i); + void add_do_stmt(const common::model::diagram_element::id_t i); void end_do_stmt(const common::model::diagram_element::id_t i); + void add_for_stmt(const common::model::diagram_element::id_t i); void end_for_stmt(const common::model::diagram_element::id_t i); }; diff --git a/src/sequence_diagram/visitor/translation_unit_visitor.cc b/src/sequence_diagram/visitor/translation_unit_visitor.cc index fd7074b4..841ead85 100644 --- a/src/sequence_diagram/visitor/translation_unit_visitor.cc +++ b/src/sequence_diagram/visitor/translation_unit_visitor.cc @@ -102,7 +102,8 @@ bool translation_unit_visitor::VisitCXXRecordDecl(clang::CXXRecordDecl *cls) if (cls->isTemplated() && cls->getDescribedTemplate()) { // If the described templated of this class is already in the model // skip it: - if (get_unique_id(cls->getDescribedTemplate()->getID())) + auto local_id = cls->getDescribedTemplate()->getID(); + if (get_unique_id(local_id)) return true; } @@ -110,12 +111,12 @@ bool translation_unit_visitor::VisitCXXRecordDecl(clang::CXXRecordDecl *cls) if (cls->isLocalClass()) return true; - LOG_DBG("Visiting class declaration at {}", + LOG_TRACE("Visiting class declaration at {}", cls->getBeginLoc().printToString(source_manager())); // Build the class declaration and store it in the diagram, even // if we don't need it for any of the participants of this diagram - auto c_ptr = create_class_declaration(cls); + auto c_ptr = this->create_class_declaration(cls); if (!c_ptr) return true; @@ -327,9 +328,16 @@ bool translation_unit_visitor::VisitCXXMethodDecl(clang::CXXMethodDecl *m) m_ptr->set_id(common::to_id(method_full_name)); - set_unique_id(m->getID(), m_ptr->id()); + // Callee methods in call expressions are referred to by first declaration + // id + if (m->isThisDeclarationADefinition()) { + set_unique_id(m->getFirstDecl()->getID(), m_ptr->id()); + } - LOG_DBG("Set id {} for method name {}", m_ptr->id(), method_full_name); + set_unique_id(m->getID(), m_ptr->id()); // This is probably not necessary? + + LOG_DBG("Set id {} --> {} for method name {} [{}]", m->getID(), m_ptr->id(), + method_full_name, m->isThisDeclarationADefinition()); context().update(m); @@ -379,6 +387,9 @@ bool translation_unit_visitor::VisitFunctionDecl(clang::FunctionDecl *f) context().set_caller_id(f_ptr->id()); + if (f->isThisDeclarationADefinition()) { + set_unique_id(f->getFirstDecl()->getID(), f_ptr->id()); + } set_unique_id(f->getID(), f_ptr->id()); set_source_location(*f, *f_ptr); @@ -408,6 +419,9 @@ bool translation_unit_visitor::VisitFunctionDecl(clang::FunctionDecl *f) context().set_caller_id(f_ptr->id()); + if (f->isThisDeclarationADefinition()) { + set_unique_id(f->getFirstDecl()->getID(), f_ptr->id()); + } set_unique_id(f->getID(), f_ptr->id()); set_source_location(*f, *f_ptr); @@ -469,11 +483,11 @@ bool translation_unit_visitor::VisitLambdaExpr(clang::LambdaExpr *expr) const auto lambda_full_name = expr->getLambdaClass()->getCanonicalDecl()->getNameAsString(); - LOG_DBG("Visiting lambda expression {} at {}", lambda_full_name, + LOG_TRACE("Visiting lambda expression {} at {}", lambda_full_name, expr->getBeginLoc().printToString(source_manager())); - LOG_DBG("Lambda call operator ID {} - lambda class ID {}, class call " - "operator ID {}", + LOG_TRACE("Lambda call operator ID {} - lambda class ID {}, class call " + "operator ID {}", expr->getCallOperator()->getID(), expr->getLambdaClass()->getID(), expr->getLambdaClass()->getLambdaCallOperator()->getID()); @@ -593,75 +607,37 @@ bool translation_unit_visitor::TraverseIfStmt(clang::IfStmt *stmt) using clanguml::sequence_diagram::model::activity; using clanguml::sequence_diagram::model::message; - const auto current_caller_id = context().caller_id(); bool elseif_block{false}; - if (current_caller_id && !stmt->isConstexpr()) { - const auto *current_ifstmt = context().current_ifstmt(); - context().enter_ifstmt(stmt); + const auto current_caller_id = context().caller_id(); + const auto *current_ifstmt = context().current_ifstmt(); - if (diagram().sequences.find(current_caller_id) == - diagram().sequences.end()) { - activity a; - a.from = current_caller_id; - diagram().sequences.insert({current_caller_id, std::move(a)}); - } - message m; - m.from = current_caller_id; - - // Check if this is a beginning of a new if statement, or an - // else if condition of the current if statement - if (current_ifstmt != nullptr) { - for (const auto *child_stmt : current_ifstmt->children()) { - if (child_stmt == stmt) { - elseif_block = true; - break; - } + // Check if this is a beginning of a new if statement, or an + // else if condition of the current if statement + if (current_ifstmt != nullptr) { + for (const auto *child_stmt : current_ifstmt->children()) { + if (child_stmt == stmt) { + elseif_block = true; + break; } } + } + if (current_caller_id && !stmt->isConstexpr()) { + context().enter_ifstmt(stmt); if (elseif_block) { - m.type = message_t::kElseIf; context().enter_elseifstmt(stmt); + diagram().add_if_stmt(current_caller_id, message_t::kElseIf); } else { - m.type = message_t::kIf; + diagram().add_if_stmt(current_caller_id, message_t::kIf); } - - diagram().sequences[current_caller_id].messages.emplace_back( - std::move(m)); } RecursiveASTVisitor::TraverseIfStmt(stmt); if (current_caller_id && !stmt->isConstexpr() && !elseif_block) { - message m; - m.from = current_caller_id; - m.type = message_t::kIfEnd; - - if (diagram().sequences.find(current_caller_id) != - diagram().sequences.end()) { - - auto ¤t_messages = - diagram().sequences[current_caller_id].messages; - // Remove the if/else messages if there were no calls - // added to the diagram between them - auto last_if_it = - std::find_if(current_messages.rbegin(), current_messages.rend(), - [](const message &m) { return m.type == message_t::kIf; }); - - bool last_if_block_is_empty = std::none_of( - current_messages.rbegin(), last_if_it, - [](const message &m) { return m.type == message_t::kCall; }); - - if (!last_if_block_is_empty) { - current_messages.emplace_back(std::move(m)); - } - else { - current_messages.erase( - (last_if_it + 1).base(), current_messages.end()); - } - } + diagram().end_if_stmt(current_caller_id, message_t::kIfEnd); } return true; @@ -673,17 +649,18 @@ bool translation_unit_visitor::TraverseWhileStmt(clang::WhileStmt *stmt) using clanguml::sequence_diagram::model::activity; using clanguml::sequence_diagram::model::message; - context().enter_loopstmt(stmt); - const auto current_caller_id = context().caller_id(); - diagram().add_while_stmt(current_caller_id); - + if (current_caller_id) { + context().enter_loopstmt(stmt); + diagram().add_while_stmt(current_caller_id); + } RecursiveASTVisitor::TraverseWhileStmt(stmt); - diagram().end_while_stmt(current_caller_id); - - context().leave_loopstmt(); + if (current_caller_id) { + diagram().end_while_stmt(current_caller_id); + context().leave_loopstmt(); + } return true; } @@ -694,17 +671,19 @@ bool translation_unit_visitor::TraverseDoStmt(clang::DoStmt *stmt) using clanguml::sequence_diagram::model::activity; using clanguml::sequence_diagram::model::message; - context().enter_loopstmt(stmt); - const auto current_caller_id = context().caller_id(); - diagram().add_do_stmt(current_caller_id); + if (current_caller_id) { + context().enter_loopstmt(stmt); + diagram().add_do_stmt(current_caller_id); + } RecursiveASTVisitor::TraverseDoStmt(stmt); - context().leave_loopstmt(); - - diagram().end_do_stmt(current_caller_id); + if (current_caller_id) { + context().leave_loopstmt(); + diagram().end_do_stmt(current_caller_id); + } return true; } @@ -715,17 +694,19 @@ bool translation_unit_visitor::TraverseForStmt(clang::ForStmt *stmt) using clanguml::sequence_diagram::model::activity; using clanguml::sequence_diagram::model::message; - context().enter_loopstmt(stmt); - const auto current_caller_id = context().caller_id(); - diagram().add_for_stmt(current_caller_id); + if (current_caller_id) { + context().enter_loopstmt(stmt); + diagram().add_for_stmt(current_caller_id); + } RecursiveASTVisitor::TraverseForStmt(stmt); - context().leave_loopstmt(); - - diagram().end_for_stmt(current_caller_id); + if (current_caller_id) { + context().leave_loopstmt(); + diagram().end_for_stmt(current_caller_id); + } return true; } @@ -737,18 +718,20 @@ bool translation_unit_visitor::TraverseCXXForRangeStmt( using clanguml::sequence_diagram::model::activity; using clanguml::sequence_diagram::model::message; - context().enter_loopstmt(stmt); - const auto current_caller_id = context().caller_id(); - diagram().add_for_stmt(current_caller_id); + if (current_caller_id) { + context().enter_loopstmt(stmt); + diagram().add_for_stmt(current_caller_id); + } RecursiveASTVisitor::TraverseCXXForRangeStmt( stmt); - context().leave_loopstmt(); - - diagram().end_for_stmt(current_caller_id); + if (current_caller_id) { + context().leave_loopstmt(); + diagram().end_for_stmt(current_caller_id); + } return true; } @@ -930,6 +913,7 @@ bool translation_unit_visitor::process_class_method_call_expression( return false; m.to = method_decl->getID(); + m.message_name = method_decl->getNameAsString(); m.return_type = @@ -939,9 +923,7 @@ bool translation_unit_visitor::process_class_method_call_expression( LOG_DBG("Set callee method id {} for method name {}", m.to, method_decl->getQualifiedNameAsString()); - if (get_unique_id(callee_decl->getID())) - diagram().add_active_participant( - get_unique_id(callee_decl->getID()).value()); + diagram().add_active_participant(method_decl->getID()); return true; } diff --git a/src/sequence_diagram/visitor/translation_unit_visitor.h b/src/sequence_diagram/visitor/translation_unit_visitor.h index 5c31fa46..7ff0666f 100644 --- a/src/sequence_diagram/visitor/translation_unit_visitor.h +++ b/src/sequence_diagram/visitor/translation_unit_visitor.h @@ -245,7 +245,9 @@ private: std::unique_ptr> forward_declarations_; - std::map local_ast_id_map_; + std::mapgetID() */ int64_t, + /* global ID based on full name */ common::model::diagram_element::id_t> + local_ast_id_map_; std::mapdebug(std::string("[{}:{}] ") + fmt__, \ __FILENAME__, __LINE__, ##__VA_ARGS__) +#define LOG_TRACE(fmt__, ...) \ + spdlog::get("console")->trace(std::string("[{}:{}] ") + fmt__, \ + __FILENAME__, __LINE__, ##__VA_ARGS__) + /** * @brief Setup spdlog logger. * diff --git a/tests/t20020/t20020.cc b/tests/t20020/t20020.cc index 42d9ac9e..498ded67 100644 --- a/tests/t20020/t20020.cc +++ b/tests/t20020/t20020.cc @@ -16,10 +16,29 @@ struct B { int b2() { return 4; } }; +struct C { + void log() const { } + + void c1() const + { + if (c2()) + log(); + } + + bool c2() const { return true; } +}; + +template struct D { + + T d1(T x, T y) { return x + y; } +}; + int tmain() { A a; B b; + C c; + D d; int result{0}; @@ -38,6 +57,12 @@ int tmain() b.log(); + if (true) + c.c1(); + + if (true) + d.d1(1, 1); + // This if/else should not be included in the diagram at all // as the calls to std will be excluded by the diagram filters if (result != 2) { diff --git a/tests/t20020/test_case.h b/tests/t20020/test_case.h index 03b60b34..8bcb57d4 100644 --- a/tests/t20020/test_case.h +++ b/tests/t20020/test_case.h @@ -43,6 +43,8 @@ TEST_CASE("t20020", "[test-case][sequence]") REQUIRE_THAT(puml, HasCall(_A("tmain()"), _A("B"), "b2()")); REQUIRE_THAT(puml, HasCall(_A("tmain()"), _A("B"), "log()")); + REQUIRE_THAT(puml, HasCall(_A("tmain()"), _A("C"), "c1()")); + save_puml( "./" + config.output_directory() + "/" + diagram->name + ".puml", puml); } \ No newline at end of file From e5e7df43e8b542485ae65d1e36000e9a91d38af1 Mon Sep 17 00:00:00 2001 From: Bartek Kryza Date: Sun, 11 Dec 2022 21:21:27 +0100 Subject: [PATCH 69/77] Refactored sequence diagram model classes --- src/common/model/enums.cc | 20 ++ src/common/model/enums.h | 5 +- src/common/visitor/translation_unit_visitor.h | 2 - .../plantuml/sequence_diagram_generator.cc | 68 ++++--- src/sequence_diagram/model/activity.cc | 15 ++ src/sequence_diagram/model/activity.h | 20 +- src/sequence_diagram/model/diagram.cc | 192 +++++++++++------- src/sequence_diagram/model/diagram.h | 97 ++++----- src/sequence_diagram/model/message.cc | 30 +++ src/sequence_diagram/model/message.h | 44 ++-- .../visitor/translation_unit_visitor.cc | 109 +++++----- .../visitor/translation_unit_visitor.h | 8 +- 12 files changed, 377 insertions(+), 233 deletions(-) diff --git a/src/common/model/enums.cc b/src/common/model/enums.cc index 3cbf85d2..ea40af08 100644 --- a/src/common/model/enums.cc +++ b/src/common/model/enums.cc @@ -74,6 +74,26 @@ std::string to_string(message_t r) return "call"; case message_t::kReturn: return "return"; + case message_t::kIf: + return "if"; + case message_t::kElse: + return "else"; + case message_t::kElseIf: + return "else if"; + case message_t::kIfEnd: + return "end if"; + case message_t::kWhile: + return "while"; + case message_t::kWhileEnd: + return "end while"; + case message_t::kDo: + return "do"; + case message_t::kDoEnd: + return "end do"; + case message_t::kFor: + return "for"; + case message_t::kForEnd: + return "end for"; default: assert(false); return ""; diff --git a/src/common/model/enums.h b/src/common/model/enums.h index 78912e37..fbec4a55 100644 --- a/src/common/model/enums.h +++ b/src/common/model/enums.h @@ -51,14 +51,15 @@ enum class message_t { kDo, kDoEnd, kFor, - kForEnd + kForEnd, + kNone }; std::string to_string(relationship_t r); std::string to_string(access_t r); -std::string to_string(message_t r); +std::string to_string(message_t m); std::string to_string(diagram_t r); diff --git a/src/common/visitor/translation_unit_visitor.h b/src/common/visitor/translation_unit_visitor.h index eff0e5e9..31a35a63 100644 --- a/src/common/visitor/translation_unit_visitor.h +++ b/src/common/visitor/translation_unit_visitor.h @@ -42,8 +42,6 @@ public: clang::SourceManager &source_manager() const; - void finalize(); - protected: void set_source_location(const clang::Decl &decl, clanguml::common::model::source_location &element); diff --git a/src/sequence_diagram/generators/plantuml/sequence_diagram_generator.cc b/src/sequence_diagram/generators/plantuml/sequence_diagram_generator.cc index 777ff93b..2c6668ef 100644 --- a/src/sequence_diagram/generators/plantuml/sequence_diagram_generator.cc +++ b/src/sequence_diagram/generators/plantuml/sequence_diagram_generator.cc @@ -45,16 +45,16 @@ std::string generator::render_name(std::string name) const void generator::generate_call(const message &m, std::ostream &ostr) const { - const auto &from = m_model.get_participant(m.from); - const auto &to = m_model.get_participant(m.to); + const auto &from = m_model.get_participant(m.from()); + const auto &to = m_model.get_participant(m.to()); if (!from || !to) { - LOG_DBG("Skipping empty call from '{}' to '{}'", m.from, m.to); + LOG_DBG("Skipping empty call from '{}' to '{}'", m.from(), m.to()); return; } - generate_participant(ostr, m.from); - generate_participant(ostr, m.to); + generate_participant(ostr, m.from()); + generate_participant(ostr, m.to()); std::string message; @@ -89,16 +89,16 @@ void generator::generate_call(const message &m, std::ostream &ostr) const ostr << " : " << message << std::endl; LOG_DBG("Generated call '{}' from {} [{}] to {} [{}]", message, from, - m.from, to, m.to); + m.from(), to, m.to()); } void generator::generate_return(const message &m, std::ostream &ostr) const { // Add return activity only for messages between different actors and // only if the return type is different than void - const auto &from = m_model.get_participant(m.from); - const auto &to = m_model.get_participant(m.to); - if ((m.from != m.to) && !to.value().is_void()) { + const auto &from = m_model.get_participant(m.from()); + const auto &to = m_model.get_participant(m.to()); + if ((m.from() != m.to()) && !to.value().is_void()) { const std::string from_alias = generate_alias(from.value()); const std::string to_alias = generate_alias(to.value()); @@ -112,15 +112,16 @@ void generator::generate_return(const message &m, std::ostream &ostr) const void generator::generate_activity(const activity &a, std::ostream &ostr, std::vector &visited) const { - for (const auto &m : a.messages) { - if (m.type == message_t::kCall) { - const auto &to = m_model.get_participant(m.to); + for (const auto &m : a.messages()) { + if (m.type() == message_t::kCall) { + const auto &to = + m_model.get_participant(m.to()); if (!to) continue; - visited.push_back(m.from); + visited.push_back(m.from()); - LOG_DBG("Generating message {} --> {}", m.from, m.to); + LOG_DBG("Generating message {} --> {}", m.from(), m.to()); generate_call(m, ostr); @@ -128,18 +129,19 @@ void generator::generate_activity(const activity &a, std::ostream &ostr, ostr << "activate " << to_alias << std::endl; - if (m_model.sequences.find(m.to) != m_model.sequences.end()) { - if (std::find(visited.begin(), visited.end(), m.to) == + if (m_model.sequences().find(m.to()) != m_model.sequences().end()) { + if (std::find(visited.begin(), visited.end(), m.to()) == visited .end()) { // break infinite recursion on recursive calls LOG_DBG("Creating activity {} --> {} - missing sequence {}", - m.from, m.to, m.to); - generate_activity(m_model.sequences[m.to], ostr, visited); + m.from(), m.to(), m.to()); + generate_activity( + m_model.get_activity(m.to()), ostr, visited); } } else LOG_DBG("Skipping activity {} --> {} - missing sequence {}", - m.from, m.to, m.to); + m.from(), m.to(), m.to()); generate_return(m, ostr); @@ -147,34 +149,34 @@ void generator::generate_activity(const activity &a, std::ostream &ostr, visited.pop_back(); } - else if (m.type == message_t::kIf) { + else if (m.type() == message_t::kIf) { ostr << "alt\n"; } - else if (m.type == message_t::kElseIf) { + else if (m.type() == message_t::kElseIf) { ostr << "else\n"; } - else if (m.type == message_t::kElse) { + else if (m.type() == message_t::kElse) { ostr << "else\n"; } - else if (m.type == message_t::kIfEnd) { + else if (m.type() == message_t::kIfEnd) { ostr << "end\n"; } - else if (m.type == message_t::kWhile) { + else if (m.type() == message_t::kWhile) { ostr << "loop\n"; } - else if (m.type == message_t::kWhileEnd) { + else if (m.type() == message_t::kWhileEnd) { ostr << "end\n"; } - else if (m.type == message_t::kFor) { + else if (m.type() == message_t::kFor) { ostr << "loop\n"; } - else if (m.type == message_t::kForEnd) { + else if (m.type() == message_t::kForEnd) { ostr << "end\n"; } - else if (m.type == message_t::kDo) { + else if (m.type() == message_t::kDo) { ostr << "loop\n"; } - else if (m.type == message_t::kDoEnd) { + else if (m.type() == message_t::kDoEnd) { ostr << "end\n"; } } @@ -182,7 +184,7 @@ void generator::generate_activity(const activity &a, std::ostream &ostr, void generator::generate_participant(std::ostream &ostr, common::id_t id) const { - for (const auto participant_id : m_model.active_participants_) { + for (const auto participant_id : m_model.active_participants()) { if (participant_id != id) continue; @@ -287,8 +289,8 @@ void generator::generate(std::ostream &ostr) const for (const auto &sf : m_config.start_from()) { if (sf.location_type == source_location::location_t::function) { common::model::diagram_element::id_t start_from; - for (const auto &[k, v] : m_model.sequences) { - const auto &caller = *m_model.participants.at(v.from); + for (const auto &[k, v] : m_model.sequences()) { + const auto &caller = *m_model.participants().at(v.from()); std::string vfrom = caller.full_name(false); if (vfrom == sf.location) { LOG_DBG("Found sequence diagram start point: {}", k); @@ -327,7 +329,7 @@ void generator::generate(std::ostream &ostr) const ostr << "activate " << from_alias << std::endl; generate_activity( - m_model.sequences[start_from], ostr, visited_participants); + m_model.get_activity(start_from), ostr, visited_participants); if (from.value().type_name() == "method" || m_config.combine_free_functions_into_file_participants()) { diff --git a/src/sequence_diagram/model/activity.cc b/src/sequence_diagram/model/activity.cc index c9e3d226..e2c921ca 100644 --- a/src/sequence_diagram/model/activity.cc +++ b/src/sequence_diagram/model/activity.cc @@ -20,4 +20,19 @@ namespace clanguml::sequence_diagram::model { +activity::activity(common::model::diagram_element::id_t id) + : from_{id} +{ +} + +void activity::add_message(message m) { messages_.emplace_back(std::move(m)); } + +std::vector &activity::messages() { return messages_; } + +const std::vector &activity::messages() const { return messages_; } + +void activity::set_from(common::model::diagram_element::id_t f) { from_ = f; } + +common::model::diagram_element::id_t activity::from() const { return from_; } + } diff --git a/src/sequence_diagram/model/activity.h b/src/sequence_diagram/model/activity.h index 41505d9f..2622ad4c 100644 --- a/src/sequence_diagram/model/activity.h +++ b/src/sequence_diagram/model/activity.h @@ -25,9 +25,23 @@ namespace clanguml::sequence_diagram::model { -struct activity { - common::model::diagram_element::id_t from; - std::vector messages; +class activity { +public: + activity(common::model::diagram_element::id_t id); + + void add_message(message m); + + std::vector &messages(); + + const std::vector &messages() const; + + void set_from(common::model::diagram_element::id_t f); + + common::model::diagram_element::id_t from() const; + +private: + common::model::diagram_element::id_t from_; + std::vector messages_; }; } diff --git a/src/sequence_diagram/model/diagram.cc b/src/sequence_diagram/model/diagram.cc index 61c9af86..21feb99c 100644 --- a/src/sequence_diagram/model/diagram.cc +++ b/src/sequence_diagram/model/diagram.cc @@ -31,7 +31,7 @@ common::model::diagram_t diagram::type() const common::optional_ref diagram::get( const std::string &full_name) const { - for (const auto &[id, participant] : participants) { + for (const auto &[id, participant] : participants_) { if (participant->full_name(false) == full_name) return {*participant}; } @@ -42,8 +42,8 @@ common::optional_ref diagram::get( common::optional_ref diagram::get( const common::model::diagram_element::id_t id) const { - if (participants.find(id) != participants.end()) - return {*participants.at(id)}; + if (participants_.find(id) != participants_.end()) + return {*participants_.at(id)}; return {}; } @@ -62,7 +62,7 @@ inja::json diagram::context() const inja::json::array_t elements{}; // Add classes - for (const auto &[id, p] : participants) { + for (const auto &[id, p] : participants_) { elements.emplace_back(p->context()); } @@ -71,46 +71,29 @@ inja::json diagram::context() const return ctx; } -void diagram::print() const +void diagram::add_participant(std::unique_ptr p) { - LOG_DBG(" --- Participants ---"); - for (const auto &[id, participant] : participants) { - LOG_DBG("{} - {}", id, participant->to_string()); + const auto participant_id = p->id(); + + if (participants_.find(participant_id) == participants_.end()) { + LOG_DBG("Adding '{}' participant: {}, {} [{}]", p->type_name(), + p->full_name(false), p->id(), + p->type_name() == "method" + ? dynamic_cast(p.get())->method_name() + : ""); + + participants_.emplace(participant_id, std::move(p)); } +} - LOG_DBG(" --- Activities ---"); - for (const auto &[from_id, act] : sequences) { +void diagram::add_active_participant(common::model::diagram_element::id_t id) +{ + active_participants_.emplace(id); +} - LOG_DBG("Sequence id={}:", from_id); - - const auto &from_activity = *(participants.at(from_id)); - - LOG_DBG(" Activity id={}, from={}:", act.from, - from_activity.full_name(false)); - - for (const auto &message : act.messages) { - if (participants.find(message.from) == participants.end()) - continue; - - const auto &from_participant = *participants.at(message.from); - - if (participants.find(message.to) == participants.end()) { - LOG_DBG(" Message from={}, from_id={}, " - "to={}, to_id={}, name={}", - from_participant.full_name(false), from_participant.id(), - "__UNRESOLVABLE_ID__", message.to, message.message_name); - } - else { - const auto &to_participant = *participants.at(message.to); - - LOG_DBG(" Message from={}, from_id={}, " - "to={}, to_id={}, name={}", - from_participant.full_name(false), from_participant.id(), - to_participant.full_name(false), to_participant.id(), - message.message_name); - } - } - } +activity &diagram::get_activity(common::model::diagram_element::id_t id) +{ + return sequences_.at(id); } void diagram::add_for_stmt( @@ -158,17 +141,12 @@ void diagram::add_loop_stmt( if (current_caller_id == 0) return; - if (sequences.find(current_caller_id) == sequences.end()) { - activity a; - a.from = current_caller_id; - sequences.insert({current_caller_id, std::move(a)}); + if (sequences_.find(current_caller_id) == sequences_.end()) { + activity a{current_caller_id}; + sequences_.insert({current_caller_id, std::move(a)}); } - message m; - m.from = current_caller_id; - m.type = type; - - sequences[current_caller_id].messages.emplace_back(std::move(m)); + get_activity(current_caller_id).add_message({type, current_caller_id}); } void diagram::end_loop_stmt( @@ -180,9 +158,7 @@ void diagram::end_loop_stmt( if (current_caller_id == 0) return; - message m; - m.from = current_caller_id; - m.type = type; + message m{type, current_caller_id}; message_t loop_type = message_t::kWhile; @@ -191,10 +167,10 @@ void diagram::end_loop_stmt( else if (type == message_t::kDoEnd) loop_type = message_t::kDo; - if (sequences.find(current_caller_id) != sequences.end()) { - auto ¤t_messages = sequences[current_caller_id].messages; + if (sequences_.find(current_caller_id) != sequences_.end()) { + auto ¤t_messages = get_activity(current_caller_id).messages(); - if (current_messages.back().type == loop_type) { + if (current_messages.back().type() == loop_type) { current_messages.pop_back(); } else { @@ -209,16 +185,12 @@ void diagram::add_if_stmt( { using clanguml::common::model::message_t; - if (sequences.find(current_caller_id) == sequences.end()) { - activity a; - a.from = current_caller_id; - sequences.insert({current_caller_id, std::move(a)}); + if (sequences_.find(current_caller_id) == sequences_.end()) { + activity a{current_caller_id}; + sequences_.insert({current_caller_id, std::move(a)}); } - message m; - m.from = current_caller_id; - m.type = type; - sequences[current_caller_id].messages.emplace_back(std::move(m)); + get_activity(current_caller_id).add_message({type, current_caller_id}); } void diagram::end_if_stmt( @@ -227,22 +199,20 @@ void diagram::end_if_stmt( { using clanguml::common::model::message_t; - message m; - m.from = current_caller_id; - m.type = message_t::kIfEnd; + message m{message_t::kIfEnd, current_caller_id}; - if (sequences.find(current_caller_id) != sequences.end()) { + if (sequences_.find(current_caller_id) != sequences_.end()) { - auto ¤t_messages = sequences[current_caller_id].messages; + auto ¤t_messages = get_activity(current_caller_id).messages(); // Remove the if/else messages if there were no calls // added to the diagram between them auto last_if_it = std::find_if(current_messages.rbegin(), current_messages.rend(), - [](const message &m) { return m.type == message_t::kIf; }); + [](const message &m) { return m.type() == message_t::kIf; }); bool last_if_block_is_empty = std::none_of(current_messages.rbegin(), last_if_it, - [](const message &m) { return m.type == message_t::kCall; }); + [](const message &m) { return m.type() == message_t::kCall; }); if (!last_if_block_is_empty) { current_messages.emplace_back(std::move(m)); @@ -254,6 +224,88 @@ void diagram::end_if_stmt( } } +bool diagram::started() const { return started_; } + +void diagram::started(bool s) { started_ = s; } + +std::map &diagram::sequences() +{ + return sequences_; +} + +const std::map & +diagram::sequences() const +{ + return sequences_; +} + +std::map> & +diagram::participants() +{ + return participants_; +} + +const std::map> & +diagram::participants() const +{ + return participants_; +} + +std::set &diagram::active_participants() +{ + return active_participants_; +}; + +const std::set & +diagram::active_participants() const +{ + return active_participants_; +}; + +void diagram::print() const +{ + LOG_DBG(" --- Participants ---"); + for (const auto &[id, participant] : participants_) { + LOG_DBG("{} - {}", id, participant->to_string()); + } + + LOG_DBG(" --- Activities ---"); + for (const auto &[from_id, act] : sequences_) { + + LOG_DBG("Sequence id={}:", from_id); + + const auto &from_activity = *(participants_.at(from_id)); + + LOG_DBG(" Activity id={}, from={}:", act.from(), + from_activity.full_name(false)); + + for (const auto &message : act.messages()) { + if (participants_.find(message.from()) == participants_.end()) + continue; + + const auto &from_participant = *participants_.at(message.from()); + + if (participants_.find(message.to()) == participants_.end()) { + LOG_DBG(" Message from={}, from_id={}, " + "to={}, to_id={}, name={}, type={}", + from_participant.full_name(false), from_participant.id(), + "__UNRESOLVABLE_ID__", message.to(), message.message_name(), + to_string(message.type())); + } + else { + const auto &to_participant = *participants_.at(message.to()); + + LOG_DBG(" Message from={}, from_id={}, " + "to={}, to_id={}, name={}, type={}", + from_participant.full_name(false), from_participant.id(), + to_participant.full_name(false), to_participant.id(), + message.message_name(), to_string(message.type())); + } + } + } +} + } namespace clanguml::common::model { diff --git a/src/sequence_diagram/model/diagram.h b/src/sequence_diagram/model/diagram.h index 48f7f792..51d51976 100644 --- a/src/sequence_diagram/model/diagram.h +++ b/src/sequence_diagram/model/diagram.h @@ -50,81 +50,84 @@ public: void print() const; - bool started{false}; - template common::optional_ref get_participant( common::model::diagram_element::id_t id) { - if (participants.find(id) == participants.end()) { + if (participants_.find(id) == participants_.end()) { return {}; } return common::optional_ref( - static_cast(participants.at(id).get())); + static_cast(participants_.at(id).get())); } template const common::optional_ref get_participant( common::model::diagram_element::id_t id) const { - if (participants.find(id) == participants.end()) { + if (participants_.find(id) == participants_.end()) { return {}; } return common::optional_ref( - static_cast(participants.at(id).get())); + static_cast(participants_.at(id).get())); } - void add_participant(std::unique_ptr p) - { - const auto participant_id = p->id(); + void add_participant(std::unique_ptr p); - if (participants.find(participant_id) == participants.end()) { - LOG_DBG("Adding '{}' participant: {}, {} [{}]", p->type_name(), - p->full_name(false), p->id(), - p->type_name() == "method" - ? dynamic_cast(p.get())->method_name() - : ""); + void add_active_participant(common::model::diagram_element::id_t id); - participants.emplace(participant_id, std::move(p)); - } - } + activity& get_activity(common::model::diagram_element::id_t id); - void add_active_participant(common::model::diagram_element::id_t id) - { - active_participants_.emplace(id); - } + void add_if_stmt(common::model::diagram_element::id_t current_caller_id, + common::model::message_t type); + void end_if_stmt(common::model::diagram_element::id_t current_caller_id, + common::model::message_t type); - std::map sequences; + void add_loop_stmt(common::model::diagram_element::id_t current_caller_id, + common::model::message_t type); + void end_loop_stmt(common::model::diagram_element::id_t current_caller_id, + common::model::message_t type); + + void add_while_stmt(common::model::diagram_element::id_t i); + void end_while_stmt(common::model::diagram_element::id_t i); + + void add_do_stmt(common::model::diagram_element::id_t i); + void end_do_stmt(common::model::diagram_element::id_t i); + + void add_for_stmt(common::model::diagram_element::id_t i); + void end_for_stmt(common::model::diagram_element::id_t i); + + bool started() const; + void started(bool s); + + std::map &sequences(); + + const std::map & + sequences() const; std::map> - participants; + &participants(); + + const std::map> & + participants() const; + + std::set &active_participants(); + + const std::set & + active_participants() const; + +private: + bool started_{false}; + + std::map sequences_; + + std::map> + participants_; std::set active_participants_; - - void add_if_stmt( - const common::model::diagram_element::id_t current_caller_id, - common::model::message_t type); - void end_if_stmt( - const common::model::diagram_element::id_t current_caller_id, - common::model::message_t type); - - void add_loop_stmt( - const common::model::diagram_element::id_t current_caller_id, - common::model::message_t type); - void end_loop_stmt( - const common::model::diagram_element::id_t current_caller_id, - common::model::message_t type); - - void add_while_stmt(const common::model::diagram_element::id_t i); - void end_while_stmt(const common::model::diagram_element::id_t i); - - void add_do_stmt(const common::model::diagram_element::id_t i); - void end_do_stmt(const common::model::diagram_element::id_t i); - - void add_for_stmt(const common::model::diagram_element::id_t i); - void end_for_stmt(const common::model::diagram_element::id_t i); }; } diff --git a/src/sequence_diagram/model/message.cc b/src/sequence_diagram/model/message.cc index ef92071b..93f23937 100644 --- a/src/sequence_diagram/model/message.cc +++ b/src/sequence_diagram/model/message.cc @@ -20,4 +20,34 @@ namespace clanguml::sequence_diagram::model { +message::message( + common::model::message_t type, common::model::diagram_element::id_t from) + : type_{type} + , from_{from} +{ +} + +void message::set_type(common::model::message_t t) { type_ = t; } + +common::model::message_t message::type() const { return type_; } + +void message::set_from(common::model::diagram_element::id_t f) { from_ = f; } + +common::model::diagram_element::id_t message::from() const { return from_; } + +void message::set_to(common::model::diagram_element::id_t t) { to_ = t; } + +common::model::diagram_element::id_t message::to() const { return to_; } + +void message::set_message_name(std::string name) +{ + message_name_ = std::move(name); +} + +const std::string &message::message_name() const { return message_name_; } + +void message::set_return_type(std::string t) { return_type_ = std::move(t); } + +const std::string &message::return_type() const { return return_type_; } + } diff --git a/src/sequence_diagram/model/message.h b/src/sequence_diagram/model/message.h index b12614c0..48c6ca0a 100644 --- a/src/sequence_diagram/model/message.h +++ b/src/sequence_diagram/model/message.h @@ -25,22 +25,40 @@ namespace clanguml::sequence_diagram::model { -struct message : public common::model::diagram_element { - message() - : from{} - , to{} - , message_name{} - , return_type{} - { - } +class message : public common::model::diagram_element { +public: + message() = default; - common::model::message_t type; - common::model::diagram_element::id_t from; - common::model::diagram_element::id_t to; + message(common::model::message_t type, + common::model::diagram_element::id_t from); - std::string message_name; + void set_type(common::model::message_t t); + common::model::message_t type() const; - std::string return_type; + void set_from(common::model::diagram_element::id_t f); + common::model::diagram_element::id_t from() const; + + void set_to(common::model::diagram_element::id_t t); + common::model::diagram_element::id_t to() const; + + void set_message_name(std::string name); + const std::string &message_name() const; + + void set_return_type(std::string t); + const std::string &return_type() const; + +private: + common::model::message_t type_{common::model::message_t::kNone}; + + common::model::diagram_element::id_t from_{}; + + common::model::diagram_element::id_t to_{}; + + // This is only for better verbose messages, we cannot rely on this + // always + std::string message_name_{}; + + std::string return_type_{}; }; } diff --git a/src/sequence_diagram/visitor/translation_unit_visitor.cc b/src/sequence_diagram/visitor/translation_unit_visitor.cc index 841ead85..45d48134 100644 --- a/src/sequence_diagram/visitor/translation_unit_visitor.cc +++ b/src/sequence_diagram/visitor/translation_unit_visitor.cc @@ -571,12 +571,9 @@ bool translation_unit_visitor::TraverseCompoundStmt(clang::CompoundStmt *stmt) const auto current_caller_id = context().caller_id(); if (current_caller_id) { - message m; - m.from = current_caller_id; - m.type = message_t::kElse; - - diagram().sequences[current_caller_id].messages.emplace_back( - std::move(m)); + diagram() + .get_activity(current_caller_id) + .add_message({message_t::kElse, current_caller_id}); } } } @@ -585,12 +582,9 @@ bool translation_unit_visitor::TraverseCompoundStmt(clang::CompoundStmt *stmt) const auto current_caller_id = context().caller_id(); if (current_caller_id) { - message m; - m.from = current_caller_id; - m.type = message_t::kElse; - - diagram().sequences[current_caller_id].messages.emplace_back( - std::move(m)); + diagram() + .get_activity(current_caller_id) + .add_message({message_t::kElse, current_caller_id}); } } } @@ -763,9 +757,7 @@ bool translation_unit_visitor::VisitCallExpr(clang::CallExpr *expr) expr->getBeginLoc().printToString(source_manager()), context().caller_id()); - message m; - m.type = message_t::kCall; - m.from = context().caller_id(); + message m{message_t::kCall, context().caller_id()}; set_source_location(*expr, m); @@ -774,7 +766,7 @@ bool translation_unit_visitor::VisitCallExpr(clang::CallExpr *expr) // Unless the lambda is declared in a function or method call if (context().lambda_caller_id() != 0) { if (context().current_function_call_expr_ == nullptr) { - m.from = context().lambda_caller_id(); + m.set_from(context().lambda_caller_id()); } else { LOG_DBG("Current lambda declaration is passed to a method or " @@ -847,24 +839,21 @@ bool translation_unit_visitor::VisitCallExpr(clang::CallExpr *expr) // const auto &return_type = // function_call_expr->getCallReturnType(current_ast_context); // m.return_type = return_type.getAsString(); - m.return_type = ""; - if (m.from > 0 && m.to > 0) { - if (diagram().sequences.find(m.from) == diagram().sequences.end()) { - activity a; - a.from = m.from; - diagram().sequences.insert({m.from, std::move(a)}); + if (m.from() > 0 && m.to() > 0) { + if (diagram().sequences().find(m.from()) == + diagram().sequences().end()) { + activity a{m.from()}; + diagram().sequences().insert({m.from(), std::move(a)}); } - diagram().add_active_participant(m.from); - diagram().add_active_participant(m.to); + diagram().add_active_participant(m.from()); + diagram().add_active_participant(m.to()); - LOG_DBG("Found call {} from {} [{}] to {} [{}] ", m.message_name, - m.from, m.from, m.to, m.to); + LOG_DBG("Found call {} from {} [{}] to {} [{}] ", m.message_name(), + m.from(), m.from(), m.to(), m.to()); - diagram().sequences[m.from].messages.emplace_back(std::move(m)); - - assert(!diagram().sequences.empty()); + diagram().get_activity(m.from()).add_message(std::move(m)); } return true; @@ -876,6 +865,11 @@ bool translation_unit_visitor::process_operator_call_expression( if (operator_call_expr->getCalleeDecl() == nullptr) return false; + // For now we only handle call overloaded operators + if (operator_call_expr->getOperator() != + clang::OverloadedOperatorKind::OO_Call) + return false; + LOG_DBG("Operator '{}' call expression to {} at {}", getOperatorSpelling(operator_call_expr->getOperator()), operator_call_expr->getCalleeDecl()->getID(), @@ -883,14 +877,14 @@ bool translation_unit_visitor::process_operator_call_expression( auto maybe_id = get_unique_id(operator_call_expr->getCalleeDecl()->getID()); if (maybe_id.has_value()) { - m.to = maybe_id.value(); + m.set_to(maybe_id.value()); } else { - m.to = operator_call_expr->getCalleeDecl()->getID(); + m.set_to(operator_call_expr->getCalleeDecl()->getID()); } - m.message_name = fmt::format( - "operator{}", getOperatorSpelling(operator_call_expr->getOperator())); + m.set_message_name(fmt::format( + "operator{}", getOperatorSpelling(operator_call_expr->getOperator()))); return true; } @@ -912,15 +906,13 @@ bool translation_unit_visitor::process_class_method_call_expression( diagram().should_include(callee_decl->getQualifiedNameAsString()))) return false; - m.to = method_decl->getID(); - - m.message_name = method_decl->getNameAsString(); - - m.return_type = + m.set_to(method_decl->getID()); + m.set_message_name(method_decl->getNameAsString()); + m.set_return_type( method_call_expr->getCallReturnType(*context().get_ast_context()) - .getAsString(); + .getAsString()); - LOG_DBG("Set callee method id {} for method name {}", m.to, + LOG_DBG("Set callee method id {} for method name {}", m.to(), method_decl->getQualifiedNameAsString()); diagram().add_active_participant(method_decl->getID()); @@ -951,13 +943,13 @@ bool translation_unit_visitor::process_class_template_method_call_expression( get_participant(template_declaration).value().full_name(false) + "::" + dependent_member_callee->getMember().getAsString(); - for (const auto &[id, p] : diagram().participants) { + for (const auto &[id, p] : diagram().participants()) { const auto p_full_name = p->full_name(false); if (p_full_name.find(callee_method_full_name + "(") == 0) { // TODO: This selects the first matching template method // without considering arguments!!! - m.to = id; + m.set_to(id); break; } } @@ -975,12 +967,12 @@ bool translation_unit_visitor::process_class_template_method_call_expression( .full_name(false) + "::" + dependent_member_callee->getMember().getAsString(); - for (const auto &[id, p] : diagram().participants) { + for (const auto &[id, p] : diagram().participants()) { const auto p_full_name = p->full_name(false); if (p_full_name.find(callee_method_full_name + "(") == 0) { // TODO: This selects the first matching template method // without considering arguments!!! - m.to = id; + m.set_to(id); break; } } @@ -989,8 +981,7 @@ bool translation_unit_visitor::process_class_template_method_call_expression( return false; } - m.message_name = dependent_member_callee->getMember().getAsString(); - m.return_type = ""; + m.set_message_name(dependent_member_callee->getMember().getAsString()); if (get_unique_id(template_declaration->getID())) diagram().add_active_participant( @@ -1027,14 +1018,14 @@ bool translation_unit_visitor::process_function_call_expression( if (!get_unique_id(callee_function->getID()).has_value()) { // This is hopefully not an interesting call... - m.to = callee_function->getID(); + m.set_to(callee_function->getID()); } else { - m.to = get_unique_id(callee_function->getID()).value(); + m.set_to(get_unique_id(callee_function->getID()).value()); } auto message_name = callee_name; - m.message_name = message_name.substr(0, message_name.size() - 2); + m.set_message_name(message_name.substr(0, message_name.size() - 2)); if (f_ptr) diagram().add_participant(std::move(f_ptr)); @@ -1057,9 +1048,9 @@ bool translation_unit_visitor::process_unresolved_lookup_call_expression( clang::dyn_cast_or_null(decl); if (!get_unique_id(ftd->getID()).has_value()) - m.to = ftd->getID(); + m.set_to(ftd->getID()); else { - m.to = get_unique_id(ftd->getID()).value(); + m.set_to(get_unique_id(ftd->getID()).value()); } break; @@ -1878,7 +1869,7 @@ translation_unit_visitor::build_template_instantiation( int best_match{}; common::model::diagram_element::id_t best_match_id{0}; - for (const auto &[id, c] : diagram().participants) { + for (const auto &[id, c] : diagram().participants()) { const auto *participant_as_class = dynamic_cast(c.get()); if ((participant_as_class != nullptr) && @@ -1981,9 +1972,9 @@ std::string translation_unit_visitor::make_lambda_name( void translation_unit_visitor::finalize() { - decltype(diagram().active_participants_) active_participants_unique; + std::set active_participants_unique; - for (auto id : diagram().active_participants_) { + for (auto id : diagram().active_participants()) { if (local_ast_id_map_.find(id) != local_ast_id_map_.end()) { active_participants_unique.emplace(local_ast_id_map_.at(id)); } @@ -1992,12 +1983,12 @@ void translation_unit_visitor::finalize() } } - diagram().active_participants_ = std::move(active_participants_unique); + diagram().active_participants() = std::move(active_participants_unique); - for (auto &[id, activity] : diagram().sequences) { - for (auto &m : activity.messages) { - if (local_ast_id_map_.find(m.to) != local_ast_id_map_.end()) { - m.to = local_ast_id_map_.at(m.to); + for (auto &[id, activity] : diagram().sequences()) { + for (auto &m : activity.messages()) { + if (local_ast_id_map_.find(m.to()) != local_ast_id_map_.end()) { + m.set_to(local_ast_id_map_.at(m.to())); } } } diff --git a/src/sequence_diagram/visitor/translation_unit_visitor.h b/src/sequence_diagram/visitor/translation_unit_visitor.h index 7ff0666f..83eb4dbc 100644 --- a/src/sequence_diagram/visitor/translation_unit_visitor.h +++ b/src/sequence_diagram/visitor/translation_unit_visitor.h @@ -116,22 +116,22 @@ public: common::optional_ref get_participant( const common::model::diagram_element::id_t id) { - if (diagram().participants.find(id) == diagram().participants.end()) + if (diagram().participants().find(id) == diagram().participants().end()) return {}; return common::optional_ref( - *(static_cast(diagram().participants.at(id).get()))); + *(static_cast(diagram().participants().at(id).get()))); } template const common::optional_ref get_participant( const common::model::diagram_element::id_t id) const { - if (diagram().participants.find(id) == diagram().participants.end()) + if (diagram().participants().find(id) == diagram().participants().end()) return {}; return common::optional_ref( - *(static_cast(diagram().participants.at(id).get()))); + *(static_cast(diagram().participants().at(id).get()))); } /// Store the mapping from local clang entity id (obtained using From fb2bc68d39857eac9d69f45b5f2925bf6c0a92bf Mon Sep 17 00:00:00 2001 From: Bartek Kryza Date: Sun, 11 Dec 2022 22:32:32 +0100 Subject: [PATCH 70/77] Refactor HasCall sequence diagram test cases matcher --- tests/t20018/test_case.h | 3 -- tests/t20021/test_case.h | 2 +- tests/test_cases.h | 70 +++++++++++++++++++++++++++++----------- 3 files changed, 52 insertions(+), 23 deletions(-) diff --git a/tests/t20018/test_case.h b/tests/t20018/test_case.h index 22e4522a..d48116cb 100644 --- a/tests/t20018/test_case.h +++ b/tests/t20018/test_case.h @@ -42,9 +42,6 @@ TEST_CASE("t20018", "[test-case][sequence]") "__print(int)__")); REQUIRE_THAT(puml, HasCall(_A("Factorial<5>"), _A("Factorial<4>"), "__print(int)__")); - REQUIRE_THAT(puml, - !HasCallWithResponse( - _A("Factorial<5>"), _A("Factorial<4>"), "__print(int)__")); REQUIRE_THAT(puml, HasCall(_A("Factorial<4>"), _A("Factorial<3>"), "__print(int)__")); REQUIRE_THAT(puml, diff --git a/tests/t20021/test_case.h b/tests/t20021/test_case.h index f034e315..5868931e 100644 --- a/tests/t20021/test_case.h +++ b/tests/t20021/test_case.h @@ -39,7 +39,7 @@ TEST_CASE("t20021", "[test-case][sequence]") REQUIRE_THAT(puml, HasCall(_A("tmain()"), _A("A"), "a2()")); REQUIRE_THAT(puml, HasCall(_A("tmain()"), _A("A"), "a3()")); - REQUIRE_THAT(puml, HasCall(_A("tmain()"), _A("B"), "b1()")); + REQUIRE_THAT(puml, !HasCall(_A("tmain()"), _A("B"), "b1()")); REQUIRE_THAT(puml, HasCall(_A("tmain()"), _A("B"), "b2()")); save_puml( diff --git a/tests/test_cases.h b/tests/test_cases.h index d4d3287f..276a534d 100644 --- a/tests/test_cases.h +++ b/tests/test_cases.h @@ -82,26 +82,19 @@ template constexpr bool has_type() noexcept return (std::is_same_v || ... || false); } -struct Public { -}; +struct Public { }; -struct Protected { -}; +struct Protected { }; -struct Private { -}; +struct Private { }; -struct Abstract { -}; +struct Abstract { }; -struct Static { -}; +struct Static { }; -struct Const { -}; +struct Const { }; -struct Default { -}; +struct Default { }; struct HasCallWithResultMatcher : ContainsMatcher { HasCallWithResultMatcher( @@ -122,12 +115,51 @@ struct HasCallWithResultMatcher : ContainsMatcher { CasedString m_resultComparator; }; +template class HasCallMatcher : public Catch::MatcherBase { + T m_from, m_to, m_message; + +public: + HasCallMatcher(T from, T to, T message) + : m_from(from) + , m_to{to} + , m_message{message} + { + util::replace_all(m_message, "(", "\\("); + util::replace_all(m_message, "*", "\\*"); + util::replace_all(m_message, ")", "\\)"); + } + + bool match(T const &in) const override + { + std::istringstream fin(in); + std::string line; + std::regex r{fmt::format("{} -> {} " + "(\\[\\[.*\\]\\] )?: {}", + m_from, m_to, m_message)}; + while (std::getline(fin, line)) { + std::smatch base_match; + std::regex_search(in, base_match, r); + if (base_match.size() > 0) + return true; + } + + return false; + } + + std::string describe() const override + { + std::ostringstream ss; + ss << "has call " + << fmt::format("{} -> {} : {}", m_from, m_to, m_message); + return ss.str(); + } +}; + auto HasCall(std::string const &from, std::string const &to, std::string const &message, CaseSensitive::Choice caseSensitivity = CaseSensitive::Yes) { - return ContainsMatcher( - CasedString(fmt::format("{} -> {}", from, to), caseSensitivity)); + return HasCallMatcher(from, to, message); } auto HasCall(std::string const &from, std::string const &message, @@ -140,9 +172,9 @@ auto HasCallWithResponse(std::string const &from, std::string const &to, std::string const &message, CaseSensitive::Choice caseSensitivity = CaseSensitive::Yes) { - return HasCallWithResultMatcher( - CasedString(fmt::format("{} -> {}", from, to), caseSensitivity), - CasedString(fmt::format("{} --> {}", to, from), caseSensitivity)); + return ContainsMatcher(CasedString( + fmt::format("{} --> {}", to, from), caseSensitivity)) && + HasCallMatcher(from, to, message); } ContainsMatcher HasEntrypoint(std::string const &to, std::string const &message, From c7b80297d7d7c4d68cf472bdbaabaa1551c1a632 Mon Sep 17 00:00:00 2001 From: Bartek Kryza Date: Sun, 11 Dec 2022 22:48:56 +0100 Subject: [PATCH 71/77] Added forward class declaration sequence diagram test case --- tests/t20022/.clang-uml | 14 +++++++++++++ tests/t20022/t20022.cc | 37 ++++++++++++++++++++++++++++++++ tests/t20022/test_case.h | 43 ++++++++++++++++++++++++++++++++++++++ tests/test_cases.cc | 1 + tests/test_cases.yaml | 3 +++ util/generate_test_case.py | 4 ++-- 6 files changed, 100 insertions(+), 2 deletions(-) create mode 100644 tests/t20022/.clang-uml create mode 100644 tests/t20022/t20022.cc create mode 100644 tests/t20022/test_case.h diff --git a/tests/t20022/.clang-uml b/tests/t20022/.clang-uml new file mode 100644 index 00000000..0fa68fa9 --- /dev/null +++ b/tests/t20022/.clang-uml @@ -0,0 +1,14 @@ +compilation_database_dir: .. +output_directory: puml +diagrams: + t20022_sequence: + type: sequence + glob: + - ../../tests/t20022/t20022.cc + include: + namespaces: + - clanguml::t20022 + using_namespace: + - clanguml::t20022 + start_from: + - function: "clanguml::t20022::tmain()" \ No newline at end of file diff --git a/tests/t20022/t20022.cc b/tests/t20022/t20022.cc new file mode 100644 index 00000000..d9aee6ae --- /dev/null +++ b/tests/t20022/t20022.cc @@ -0,0 +1,37 @@ +#include + +namespace clanguml { +namespace t20022 { +class B; + +class A { +public: + A(std::unique_ptr b); + + void a(); + + std::unique_ptr b_; +}; + +class B { +public: + void b() { } +}; + +A::A(std::unique_ptr b) + : b_{std::move(b)} +{ +} + +void A::a() { b_->b(); } + +int tmain() +{ + A a{std::make_unique()}; + + a.a(); + + return 0; +} +} +} \ No newline at end of file diff --git a/tests/t20022/test_case.h b/tests/t20022/test_case.h new file mode 100644 index 00000000..9ffa41ed --- /dev/null +++ b/tests/t20022/test_case.h @@ -0,0 +1,43 @@ +/** + * tests/t20022/test_case.h + * + * Copyright (c) 2021-2022 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("t20022", "[test-case][sequence]") +{ + auto [config, db] = load_config("t20022"); + + auto diagram = config.diagrams["t20022_sequence"]; + + REQUIRE(diagram->name == "t20022_sequence"); + + auto model = generate_sequence_diagram(*db, diagram); + + REQUIRE(model->name() == "t20022_sequence"); + + auto puml = generate_sequence_puml(diagram, *model); + AliasMatcher _A(puml); + + REQUIRE_THAT(puml, StartsWith("@startuml")); + REQUIRE_THAT(puml, EndsWith("@enduml\n")); + + // Check if all calls exist + REQUIRE_THAT(puml, HasCall(_A("tmain()"), _A("A"), "a()")); + REQUIRE_THAT(puml, HasCall(_A("A"), _A("B"), "b()")); + + save_puml( + "./" + config.output_directory() + "/" + diagram->name + ".puml", puml); +} \ No newline at end of file diff --git a/tests/test_cases.cc b/tests/test_cases.cc index e4a08b61..3a9b7b6a 100644 --- a/tests/test_cases.cc +++ b/tests/test_cases.cc @@ -268,6 +268,7 @@ using namespace clanguml::test::matchers; #include "t20019/test_case.h" #include "t20020/test_case.h" #include "t20021/test_case.h" +#include "t20022/test_case.h" /// /// Package diagram tests diff --git a/tests/test_cases.yaml b/tests/test_cases.yaml index e51d4d09..37fd33cb 100644 --- a/tests/test_cases.yaml +++ b/tests/test_cases.yaml @@ -211,6 +211,9 @@ test_cases: - name: t20021 title: Loop statements sequence diagram test case description: + - name: t20022 + title: Forward class declaration sequence diagram test case + description: Package diagrams: - name: t30001 title: Basic package diagram test case diff --git a/util/generate_test_case.py b/util/generate_test_case.py index 933ad835..ba2e1bc3 100755 --- a/util/generate_test_case.py +++ b/util/generate_test_case.py @@ -56,8 +56,8 @@ CLASS_DIAGRAM_TEST_CASE_EXAMPLES = """ SEQUENCE_DIAGRAM_TEST_CASE_EXAMPLES = """ // Check if all calls exist - //REQUIRE_THAT(puml, HasCall("A", "log_result")); - //REQUIRE_THAT(puml, HasCallWithResponse("B", "A", "add3")); + //REQUIRE_THAT(puml, HasCall(_A("tmain()"), _A("A"), "a()")); + //REQUIRE_THAT(puml, HasCall(_A("A"), "a()")); """ PACKAGE_DIAGRAM_TEST_CASE_EXAMPLES = """ From 452271fd45e4c3c69209b62675c6de47e416bcef Mon Sep 17 00:00:00 2001 From: Bartek Kryza Date: Sun, 11 Dec 2022 23:08:53 +0100 Subject: [PATCH 72/77] Refactored verbosity option to counter (none), -v, -vv, -vvv (trace) --- src/main.cc | 2 +- src/sequence_diagram/model/diagram.cc | 12 ++++---- .../visitor/translation_unit_visitor.cc | 30 +++++++++---------- src/util/util.cc | 13 ++++++-- src/util/util.h | 2 +- 5 files changed, 34 insertions(+), 25 deletions(-) diff --git a/src/main.cc b/src/main.cc index b816aff6..d08d0f82 100644 --- a/src/main.cc +++ b/src/main.cc @@ -60,7 +60,7 @@ int main(int argc, const char *argv[]) std::optional output_directory; unsigned int thread_count{0}; bool show_version{false}; - bool verbose{false}; + int verbose{0}; bool list_diagrams{false}; app.add_option( diff --git a/src/sequence_diagram/model/diagram.cc b/src/sequence_diagram/model/diagram.cc index 21feb99c..decb8db2 100644 --- a/src/sequence_diagram/model/diagram.cc +++ b/src/sequence_diagram/model/diagram.cc @@ -265,19 +265,19 @@ diagram::active_participants() const void diagram::print() const { - LOG_DBG(" --- Participants ---"); + LOG_TRACE(" --- Participants ---"); for (const auto &[id, participant] : participants_) { LOG_DBG("{} - {}", id, participant->to_string()); } - LOG_DBG(" --- Activities ---"); + LOG_TRACE(" --- Activities ---"); for (const auto &[from_id, act] : sequences_) { - LOG_DBG("Sequence id={}:", from_id); + LOG_TRACE("Sequence id={}:", from_id); const auto &from_activity = *(participants_.at(from_id)); - LOG_DBG(" Activity id={}, from={}:", act.from(), + LOG_TRACE(" Activity id={}, from={}:", act.from(), from_activity.full_name(false)); for (const auto &message : act.messages()) { @@ -287,7 +287,7 @@ void diagram::print() const const auto &from_participant = *participants_.at(message.from()); if (participants_.find(message.to()) == participants_.end()) { - LOG_DBG(" Message from={}, from_id={}, " + LOG_TRACE(" Message from={}, from_id={}, " "to={}, to_id={}, name={}, type={}", from_participant.full_name(false), from_participant.id(), "__UNRESOLVABLE_ID__", message.to(), message.message_name(), @@ -296,7 +296,7 @@ void diagram::print() const else { const auto &to_participant = *participants_.at(message.to()); - LOG_DBG(" Message from={}, from_id={}, " + LOG_TRACE(" Message from={}, from_id={}, " "to={}, to_id={}, name={}, type={}", from_participant.full_name(false), from_participant.id(), to_participant.full_name(false), to_participant.id(), diff --git a/src/sequence_diagram/visitor/translation_unit_visitor.cc b/src/sequence_diagram/visitor/translation_unit_visitor.cc index 45d48134..a933042b 100644 --- a/src/sequence_diagram/visitor/translation_unit_visitor.cc +++ b/src/sequence_diagram/visitor/translation_unit_visitor.cc @@ -173,7 +173,7 @@ bool translation_unit_visitor::VisitClassTemplateDecl( if (!diagram().should_include(cls->getQualifiedNameAsString())) return true; - LOG_DBG("= Visiting class template declaration {} at {} [{}]", + LOG_TRACE("Visiting class template declaration {} at {} [{}]", cls->getQualifiedNameAsString(), cls->getLocation().printToString(source_manager()), (void *)cls); @@ -222,7 +222,7 @@ bool translation_unit_visitor::VisitClassTemplateSpecializationDecl( if (!diagram().should_include(cls->getQualifiedNameAsString())) return true; - LOG_DBG("Visiting template specialization declaration {} at {}", + LOG_TRACE("Visiting template specialization declaration {} at {}", cls->getQualifiedNameAsString(), cls->getLocation().printToString(source_manager())); @@ -275,7 +275,7 @@ bool translation_unit_visitor::VisitCXXMethodDecl(clang::CXXMethodDecl *m) static_cast(m->getDefinition())); } - LOG_DBG("Visiting method {} in class {} [{}]", + LOG_TRACE("Visiting method {} in class {} [{}]", m->getQualifiedNameAsString(), m->getParent()->getQualifiedNameAsString(), (void *)m->getParent()); @@ -299,7 +299,7 @@ bool translation_unit_visitor::VisitCXXMethodDecl(clang::CXXMethodDecl *m) LOG_DBG("Getting method's class with local id {}", parent_decl->getID()); if (!get_participant(parent_decl)) { - LOG_WARN("Cannot find parent class_ for method {} in class {}", + LOG_INFO("Cannot find parent class_ for method {} in class {}", m->getQualifiedNameAsString(), m->getParent()->getQualifiedNameAsString()); return true; @@ -336,7 +336,7 @@ bool translation_unit_visitor::VisitCXXMethodDecl(clang::CXXMethodDecl *m) set_unique_id(m->getID(), m_ptr->id()); // This is probably not necessary? - LOG_DBG("Set id {} --> {} for method name {} [{}]", m->getID(), m_ptr->id(), + LOG_TRACE("Set id {} --> {} for method name {} [{}]", m->getID(), m_ptr->id(), method_full_name, m->isThisDeclarationADefinition()); context().update(m); @@ -364,7 +364,7 @@ bool translation_unit_visitor::VisitFunctionDecl(clang::FunctionDecl *f) static_cast(f->getDefinition())); } - LOG_DBG("Visiting function declaration {} at {}", function_name, + LOG_TRACE("Visiting function declaration {} at {}", function_name, f->getLocation().printToString(source_manager())); if (f->isTemplated()) { @@ -441,7 +441,7 @@ bool translation_unit_visitor::VisitFunctionTemplateDecl( if (!diagram().should_include(function_name)) return true; - LOG_DBG("Visiting function template declaration {} at {}", function_name, + LOG_TRACE("Visiting function template declaration {} at {}", function_name, function_template->getLocation().printToString(source_manager())); auto f_ptr = std::make_unique( @@ -753,7 +753,7 @@ bool translation_unit_visitor::VisitCallExpr(clang::CallExpr *expr) if (!context().valid()) return true; - LOG_DBG("Visiting call expression at {} [caller_id = {}]", + LOG_TRACE("Visiting call expression at {} [caller_id = {}]", expr->getBeginLoc().printToString(source_manager()), context().caller_id()); @@ -912,7 +912,7 @@ bool translation_unit_visitor::process_class_method_call_expression( method_call_expr->getCallReturnType(*context().get_ast_context()) .getAsString()); - LOG_DBG("Set callee method id {} for method name {}", m.to(), + LOG_TRACE("Set callee method id {} for method name {}", m.to(), method_decl->getQualifiedNameAsString()); diagram().add_active_participant(method_decl->getID()); @@ -1216,7 +1216,7 @@ bool translation_unit_visitor::process_template_parameters( { using class_diagram::model::template_parameter; - LOG_DBG("Processing class {} template parameters...", + LOG_TRACE("Processing class {} template parameters...", common::get_qualified_name(template_declaration)); if (template_declaration.getTemplateParameters() == nullptr) @@ -1275,7 +1275,7 @@ bool translation_unit_visitor::process_template_parameters( void translation_unit_visitor::set_unique_id( int64_t local_id, common::model::diagram_element::id_t global_id) { - LOG_DBG("== Setting local element mapping {} --> {}", local_id, global_id); + LOG_TRACE("Setting local element mapping {} --> {}", local_id, global_id); local_ast_id_map_[local_id] = global_id; } @@ -1361,7 +1361,7 @@ void translation_unit_visitor:: arg, argument); } else { - LOG_ERROR("Unsupported argument type {}", arg.getKind()); + LOG_INFO("Unsupported argument type {}", arg.getKind()); } simplify_system_template( @@ -1683,7 +1683,7 @@ void translation_unit_visitor::process_template_specialization_argument( argument.set_name(type_name); } - LOG_DBG("Adding template instantiation argument {}", + LOG_TRACE("Adding template instantiation argument {}", argument.to_string(config().using_namespace(), false)); simplify_system_template( @@ -1720,7 +1720,7 @@ void translation_unit_visitor::process_template_specialization_argument( } } else { - LOG_ERROR("Unsupported template argument kind {} [{}]", arg.getKind(), + LOG_INFO("Unsupported template argument kind {} [{}]", arg.getKind(), cls->getLocation().printToString(source_manager())); } } @@ -1897,7 +1897,7 @@ translation_unit_visitor::build_template_instantiation( destination = best_match_full_name; } else { - LOG_DBG("== Cannot determine global id for specialization template {} " + LOG_DBG("Cannot determine global id for specialization template {} " "- delaying until the translation unit is complete ", templated_decl_id); } diff --git a/src/util/util.cc b/src/util/util.cc index 9a820790..4801f877 100644 --- a/src/util/util.cc +++ b/src/util/util.cc @@ -26,16 +26,25 @@ namespace util { const std::string WHITESPACE = " \n\r\t\f\v"; -void setup_logging(bool verbose) +void setup_logging(int verbose) { auto console = spdlog::stdout_color_mt("console", spdlog::color_mode::automatic); console->set_pattern("[%^%l%^] [tid %t] %v"); - if (verbose) { + if (verbose == 0) { + console->set_level(spdlog::level::err); + } + else if(verbose == 1) { + console->set_level(spdlog::level::info); + } + else if(verbose == 2) { console->set_level(spdlog::level::debug); } + else { + console->set_level(spdlog::level::trace); + } } std::string get_process_output(const std::string &command) diff --git a/src/util/util.h b/src/util/util.h index 7c846d4e..a5b5b696 100644 --- a/src/util/util.h +++ b/src/util/util.h @@ -62,7 +62,7 @@ std::string trim(const std::string &s); * * @param verbose Whether the logging should be verbose or not. */ -void setup_logging(bool verbose); +void setup_logging(int verbose); std::string get_process_output(const std::string &command); From 4a3f87caefebb4c289a380a4282c94e20fc18f7d Mon Sep 17 00:00:00 2001 From: Bartek Kryza Date: Sun, 11 Dec 2022 23:11:12 +0100 Subject: [PATCH 73/77] Updated gitignore --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index 2b3f25ec..d82c22e2 100644 --- a/.gitignore +++ b/.gitignore @@ -31,3 +31,4 @@ packaging/conda/meta.yaml .idea/ cmake-build- cmake-build-* +.run/ From 9fcfaf4cd8745226f939f68aa097bc09594b79eb Mon Sep 17 00:00:00 2001 From: Bartek Kryza Date: Sun, 11 Dec 2022 23:13:15 +0100 Subject: [PATCH 74/77] Updated test case documentation --- docs/test_cases.md | 1 + docs/test_cases/t00002_class.svg | 36 ++--- docs/test_cases/t00003_class.svg | 46 +++---- docs/test_cases/t00004_class.svg | 76 +++++------ docs/test_cases/t00005_class.svg | 110 +++++++-------- docs/test_cases/t00006_class.svg | 132 +++++++++--------- docs/test_cases/t00007_class.svg | 30 ++-- docs/test_cases/t00008_class.svg | 56 ++++---- docs/test_cases/t00009_class.svg | 32 ++--- docs/test_cases/t00010_class.svg | 34 ++--- docs/test_cases/t00011_class.svg | 22 +-- docs/test_cases/t00012_class.svg | 66 ++++----- docs/test_cases/t00013_class.svg | 82 +++++------ docs/test_cases/t00014_class.svg | 116 ++++++++-------- docs/test_cases/t00015_class.svg | 22 +-- docs/test_cases/t00016_class.svg | 30 ++-- docs/test_cases/t00017_class.svg | 66 ++++----- docs/test_cases/t00018_class.svg | 18 +-- docs/test_cases/t00019_class.svg | 40 +++--- docs/test_cases/t00020_class.svg | 38 +++--- docs/test_cases/t00021_class.svg | 30 ++-- docs/test_cases/t00022_class.svg | 14 +- docs/test_cases/t00023_class.svg | 26 ++-- docs/test_cases/t00024_class.svg | 22 +-- docs/test_cases/t00025_class.svg | 34 ++--- docs/test_cases/t00026_class.svg | 42 +++--- docs/test_cases/t00027_class.svg | 58 ++++---- docs/test_cases/t00028_class.svg | 78 +++++------ docs/test_cases/t00029_class.svg | 50 +++---- docs/test_cases/t00030_class.svg | 46 +++---- docs/test_cases/t00031_class.svg | 50 +++---- docs/test_cases/t00032_class.svg | 40 +++--- docs/test_cases/t00033_class.svg | 48 +++---- docs/test_cases/t00034_class.svg | 46 +++---- docs/test_cases/t00035_class.svg | 22 +-- docs/test_cases/t00036_class.svg | 38 +++--- docs/test_cases/t00037_class.svg | 54 ++++---- docs/test_cases/t00038_class.svg | 58 ++++---- docs/test_cases/t00039_class.svg | 78 +++++------ docs/test_cases/t00040_class.svg | 26 ++-- docs/test_cases/t00041_class.svg | 54 ++++---- docs/test_cases/t00042_class.svg | 36 ++--- docs/test_cases/t00043_class.svg | 50 +++---- docs/test_cases/t00044_class.svg | 36 ++--- docs/test_cases/t00045_class.svg | 70 +++++----- docs/test_cases/t00046_class.svg | 64 ++++----- docs/test_cases/t00047_class.svg | 22 +-- docs/test_cases/t00048_class.svg | 50 +++---- docs/test_cases/t00049_class.svg | 32 ++--- docs/test_cases/t00050_class.svg | 70 +++++----- docs/test_cases/t20001_sequence.svg | 62 ++++----- docs/test_cases/t20002_sequence.svg | 48 +++---- docs/test_cases/t20003_sequence.svg | 48 +++---- docs/test_cases/t20004_sequence.svg | 120 ++++++++-------- docs/test_cases/t20005_sequence.svg | 36 ++--- docs/test_cases/t20006_sequence.svg | 150 ++++++++++---------- docs/test_cases/t20007_sequence.svg | 48 +++---- docs/test_cases/t20008_sequence.svg | 84 ++++++------ docs/test_cases/t20009_sequence.svg | 84 ++++++------ docs/test_cases/t20010_sequence.svg | 72 +++++----- docs/test_cases/t20011_sequence.svg | 72 +++++----- docs/test_cases/t20012_sequence.svg | 204 ++++++++++++++-------------- docs/test_cases/t20013_sequence.svg | 60 ++++---- docs/test_cases/t20014_sequence.svg | 72 +++++----- docs/test_cases/t20015_sequence.svg | 24 ++-- docs/test_cases/t20016_sequence.svg | 48 +++---- docs/test_cases/t20017_sequence.svg | 48 +++---- docs/test_cases/t20018_sequence.svg | 96 ++++++------- docs/test_cases/t20019_sequence.svg | 84 ++++++------ docs/test_cases/t20020.md | 25 ++++ docs/test_cases/t20020_sequence.svg | 142 +++++++++++++------ docs/test_cases/t20021_sequence.svg | 62 ++++----- docs/test_cases/t20022.md | 61 +++++++++ docs/test_cases/t20022_sequence.svg | 50 +++++++ docs/test_cases/t30001_package.svg | 48 +++---- docs/test_cases/t30002_package.svg | 90 ++++++------ docs/test_cases/t30003_package.svg | 26 ++-- docs/test_cases/t30004_package.svg | 30 ++-- docs/test_cases/t30005_package.svg | 38 +++--- docs/test_cases/t30006_package.svg | 16 +-- docs/test_cases/t30007_package.svg | 20 +-- docs/test_cases/t30008_package.svg | 34 ++--- docs/test_cases/t40001_include.svg | 30 ++-- docs/test_cases/t40002_include.svg | 34 ++--- docs/test_cases/t40003_include.svg | 50 +++---- 85 files changed, 2407 insertions(+), 2206 deletions(-) create mode 100644 docs/test_cases/t20022.md create mode 100644 docs/test_cases/t20022_sequence.svg diff --git a/docs/test_cases.md b/docs/test_cases.md index 00736d07..cc9f1167 100644 --- a/docs/test_cases.md +++ b/docs/test_cases.md @@ -71,6 +71,7 @@ * [t20019](./test_cases/t20019.md) - Curiously Recurring Template Pattern sequence diagram test case * [t20020](./test_cases/t20020.md) - If statement sequence diagram test case * [t20021](./test_cases/t20021.md) - Loop statements sequence diagram test case + * [t20022](./test_cases/t20022.md) - Forward class declaration sequence diagram test case ## Package diagrams * [t30001](./test_cases/t30001.md) - Basic package diagram test case * [t30002](./test_cases/t30002.md) - Package dependency test case diff --git a/docs/test_cases/t00002_class.svg b/docs/test_cases/t00002_class.svg index 5d9e9208..25ba8f91 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_class.svg b/docs/test_cases/t00003_class.svg index 27d38e58..b835944b 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_class.svg b/docs/test_cases/t00004_class.svg index 6c3105e2..f9895e2d 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,15 +59,15 @@ Red - - + + A::AA::AAA - + C::B @@ -75,8 +75,8 @@ int - - + + C @@ -84,39 +84,39 @@ T - + - + t : T - + - + b_int : B<int> - - + + C::AA - - + + C::AA::AAA - - + + C::AA::CCC @@ -125,8 +125,8 @@ CCC_2 - - + + C::B @@ -134,16 +134,16 @@ V - + - + b : V - - + + C::CC @@ -152,16 +152,16 @@ CC_2 - - + + detail::D - - + + detail::D::AA @@ -171,8 +171,8 @@ AA_3 - - + + detail::D::DD diff --git a/docs/test_cases/t00005_class.svg b/docs/test_cases/t00005_class.svg index 28259219..c492fd3c 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_class.svg b/docs/test_cases/t00006_class.svg index 65473d96..c3825c05 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,15 +146,15 @@ T - + - + data : std::vector<T> - + custom_container @@ -162,102 +162,102 @@ 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_class.svg b/docs/test_cases/t00007_class.svg index c08a89f3..e85d5e45 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_class.svg b/docs/test_cases/t00008_class.svg index 16ee6aa2..7f57b220 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,CMP,int N - + - + 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,15 +87,15 @@ T,C<> - + - + template_template : C<T> - + B @@ -103,18 +103,18 @@ int,Vector - - + + D - + - + ints : B<int,Vector> diff --git a/docs/test_cases/t00009_class.svg b/docs/test_cases/t00009_class.svg index 6db3aa2d..45f31da2 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,15 +18,15 @@ T - + - + value : T - + A @@ -34,7 +34,7 @@ int - + A @@ -42,7 +42,7 @@ std::string - + A @@ -50,32 +50,32 @@ 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_class.svg b/docs/test_cases/t00010_class.svg index 74c74b33..454fc824 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,22 +18,22 @@ T,P - + - + first : T - + - + second : P - + A @@ -41,8 +41,8 @@ T,std::string - - + + B @@ -50,15 +50,15 @@ T - + - + astring : A<T,std::string> - + B @@ -66,18 +66,18 @@ int - - + + C - + - + aintstring : B<int> diff --git a/docs/test_cases/t00011_class.svg b/docs/test_cases/t00011_class.svg index bd70b707..e53c0dd2 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_class.svg b/docs/test_cases/t00012_class.svg index 1e6c5a46..f3639361 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,14 +60,14 @@ - + - + ints : std::array<T,sizeof...(Is)> - + A @@ -75,7 +75,7 @@ int,std::string,float - + A @@ -83,7 +83,7 @@ int,std::string,bool - + B @@ -91,7 +91,7 @@ 3,2,1 - + B @@ -99,7 +99,7 @@ 1,1,1,1 - + C @@ -107,50 +107,50 @@ 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_class.svg b/docs/test_cases/t00013_class.svg index 2bdc3de1..9c1e16d6 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,15 +18,15 @@ T - + - + f : T - + ABCD::F @@ -34,70 +34,70 @@ int - - + + A - + - + a : int - - + + B - + - + b : int - - + + C - + - + c : int - - + + D - + - + d : int print(R * r) : void - - + + E @@ -105,16 +105,16 @@ T - + - + e : T - - + + G @@ -122,22 +122,22 @@ T,Args... - + - + g : T - + - + args : std::tuple<Args...> - + E @@ -145,7 +145,7 @@ int - + G @@ -153,7 +153,7 @@ int,float,std::string - + E @@ -161,25 +161,25 @@ std::string - - + + R - + - + gintstring : G<int,float,std::string> - + - + estring : E<std::string> diff --git a/docs/test_cases/t00014_class.svg b/docs/test_cases/t00014_class.svg index 1e715b77..620ada74 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,37 +18,37 @@ T,P - + - + t : T - + - + p : P - - + + B - + - + value : std::string - + A @@ -56,7 +56,7 @@ T,std::string - + A @@ -64,7 +64,7 @@ T,std::unique_ptr<std::string> - + A @@ -72,7 +72,7 @@ long,T - + A @@ -80,7 +80,7 @@ double,T - + A @@ -88,7 +88,7 @@ long,U - + A @@ -96,7 +96,7 @@ long,bool - + A @@ -104,7 +104,7 @@ double,bool - + A @@ -112,7 +112,7 @@ long,float - + A @@ -120,7 +120,7 @@ double,float - + A @@ -128,7 +128,7 @@ bool,std::string - + A @@ -136,7 +136,7 @@ float,std::unique_ptr<std::string> - + A @@ -144,7 +144,7 @@ int,std::string - + A @@ -152,7 +152,7 @@ std::string,std::string - + A @@ -160,7 +160,7 @@ char,std::string - + A @@ -168,116 +168,116 @@ wchar_t,std::string - - + + R - + - + 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 - + - + bs : BVector - + - + bs2 : BVector2 - + - + cb : SimpleCallback<ACharString> - + - + gcb : GenericCallback<R::AWCharString> - + - + vcb : VoidCallback - + - + vps : VectorPtr<B> diff --git a/docs/test_cases/t00015_class.svg b/docs/test_cases/t00015_class.svg index 9273bf17..88d3ebfd 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_class.svg b/docs/test_cases/t00016_class.svg index fbd5b7cf..c283d21d 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<> @@ -19,8 +19,8 @@ value : enum - - + + is_numeric @@ -29,8 +29,8 @@ value : enum - - + + is_numeric @@ -41,8 +41,8 @@ value : enum - - + + is_numeric @@ -53,8 +53,8 @@ value : enum - - + + is_numeric @@ -65,8 +65,8 @@ value : enum - - + + is_numeric @@ -77,8 +77,8 @@ value : enum - - + + is_numeric diff --git a/docs/test_cases/t00017_class.svg b/docs/test_cases/t00017_class.svg index fb818d23..41e343f7 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_class.svg b/docs/test_cases/t00018_class.svg index 88f15dd6..f89e9346 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_class.svg b/docs/test_cases/t00019_class.svg index 0ca37c76..be59f547 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,7 +83,7 @@ m1_calls() const : int m2_calls() const : int - + Layer3 @@ -91,7 +91,7 @@ Base - + Layer2 @@ -99,7 +99,7 @@ Layer3<Base> - + Layer1 @@ -107,18 +107,18 @@ Layer2<Layer3<Base>> - - + + A - + - + layers : std::unique_ptr<Layer1<Layer2<Layer3<Base>>>> diff --git a/docs/test_cases/t00020_class.svg b/docs/test_cases/t00020_class.svg index fbd55f5a..c3cea5dd 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_class.svg b/docs/test_cases/t00021_class.svg index 34cdabc8..a0190d42 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_class.svg b/docs/test_cases/t00022_class.svg index d5e6c815..65719565 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_class.svg b/docs/test_cases/t00023_class.svg index bf9cc553..2af88994 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_class.svg b/docs/test_cases/t00024_class.svg index 48d96997..d3c264ec 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_class.svg b/docs/test_cases/t00025_class.svg index a75793a9..633dbb10 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,7 +56,7 @@ m1() : void m2() : void - + Proxy @@ -64,7 +64,7 @@ Target1 - + Proxy @@ -72,25 +72,25 @@ Target2 - - + + ProxyHolder - + - + proxy1 : Proxy<Target1> - + - + proxy2 : Proxy<Target2> diff --git a/docs/test_cases/t00026_class.svg b/docs/test_cases/t00026_class.svg index 1263118f..d5f2d054 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>(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,7 +78,7 @@ state(const std::string & n) : Memento<T> & set_state(const std::string & s, Memento<T> && m) : void - + Caretaker @@ -86,7 +86,7 @@ std::string - + Originator @@ -94,25 +94,25 @@ std::string - - + + StringMemento - + - + caretaker : Caretaker<std::string> - + - + originator : Originator<std::string> diff --git a/docs/test_cases/t00027_class.svg b/docs/test_cases/t00027_class.svg index 71a21a60..ffee9619 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,14 @@ ~Shape() = default : void - + Line - - + + Line @@ -39,14 +39,14 @@ display() : void - + Text - - + + Text @@ -57,8 +57,8 @@ display() : void - - + + ShapeDecorator @@ -67,8 +67,8 @@ display() = 0 : void - - + + Color @@ -79,8 +79,8 @@ display() : void - - + + Weight @@ -91,7 +91,7 @@ display() : void - + Line @@ -99,7 +99,7 @@ Color,Weight - + Line @@ -107,7 +107,7 @@ Color - + Text @@ -115,7 +115,7 @@ Color,Weight - + Text @@ -123,39 +123,39 @@ Color - - + + Window - + - + border : Line<Color,Weight> - + - + divider : Line<Color> - + - + title : Text<Color,Weight> - + - + description : Text<Color> diff --git a/docs/test_cases/t00028_class.svg b/docs/test_cases/t00028_class.svg index 2aaa5131..cf3e820a 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,10 +94,10 @@ three - + F enum note. - + E @@ -105,59 +105,59 @@ 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. diff --git a/docs/test_cases/t00029_class.svg b/docs/test_cases/t00029_class.svg index ddcd8a13..8d879047 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_class.svg b/docs/test_cases/t00030_class.svg index 8b6cb90d..9da336d7 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_class.svg b/docs/test_cases/t00031_class.svg index 3a86c444..4242c6d8 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,23 +47,23 @@ T - + - + ttt : T - - + + D - + C @@ -71,39 +71,39 @@ int - - + + R - + - + aaa : A * - + - + bbb : std::vector<B> - + - + ccc : C<int> - + - + ddd : D * diff --git a/docs/test_cases/t00032_class.svg b/docs/test_cases/t00032_class.svg index 58c74525..63315434 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,15 +64,15 @@ T,L,Ts... - + - + counter : L - + Overload @@ -80,18 +80,18 @@ TBase,int,A,B,C - - + + R - + - + overload : Overload<TBase,int,A,B,C> diff --git a/docs/test_cases/t00033_class.svg b/docs/test_cases/t00033_class.svg index 1ed55110..5045fd71 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,30 +52,30 @@ T - + - + ccc : T - - + + D - + - + ddd : int - + C @@ -83,7 +83,7 @@ D - + B @@ -91,7 +91,7 @@ std::unique_ptr<C<D>> - + A @@ -99,18 +99,18 @@ B<std::unique_ptr<C<D>>> - - + + R - + - + abc : A<B<std::unique_ptr<C<D>>>> diff --git a/docs/test_cases/t00034_class.svg b/docs/test_cases/t00034_class.svg index d8202a67..f1deaa13 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,16 +31,16 @@ - - + + lift_void - - + + lift_void @@ -49,8 +49,8 @@ - - + + drop_void @@ -59,16 +59,16 @@ - - + + drop_void - - + + drop_void @@ -77,33 +77,33 @@ - - + + A - - + + R - + - + la : lift_void_t<A> * - + - + lv : lift_void_t<void> * diff --git a/docs/test_cases/t00035_class.svg b/docs/test_cases/t00035_class.svg index 3f2141e4..502f58f9 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_class.svg b/docs/test_cases/t00036_class.svg index 644ab60a..0a7b0595 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,15 +43,15 @@ T - + - + a : T - + A @@ -59,23 +59,23 @@ int - - + + B - + - + a_int : A<int> - - + + C diff --git a/docs/test_cases/t00037_class.svg b/docs/test_cases/t00037_class.svg index 1eda95f6..f1964b8a 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_620) - + - + units : ST::(anonymous_739) - - + + 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_class.svg b/docs/test_cases/t00038_class.svg index 57f07dbf..2553ccd0 100644 --- a/docs/test_cases/t00038_class.svg +++ b/docs/test_cases/t00038_class.svg @@ -1,6 +1,6 @@ - + @@ -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,16 +88,16 @@ - - + + map - - + + map @@ -106,8 +106,8 @@ - - + + map @@ -116,8 +116,8 @@ - - + + map @@ -126,8 +126,8 @@ - - + + map diff --git a/docs/test_cases/t00039_class.svg b/docs/test_cases/t00039_class.svg index b2c465ce..ef945456 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_class.svg b/docs/test_cases/t00040_class.svg index 02f0e2db..aaaf350d 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_class.svg b/docs/test_cases/t00041_class.svg index 5815d27d..a59e1afd 100644 --- a/docs/test_cases/t00041_class.svg +++ b/docs/test_cases/t00041_class.svg @@ -1,6 +1,6 @@ - + @@ -9,100 +9,100 @@ - - + + R - - + + D - + - + rr : RR * - - + + E - - + + F - - + + RR - + - + e : E * - + - + f : F * - + - + g : detail::G * - - + + RRR - - + + ns1::N - - + + ns1::NN - - + + ns1::NM diff --git a/docs/test_cases/t00042_class.svg b/docs/test_cases/t00042_class.svg index 709cc47a..2ff11951 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,22 +52,22 @@ T,K - + - + b : T - + - + bb : K - + A @@ -75,7 +75,7 @@ double - + A @@ -83,7 +83,7 @@ std::string - + B diff --git a/docs/test_cases/t00043_class.svg b/docs/test_cases/t00043_class.svg index 27534098..5306fa47 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_class.svg b/docs/test_cases/t00044_class.svg index b4e124db..7ef5b0f8 100644 --- a/docs/test_cases/t00044_class.svg +++ b/docs/test_cases/t00044_class.svg @@ -1,6 +1,6 @@ - + @@ -9,7 +9,7 @@ - + signal_handler @@ -17,8 +17,8 @@ ,A - - + + sink @@ -27,15 +27,15 @@ sink<signal_handler<type-parameter-0-0 (type-parameter-0-1...), type-parameter-0-2> >(sink<signal_handler<type-parameter-0-0 (type-parameter-0-1...),type-parameter-0-2>>::signal_t & sh) : void - + - + signal : sink<signal_handler<type-parameter-0-0 (type-parameter-0-1...),type-parameter-0-2>>::signal_t * - - + + sink @@ -46,23 +46,23 @@ sink<signal_handler<type-parameter-0-0 (type-parameter-0-1...), type-parameter-0-2> >(sink<signal_handler<type-parameter-0-0 (type-parameter-0-1...),type-parameter-0-2>>::signal_t & sh) : void - + - + signal : sink<signal_handler<type-parameter-0-0 (type-parameter-0-1...),type-parameter-0-2>>::signal_t * - - + + signal_handler - - + + signal_handler @@ -71,8 +71,8 @@ - - + + signal_handler @@ -81,8 +81,8 @@ - - + + sink diff --git a/docs/test_cases/t00045_class.svg b/docs/test_cases/t00045_class.svg index 8916f5dd..0d9fca2d 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_class.svg b/docs/test_cases/t00046_class.svg index 25272c88..26a56339 100644 --- a/docs/test_cases/t00046_class.svg +++ b/docs/test_cases/t00046_class.svg @@ -1,6 +1,6 @@ - + @@ -9,118 +9,118 @@ - + ns1 - + ns2 - + __gnu_cxx - - + + A - - + + A - - + + B - - + + C - - + + D - - + + E - - + + R - + - + a : ns1::ns2::A * - + - + ns1_a : ns1::A * - + - + ns1_ns2_a : ns1::ns2::A * - + - + root_a : ::A * - + - + i : std::vector<std::uint8_t> foo(AA & aa) : void - - + + A - - + + AA diff --git a/docs/test_cases/t00047_class.svg b/docs/test_cases/t00047_class.svg index e5c56714..067e14a5 100644 --- a/docs/test_cases/t00047_class.svg +++ b/docs/test_cases/t00047_class.svg @@ -1,6 +1,6 @@ - + @@ -9,16 +9,16 @@ - - + + conditional_t - - + + conditional_t @@ -27,8 +27,8 @@ - - + + conditional_t @@ -37,8 +37,8 @@ - - + + conditional_t @@ -47,8 +47,8 @@ - - + + conditional_t diff --git a/docs/test_cases/t00048_class.svg b/docs/test_cases/t00048_class.svg index 3b9b2bb8..c2d986d4 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_class.svg b/docs/test_cases/t00049_class.svg index fcfaae64..07abb039 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,17 +18,17 @@ T - + - + a : T get_a() : T & - + A @@ -36,7 +36,7 @@ intmap - + A @@ -44,7 +44,7 @@ thestring - + A @@ -52,32 +52,32 @@ std::vector<thestring> - - + + R - + - + a_string : A<thestring> - + - + a_vector_string : A<string_vector> - + - + a_int_map : A<intmap> diff --git a/docs/test_cases/t00050_class.svg b/docs/test_cases/t00050_class.svg index 507e0432..e8f8344c 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 diff --git a/docs/test_cases/t20001_sequence.svg b/docs/test_cases/t20001_sequence.svg index c53bd600..7c628e22 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_sequence.svg b/docs/test_cases/t20002_sequence.svg index 8f7b1188..7229c105 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_sequence.svg b/docs/test_cases/t20003_sequence.svg index aea372bb..c44654ac 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_sequence.svg b/docs/test_cases/t20004_sequence.svg index 37050c2c..146bc280 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_sequence.svg b/docs/test_cases/t20005_sequence.svg index 4d55456d..9366c934 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_sequence.svg b/docs/test_cases/t20006_sequence.svg index 0eefbbe8..de5984f9 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_sequence.svg b/docs/test_cases/t20007_sequence.svg index 2f174b40..f44f405a 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_sequence.svg b/docs/test_cases/t20008_sequence.svg index 003b9b8c..f20f12f7 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_sequence.svg b/docs/test_cases/t20009_sequence.svg index eedfaba1..40bd1dc3 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_sequence.svg b/docs/test_cases/t20010_sequence.svg index f8dde17d..aaf0098f 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_sequence.svg b/docs/test_cases/t20011_sequence.svg index e021dc33..adad4e13 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_sequence.svg b/docs/test_cases/t20012_sequence.svg index 501124ab..16a25bcf 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 t20012.cc:66:20) - + tmain()::(lambda t20012.cc:66:20) - - + + A - + A - - + + B - + B - - + + tmain()::(lambda t20012.cc:79:20) - + tmain()::(lambda t20012.cc:79:20) - - + + C - + C - - + + R<R::(lambda t20012.cc:85:9)> - + R<R::(lambda t20012.cc:85:9)> - - + + tmain()::(lambda t20012.cc:85:9) - + tmain()::(lambda 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_sequence.svg b/docs/test_cases/t20013_sequence.svg index d3a37814..618b9fdc 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_sequence.svg b/docs/test_cases/t20014_sequence.svg index e9a186c4..8230b3ab 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_sequence.svg b/docs/test_cases/t20015_sequence.svg index 79c6e532..16d2d201 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_sequence.svg b/docs/test_cases/t20016_sequence.svg index 8301e71c..845c864e 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_sequence.svg b/docs/test_cases/t20017_sequence.svg index dfd82c34..63ba470d 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_b.h - + include/t20017_b.h - + include/t20017_a.h - + include/t20017_a.h - - - - - - + + + + + + tmain() - + b2<int>(int,int) - + a1(int,int) - + a2(int,int) - + a3(int,int) - + b1(int,int) diff --git a/docs/test_cases/t20018_sequence.svg b/docs/test_cases/t20018_sequence.svg index 9d2d19d8..20fe0636 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_sequence.svg b/docs/test_cases/t20019_sequence.svg index 9e19c79d..d3479ee6 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 1aec891e..6ba3e37e 100644 --- a/docs/test_cases/t20020.md +++ b/docs/test_cases/t20020.md @@ -37,10 +37,29 @@ struct B { int b2() { return 4; } }; +struct C { + void log() const { } + + void c1() const + { + if (c2()) + log(); + } + + bool c2() const { return true; } +}; + +template struct D { + + T d1(T x, T y) { return x + y; } +}; + int tmain() { A a; B b; + C c; + D d; int result{0}; @@ -59,6 +78,12 @@ int tmain() b.log(); + if (true) + c.c1(); + + if (true) + d.d1(1, 1); + // This if/else should not be included in the diagram at all // as the calls to std will be excluded by the diagram filters if (result != 2) { diff --git a/docs/test_cases/t20020_sequence.svg b/docs/test_cases/t20020_sequence.svg index 6fadc05a..eb03a283 100644 --- a/docs/test_cases/t20020_sequence.svg +++ b/docs/test_cases/t20020_sequence.svg @@ -1,6 +1,6 @@ - + - + @@ -9,49 +9,74 @@ - - - - - - - - + + + + + + + + + + + + - + - - - - - + + + + + + + + + + tmain() - - tmain() + + tmain() - - + + A - - A + + A - - + + B - - B + + B - - - - - - - + + + C + + C + + + + D<int> + + D<int> + + + + + + + + + + + + alt - + a1() @@ -62,21 +87,21 @@ alt - + a2() - + b1() - + b2() @@ -84,17 +109,56 @@ - + a3() - + log() + + + alt + + + + c1() + + + + alt + + + + + + c2() + + + + + + + + + + + log() + + + + alt + + + + d1(int,int) + + + diff --git a/docs/test_cases/t20021_sequence.svg b/docs/test_cases/t20021_sequence.svg index 15987f49..85377574 100644 --- a/docs/test_cases/t20021_sequence.svg +++ b/docs/test_cases/t20021_sequence.svg @@ -1,6 +1,6 @@ - + @@ -9,47 +9,47 @@ - - - - - - - - - - + + + + + + + + + + - - + + tmain() - + tmain() - - + + A - + A - - + + B - + B - - - - - - + + + + + + loop - + a3() @@ -62,14 +62,14 @@ loop - + a2() - + a1() @@ -79,14 +79,14 @@ loop - + b2() - + b2() diff --git a/docs/test_cases/t20022.md b/docs/test_cases/t20022.md new file mode 100644 index 00000000..526f2c12 --- /dev/null +++ b/docs/test_cases/t20022.md @@ -0,0 +1,61 @@ +# t20022 - Forward class declaration sequence diagram test case +## Config +```yaml +compilation_database_dir: .. +output_directory: puml +diagrams: + t20022_sequence: + type: sequence + glob: + - ../../tests/t20022/t20022.cc + include: + namespaces: + - clanguml::t20022 + using_namespace: + - clanguml::t20022 + start_from: + - function: "clanguml::t20022::tmain()" +``` +## Source code +File t20022.cc +```cpp +#include + +namespace clanguml { +namespace t20022 { +class B; + +class A { +public: + A(std::unique_ptr b); + + void a(); + + std::unique_ptr b_; +}; + +class B { +public: + void b() { } +}; + +A::A(std::unique_ptr b) + : b_{std::move(b)} +{ +} + +void A::a() { b_->b(); } + +int tmain() +{ + A a{std::make_unique()}; + + a.a(); + + return 0; +} +} +} +``` +## Generated UML diagrams +![t20022_sequence](./t20022_sequence.svg "Forward class declaration sequence diagram test case") diff --git a/docs/test_cases/t20022_sequence.svg b/docs/test_cases/t20022_sequence.svg new file mode 100644 index 00000000..c7754ac0 --- /dev/null +++ b/docs/test_cases/t20022_sequence.svg @@ -0,0 +1,50 @@ + + + + + + + + + + + + + + + + + + + + tmain() + + tmain() + + + + A + + A + + + + B + + B + + + + + + + + a() + + + + + b() + + + diff --git a/docs/test_cases/t30001_package.svg b/docs/test_cases/t30001_package.svg index a5651aa3..215bcf2d 100644 --- a/docs/test_cases/t30001_package.svg +++ b/docs/test_cases/t30001_package.svg @@ -1,6 +1,6 @@ - + @@ -9,63 +9,63 @@ - - + + 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_package.svg b/docs/test_cases/t30002_package.svg index 643049a1..39b5c4c6 100644 --- a/docs/test_cases/t30002_package.svg +++ b/docs/test_cases/t30002_package.svg @@ -1,6 +1,6 @@ - + @@ -9,113 +9,113 @@ - - + + A - - + + AA - - + + B - - + + BB - - + + A1 - - + + A2 - - + + A3 - - + + A4 - - + + A5 - - + + A6 - - + + A7 - - + + A8 - - + + A9 - - + + A10 - - + + A11 - - + + A12 - - + + A13 - - + + A14 - - + + A15 - - + + A16 - - + + A17 - - + + BBB diff --git a/docs/test_cases/t30003_package.svg b/docs/test_cases/t30003_package.svg index 4b88e7c6..d050d200 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_package.svg b/docs/test_cases/t30004_package.svg index 7d4ac651..3c8c6ff7 100644 --- a/docs/test_cases/t30004_package.svg +++ b/docs/test_cases/t30004_package.svg @@ -1,6 +1,6 @@ - + @@ -9,40 +9,40 @@ - - + + A - + Package AAA. - + Package BBB. - + CCCC package note. - + We skipped DDD. - - + + AAA - - + + BBB - - + + CCC - - + + EEE diff --git a/docs/test_cases/t30005_package.svg b/docs/test_cases/t30005_package.svg index 857c311b..920dd76e 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_package.svg b/docs/test_cases/t30006_package.svg index 4db0462a..7f5cc72d 100644 --- a/docs/test_cases/t30006_package.svg +++ b/docs/test_cases/t30006_package.svg @@ -1,6 +1,6 @@ - + @@ -9,22 +9,22 @@ - - + + B - - + + A - - + + C - + Top A note. diff --git a/docs/test_cases/t30007_package.svg b/docs/test_cases/t30007_package.svg index 4da07297..35ddb85a 100644 --- a/docs/test_cases/t30007_package.svg +++ b/docs/test_cases/t30007_package.svg @@ -1,6 +1,6 @@ - + @@ -9,27 +9,27 @@ - - + + A - - + + B - - + + AA - - + + C - + Compare layout with t30006. diff --git a/docs/test_cases/t30008_package.svg b/docs/test_cases/t30008_package.svg index b53decd3..e256d29b 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/t40001_include.svg b/docs/test_cases/t40001_include.svg index 07e00c88..a0b8504f 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 diff --git a/docs/test_cases/t40002_include.svg b/docs/test_cases/t40002_include.svg index 2451c9e6..6139e474 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_include.svg b/docs/test_cases/t40003_include.svg index e891a7ad..01aefbbc 100644 --- a/docs/test_cases/t40003_include.svg +++ b/docs/test_cases/t40003_include.svg @@ -1,6 +1,6 @@ - + @@ -9,66 +9,66 @@ - + include - + dependants - + dependencies - + src - + dependants - + dependencies - - + + t3.h - - + + t2.h - - + + t1.h - - + + t3.h - - + + t2.h - - + + t1.h - - + + t5.h - - + + t1.cc - - + + t2.cc From 8a167a5cccbab23a1878255cb852b8d1126834f5 Mon Sep 17 00:00:00 2001 From: Bartek Kryza Date: Sun, 11 Dec 2022 23:33:15 +0100 Subject: [PATCH 75/77] Added example clang-uml sequence diagrams --- .clang-uml | 4 ++++ uml/class_diagram_generator_sequence_diagram.yml | 13 +++++++++++++ uml/sequence_diagram_visitor_sequence_diagram.yml | 15 +++++++++++++++ 3 files changed, 32 insertions(+) create mode 100644 uml/class_diagram_generator_sequence_diagram.yml create mode 100644 uml/sequence_diagram_visitor_sequence_diagram.yml diff --git a/.clang-uml b/.clang-uml index ff87813c..6e6d2e75 100644 --- a/.clang-uml +++ b/.clang-uml @@ -16,6 +16,10 @@ diagrams: include!: uml/class_model_class_diagram.yml sequence_model_class: include!: uml/sequence_model_class_diagram.yml + sequence_diagram_visitor_sequence: + include!: uml/sequence_diagram_visitor_sequence_diagram.yml + class_diagram_generator_sequence: + include!: uml/class_diagram_generator_sequence_diagram.yml package_model_class: include!: uml/package_model_class_diagram.yml include_graph: diff --git a/uml/class_diagram_generator_sequence_diagram.yml b/uml/class_diagram_generator_sequence_diagram.yml new file mode 100644 index 00000000..ffad3a03 --- /dev/null +++ b/uml/class_diagram_generator_sequence_diagram.yml @@ -0,0 +1,13 @@ +type: sequence +glob: + - src/class_diagram/generators/plantuml/*.cc +include: + namespaces: + - clanguml +using_namespace: + - clanguml::class_diagram::generators::plantuml +plantuml: + before: + - 'title clang-uml clanguml::class_diagram::generators::plantuml::generator sequence diagram' +start_from: + - function: "clanguml::class_diagram::generators::plantuml::generator::generate(std::ostream &)" \ No newline at end of file diff --git a/uml/sequence_diagram_visitor_sequence_diagram.yml b/uml/sequence_diagram_visitor_sequence_diagram.yml new file mode 100644 index 00000000..bcbbe923 --- /dev/null +++ b/uml/sequence_diagram_visitor_sequence_diagram.yml @@ -0,0 +1,15 @@ +type: sequence +glob: + - src/sequence_diagram/visitor/*.cc + - src/sequence_diagram/model/*.cc +include: + namespaces: + - clanguml::sequence_diagram::visitor + - clanguml::sequence_diagram::model +using_namespace: + - clanguml::sequence_diagram::visitor +plantuml: + before: + - 'title clang-uml sequence_diagram::visitor::translation_unit_visitor::VisitCXXRecordDecl sequence diagram' +start_from: + - function: "clanguml::sequence_diagram::visitor::translation_unit_visitor::VisitCXXRecordDecl(clang::CXXRecordDecl *)" From 62e4467665d4a0a7669c92b49820e14243292e2a Mon Sep 17 00:00:00 2001 From: Bartek Kryza Date: Sun, 11 Dec 2022 23:33:40 +0100 Subject: [PATCH 76/77] Fixed formatting --- src/sequence_diagram/model/diagram.cc | 4 ++-- src/sequence_diagram/model/diagram.h | 2 +- .../visitor/translation_unit_visitor.cc | 4 ++-- src/util/util.cc | 4 ++-- tests/test_cases.h | 21 ++++++++++++------- 5 files changed, 21 insertions(+), 14 deletions(-) diff --git a/src/sequence_diagram/model/diagram.cc b/src/sequence_diagram/model/diagram.cc index decb8db2..99091e9d 100644 --- a/src/sequence_diagram/model/diagram.cc +++ b/src/sequence_diagram/model/diagram.cc @@ -288,7 +288,7 @@ void diagram::print() const if (participants_.find(message.to()) == participants_.end()) { LOG_TRACE(" Message from={}, from_id={}, " - "to={}, to_id={}, name={}, type={}", + "to={}, to_id={}, name={}, type={}", from_participant.full_name(false), from_participant.id(), "__UNRESOLVABLE_ID__", message.to(), message.message_name(), to_string(message.type())); @@ -297,7 +297,7 @@ void diagram::print() const const auto &to_participant = *participants_.at(message.to()); LOG_TRACE(" Message from={}, from_id={}, " - "to={}, to_id={}, name={}, type={}", + "to={}, to_id={}, name={}, type={}", from_participant.full_name(false), from_participant.id(), to_participant.full_name(false), to_participant.id(), message.message_name(), to_string(message.type())); diff --git a/src/sequence_diagram/model/diagram.h b/src/sequence_diagram/model/diagram.h index 51d51976..2b530f49 100644 --- a/src/sequence_diagram/model/diagram.h +++ b/src/sequence_diagram/model/diagram.h @@ -78,7 +78,7 @@ public: void add_active_participant(common::model::diagram_element::id_t id); - activity& get_activity(common::model::diagram_element::id_t id); + activity &get_activity(common::model::diagram_element::id_t id); void add_if_stmt(common::model::diagram_element::id_t current_caller_id, common::model::message_t type); diff --git a/src/sequence_diagram/visitor/translation_unit_visitor.cc b/src/sequence_diagram/visitor/translation_unit_visitor.cc index a933042b..79f7eaf0 100644 --- a/src/sequence_diagram/visitor/translation_unit_visitor.cc +++ b/src/sequence_diagram/visitor/translation_unit_visitor.cc @@ -336,8 +336,8 @@ bool translation_unit_visitor::VisitCXXMethodDecl(clang::CXXMethodDecl *m) set_unique_id(m->getID(), m_ptr->id()); // This is probably not necessary? - LOG_TRACE("Set id {} --> {} for method name {} [{}]", m->getID(), m_ptr->id(), - method_full_name, m->isThisDeclarationADefinition()); + LOG_TRACE("Set id {} --> {} for method name {} [{}]", m->getID(), + m_ptr->id(), method_full_name, m->isThisDeclarationADefinition()); context().update(m); diff --git a/src/util/util.cc b/src/util/util.cc index 4801f877..bda4497b 100644 --- a/src/util/util.cc +++ b/src/util/util.cc @@ -36,10 +36,10 @@ void setup_logging(int verbose) if (verbose == 0) { console->set_level(spdlog::level::err); } - else if(verbose == 1) { + else if (verbose == 1) { console->set_level(spdlog::level::info); } - else if(verbose == 2) { + else if (verbose == 2) { console->set_level(spdlog::level::debug); } else { diff --git a/tests/test_cases.h b/tests/test_cases.h index 276a534d..1bfe9dd8 100644 --- a/tests/test_cases.h +++ b/tests/test_cases.h @@ -82,19 +82,26 @@ template constexpr bool has_type() noexcept return (std::is_same_v || ... || false); } -struct Public { }; +struct Public { +}; -struct Protected { }; +struct Protected { +}; -struct Private { }; +struct Private { +}; -struct Abstract { }; +struct Abstract { +}; -struct Static { }; +struct Static { +}; -struct Const { }; +struct Const { +}; -struct Default { }; +struct Default { +}; struct HasCallWithResultMatcher : ContainsMatcher { HasCallWithResultMatcher( From 8dd35d11e9a232fd6206789e7f7ab09c6624ba53 Mon Sep 17 00:00:00 2001 From: Bartek Kryza Date: Sun, 11 Dec 2022 23:35:31 +0100 Subject: [PATCH 77/77] Updated test case documentation --- docs/test_cases/t00002_class.svg | 36 ++--- docs/test_cases/t00003_class.svg | 46 +++---- docs/test_cases/t00004_class.svg | 76 +++++------ docs/test_cases/t00005_class.svg | 110 +++++++-------- docs/test_cases/t00006_class.svg | 132 +++++++++--------- docs/test_cases/t00007_class.svg | 30 ++-- docs/test_cases/t00008_class.svg | 56 ++++---- docs/test_cases/t00009_class.svg | 32 ++--- docs/test_cases/t00010_class.svg | 34 ++--- docs/test_cases/t00011_class.svg | 22 +-- docs/test_cases/t00012_class.svg | 66 ++++----- docs/test_cases/t00013_class.svg | 82 +++++------ docs/test_cases/t00014_class.svg | 116 ++++++++-------- docs/test_cases/t00015_class.svg | 22 +-- docs/test_cases/t00016_class.svg | 30 ++-- docs/test_cases/t00017_class.svg | 66 ++++----- docs/test_cases/t00018_class.svg | 18 +-- docs/test_cases/t00019_class.svg | 40 +++--- docs/test_cases/t00020_class.svg | 38 +++--- docs/test_cases/t00021_class.svg | 30 ++-- docs/test_cases/t00022_class.svg | 14 +- docs/test_cases/t00023_class.svg | 26 ++-- docs/test_cases/t00024_class.svg | 22 +-- docs/test_cases/t00025_class.svg | 34 ++--- docs/test_cases/t00026_class.svg | 42 +++--- docs/test_cases/t00027_class.svg | 58 ++++---- docs/test_cases/t00028_class.svg | 78 +++++------ docs/test_cases/t00029_class.svg | 50 +++---- docs/test_cases/t00030_class.svg | 46 +++---- docs/test_cases/t00031_class.svg | 50 +++---- docs/test_cases/t00032_class.svg | 40 +++--- docs/test_cases/t00033_class.svg | 48 +++---- docs/test_cases/t00034_class.svg | 46 +++---- docs/test_cases/t00035_class.svg | 22 +-- docs/test_cases/t00036_class.svg | 38 +++--- docs/test_cases/t00037_class.svg | 54 ++++---- docs/test_cases/t00038_class.svg | 58 ++++---- docs/test_cases/t00039_class.svg | 78 +++++------ docs/test_cases/t00040_class.svg | 26 ++-- docs/test_cases/t00041_class.svg | 54 ++++---- docs/test_cases/t00042_class.svg | 36 ++--- docs/test_cases/t00043_class.svg | 50 +++---- docs/test_cases/t00044_class.svg | 36 ++--- docs/test_cases/t00045_class.svg | 70 +++++----- docs/test_cases/t00046_class.svg | 64 ++++----- docs/test_cases/t00047_class.svg | 22 +-- docs/test_cases/t00048_class.svg | 50 +++---- docs/test_cases/t00049_class.svg | 32 ++--- docs/test_cases/t00050_class.svg | 70 +++++----- docs/test_cases/t20001_sequence.svg | 62 ++++----- docs/test_cases/t20002_sequence.svg | 48 +++---- docs/test_cases/t20003_sequence.svg | 48 +++---- docs/test_cases/t20004_sequence.svg | 120 ++++++++-------- docs/test_cases/t20005_sequence.svg | 36 ++--- docs/test_cases/t20006_sequence.svg | 150 ++++++++++---------- docs/test_cases/t20007_sequence.svg | 48 +++---- docs/test_cases/t20008_sequence.svg | 84 ++++++------ docs/test_cases/t20009_sequence.svg | 84 ++++++------ docs/test_cases/t20010_sequence.svg | 72 +++++----- docs/test_cases/t20011_sequence.svg | 72 +++++----- docs/test_cases/t20012_sequence.svg | 204 ++++++++++++++-------------- docs/test_cases/t20013_sequence.svg | 60 ++++---- docs/test_cases/t20014_sequence.svg | 72 +++++----- docs/test_cases/t20015_sequence.svg | 24 ++-- docs/test_cases/t20016_sequence.svg | 48 +++---- docs/test_cases/t20017_sequence.svg | 48 +++---- docs/test_cases/t20018_sequence.svg | 96 ++++++------- docs/test_cases/t20019_sequence.svg | 84 ++++++------ docs/test_cases/t20020_sequence.svg | 106 +++++++-------- docs/test_cases/t20021_sequence.svg | 62 ++++----- docs/test_cases/t20022_sequence.svg | 36 ++--- docs/test_cases/t30001_package.svg | 48 +++---- docs/test_cases/t30002_package.svg | 90 ++++++------ docs/test_cases/t30003_package.svg | 26 ++-- docs/test_cases/t30004_package.svg | 30 ++-- docs/test_cases/t30005_package.svg | 38 +++--- docs/test_cases/t30006_package.svg | 16 +-- docs/test_cases/t30007_package.svg | 20 +-- docs/test_cases/t30008_package.svg | 34 ++--- docs/test_cases/t40001_include.svg | 30 ++-- docs/test_cases/t40002_include.svg | 34 ++--- docs/test_cases/t40003_include.svg | 50 +++---- 82 files changed, 2238 insertions(+), 2238 deletions(-) diff --git a/docs/test_cases/t00002_class.svg b/docs/test_cases/t00002_class.svg index 25ba8f91..9c2ce178 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_class.svg b/docs/test_cases/t00003_class.svg index b835944b..ab9f861a 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_class.svg b/docs/test_cases/t00004_class.svg index f9895e2d..3402db3a 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,15 +59,15 @@ Red - - + + A::AA::AAA - + C::B @@ -75,8 +75,8 @@ int - - + + C @@ -84,39 +84,39 @@ T - + - + t : T - + - + b_int : B<int> - - + + C::AA - - + + C::AA::AAA - - + + C::AA::CCC @@ -125,8 +125,8 @@ CCC_2 - - + + C::B @@ -134,16 +134,16 @@ V - + - + b : V - - + + C::CC @@ -152,16 +152,16 @@ CC_2 - - + + detail::D - - + + detail::D::AA @@ -171,8 +171,8 @@ AA_3 - - + + detail::D::DD diff --git a/docs/test_cases/t00005_class.svg b/docs/test_cases/t00005_class.svg index c492fd3c..90580ecc 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_class.svg b/docs/test_cases/t00006_class.svg index c3825c05..34d305dd 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,15 +146,15 @@ T - + - + data : std::vector<T> - + custom_container @@ -162,102 +162,102 @@ 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_class.svg b/docs/test_cases/t00007_class.svg index e85d5e45..2e8e3413 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_class.svg b/docs/test_cases/t00008_class.svg index 7f57b220..127c6642 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,CMP,int N - + - + 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,15 +87,15 @@ T,C<> - + - + template_template : C<T> - + B @@ -103,18 +103,18 @@ int,Vector - - + + D - + - + ints : B<int,Vector> diff --git a/docs/test_cases/t00009_class.svg b/docs/test_cases/t00009_class.svg index 45f31da2..97c3cf94 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,15 +18,15 @@ T - + - + value : T - + A @@ -34,7 +34,7 @@ int - + A @@ -42,7 +42,7 @@ std::string - + A @@ -50,32 +50,32 @@ 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_class.svg b/docs/test_cases/t00010_class.svg index 454fc824..56fe165f 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,22 +18,22 @@ T,P - + - + first : T - + - + second : P - + A @@ -41,8 +41,8 @@ T,std::string - - + + B @@ -50,15 +50,15 @@ T - + - + astring : A<T,std::string> - + B @@ -66,18 +66,18 @@ int - - + + C - + - + aintstring : B<int> diff --git a/docs/test_cases/t00011_class.svg b/docs/test_cases/t00011_class.svg index e53c0dd2..9e510a1d 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_class.svg b/docs/test_cases/t00012_class.svg index f3639361..fa0424c4 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,14 +60,14 @@ - + - + ints : std::array<T,sizeof...(Is)> - + A @@ -75,7 +75,7 @@ int,std::string,float - + A @@ -83,7 +83,7 @@ int,std::string,bool - + B @@ -91,7 +91,7 @@ 3,2,1 - + B @@ -99,7 +99,7 @@ 1,1,1,1 - + C @@ -107,50 +107,50 @@ 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_class.svg b/docs/test_cases/t00013_class.svg index 9c1e16d6..b36f70ac 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,15 +18,15 @@ T - + - + f : T - + ABCD::F @@ -34,70 +34,70 @@ int - - + + A - + - + a : int - - + + B - + - + b : int - - + + C - + - + c : int - - + + D - + - + d : int print(R * r) : void - - + + E @@ -105,16 +105,16 @@ T - + - + e : T - - + + G @@ -122,22 +122,22 @@ T,Args... - + - + g : T - + - + args : std::tuple<Args...> - + E @@ -145,7 +145,7 @@ int - + G @@ -153,7 +153,7 @@ int,float,std::string - + E @@ -161,25 +161,25 @@ std::string - - + + R - + - + gintstring : G<int,float,std::string> - + - + estring : E<std::string> diff --git a/docs/test_cases/t00014_class.svg b/docs/test_cases/t00014_class.svg index 620ada74..53800b54 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,37 +18,37 @@ T,P - + - + t : T - + - + p : P - - + + B - + - + value : std::string - + A @@ -56,7 +56,7 @@ T,std::string - + A @@ -64,7 +64,7 @@ T,std::unique_ptr<std::string> - + A @@ -72,7 +72,7 @@ long,T - + A @@ -80,7 +80,7 @@ double,T - + A @@ -88,7 +88,7 @@ long,U - + A @@ -96,7 +96,7 @@ long,bool - + A @@ -104,7 +104,7 @@ double,bool - + A @@ -112,7 +112,7 @@ long,float - + A @@ -120,7 +120,7 @@ double,float - + A @@ -128,7 +128,7 @@ bool,std::string - + A @@ -136,7 +136,7 @@ float,std::unique_ptr<std::string> - + A @@ -144,7 +144,7 @@ int,std::string - + A @@ -152,7 +152,7 @@ std::string,std::string - + A @@ -160,7 +160,7 @@ char,std::string - + A @@ -168,116 +168,116 @@ wchar_t,std::string - - + + R - + - + 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 - + - + bs : BVector - + - + bs2 : BVector2 - + - + cb : SimpleCallback<ACharString> - + - + gcb : GenericCallback<R::AWCharString> - + - + vcb : VoidCallback - + - + vps : VectorPtr<B> diff --git a/docs/test_cases/t00015_class.svg b/docs/test_cases/t00015_class.svg index 88d3ebfd..d16e1ce3 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_class.svg b/docs/test_cases/t00016_class.svg index c283d21d..fdaeb1cd 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<> @@ -19,8 +19,8 @@ value : enum - - + + is_numeric @@ -29,8 +29,8 @@ value : enum - - + + is_numeric @@ -41,8 +41,8 @@ value : enum - - + + is_numeric @@ -53,8 +53,8 @@ value : enum - - + + is_numeric @@ -65,8 +65,8 @@ value : enum - - + + is_numeric @@ -77,8 +77,8 @@ value : enum - - + + is_numeric diff --git a/docs/test_cases/t00017_class.svg b/docs/test_cases/t00017_class.svg index 41e343f7..a0a92932 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_class.svg b/docs/test_cases/t00018_class.svg index f89e9346..a0ebe9bc 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_class.svg b/docs/test_cases/t00019_class.svg index be59f547..928330d1 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,7 +83,7 @@ m1_calls() const : int m2_calls() const : int - + Layer3 @@ -91,7 +91,7 @@ Base - + Layer2 @@ -99,7 +99,7 @@ Layer3<Base> - + Layer1 @@ -107,18 +107,18 @@ Layer2<Layer3<Base>> - - + + A - + - + layers : std::unique_ptr<Layer1<Layer2<Layer3<Base>>>> diff --git a/docs/test_cases/t00020_class.svg b/docs/test_cases/t00020_class.svg index c3cea5dd..1807f957 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_class.svg b/docs/test_cases/t00021_class.svg index a0190d42..20ad9ec6 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_class.svg b/docs/test_cases/t00022_class.svg index 65719565..cf9fe7d9 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_class.svg b/docs/test_cases/t00023_class.svg index 2af88994..e7a45e26 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_class.svg b/docs/test_cases/t00024_class.svg index d3c264ec..fb73378e 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_class.svg b/docs/test_cases/t00025_class.svg index 633dbb10..d19e7f69 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,7 +56,7 @@ m1() : void m2() : void - + Proxy @@ -64,7 +64,7 @@ Target1 - + Proxy @@ -72,25 +72,25 @@ Target2 - - + + ProxyHolder - + - + proxy1 : Proxy<Target1> - + - + proxy2 : Proxy<Target2> diff --git a/docs/test_cases/t00026_class.svg b/docs/test_cases/t00026_class.svg index d5f2d054..066745e3 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>(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,7 +78,7 @@ state(const std::string & n) : Memento<T> & set_state(const std::string & s, Memento<T> && m) : void - + Caretaker @@ -86,7 +86,7 @@ std::string - + Originator @@ -94,25 +94,25 @@ std::string - - + + StringMemento - + - + caretaker : Caretaker<std::string> - + - + originator : Originator<std::string> diff --git a/docs/test_cases/t00027_class.svg b/docs/test_cases/t00027_class.svg index ffee9619..0fdb1f8c 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,14 @@ ~Shape() = default : void - + Line - - + + Line @@ -39,14 +39,14 @@ display() : void - + Text - - + + Text @@ -57,8 +57,8 @@ display() : void - - + + ShapeDecorator @@ -67,8 +67,8 @@ display() = 0 : void - - + + Color @@ -79,8 +79,8 @@ display() : void - - + + Weight @@ -91,7 +91,7 @@ display() : void - + Line @@ -99,7 +99,7 @@ Color,Weight - + Line @@ -107,7 +107,7 @@ Color - + Text @@ -115,7 +115,7 @@ Color,Weight - + Text @@ -123,39 +123,39 @@ Color - - + + Window - + - + border : Line<Color,Weight> - + - + divider : Line<Color> - + - + title : Text<Color,Weight> - + - + description : Text<Color> diff --git a/docs/test_cases/t00028_class.svg b/docs/test_cases/t00028_class.svg index cf3e820a..208355dd 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,10 +94,10 @@ three - + F enum note. - + E @@ -105,59 +105,59 @@ 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. diff --git a/docs/test_cases/t00029_class.svg b/docs/test_cases/t00029_class.svg index 8d879047..b2dbc496 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_class.svg b/docs/test_cases/t00030_class.svg index 9da336d7..4b355df3 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_class.svg b/docs/test_cases/t00031_class.svg index 4242c6d8..f52e2137 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,23 +47,23 @@ T - + - + ttt : T - - + + D - + C @@ -71,39 +71,39 @@ int - - + + R - + - + aaa : A * - + - + bbb : std::vector<B> - + - + ccc : C<int> - + - + ddd : D * diff --git a/docs/test_cases/t00032_class.svg b/docs/test_cases/t00032_class.svg index 63315434..4e3e60b0 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,15 +64,15 @@ T,L,Ts... - + - + counter : L - + Overload @@ -80,18 +80,18 @@ TBase,int,A,B,C - - + + R - + - + overload : Overload<TBase,int,A,B,C> diff --git a/docs/test_cases/t00033_class.svg b/docs/test_cases/t00033_class.svg index 5045fd71..9f91eeab 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,30 +52,30 @@ T - + - + ccc : T - - + + D - + - + ddd : int - + C @@ -83,7 +83,7 @@ D - + B @@ -91,7 +91,7 @@ std::unique_ptr<C<D>> - + A @@ -99,18 +99,18 @@ B<std::unique_ptr<C<D>>> - - + + R - + - + abc : A<B<std::unique_ptr<C<D>>>> diff --git a/docs/test_cases/t00034_class.svg b/docs/test_cases/t00034_class.svg index f1deaa13..8456b303 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,16 +31,16 @@ - - + + lift_void - - + + lift_void @@ -49,8 +49,8 @@ - - + + drop_void @@ -59,16 +59,16 @@ - - + + drop_void - - + + drop_void @@ -77,33 +77,33 @@ - - + + A - - + + R - + - + la : lift_void_t<A> * - + - + lv : lift_void_t<void> * diff --git a/docs/test_cases/t00035_class.svg b/docs/test_cases/t00035_class.svg index 502f58f9..9aa89966 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_class.svg b/docs/test_cases/t00036_class.svg index 0a7b0595..94611d59 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,15 +43,15 @@ T - + - + a : T - + A @@ -59,23 +59,23 @@ int - - + + B - + - + a_int : A<int> - - + + C diff --git a/docs/test_cases/t00037_class.svg b/docs/test_cases/t00037_class.svg index f1964b8a..15145200 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_620) - + - + units : ST::(anonymous_739) - - + + 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_class.svg b/docs/test_cases/t00038_class.svg index 2553ccd0..a3645f4e 100644 --- a/docs/test_cases/t00038_class.svg +++ b/docs/test_cases/t00038_class.svg @@ -1,6 +1,6 @@ - + @@ -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,16 +88,16 @@ - - + + map - - + + map @@ -106,8 +106,8 @@ - - + + map @@ -116,8 +116,8 @@ - - + + map @@ -126,8 +126,8 @@ - - + + map diff --git a/docs/test_cases/t00039_class.svg b/docs/test_cases/t00039_class.svg index ef945456..f7aaa5cc 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_class.svg b/docs/test_cases/t00040_class.svg index aaaf350d..49a51f25 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_class.svg b/docs/test_cases/t00041_class.svg index a59e1afd..335ec522 100644 --- a/docs/test_cases/t00041_class.svg +++ b/docs/test_cases/t00041_class.svg @@ -1,6 +1,6 @@ - + @@ -9,100 +9,100 @@ - - + + R - - + + D - + - + rr : RR * - - + + E - - + + F - - + + RR - + - + e : E * - + - + f : F * - + - + g : detail::G * - - + + RRR - - + + ns1::N - - + + ns1::NN - - + + ns1::NM diff --git a/docs/test_cases/t00042_class.svg b/docs/test_cases/t00042_class.svg index 2ff11951..cbdbcd54 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,22 +52,22 @@ T,K - + - + b : T - + - + bb : K - + A @@ -75,7 +75,7 @@ double - + A @@ -83,7 +83,7 @@ std::string - + B diff --git a/docs/test_cases/t00043_class.svg b/docs/test_cases/t00043_class.svg index 5306fa47..13141926 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_class.svg b/docs/test_cases/t00044_class.svg index 7ef5b0f8..b6ba8e41 100644 --- a/docs/test_cases/t00044_class.svg +++ b/docs/test_cases/t00044_class.svg @@ -1,6 +1,6 @@ - + @@ -9,7 +9,7 @@ - + signal_handler @@ -17,8 +17,8 @@ ,A - - + + sink @@ -27,15 +27,15 @@ sink<signal_handler<type-parameter-0-0 (type-parameter-0-1...), type-parameter-0-2> >(sink<signal_handler<type-parameter-0-0 (type-parameter-0-1...),type-parameter-0-2>>::signal_t & sh) : void - + - + signal : sink<signal_handler<type-parameter-0-0 (type-parameter-0-1...),type-parameter-0-2>>::signal_t * - - + + sink @@ -46,23 +46,23 @@ sink<signal_handler<type-parameter-0-0 (type-parameter-0-1...), type-parameter-0-2> >(sink<signal_handler<type-parameter-0-0 (type-parameter-0-1...),type-parameter-0-2>>::signal_t & sh) : void - + - + signal : sink<signal_handler<type-parameter-0-0 (type-parameter-0-1...),type-parameter-0-2>>::signal_t * - - + + signal_handler - - + + signal_handler @@ -71,8 +71,8 @@ - - + + signal_handler @@ -81,8 +81,8 @@ - - + + sink diff --git a/docs/test_cases/t00045_class.svg b/docs/test_cases/t00045_class.svg index 0d9fca2d..82f48d40 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_class.svg b/docs/test_cases/t00046_class.svg index 26a56339..c327b0fb 100644 --- a/docs/test_cases/t00046_class.svg +++ b/docs/test_cases/t00046_class.svg @@ -1,6 +1,6 @@ - + @@ -9,118 +9,118 @@ - + ns1 - + ns2 - + __gnu_cxx - - + + A - - + + A - - + + B - - + + C - - + + D - - + + E - - + + R - + - + a : ns1::ns2::A * - + - + ns1_a : ns1::A * - + - + ns1_ns2_a : ns1::ns2::A * - + - + root_a : ::A * - + - + i : std::vector<std::uint8_t> foo(AA & aa) : void - - + + A - - + + AA diff --git a/docs/test_cases/t00047_class.svg b/docs/test_cases/t00047_class.svg index 067e14a5..34a19237 100644 --- a/docs/test_cases/t00047_class.svg +++ b/docs/test_cases/t00047_class.svg @@ -1,6 +1,6 @@ - + @@ -9,16 +9,16 @@ - - + + conditional_t - - + + conditional_t @@ -27,8 +27,8 @@ - - + + conditional_t @@ -37,8 +37,8 @@ - - + + conditional_t @@ -47,8 +47,8 @@ - - + + conditional_t diff --git a/docs/test_cases/t00048_class.svg b/docs/test_cases/t00048_class.svg index c2d986d4..48b3d53d 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_class.svg b/docs/test_cases/t00049_class.svg index 07abb039..1467c05b 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,17 +18,17 @@ T - + - + a : T get_a() : T & - + A @@ -36,7 +36,7 @@ intmap - + A @@ -44,7 +44,7 @@ thestring - + A @@ -52,32 +52,32 @@ std::vector<thestring> - - + + R - + - + a_string : A<thestring> - + - + a_vector_string : A<string_vector> - + - + a_int_map : A<intmap> diff --git a/docs/test_cases/t00050_class.svg b/docs/test_cases/t00050_class.svg index e8f8344c..09c91c9a 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 diff --git a/docs/test_cases/t20001_sequence.svg b/docs/test_cases/t20001_sequence.svg index 7c628e22..f28a6cf3 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_sequence.svg b/docs/test_cases/t20002_sequence.svg index 7229c105..3e43826b 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_sequence.svg b/docs/test_cases/t20003_sequence.svg index c44654ac..d0dbe2ec 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_sequence.svg b/docs/test_cases/t20004_sequence.svg index 146bc280..c1c43de4 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_sequence.svg b/docs/test_cases/t20005_sequence.svg index 9366c934..bc341a89 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_sequence.svg b/docs/test_cases/t20006_sequence.svg index de5984f9..b6a69bb2 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_sequence.svg b/docs/test_cases/t20007_sequence.svg index f44f405a..30adc106 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_sequence.svg b/docs/test_cases/t20008_sequence.svg index f20f12f7..107697aa 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_sequence.svg b/docs/test_cases/t20009_sequence.svg index 40bd1dc3..f2ec6655 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_sequence.svg b/docs/test_cases/t20010_sequence.svg index aaf0098f..9f17be94 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_sequence.svg b/docs/test_cases/t20011_sequence.svg index adad4e13..0358d213 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_sequence.svg b/docs/test_cases/t20012_sequence.svg index 16a25bcf..07d7aed2 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 t20012.cc:66:20) - + tmain()::(lambda t20012.cc:66:20) - - + + A - + A - - + + B - + B - - + + tmain()::(lambda t20012.cc:79:20) - + tmain()::(lambda t20012.cc:79:20) - - + + C - + C - - + + R<R::(lambda t20012.cc:85:9)> - + R<R::(lambda t20012.cc:85:9)> - - + + tmain()::(lambda t20012.cc:85:9) - + tmain()::(lambda 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_sequence.svg b/docs/test_cases/t20013_sequence.svg index 618b9fdc..354c6cdb 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_sequence.svg b/docs/test_cases/t20014_sequence.svg index 8230b3ab..98e6b209 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_sequence.svg b/docs/test_cases/t20015_sequence.svg index 16d2d201..0c16fb7b 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_sequence.svg b/docs/test_cases/t20016_sequence.svg index 845c864e..eca94d50 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_sequence.svg b/docs/test_cases/t20017_sequence.svg index 63ba470d..589d6843 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_b.h - + include/t20017_b.h - + include/t20017_a.h - + include/t20017_a.h - - - - - - + + + + + + tmain() - + b2<int>(int,int) - + a1(int,int) - + a2(int,int) - + a3(int,int) - + b1(int,int) diff --git a/docs/test_cases/t20018_sequence.svg b/docs/test_cases/t20018_sequence.svg index 20fe0636..7b159bbd 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_sequence.svg b/docs/test_cases/t20019_sequence.svg index d3479ee6..854edb38 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_sequence.svg b/docs/test_cases/t20020_sequence.svg index eb03a283..48225848 100644 --- a/docs/test_cases/t20020_sequence.svg +++ b/docs/test_cases/t20020_sequence.svg @@ -1,6 +1,6 @@ - + @@ -9,74 +9,74 @@ - - - - - - - - - - - - + + + + + + + + + + + + - + - - - + + + - - + + tmain() - + tmain() - - + + A - + A - - + + B - + B - - + + C - + C - - + + D<int> - + D<int> - - - - - - - - - - - + + + + + + + + + + + alt - + a1() @@ -87,21 +87,21 @@ alt - + a2() - + b1() - + b2() @@ -109,14 +109,14 @@ - + a3() - + log() @@ -124,7 +124,7 @@ alt - + c1() @@ -132,7 +132,7 @@ alt - + @@ -143,7 +143,7 @@ - + @@ -153,7 +153,7 @@ alt - + d1(int,int) diff --git a/docs/test_cases/t20021_sequence.svg b/docs/test_cases/t20021_sequence.svg index 85377574..f3d766f2 100644 --- a/docs/test_cases/t20021_sequence.svg +++ b/docs/test_cases/t20021_sequence.svg @@ -1,6 +1,6 @@ - + @@ -9,47 +9,47 @@ - - - - - - - - - - + + + + + + + + + + - - + + tmain() - + tmain() - - + + A - + A - - + + B - + B - - - - - - + + + + + + loop - + a3() @@ -62,14 +62,14 @@ loop - + a2() - + a1() @@ -79,14 +79,14 @@ loop - + b2() - + b2() diff --git a/docs/test_cases/t20022_sequence.svg b/docs/test_cases/t20022_sequence.svg index c7754ac0..a2f1c265 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/t30001_package.svg b/docs/test_cases/t30001_package.svg index 215bcf2d..bec22d11 100644 --- a/docs/test_cases/t30001_package.svg +++ b/docs/test_cases/t30001_package.svg @@ -1,6 +1,6 @@ - + @@ -9,63 +9,63 @@ - - + + 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_package.svg b/docs/test_cases/t30002_package.svg index 39b5c4c6..0cbefe24 100644 --- a/docs/test_cases/t30002_package.svg +++ b/docs/test_cases/t30002_package.svg @@ -1,6 +1,6 @@ - + @@ -9,113 +9,113 @@ - - + + A - - + + AA - - + + B - - + + BB - - + + A1 - - + + A2 - - + + A3 - - + + A4 - - + + A5 - - + + A6 - - + + A7 - - + + A8 - - + + A9 - - + + A10 - - + + A11 - - + + A12 - - + + A13 - - + + A14 - - + + A15 - - + + A16 - - + + A17 - - + + BBB diff --git a/docs/test_cases/t30003_package.svg b/docs/test_cases/t30003_package.svg index d050d200..0da4fff2 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_package.svg b/docs/test_cases/t30004_package.svg index 3c8c6ff7..74aee223 100644 --- a/docs/test_cases/t30004_package.svg +++ b/docs/test_cases/t30004_package.svg @@ -1,6 +1,6 @@ - + @@ -9,40 +9,40 @@ - - + + A - + Package AAA. - + Package BBB. - + CCCC package note. - + We skipped DDD. - - + + AAA - - + + BBB - - + + CCC - - + + EEE diff --git a/docs/test_cases/t30005_package.svg b/docs/test_cases/t30005_package.svg index 920dd76e..a0b57541 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_package.svg b/docs/test_cases/t30006_package.svg index 7f5cc72d..a8dfe383 100644 --- a/docs/test_cases/t30006_package.svg +++ b/docs/test_cases/t30006_package.svg @@ -1,6 +1,6 @@ - + @@ -9,22 +9,22 @@ - - + + B - - + + A - - + + C - + Top A note. diff --git a/docs/test_cases/t30007_package.svg b/docs/test_cases/t30007_package.svg index 35ddb85a..b7f81ee3 100644 --- a/docs/test_cases/t30007_package.svg +++ b/docs/test_cases/t30007_package.svg @@ -1,6 +1,6 @@ - + @@ -9,27 +9,27 @@ - - + + A - - + + B - - + + AA - - + + C - + Compare layout with t30006. diff --git a/docs/test_cases/t30008_package.svg b/docs/test_cases/t30008_package.svg index e256d29b..d31552cb 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/t40001_include.svg b/docs/test_cases/t40001_include.svg index a0b8504f..9e5f1dff 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 diff --git a/docs/test_cases/t40002_include.svg b/docs/test_cases/t40002_include.svg index 6139e474..2d466344 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_include.svg b/docs/test_cases/t40003_include.svg index 01aefbbc..70e34409 100644 --- a/docs/test_cases/t40003_include.svg +++ b/docs/test_cases/t40003_include.svg @@ -1,6 +1,6 @@ - + @@ -9,66 +9,66 @@ - + include - + dependants - + dependencies - + src - + dependants - + dependencies - - + + t3.h - - + + t2.h - - + + t1.h - - + + t3.h - - + + t2.h - - + + t1.h - - + + t5.h - - + + t1.cc - - + + t2.cc