Support attributes in using declaration target
Fixes parsing of libcxx.
This commit is contained in:
parent
bf7ec70ea5
commit
d303bab0da
1 changed files with 52 additions and 52 deletions
|
|
@ -85,7 +85,8 @@ namespace
|
||||||
cpp_entity_id parse_ns_target_cursor(const CXCursor& cur)
|
cpp_entity_id parse_ns_target_cursor(const CXCursor& cur)
|
||||||
{
|
{
|
||||||
cpp_entity_id result("");
|
cpp_entity_id result("");
|
||||||
detail::visit_children(cur,
|
detail::visit_children(
|
||||||
|
cur,
|
||||||
[&](const CXCursor& child) {
|
[&](const CXCursor& child) {
|
||||||
auto referenced = clang_getCursorReferenced(child);
|
auto referenced = clang_getCursorReferenced(child);
|
||||||
auto kind = clang_getCursorKind(referenced);
|
auto kind = clang_getCursorKind(referenced);
|
||||||
|
|
@ -157,7 +158,8 @@ namespace
|
||||||
cpp_entity_ref parse_entity_target_cursor(const CXCursor& cur, std::string name)
|
cpp_entity_ref parse_entity_target_cursor(const CXCursor& cur, std::string name)
|
||||||
{
|
{
|
||||||
type_safe::deferred_construction<cpp_entity_ref> result;
|
type_safe::deferred_construction<cpp_entity_ref> result;
|
||||||
detail::visit_children(cur,
|
detail::visit_children(
|
||||||
|
cur,
|
||||||
[&](const CXCursor& child) {
|
[&](const CXCursor& child) {
|
||||||
if (result)
|
if (result)
|
||||||
return;
|
return;
|
||||||
|
|
@ -168,23 +170,19 @@ cpp_entity_ref parse_entity_target_cursor(const CXCursor& cur, std::string name)
|
||||||
case CXCursor_TemplateRef:
|
case CXCursor_TemplateRef:
|
||||||
case CXCursor_MemberRef:
|
case CXCursor_MemberRef:
|
||||||
case CXCursor_VariableRef:
|
case CXCursor_VariableRef:
|
||||||
case CXCursor_DeclRefExpr:
|
case CXCursor_DeclRefExpr: {
|
||||||
{
|
|
||||||
auto referenced = clang_getCursorReferenced(child);
|
auto referenced = clang_getCursorReferenced(child);
|
||||||
result = cpp_entity_ref(detail::get_entity_id(referenced),
|
result = cpp_entity_ref(detail::get_entity_id(referenced), std::move(name));
|
||||||
std::move(name));
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
case CXCursor_OverloadedDeclRef:
|
case CXCursor_OverloadedDeclRef: {
|
||||||
{
|
|
||||||
auto size = clang_getNumOverloadedDecls(child);
|
auto size = clang_getNumOverloadedDecls(child);
|
||||||
DEBUG_ASSERT(size >= 1u, detail::parse_error_handler{}, cur,
|
DEBUG_ASSERT(size >= 1u, detail::parse_error_handler{}, cur,
|
||||||
"no target for using declaration");
|
"no target for using declaration");
|
||||||
std::vector<cpp_entity_id> ids;
|
std::vector<cpp_entity_id> ids;
|
||||||
for (auto i = 0u; i != size; ++i)
|
for (auto i = 0u; i != size; ++i)
|
||||||
ids.push_back(detail::get_entity_id(
|
ids.push_back(detail::get_entity_id(clang_getOverloadedDecl(child, i)));
|
||||||
clang_getOverloadedDecl(child, i)));
|
|
||||||
result = cpp_entity_ref(std::move(ids), std::move(name));
|
result = cpp_entity_ref(std::move(ids), std::move(name));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
@ -193,6 +191,8 @@ cpp_entity_ref parse_entity_target_cursor(const CXCursor& cur, std::string name)
|
||||||
break; // wait for children
|
break; // wait for children
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
if (clang_isAttribute(clang_getCursorKind(child)))
|
||||||
|
break;
|
||||||
DEBUG_UNREACHABLE(detail::parse_error_handler{}, cur,
|
DEBUG_UNREACHABLE(detail::parse_error_handler{}, cur,
|
||||||
"unexpected target for using declaration");
|
"unexpected target for using declaration");
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue