Fixed t00014 on macos (Fixes #176)

This commit is contained in:
Bartek Kryza
2023-12-05 23:11:36 +01:00
parent 9280edfafb
commit f1d3695ccc
4 changed files with 21 additions and 7 deletions

View File

@@ -62,6 +62,7 @@ bool template_builder::simplify_system_template(
if (simplified != full_name) {
ct.set_type(simplified);
ct.set_id(common::to_id(simplified));
ct.clear_params();
return true;
}
@@ -435,6 +436,10 @@ void template_builder::process_template_arguments(
arg_index++;
}
// Update id
template_instantiation.set_id(
common::to_id(template_instantiation.full_name(false)));
}
void template_builder::argument_process_dispatch(
@@ -1029,6 +1034,9 @@ template_builder::try_as_template_specialization_type(
simplify_system_template(
argument, argument.to_string(using_namespace(), false));
argument.set_id(
common::to_id(argument.to_string(using_namespace(), false)));
const auto nested_template_instantiation_full_name =
nested_template_instantiation->full_name(false);
@@ -1140,10 +1148,12 @@ std::optional<template_parameter> template_builder::try_as_record_type(
auto argument = template_parameter::make_argument({});
type = consume_context(type, argument);
auto type_name = common::to_string(type, template_decl->getASTContext());
const auto type_name = config().simplify_template_type(
common::to_string(type, template_decl->getASTContext()));
argument.set_type(type_name);
const auto type_id = common::to_id(type_name);
argument.set_id(type_id);
const auto *class_template_specialization =

View File

@@ -47,7 +47,7 @@ public:
* @param multiplicity_source Multiplicity at the source
* @param multiplicity_destination Multiplicity at the destination
*/
relationship(relationship_t type, int64_t destination,
relationship(relationship_t type, clanguml::common::id_t destination,
access_t access = access_t::kPublic, std::string label = "",
std::string multiplicity_source = "",
std::string multiplicity_destination = "");
@@ -144,7 +144,7 @@ public:
private:
relationship_t type_;
int64_t destination_;
clanguml::common::id_t destination_;
std::string multiplicity_source_;
std::string multiplicity_destination_;
std::string label_;

View File

@@ -517,6 +517,9 @@ bool template_parameter::find_nested_relationships(
// just add it and skip recursion (e.g. this is a user defined type)
const auto maybe_type = type();
if (is_function_template())
hint = common::model::relationship_t::kDependency;
if (maybe_type && should_include(maybe_type.value())) {
if (is_association())
hint = common::model::relationship_t::kAssociation;
@@ -538,7 +541,8 @@ bool template_parameter::find_nested_relationships(
if (maybe_id && maybe_arg_type && should_include(*maybe_arg_type)) {
if (template_argument.is_association())
if (template_argument.is_association() &&
hint == common::model::relationship_t::kAggregation)
hint = common::model::relationship_t::kAssociation;
nested_relationships.emplace_back(maybe_id.value(), hint);
@@ -547,6 +551,9 @@ bool template_parameter::find_nested_relationships(
(hint == common::model::relationship_t::kAggregation);
}
else {
if (template_argument.is_function_template())
hint = common::model::relationship_t::kDependency;
added_aggregation_relationship =
template_argument.find_nested_relationships(
nested_relationships, hint, should_include);

View File

@@ -136,12 +136,9 @@ TEST_CASE("t00014", "[test-case][class]")
REQUIRE_THAT(src,
IsAggregation(_A("R<T>"),
_A("A<float,std::unique_ptr<std::string>>"), "-floatstring"));
#if !defined(__APPLE__)
// TODO(#176)
REQUIRE_THAT(src, IsDependency(_A("R<T>"), _A("A<char,std::string>")));
REQUIRE_THAT(
src, IsDependency(_A("R<T>"), _A("A<wchar_t,std::string>")));
#endif
save_puml(config.output_directory(), diagram->name + ".puml", src);
}