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(