diff options
| author | Alex Langford <apl@fb.com> | 2019-06-24 20:33:09 +0000 |
|---|---|---|
| committer | Alex Langford <apl@fb.com> | 2019-06-24 20:33:09 +0000 |
| commit | 11cfa92a1967d5c890ae71a4f7422d9b5be0ea1f (patch) | |
| tree | cdee29016b9cf885dafdf0f78a0112edf5d9efda /lldb/source/API | |
| parent | f1ffc4305dd17ecead3079a4473103c28fdbe410 (diff) | |
| download | bcm5719-llvm-11cfa92a1967d5c890ae71a4f7422d9b5be0ea1f.tar.gz bcm5719-llvm-11cfa92a1967d5c890ae71a4f7422d9b5be0ea1f.zip | |
[Target] Hoist LanguageRuntime::GetDeclVendor
Summary:
It's possible that each LanguageRuntime could have its own DeclVendor,
so let's hoist that out of ObjCLanguageRuntime into LanguageRuntime.
Additionally, this gives the opportunity to remove SBTarget's dependency
on ObjCLanguageRuntime.
Reviewers: JDevlieghere, labath, compnerd, davide
Subscribers: lldb-commits
Differential Revision: https://reviews.llvm.org/D63622
llvm-svn: 364229
Diffstat (limited to 'lldb/source/API')
| -rw-r--r-- | lldb/source/API/SBTarget.cpp | 55 |
1 files changed, 20 insertions, 35 deletions
diff --git a/lldb/source/API/SBTarget.cpp b/lldb/source/API/SBTarget.cpp index 0a408e7037b..b1ad0d8f58b 100644 --- a/lldb/source/API/SBTarget.cpp +++ b/lldb/source/API/SBTarget.cpp @@ -53,7 +53,6 @@ #include "lldb/Target/ABI.h" #include "lldb/Target/Language.h" #include "lldb/Target/LanguageRuntime.h" -#include "lldb/Target/ObjCLanguageRuntime.h" #include "lldb/Target/Process.h" #include "lldb/Target/StackFrame.h" #include "lldb/Target/Target.h" @@ -1847,25 +1846,18 @@ lldb::SBType SBTarget::FindFirstType(const char *typename_cstr) { } } - // Didn't find the type in the symbols; try the Objective-C runtime if one - // is installed - - ProcessSP process_sp(target_sp->GetProcessSP()); - - if (process_sp) { - ObjCLanguageRuntime *objc_language_runtime = - ObjCLanguageRuntime::Get(*process_sp); - - if (objc_language_runtime) { - DeclVendor *objc_decl_vendor = objc_language_runtime->GetDeclVendor(); - - if (objc_decl_vendor) { + // Didn't find the type in the symbols; Try the loaded language runtimes + // FIXME: This depends on clang, but should be able to support any + // TypeSystem/compiler. + if (auto process_sp = target_sp->GetProcessSP()) { + for (auto *runtime : process_sp->GetLanguageRuntimes()) { + if (auto vendor = runtime->GetDeclVendor()) { std::vector<clang::NamedDecl *> decls; - - if (objc_decl_vendor->FindDecls(const_typename, true, 1, decls) > 0) { - if (CompilerType type = ClangASTContext::GetTypeForDecl(decls[0])) { + if (vendor->FindDecls(const_typename, /*append*/ true, + /*max_matches*/ 1, decls) > 0) { + if (CompilerType type = + ClangASTContext::GetTypeForDecl(decls.front())) return LLDB_RECORD_RESULT(SBType(type)); - } } } } @@ -1918,25 +1910,18 @@ lldb::SBTypeList SBTarget::FindTypes(const char *typename_cstr) { } } - // Try the Objective-C runtime if one is installed - - ProcessSP process_sp(target_sp->GetProcessSP()); - - if (process_sp) { - ObjCLanguageRuntime *objc_language_runtime = - ObjCLanguageRuntime::Get(*process_sp); - - if (objc_language_runtime) { - DeclVendor *objc_decl_vendor = objc_language_runtime->GetDeclVendor(); - - if (objc_decl_vendor) { + // Try the loaded language runtimes + // FIXME: This depends on clang, but should be able to support any + // TypeSystem/compiler. + if (auto process_sp = target_sp->GetProcessSP()) { + for (auto *runtime : process_sp->GetLanguageRuntimes()) { + if (auto *vendor = runtime->GetDeclVendor()) { std::vector<clang::NamedDecl *> decls; - - if (objc_decl_vendor->FindDecls(const_typename, true, 1, decls) > 0) { - for (clang::NamedDecl *decl : decls) { - if (CompilerType type = ClangASTContext::GetTypeForDecl(decl)) { + if (vendor->FindDecls(const_typename, /*append*/ true, + /*max_matches*/ 1, decls) > 0) { + for (auto *decl : decls) { + if (CompilerType type = ClangASTContext::GetTypeForDecl(decl)) sb_type_list.Append(SBType(type)); - } } } } |

