summaryrefslogtreecommitdiffstats
path: root/lldb/source/API
diff options
context:
space:
mode:
authorAlex Langford <apl@fb.com>2019-07-02 19:53:07 +0000
committerAlex Langford <apl@fb.com>2019-07-02 19:53:07 +0000
commit8055cbc4490932e617e5dd0278a38e498adee98c (patch)
tree291371f3046f1de046491e091254af0ed3d8e312 /lldb/source/API
parent99316043bbce99081d977a276e8a4c879cfa9de2 (diff)
downloadbcm5719-llvm-8055cbc4490932e617e5dd0278a38e498adee98c.tar.gz
bcm5719-llvm-8055cbc4490932e617e5dd0278a38e498adee98c.zip
[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 llvm-svn: 364962
Diffstat (limited to 'lldb/source/API')
-rw-r--r--lldb/source/API/SBTarget.cpp26
1 files changed, 7 insertions, 19 deletions
diff --git a/lldb/source/API/SBTarget.cpp b/lldb/source/API/SBTarget.cpp
index b1ad0d8f58b..5e87eb6273b 100644
--- a/lldb/source/API/SBTarget.cpp
+++ b/lldb/source/API/SBTarget.cpp
@@ -1847,18 +1847,12 @@ lldb::SBType SBTarget::FindFirstType(const char *typename_cstr) {
}
// 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 (vendor->FindDecls(const_typename, /*append*/ true,
- /*max_matches*/ 1, decls) > 0) {
- if (CompilerType type =
- ClangASTContext::GetTypeForDecl(decls.front()))
- return LLDB_RECORD_RESULT(SBType(type));
- }
+ auto types = vendor->FindTypes(const_typename, /*max_matches*/ 1);
+ if (!types.empty())
+ return LLDB_RECORD_RESULT(SBType(types.front()));
}
}
}
@@ -1911,19 +1905,13 @@ lldb::SBTypeList SBTarget::FindTypes(const char *typename_cstr) {
}
// 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 (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));
- }
- }
+ auto types =
+ vendor->FindTypes(const_typename, /*max_matches*/ UINT32_MAX);
+ for (auto type : types)
+ sb_type_list.Append(SBType(type));
}
}
}
OpenPOWER on IntegriCloud