diff options
author | Alex Langford <apl@fb.com> | 2019-07-02 19:53:07 +0000 |
---|---|---|
committer | Alex Langford <apl@fb.com> | 2019-07-02 19:53:07 +0000 |
commit | 7c5647142468705db87eff49a88dc4e312c2ce05 (patch) | |
tree | 3f4346a2ca4dfd78bd10a1eab41ee6ef0aec1704 /source/Plugins/LanguageRuntime | |
parent | c9ddb9349fc7b42f954c08a71ec299d479f11573 (diff) | |
download | lldb-7c5647142468705db87eff49a88dc4e312c2ce05.tar.gz |
[Symbol] Add DeclVendor::FindTypes
Summary:
Following up on the plan I outlined in D63622, we can remove the
dependence on clang in all the places where we only want to find the
types from the DeclVendor. This means that currently DeclVendor depends
on clang, but centralizing the dependency makes it easier to refactor
cleanly.
Differential Revision: https://reviews.llvm.org/D63853
git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@364962 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'source/Plugins/LanguageRuntime')
-rw-r--r-- | source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp | 10 | ||||
-rw-r--r-- | source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCTypeEncodingParser.cpp | 14 |
2 files changed, 8 insertions, 16 deletions
diff --git a/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp b/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp index c849a5441..38a4f9e40 100644 --- a/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp +++ b/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp @@ -474,12 +474,10 @@ bool AppleObjCRuntimeV2::GetDynamicTypeAndAddress( class_type_or_name.SetTypeSP(type_sp); } else { // try to go for a CompilerType at least - DeclVendor *vendor = GetDeclVendor(); - if (vendor) { - std::vector<clang::NamedDecl *> decls; - if (vendor->FindDecls(class_name, false, 1, decls) && decls.size()) - class_type_or_name.SetCompilerType( - ClangASTContext::GetTypeForDecl(decls[0])); + if (auto *vendor = GetDeclVendor()) { + auto types = vendor->FindTypes(class_name, /*max_matches*/ 1); + if (!types.empty()) + class_type_or_name.SetCompilerType(types.front()); } } } diff --git a/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCTypeEncodingParser.cpp b/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCTypeEncodingParser.cpp index e1068e8d4..26654e921 100644 --- a/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCTypeEncodingParser.cpp +++ b/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCTypeEncodingParser.cpp @@ -245,25 +245,19 @@ clang::QualType AppleObjCTypeEncodingParser::BuildObjCObjectPointerType( if (!decl_vendor) return clang::QualType(); - const bool append = false; - const uint32_t max_matches = 1; - std::vector<clang::NamedDecl *> 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 - return ClangUtil::GetQualType( - ClangASTContext::GetTypeForDecl(decls[0]).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(); |