parent
4b5fc57f32
commit
40236f606b
2 changed files with 43 additions and 24 deletions
|
|
@ -206,6 +206,8 @@ CXSourceRange get_extent(const CXTranslationUnit& tu, const CXFile& file, const
|
||||||
if (cursor_is_function(kind) || cursor_is_function(clang_getTemplateCursorKind(cur))
|
if (cursor_is_function(kind) || cursor_is_function(clang_getTemplateCursorKind(cur))
|
||||||
|| kind == CXCursor_VarDecl || kind == CXCursor_FieldDecl || kind == CXCursor_ParmDecl
|
|| kind == CXCursor_VarDecl || kind == CXCursor_FieldDecl || kind == CXCursor_ParmDecl
|
||||||
|| kind == CXCursor_NonTypeTemplateParameter)
|
|| kind == CXCursor_NonTypeTemplateParameter)
|
||||||
|
{
|
||||||
|
while (token_before_is(tu, file, begin, "]]") || token_before_is(tu, file, begin, ")"))
|
||||||
{
|
{
|
||||||
auto save_begin = begin;
|
auto save_begin = begin;
|
||||||
if (consume_if_token_before_is(tu, file, begin, "]]"))
|
if (consume_if_token_before_is(tu, file, begin, "]]"))
|
||||||
|
|
@ -232,8 +234,12 @@ CXSourceRange get_extent(const CXTranslationUnit& tu, const CXFile& file, const
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!consume_if_token_before_is(tu, file, begin, "alignas"))
|
if (!consume_if_token_before_is(tu, file, begin, "alignas"))
|
||||||
|
{
|
||||||
// not alignas
|
// not alignas
|
||||||
begin = save_begin;
|
begin = save_begin;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -42,6 +42,9 @@ alignas(type) int var;
|
||||||
|
|
||||||
// keyword attributes
|
// keyword attributes
|
||||||
[[const]] int k();
|
[[const]] int k();
|
||||||
|
|
||||||
|
// multiple attributes but separately
|
||||||
|
[[a]] [[b]] [[c]] int l();
|
||||||
)";
|
)";
|
||||||
|
|
||||||
auto file = parse({}, "cpp_attribute.cpp", code);
|
auto file = parse({}, "cpp_attribute.cpp", code);
|
||||||
|
|
@ -122,9 +125,19 @@ alignas(type) int var;
|
||||||
else if (e.name() == "k")
|
else if (e.name() == "k")
|
||||||
check_attribute(attr, "const", type_safe::nullopt, false,
|
check_attribute(attr, "const", type_safe::nullopt, false,
|
||||||
"", cpp_attribute_kind::unknown);
|
"", cpp_attribute_kind::unknown);
|
||||||
|
else if (e.name() == "l")
|
||||||
|
{
|
||||||
|
REQUIRE_NOTHROW(attributes.size() == 3);
|
||||||
|
check_attribute(attributes[0], "a", type_safe::nullopt,
|
||||||
|
false, "", cpp_attribute_kind::unknown);
|
||||||
|
check_attribute(attributes[1], "b", type_safe::nullopt,
|
||||||
|
false, "", cpp_attribute_kind::unknown);
|
||||||
|
check_attribute(attributes[2], "c", type_safe::nullopt,
|
||||||
|
false, "", cpp_attribute_kind::unknown);
|
||||||
|
}
|
||||||
},
|
},
|
||||||
false);
|
false);
|
||||||
REQUIRE(count == 10);
|
REQUIRE(count == 11);
|
||||||
|
|
||||||
count = test_visit<cpp_class>(*file,
|
count = test_visit<cpp_class>(*file,
|
||||||
[&](const cpp_entity& e) {
|
[&](const cpp_entity& e) {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue