summaryrefslogtreecommitdiffstats
path: root/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp')
-rw-r--r--lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp110
1 files changed, 46 insertions, 64 deletions
diff --git a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
index 3c1d4e7c751..e805999da59 100644
--- a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
+++ b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
@@ -2384,15 +2384,11 @@ void SymbolFileDWARF::GetMangledNamesForFunction(
}
uint32_t SymbolFileDWARF::FindTypes(
- ConstString name, const CompilerDeclContext *parent_decl_ctx, bool append,
+ ConstString name, const CompilerDeclContext *parent_decl_ctx,
uint32_t max_matches,
llvm::DenseSet<lldb_private::SymbolFile *> &searched_symbol_files,
TypeMap &types) {
std::lock_guard<std::recursive_mutex> guard(GetModuleMutex());
- // If we aren't appending the results to this list, then clear the list
- if (!append)
- types.Clear();
-
// Make sure we haven't already searched this SymbolFile before...
if (searched_symbol_files.count(this))
return 0;
@@ -2410,15 +2406,15 @@ uint32_t SymbolFileDWARF::FindTypes(
GetObjectFile()->GetModule()->LogMessage(
log,
"SymbolFileDWARF::FindTypes (sc, name=\"%s\", parent_decl_ctx = "
- "%p (\"%s\"), append=%u, max_matches=%u, type_list)",
+ "%p (\"%s\"), max_matches=%u, type_list)",
name.GetCString(), static_cast<const void *>(parent_decl_ctx),
- parent_decl_ctx->GetName().AsCString("<NULL>"), append, max_matches);
+ parent_decl_ctx->GetName().AsCString("<NULL>"), max_matches);
else
GetObjectFile()->GetModule()->LogMessage(
log,
"SymbolFileDWARF::FindTypes (sc, name=\"%s\", parent_decl_ctx = "
- "NULL, append=%u, max_matches=%u, type_list)",
- name.GetCString(), append, max_matches);
+ "NULL, max_matches=%u, type_list)",
+ name.GetCString(), max_matches);
}
if (!DeclContextMatchesThisSymbolFile(parent_decl_ctx))
@@ -2427,46 +2423,25 @@ uint32_t SymbolFileDWARF::FindTypes(
DIEArray die_offsets;
m_index->GetTypes(name, die_offsets);
const size_t num_die_matches = die_offsets.size();
+ const uint32_t initial_types_size = types.GetSize();
- if (num_die_matches) {
- const uint32_t initial_types_size = types.GetSize();
- for (size_t i = 0; i < num_die_matches; ++i) {
- const DIERef &die_ref = die_offsets[i];
- DWARFDIE die = GetDIE(die_ref);
+ for (size_t i = 0; i < num_die_matches; ++i) {
+ const DIERef &die_ref = die_offsets[i];
+ DWARFDIE die = GetDIE(die_ref);
+ if (die) {
+ if (!DIEInDeclContext(parent_decl_ctx, die))
+ continue; // The containing decl contexts don't match
- if (die) {
- if (!DIEInDeclContext(parent_decl_ctx, die))
- continue; // The containing decl contexts don't match
-
- Type *matching_type = ResolveType(die, true, true);
- if (matching_type) {
- // We found a type pointer, now find the shared pointer form our type
- // list
- types.InsertUnique(matching_type->shared_from_this());
- if (types.GetSize() >= max_matches)
- break;
- }
- } else {
- m_index->ReportInvalidDIERef(die_ref, name.GetStringRef());
- }
- }
- const uint32_t num_matches = types.GetSize() - initial_types_size;
- if (log && num_matches) {
- if (parent_decl_ctx) {
- GetObjectFile()->GetModule()->LogMessage(
- log,
- "SymbolFileDWARF::FindTypes (sc, name=\"%s\", parent_decl_ctx "
- "= %p (\"%s\"), append=%u, max_matches=%u, type_list) => %u",
- name.GetCString(), static_cast<const void *>(parent_decl_ctx),
- parent_decl_ctx->GetName().AsCString("<NULL>"), append, max_matches,
- num_matches);
- } else {
- GetObjectFile()->GetModule()->LogMessage(
- log,
- "SymbolFileDWARF::FindTypes (sc, name=\"%s\", parent_decl_ctx "
- "= NULL, append=%u, max_matches=%u, type_list) => %u",
- name.GetCString(), append, max_matches, num_matches);
+ Type *matching_type = ResolveType(die, true, true);
+ if (matching_type) {
+ // We found a type pointer, now find the shared pointer form our type
+ // list
+ types.InsertUnique(matching_type->shared_from_this());
+ if (types.GetSize() >= max_matches)
+ break;
}
+ } else {
+ m_index->ReportInvalidDIERef(die_ref, name.GetStringRef());
}
}
@@ -2476,31 +2451,38 @@ uint32_t SymbolFileDWARF::FindTypes(
if (num_die_matches < max_matches) {
UpdateExternalModuleListIfNeeded();
- for (const auto &pair : m_external_type_modules) {
- ModuleSP external_module_sp = pair.second;
- if (external_module_sp) {
- SymbolFile *sym_file = external_module_sp->GetSymbolFile();
- if (sym_file) {
- const uint32_t num_external_matches =
- sym_file->FindTypes(name, parent_decl_ctx, append, max_matches,
- searched_symbol_files, types);
- if (num_external_matches)
- return num_external_matches;
- }
- }
+ for (const auto &pair : m_external_type_modules)
+ if (ModuleSP external_module_sp = pair.second)
+ if (SymbolFile *sym_file = external_module_sp->GetSymbolFile())
+ sym_file->FindTypes(name, parent_decl_ctx, max_matches,
+ searched_symbol_files, types);
+ }
+
+ uint32_t num_matches = types.GetSize() - initial_types_size;
+ if (log && num_matches) {
+ if (parent_decl_ctx) {
+ GetObjectFile()->GetModule()->LogMessage(
+ log,
+ "SymbolFileDWARF::FindTypes (sc, name=\"%s\", parent_decl_ctx "
+ "= %p (\"%s\"), max_matches=%u, type_list) => %u",
+ name.GetCString(), static_cast<const void *>(parent_decl_ctx),
+ parent_decl_ctx->GetName().AsCString("<NULL>"), max_matches,
+ num_matches);
+ } else {
+ GetObjectFile()->GetModule()->LogMessage(
+ log,
+ "SymbolFileDWARF::FindTypes (sc, name=\"%s\", parent_decl_ctx "
+ "= NULL, max_matches=%u, type_list) => %u",
+ name.GetCString(), max_matches, num_matches);
}
}
- return num_die_matches;
+ return num_matches;
}
size_t SymbolFileDWARF::FindTypes(llvm::ArrayRef<CompilerContext> pattern,
- LanguageSet languages, bool append,
- TypeMap &types) {
+ LanguageSet languages, TypeMap &types) {
std::lock_guard<std::recursive_mutex> guard(GetModuleMutex());
- if (!append)
- types.Clear();
-
if (pattern.empty())
return 0;
OpenPOWER on IntegriCloud