Add is_templated() helper

This commit is contained in:
Jonathan Müller 2017-03-27 21:47:57 +02:00
commit 67f247533c
6 changed files with 26 additions and 4 deletions

View file

@ -40,6 +40,8 @@ using h = g<T, a>;
cpp_entity_index idx;
auto file = parse(idx, "cpp_alias_template.cpp", code);
auto count = test_visit<cpp_alias_template>(*file, [&](const cpp_alias_template& alias) {
REQUIRE(is_templated(alias.type_alias()));
if (alias.name() == "a")
{
check_template_parameters(alias, {{cpp_entity_kind::template_type_parameter_t, "T"}});

View file

@ -62,6 +62,7 @@ struct b<0, T> {};
auto count = test_visit<cpp_class_template>(*file, [&](const cpp_class_template& templ) {
auto& c = templ.class_();
REQUIRE(!c.is_final());
REQUIRE(is_templated(c));
if (templ.name() == "a")
{

View file

@ -54,6 +54,8 @@ d::d(const int&);
cpp_entity_index idx;
auto file = parse(idx, "cpp_function_template.cpp", code);
auto count = test_visit<cpp_function_template>(*file, [&](const cpp_function_template& tfunc) {
REQUIRE(is_templated(tfunc.function()));
if (tfunc.name() == "a")
{
check_template_parameters(tfunc, {{cpp_entity_kind::template_type_parameter_t, "T"}});