Index: lldb/trunk/include/lldb/Target/LanguageRuntime.h =================================================================== --- lldb/trunk/include/lldb/Target/LanguageRuntime.h +++ lldb/trunk/include/lldb/Target/LanguageRuntime.h @@ -16,6 +16,7 @@ #include "lldb/Core/Value.h" #include "lldb/Core/ValueObject.h" #include "lldb/Expression/LLVMUserExpression.h" +#include "lldb/Symbol/DeclVendor.h" #include "lldb/Target/ExecutionContextScope.h" #include "lldb/lldb-private.h" #include "lldb/lldb-public.h" @@ -132,6 +133,8 @@ Target &GetTargetRef() { return m_process->GetTarget(); } + virtual DeclVendor *GetDeclVendor() { return nullptr; } + virtual lldb::BreakpointResolverSP CreateExceptionResolver(Breakpoint *bkpt, bool catch_bp, bool throw_bp) = 0; Index: lldb/trunk/include/lldb/Target/ObjCLanguageRuntime.h =================================================================== --- lldb/trunk/include/lldb/Target/ObjCLanguageRuntime.h +++ lldb/trunk/include/lldb/Target/ObjCLanguageRuntime.h @@ -20,7 +20,6 @@ #include "lldb/Core/PluginInterface.h" #include "lldb/Core/ThreadSafeDenseMap.h" #include "lldb/Symbol/CompilerType.h" -#include "lldb/Symbol/DeclVendor.h" #include "lldb/Symbol/Type.h" #include "lldb/Target/LanguageRuntime.h" #include "lldb/lldb-private.h" @@ -276,8 +275,6 @@ virtual ObjCISA GetParentClass(ObjCISA isa); - virtual DeclVendor *GetDeclVendor() { return nullptr; } - // Finds the byte offset of the child_type ivar in parent_type. If it can't // find the offset, returns LLDB_INVALID_IVAR_OFFSET. Index: lldb/trunk/source/API/SBTarget.cpp =================================================================== --- lldb/trunk/source/API/SBTarget.cpp +++ lldb/trunk/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 @@ } } - // 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 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 @@ } } - // 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 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)); - } } } }