Skip to content

[upstreaming] Revert changes to AppleObjCTypeEncodingParser.cpp #250

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -237,25 +237,19 @@ clang::QualType AppleObjCTypeEncodingParser::BuildObjCObjectPointerType(
if (!decl_vendor)
return clang::QualType();

const bool append = false;
const uint32_t max_matches = 1;
std::vector<CompilerDecl> decls;

uint32_t num_types =
decl_vendor->FindDecls(ConstString(name), append, max_matches, decls);
auto types = decl_vendor->FindTypes(ConstString(name), /*max_matches*/ 1);

// The user can forward-declare something that has no definition. The runtime
// doesn't prohibit this at all. This is a rare and very weird case. We keep
// this assert in debug builds so we catch other weird cases.
#ifdef LLDB_CONFIGURATION_DEBUG
assert(num_types);
assert(!types.empty());
#else
if (!num_types)
if (types.empty())
return ast_ctx.getObjCIdType();
#endif
if (auto *ctx = llvm::dyn_cast<ClangASTContext>(decls[0].GetTypeSystem()))
return ClangUtil::GetQualType(
ctx->GetTypeForDecl(decls[0].GetOpaqueDecl()).GetPointerType());

return ClangUtil::GetQualType(types.front().GetPointerType());
} else {
// We're going to resolve this dynamically anyway, so just smile and wave.
return ast_ctx.getObjCIdType();
Expand Down