summaryrefslogtreecommitdiffstats
path: root/lldb/source/Target/Language.cpp
diff options
context:
space:
mode:
authorEnrico Granata <egranata@apple.com>2016-11-01 18:50:49 +0000
committerEnrico Granata <egranata@apple.com>2016-11-01 18:50:49 +0000
commit63db2395f655136ce9013e60b93f0a8b3638dd35 (patch)
tree2b17a7bdc70f49a008e580f1ff9f31f149563a62 /lldb/source/Target/Language.cpp
parent419019956872e6099fefff1da619b117e5444c69 (diff)
downloadbcm5719-llvm-63db2395f655136ce9013e60b93f0a8b3638dd35.tar.gz
bcm5719-llvm-63db2395f655136ce9013e60b93f0a8b3638dd35.zip
Implement a general type scavenger that can dig types from debug info + a filtering mechanism to accept/reject results thusly obtained
Implement the C++ type lookup support in terms of this general scavenger The idea is that we may want other languages to do debug info based search (exclusively, or as an add-on to runtime/module based searching) and it makes sense to avoid duplicating this functionality llvm-svn: 285727
Diffstat (limited to 'lldb/source/Target/Language.cpp')
-rw-r--r--lldb/source/Target/Language.cpp33
1 files changed, 33 insertions, 0 deletions
diff --git a/lldb/source/Target/Language.cpp b/lldb/source/Target/Language.cpp
index 904c18780f4..938d80ac175 100644
--- a/lldb/source/Target/Language.cpp
+++ b/lldb/source/Target/Language.cpp
@@ -16,6 +16,9 @@
#include "lldb/Core/PluginManager.h"
#include "lldb/Core/Stream.h"
+#include "lldb/Symbol/SymbolFile.h"
+#include "lldb/Symbol/TypeList.h"
+#include "lldb/Target/Target.h"
using namespace lldb;
using namespace lldb_private;
@@ -341,6 +344,36 @@ size_t Language::TypeScavenger::Find(ExecutionContextScope *exe_scope,
return 0;
}
+bool Language::ImageListTypeScavenger::Find_Impl(
+ ExecutionContextScope *exe_scope, const char *key, ResultSet &results) {
+ bool result = false;
+
+ Target *target = exe_scope->CalculateTarget().get();
+ if (target) {
+ const auto &images(target->GetImages());
+ SymbolContext null_sc;
+ ConstString cs_key(key);
+ llvm::DenseSet<SymbolFile *> searched_sym_files;
+ TypeList matches;
+ images.FindTypes(null_sc, cs_key, false, UINT32_MAX, searched_sym_files,
+ matches);
+ for (const auto &match : matches.Types()) {
+ if (match.get()) {
+ CompilerType compiler_type(match->GetFullCompilerType());
+ compiler_type = AdjustForInclusion(compiler_type);
+ if (!compiler_type)
+ continue;
+ std::unique_ptr<Language::TypeScavenger::Result> scavengeresult(
+ new Result(compiler_type));
+ results.insert(std::move(scavengeresult));
+ result = true;
+ }
+ }
+ }
+
+ return result;
+}
+
bool Language::GetFormatterPrefixSuffix(ValueObject &valobj,
ConstString type_hint,
std::string &prefix,
OpenPOWER on IntegriCloud