Override scope_name() in templates
This commit is contained in:
parent
93d2c58f7f
commit
68f2ab91a0
7 changed files with 24 additions and 9 deletions
|
|
@ -57,6 +57,6 @@ install:
|
|||
|
||||
script:
|
||||
- mkdir build/ && cd build/
|
||||
- $CMAKE -DCMAKE_CXX_FLAGS="-Werror -pedantic -Wall -Wextra -Wconversion -Wsign-conversion -Wno-parentheses" -DLLVM_DOWNLOAD_OS_NAME=$LLVM_DOWNLOAD_OS_NAME -DLLVM_PREFERRED_VERSION=$LLVM_VERSION ../
|
||||
- $CMAKE -DCMAKE_CXX_FLAGS="-Werror -pedantic -Wall -Wextra -Wconversion -Wsign-conversion -Wno-parentheses -Wno-assume" -DLLVM_DOWNLOAD_OS_NAME=$LLVM_DOWNLOAD_OS_NAME -DLLVM_PREFERRED_VERSION=$LLVM_VERSION ../
|
||||
- $CMAKE --build .
|
||||
- if [[ "$LLVM_VERSION" == "4.0.0" ]]; then ./test/cppast_test \*; else ./test/cppast_test; fi
|
||||
|
|
|
|||
2
external/cxxopts
vendored
2
external/cxxopts
vendored
|
|
@ -1 +1 @@
|
|||
Subproject commit 9db62cb338aeaed1fec5806f6b5d9781f5e19e4c
|
||||
Subproject commit 11faadeba77d05a80c751e97142875c4b296fa87
|
||||
2
external/type_safe
vendored
2
external/type_safe
vendored
|
|
@ -1 +1 @@
|
|||
Subproject commit b5fd96de64046e919b30de07cea09135a66cc86f
|
||||
Subproject commit c9ca37cc770a2dccc1483453742c54136b992760
|
||||
|
|
@ -83,6 +83,13 @@ namespace cppast
|
|||
}
|
||||
|
||||
private:
|
||||
type_safe::optional<cppast::cpp_scope_name> do_get_scope_name() const override
|
||||
{
|
||||
return begin()->scope_name() ?
|
||||
type_safe::make_optional(cppast::cpp_scope_name(type_safe::ref(*this))) :
|
||||
type_safe::nullopt;
|
||||
}
|
||||
|
||||
detail::intrusive_list<cpp_template_parameter> parameters_;
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -57,6 +57,7 @@ using h = g<T, a>;
|
|||
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()));
|
||||
REQUIRE(!alias.scope_name());
|
||||
|
||||
if (alias.name() == "a")
|
||||
{
|
||||
|
|
@ -66,8 +67,9 @@ using h = g<T, a>;
|
|||
}
|
||||
else if (alias.name() == "b")
|
||||
{
|
||||
check_template_parameters(alias, {{cpp_entity_kind::non_type_template_parameter_t, "I"},
|
||||
{cpp_entity_kind::template_type_parameter_t, "T"}});
|
||||
check_template_parameters(alias,
|
||||
{{cpp_entity_kind::non_type_template_parameter_t, "I"},
|
||||
{cpp_entity_kind::template_type_parameter_t, "T"}});
|
||||
REQUIRE(equal_types(idx, alias.type_alias().underlying_type(),
|
||||
*cpp_template_parameter_type::build(
|
||||
cpp_template_type_parameter_ref(cpp_entity_id(""), "T"))));
|
||||
|
|
|
|||
|
|
@ -100,6 +100,7 @@ struct b<0, T> {};
|
|||
auto& c = templ.class_();
|
||||
REQUIRE(!c.is_final());
|
||||
REQUIRE(is_templated(c));
|
||||
REQUIRE(templ.scope_name());
|
||||
|
||||
if (templ.name() == "a")
|
||||
{
|
||||
|
|
@ -109,8 +110,9 @@ struct b<0, T> {};
|
|||
}
|
||||
else if (templ.name() == "b")
|
||||
{
|
||||
check_template_parameters(templ, {{cpp_entity_kind::non_type_template_parameter_t, "I"},
|
||||
{cpp_entity_kind::template_type_parameter_t, "T"}});
|
||||
check_template_parameters(templ,
|
||||
{{cpp_entity_kind::non_type_template_parameter_t, "I"},
|
||||
{cpp_entity_kind::template_type_parameter_t, "T"}});
|
||||
REQUIRE(c.class_kind() == cpp_class_kind::struct_t);
|
||||
REQUIRE(c.is_definition());
|
||||
}
|
||||
|
|
@ -224,6 +226,7 @@ struct b<0, T> {};
|
|||
count = test_visit<cpp_class_template_specialization>(
|
||||
*file, [&](const cpp_class_template_specialization& templ) {
|
||||
REQUIRE(!templ.arguments_exposed());
|
||||
REQUIRE(templ.scope_name());
|
||||
|
||||
if (templ.name() == "a")
|
||||
{
|
||||
|
|
|
|||
|
|
@ -75,6 +75,7 @@ d::d(const int&);
|
|||
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()));
|
||||
REQUIRE(!tfunc.scope_name());
|
||||
|
||||
if (tfunc.name() == "a")
|
||||
{
|
||||
|
|
@ -104,8 +105,9 @@ d::d(const int&);
|
|||
else if (tfunc.name() == "b")
|
||||
{
|
||||
check_parent(tfunc, "d", "d::b");
|
||||
check_template_parameters(tfunc, {{cpp_entity_kind::non_type_template_parameter_t, "I"},
|
||||
{cpp_entity_kind::template_type_parameter_t, "T"}});
|
||||
check_template_parameters(tfunc,
|
||||
{{cpp_entity_kind::non_type_template_parameter_t, "I"},
|
||||
{cpp_entity_kind::template_type_parameter_t, "T"}});
|
||||
|
||||
REQUIRE(tfunc.function().kind() == cpp_entity_kind::function_t);
|
||||
auto& func = static_cast<const cpp_function&>(tfunc.function());
|
||||
|
|
@ -183,6 +185,7 @@ d::d(const int&);
|
|||
*file, [&](const cpp_function_template_specialization& tfunc) {
|
||||
REQUIRE(tfunc.is_full_specialization());
|
||||
REQUIRE(!tfunc.arguments_exposed());
|
||||
REQUIRE(!tfunc.scope_name());
|
||||
|
||||
auto templ = tfunc.primary_template();
|
||||
if (tfunc.name() == "operator int")
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue