Fix issue with array function arguments

Fixes #47.
This commit is contained in:
Jonathan Müller 2018-03-19 21:33:34 +01:00
commit 4b73c44133
2 changed files with 9 additions and 7 deletions

View file

@ -276,8 +276,10 @@ namespace
auto parent = clang_getCursorLexicalParent(cur);
end = clang_getRangeEnd(clang_getCursorExtent(parent));
}
else if (kind == CXCursor_FieldDecl || kind == CXCursor_ParmDecl
|| kind == CXCursor_NonTypeTemplateParameter
else if (kind == CXCursor_ParmDecl && !token_after_is(tu, file, end, "]", -1))
// need to shrink range by one
end = get_next_location(tu, file, end, -1);
else if (kind == CXCursor_FieldDecl || kind == CXCursor_NonTypeTemplateParameter
|| kind == CXCursor_TemplateTemplateParameter
#if CINDEX_VERSION_MINOR < 37
|| clang_isExpression(kind) || kind == CXCursor_CXXBaseSpecifier

View file

@ -16,8 +16,8 @@ TEST_CASE("cpp_member_function")
template <typename T>
struct foo
{
/// void a();
void a();
/// void a(int array[]);
void a(int array[]); // throw in an array argument for good measure
/// void b()noexcept;
void b() noexcept;
@ -41,9 +41,9 @@ struct foo
void j() = delete;
};
/// void foo<T>::a();
/// void foo<T>::a(int array[]);
template <typename T>
void foo<T>::a() {}
void foo<T>::a(int array[]) {}
struct bar : foo<int>
{
@ -74,7 +74,7 @@ struct bar : foo<int>
REQUIRE(func.is_definition());
REQUIRE(func.cv_qualifier() == cpp_cv_none);
REQUIRE(func.ref_qualifier() == cpp_ref_none);
REQUIRE(func.signature() == "()");
REQUIRE(func.signature() == "(int[])");
}
else if (func.name() == "b")
{