summaryrefslogtreecommitdiffstats
path: root/lldb/source/Plugins/SymbolFile/DWARF
diff options
context:
space:
mode:
authorAdrian Prantl <aprantl@apple.com>2019-09-30 16:42:28 +0000
committerAdrian Prantl <aprantl@apple.com>2019-09-30 16:42:28 +0000
commitd4d428ef92a0ddfeafc48e35ff538654619d40eb (patch)
tree91df6a06c7beb00f7e0d94635652ad3fb407fb49 /lldb/source/Plugins/SymbolFile/DWARF
parent09025ca6fc7221d0447ffa1d0fd8a460588f748f (diff)
downloadbcm5719-llvm-d4d428ef92a0ddfeafc48e35ff538654619d40eb.tar.gz
bcm5719-llvm-d4d428ef92a0ddfeafc48e35ff538654619d40eb.zip
Remove unused "append" parameter from FindTypes API
I noticed that SymbolFileDWARFDebugMap::FindTypes was implementing it incorrectly (passing append=false in a for-loop to recursive calls to FindTypes would yield only the very last set of results), but instead of fixing it, removing it seemed like an even better option. rdar://problem/54412692 Differential Revision: https://reviews.llvm.org/D68171 llvm-svn: 373224
Diffstat (limited to 'lldb/source/Plugins/SymbolFile/DWARF')
-rw-r--r--lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp6
-rw-r--r--lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp110
-rw-r--r--lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h4
-rw-r--r--lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp7
-rw-r--r--lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.h2
5 files changed, 54 insertions, 75 deletions
diff --git a/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp b/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
index 83402bf6bd8..1a15abcf20f 100644
--- a/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
+++ b/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
@@ -151,7 +151,7 @@ TypeSP DWARFASTParserClang::ParseTypeFromDWO(const DWARFDIE &die, Log *log) {
// The type in the Clang module must have the same langage as the current CU.
LanguageSet languages;
languages.Insert(die.GetCU()->GetLanguageType());
- if (!dwo_module_sp->GetSymbolFile()->FindTypes(decl_context, languages, true,
+ if (!dwo_module_sp->GetSymbolFile()->FindTypes(decl_context, languages,
dwo_types)) {
if (!IsClangModuleFwdDecl(die))
return TypeSP();
@@ -162,8 +162,8 @@ TypeSP DWARFASTParserClang::ParseTypeFromDWO(const DWARFDIE &die, Log *log) {
for (const auto &name_module : sym_file.getExternalTypeModules()) {
if (!name_module.second)
continue;
- if (name_module.second->GetSymbolFile()->FindTypes(
- decl_context, languages, true, dwo_types))
+ if (name_module.second->GetSymbolFile()->FindTypes(decl_context,
+ languages, dwo_types))
break;
}
}
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;
diff --git a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h
index 6825c7b085b..d7b82cf0711 100644
--- a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h
+++ b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h
@@ -184,12 +184,12 @@ public:
uint32_t
FindTypes(lldb_private::ConstString name,
const lldb_private::CompilerDeclContext *parent_decl_ctx,
- bool append, uint32_t max_matches,
+ uint32_t max_matches,
llvm::DenseSet<lldb_private::SymbolFile *> &searched_symbol_files,
lldb_private::TypeMap &types) override;
size_t FindTypes(llvm::ArrayRef<lldb_private::CompilerContext> pattern,
- lldb_private::LanguageSet languages, bool append,
+ lldb_private::LanguageSet languages,
lldb_private::TypeMap &types) override;
size_t GetTypes(lldb_private::SymbolContextScope *sc_scope,
diff --git a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp
index b079855ccbd..003e0d31ae9 100644
--- a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp
+++ b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp
@@ -1201,17 +1201,14 @@ TypeSP SymbolFileDWARFDebugMap::FindCompleteObjCDefinitionTypeForDIE(
uint32_t SymbolFileDWARFDebugMap::FindTypes(
ConstString name, const CompilerDeclContext *parent_decl_ctx,
- bool append, uint32_t max_matches,
+ uint32_t max_matches,
llvm::DenseSet<lldb_private::SymbolFile *> &searched_symbol_files,
TypeMap &types) {
std::lock_guard<std::recursive_mutex> guard(GetModuleMutex());
- if (!append)
- types.Clear();
-
const uint32_t initial_types_size = types.GetSize();
ForEachSymbolFile([&](SymbolFileDWARF *oso_dwarf) -> bool {
- oso_dwarf->FindTypes(name, parent_decl_ctx, append, max_matches,
+ oso_dwarf->FindTypes(name, parent_decl_ctx, max_matches,
searched_symbol_files, types);
return types.GetSize() >= max_matches;
});
diff --git a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.h b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.h
index 2cc830485b2..5f0bdb04b53 100644
--- a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.h
+++ b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.h
@@ -111,7 +111,7 @@ public:
uint32_t
FindTypes(lldb_private::ConstString name,
const lldb_private::CompilerDeclContext *parent_decl_ctx,
- bool append, uint32_t max_matches,
+ uint32_t max_matches,
llvm::DenseSet<lldb_private::SymbolFile *> &searched_symbol_files,
lldb_private::TypeMap &types) override;
lldb_private::CompilerDeclContext FindNamespace(
OpenPOWER on IntegriCloud