diff --git a/src/class_diagram/visitor/template_builder.cc b/src/class_diagram/visitor/template_builder.cc index 0b05e619..8fb6fc4d 100644 --- a/src/class_diagram/visitor/template_builder.cc +++ b/src/class_diagram/visitor/template_builder.cc @@ -928,7 +928,15 @@ std::optional template_builder::try_as_function_prototype( clang::QualType &type, class_ &template_instantiation, size_t argument_index) { - const auto *function_type = type->getAs(); + auto *function_type = type->getAs(); + + if (function_type == nullptr && type->isFunctionPointerType()) { + function_type = + type->getPointeeType()->getAs(); + if (function_type == nullptr) + return {}; + } + if (function_type == nullptr) return {}; diff --git a/tests/t00014/test_case.h b/tests/t00014/test_case.h index 65125aa9..567cb280 100644 --- a/tests/t00014/test_case.h +++ b/tests/t00014/test_case.h @@ -35,6 +35,9 @@ TEST_CASE("t00014", "[test-case][class]") REQUIRE_THAT(puml, StartsWith("@startuml")); REQUIRE_THAT(puml, EndsWith("@enduml\n")); + + REQUIRE_THAT(puml, !Contains("type-parameter-")); + REQUIRE_THAT(puml, IsClassTemplate("A", "T,P")); REQUIRE_THAT(puml, IsClassTemplate("A", "T,std::string")); REQUIRE_THAT( diff --git a/tests/t00062/test_case.h b/tests/t00062/test_case.h index 5f55d1a2..054419d5 100644 --- a/tests/t00062/test_case.h +++ b/tests/t00062/test_case.h @@ -35,6 +35,8 @@ TEST_CASE("t00062", "[test-case][class]") REQUIRE_THAT(puml, StartsWith("@startuml")); REQUIRE_THAT(puml, EndsWith("@enduml\n")); + REQUIRE_THAT(puml, !Contains("type-parameter-")); + // Check if all classes exist REQUIRE_THAT(puml, IsClassTemplate("A", "T")); REQUIRE_THAT(puml, IsClassTemplate("A", "U &")); diff --git a/tests/t00064/t00064.cc b/tests/t00064/t00064.cc index baf4f292..4c862724 100644 --- a/tests/t00064/t00064.cc +++ b/tests/t00064/t00064.cc @@ -1,8 +1,13 @@ +#include + namespace clanguml { namespace t00064 { template struct type_list { }; +template +struct type_list { }; + template struct head; template struct head> { @@ -13,7 +18,10 @@ template using head_t = typename head::type; template class type_group_pair; template -class type_group_pair, type_list> { }; +class type_group_pair, type_list> { + template + static constexpr size_t size = sizeof...(First) + sizeof...(Second); +}; struct A { }; struct B { }; diff --git a/tests/t00064/test_case.h b/tests/t00064/test_case.h index 6f10678d..ae406a93 100644 --- a/tests/t00064/test_case.h +++ b/tests/t00064/test_case.h @@ -35,41 +35,12 @@ TEST_CASE("t00064", "[test-case][class]") REQUIRE_THAT(puml, StartsWith("@startuml")); REQUIRE_THAT(puml, EndsWith("@enduml\n")); + REQUIRE_THAT(puml, !Contains("type-parameter-")); + // Check if all classes exist REQUIRE_THAT( puml, IsClassTemplate("type_group_pair", "typename,typename")); - // Check if class templates exist - // REQUIRE_THAT(puml, IsClassTemplate("A", "T,P,CMP,int N")); - - // Check concepts - // REQUIRE_THAT(puml, IsConcept(_A("AConcept"))); - // REQUIRE_THAT(puml, - // IsConceptRequirement( - // _A("AConcept"), "sizeof (T) > sizeof (P)")); - - // Check if all enums exist - // REQUIRE_THAT(puml, IsEnum(_A("Lights"))); - - // Check if all inner classes exist - // REQUIRE_THAT(puml, IsInnerClass(_A("A"), _A("AA"))); - - // Check if all inheritance relationships exist - // REQUIRE_THAT(puml, IsBaseClass(_A("Base"), _A("Child"))); - - // Check if all methods exist - // REQUIRE_THAT(puml, (IsMethod("foo"))); - - // Check if all fields exist - // REQUIRE_THAT(puml, (IsField("private_member", "int"))); - - // Check if all relationships exist - // REQUIRE_THAT(puml, IsAssociation(_A("D"), _A("A"), "-as")); - // REQUIRE_THAT(puml, IsDependency(_A("R"), _A("B"))); - // REQUIRE_THAT(puml, IsAggregation(_A("R"), _A("D"), "-ag")); - // REQUIRE_THAT(puml, IsComposition(_A("R"), _A("D"), "-ac")); - // REQUIRE_THAT(puml, IsInstantiation(_A("ABCD::F"), _A("F"))); - save_puml( config.output_directory() + "/" + diagram->name + ".puml", puml); }