diff --git a/.travis.yml b/.travis.yml index e4bf9b7..25ddb51 100644 --- a/.travis.yml +++ b/.travis.yml @@ -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 diff --git a/external/cxxopts b/external/cxxopts index 9db62cb..11faade 160000 --- a/external/cxxopts +++ b/external/cxxopts @@ -1 +1 @@ -Subproject commit 9db62cb338aeaed1fec5806f6b5d9781f5e19e4c +Subproject commit 11faadeba77d05a80c751e97142875c4b296fa87 diff --git a/external/type_safe b/external/type_safe index b5fd96d..c9ca37c 160000 --- a/external/type_safe +++ b/external/type_safe @@ -1 +1 @@ -Subproject commit b5fd96de64046e919b30de07cea09135a66cc86f +Subproject commit c9ca37cc770a2dccc1483453742c54136b992760 diff --git a/include/cppast/cpp_template.hpp b/include/cppast/cpp_template.hpp index 31d5943..a92f58a 100644 --- a/include/cppast/cpp_template.hpp +++ b/include/cppast/cpp_template.hpp @@ -83,6 +83,13 @@ namespace cppast } private: + type_safe::optional 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 parameters_; }; diff --git a/test/cpp_alias_template.cpp b/test/cpp_alias_template.cpp index b836d12..cee6f8a 100644 --- a/test/cpp_alias_template.cpp +++ b/test/cpp_alias_template.cpp @@ -57,6 +57,7 @@ using h = g; auto file = parse(idx, "cpp_alias_template.cpp", code); auto count = test_visit(*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; } 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")))); diff --git a/test/cpp_class_template.cpp b/test/cpp_class_template.cpp index 6b98335..0fafa23 100644 --- a/test/cpp_class_template.cpp +++ b/test/cpp_class_template.cpp @@ -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( *file, [&](const cpp_class_template_specialization& templ) { REQUIRE(!templ.arguments_exposed()); + REQUIRE(templ.scope_name()); if (templ.name() == "a") { diff --git a/test/cpp_function_template.cpp b/test/cpp_function_template.cpp index 3d3ae21..d44aa8b 100644 --- a/test/cpp_function_template.cpp +++ b/test/cpp_function_template.cpp @@ -75,6 +75,7 @@ d::d(const int&); auto file = parse(idx, "cpp_function_template.cpp", code); auto count = test_visit(*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(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")