Disabled test of template template parameters

This commit is contained in:
Bartek Kryza
2021-03-21 10:53:08 +01:00
parent 32948ab143
commit 7001c0870e
5 changed files with 26 additions and 12 deletions

View File

@@ -228,14 +228,14 @@ enum CXChildVisitResult method_parameter_visitor(
class_ tinst = build_template_instantiation(
cursor, t.referenced());
// Add template instantiation relationship
class_relationship ri;
ri.destination = tinst.base_template_usr;
ri.type = relationship_t::kInstantiation;
ri.label = "";
tinst.add_relationship(std::move(ri));
r.destination = t.referenced().unqualified();
r.destination = tinst.usr;
ctx->d.add_class(std::move(tinst));
}
@@ -500,8 +500,7 @@ class_ build_template_instantiation(cx::cursor cursor, cx::type t)
}
class_ tinst;
tinst.name = template_type.spelling();
tinst.name = template_type.spelling();
tinst.name = template_type.fully_qualified();
tinst.is_template_instantiation = true;
if (partial_specialization) {
tinst.usr = template_type.usr();
@@ -547,6 +546,9 @@ bool process_template_specialization_class_field(
bool partial_specialization = false;
auto template_type =
tr.type_declaration().specialized_cursor_template();
// Check if this is partial specialization
// TODO: Is there a better way to do it?
if (template_type.kind() == CXCursor_InvalidFile) {
partial_specialization = true;
template_type = tr.type_declaration();
@@ -585,13 +587,16 @@ enum CXChildVisitResult process_field(
class_member m;
m.name = cursor.spelling();
if (tr.is_template())
m.type = t.unqualified();
else if (tr.is_template_parameter())
m.type = t.spelling();
else
m.type = t.canonical().unqualified();
m.scope = cx_access_specifier_to_scope(cursor.cxxaccess_specifier());
m.is_static = cursor.is_static();
spdlog::debug("Adding member {} {}::{} {}, {}, {}", m.type, parent->name,

View File

@@ -17,9 +17,19 @@ public:
CMP comparator;
};
template <typename T, template <typename> typename C> class B {
public:
/*
* TODO: Handle template template properly.
*
template <typename T, template <typename> typename C> struct B {
C<T> template_template;
};
struct D {
// libclang claims that the type spelling of 'ints' is 'int'...
B<int, std::vector> ints;
void add(int i) { ints.template_template.push_back(i); }
};
*/
}
}

View File

@@ -51,10 +51,6 @@ TEST_CASE("t00008", "[test-case][class]")
REQUIRE_THAT(puml, IsField(Public("std::array<int, N> ints")));
REQUIRE_THAT(puml, IsField(Public("bool (*)(int, int) comparator")));
REQUIRE_THAT(puml, IsClassTemplate("B", "T, C<>"));
REQUIRE_THAT(puml, IsField(Public("C<T> template_template")));
save_puml(
"./" + config.output_directory + "/" + diagram->name + ".puml", puml);
}

View File

@@ -40,7 +40,7 @@ class R {
public:
int get_a(A *a) { return a->a; }
int get_b(B &b) { return b.b; }
// TODO: int get_const_b(const B &b) { return b.b; }
int get_const_b(const B &b) { return b.b; }
int get_c(C c) { return c.c; }
int get_d(D &&d) { return d.d; }
// Dependency relationship should be rendered only once
@@ -51,6 +51,7 @@ public:
int get_int_e2(E<int> &e) { return e.e; }
template <typename T> T get_f(const F<T> &f) { return f.f; }
int get_int_f(const F<int> &f) { return f.f; }
private:
mutable E<std::string> estring;

View File

@@ -51,13 +51,15 @@ TEST_CASE("t00013", "[test-case][class]")
REQUIRE_THAT(puml, IsDependency(_A("R"), _A("B")));
REQUIRE_THAT(puml, IsDependency(_A("R"), _A("C")));
REQUIRE_THAT(puml, IsDependency(_A("R"), _A("D")));
REQUIRE_THAT(puml, IsDependency(_A("D"), _A("R")));
REQUIRE_THAT(puml, IsDependency(_A("R"), _A("E<T>")));
REQUIRE_THAT(puml, IsDependency(_A("R"), _A("E<int>")));
REQUIRE_THAT(puml, IsInstantiation(_A("E<T>"), _A("E<int>")));
REQUIRE_THAT(puml, IsInstantiation(_A("E<T>"), _A("E<std::string>")));
REQUIRE_THAT(puml, IsComposition(_A("R"), _A("E<std::string>"), "estring"));
REQUIRE_THAT(puml, IsDependency(_A("R"), _A("ABCD::F<T>")));
REQUIRE_THAT(puml, IsDependency(_A("D"), _A("R")));
REQUIRE_THAT(puml, IsInstantiation(_A("ABCD::F<T>"), _A("ABCD::F<int>")));
REQUIRE_THAT(puml, IsDependency(_A("R"), _A("ABCD::F<int>")));
save_puml(
"./" + config.output_directory + "/" + diagram->name + ".puml", puml);