Use empty underlying type for aliases of anonymous types (#83)

Fixes #58
This commit is contained in:
Omer Ozarslan 2019-08-16 05:58:48 -05:00 committed by Jonathan Müller
commit a89ebcdf0a
2 changed files with 2 additions and 2 deletions

View file

@ -637,7 +637,7 @@ std::unique_ptr<cpp_type> parse_type_impl(const detail::parse_context& context,
case CXType_Typedef: case CXType_Typedef:
return make_leave_type(cur, type, [&](std::string&& spelling) { return make_leave_type(cur, type, [&](std::string&& spelling) {
auto decl = clang_getTypeDeclaration(type); auto decl = clang_getTypeDeclaration(type);
if (remove_prefix(spelling, "(anonymous", false)) if (detail::cxstring(clang_getCursorSpelling(decl)).empty())
spelling = ""; // anonymous type spelling = ""; // anonymous type
return cpp_user_defined_type::build( return cpp_user_defined_type::build(
cpp_type_ref(detail::get_entity_id(decl), std::move(spelling))); cpp_type_ref(detail::get_entity_id(decl), std::move(spelling)));

View file

@ -509,7 +509,7 @@ typedef decltype(0) w;
} }
else if (alias.name() == "v") else if (alias.name() == "v")
{ {
auto type = cpp_user_defined_type::build(cpp_type_ref(cpp_entity_id(""), "v")); auto type = cpp_user_defined_type::build(cpp_type_ref(cpp_entity_id(""), ""));
REQUIRE(equal_types(idx, alias.underlying_type(), *type)); REQUIRE(equal_types(idx, alias.underlying_type(), *type));
return false; return false;
} }