DWARFIndex: more GetFunctions cleanup

This applies similar simplification as r334004, only it touches the
regex version of the method.

llvm-svn: 334012
This commit is contained in:
Pavel Labath 2018-06-05 12:13:22 +00:00
parent 955655f558
commit 6de9c79e71
7 changed files with 14 additions and 63 deletions

View File

@ -217,21 +217,14 @@ void AppleDWARFIndex::GetFunctions(ConstString name, DWARFDebugInfo &info,
}
}
void AppleDWARFIndex::GetFunctions(
const RegularExpression &regex, DWARFDebugInfo &info,
llvm::function_ref<bool(const DWARFDIE &die, bool include_inlines,
lldb_private::SymbolContextList &sc_list)>
resolve_function,
bool include_inlines, SymbolContextList &sc_list) {
void AppleDWARFIndex::GetFunctions(const RegularExpression &regex,
DIEArray &offsets) {
if (!m_apple_names_up)
return;
DIEArray offsets;
DWARFMappedHash::DIEInfoArray hash_data;
if (m_apple_names_up->AppendAllDIEsThatMatchingRegex(regex, hash_data)) {
if (m_apple_names_up->AppendAllDIEsThatMatchingRegex(regex, hash_data))
DWARFMappedHash::ExtractDIEArray(hash_data, offsets);
ParseFunctions(offsets, info, resolve_function, include_inlines, sc_list);
}
}
void AppleDWARFIndex::ReportInvalidDIEOffset(dw_offset_t offset,

View File

@ -47,12 +47,7 @@ public:
const CompilerDeclContext &parent_decl_ctx,
uint32_t name_type_mask,
std::vector<DWARFDIE> &dies) override;
void GetFunctions(
const RegularExpression &regex, DWARFDebugInfo &info,
llvm::function_ref<bool(const DWARFDIE &die, bool include_inlines,
lldb_private::SymbolContextList &sc_list)>
resolve_function,
bool include_inlines, SymbolContextList &sc_list) override;
void GetFunctions(const RegularExpression &regex, DIEArray &offsets) override;
void ReportInvalidDIEOffset(dw_offset_t offset,
llvm::StringRef name) override;

View File

@ -15,17 +15,3 @@ using namespace lldb_private;
using namespace lldb;
DWARFIndex::~DWARFIndex() = default;
void DWARFIndex::ParseFunctions(
const DIEArray &offsets, DWARFDebugInfo &info,
llvm::function_ref<bool(const DWARFDIE &die, bool include_inlines,
lldb_private::SymbolContextList &sc_list)>
resolve_function,
bool include_inlines, SymbolContextList &sc_list) {
const size_t num_matches = offsets.size();
for (size_t i = 0; i < num_matches; ++i) {
DWARFDIE die = info.GetDIE(offsets[i]);
if (die)
resolve_function(die, include_inlines, sc_list);
}
}

View File

@ -40,12 +40,8 @@ public:
const CompilerDeclContext &parent_decl_ctx,
uint32_t name_type_mask,
std::vector<DWARFDIE> &dies) = 0;
virtual void GetFunctions(
const RegularExpression &regex, DWARFDebugInfo &info,
llvm::function_ref<bool(const DWARFDIE &die, bool include_inlines,
lldb_private::SymbolContextList &sc_list)>
resolve_function,
bool include_inlines, SymbolContextList &sc_list) = 0;
virtual void GetFunctions(const RegularExpression &regex,
DIEArray &offsets) = 0;
virtual void ReportInvalidDIEOffset(dw_offset_t offset,
llvm::StringRef name) = 0;
@ -53,13 +49,6 @@ public:
protected:
Module &m_module;
void ParseFunctions(
const DIEArray &offsets, DWARFDebugInfo &info,
llvm::function_ref<bool(const DWARFDIE &die, bool include_inlines,
lldb_private::SymbolContextList &sc_list)>
resolve_function,
bool include_inlines, SymbolContextList &sc_list);
};
} // namespace lldb_private

View File

@ -459,18 +459,12 @@ void ManualDWARFIndex::GetFunctions(ConstString name, DWARFDebugInfo &info,
}
}
void ManualDWARFIndex::GetFunctions(
const RegularExpression &regex, DWARFDebugInfo &info,
llvm::function_ref<bool(const DWARFDIE &die, bool include_inlines,
lldb_private::SymbolContextList &sc_list)>
resolve_function,
bool include_inlines, SymbolContextList &sc_list) {
void ManualDWARFIndex::GetFunctions(const RegularExpression &regex,
DIEArray &offsets) {
Index();
DIEArray offsets;
m_set.function_basenames.Find(regex, offsets);
m_set.function_fullnames.Find(regex, offsets);
ParseFunctions(offsets, info, resolve_function, include_inlines, sc_list);
}
void ManualDWARFIndex::Dump(Stream &s) {

View File

@ -35,12 +35,7 @@ public:
const CompilerDeclContext &parent_decl_ctx,
uint32_t name_type_mask,
std::vector<DWARFDIE> &dies) override;
void GetFunctions(
const RegularExpression &regex, DWARFDebugInfo &info,
llvm::function_ref<bool(const DWARFDIE &die, bool include_inlines,
lldb_private::SymbolContextList &sc_list)>
resolve_function,
bool include_inlines, SymbolContextList &sc_list) override;
void GetFunctions(const RegularExpression &regex, DIEArray &offsets) override;
void ReportInvalidDIEOffset(dw_offset_t offset,
llvm::StringRef name) override {}

View File

@ -2278,12 +2278,11 @@ uint32_t SymbolFileDWARF::FindFunctions(const RegularExpression &regex,
// appending the results to a variable list.
uint32_t original_size = sc_list.GetSize();
m_index->GetFunctions(regex, *info,
[this](const DWARFDIE &die, bool include_inlines,
lldb_private::SymbolContextList &sc_list) {
return ResolveFunction(die, include_inlines, sc_list);
},
include_inlines, sc_list);
DIEArray offsets;
m_index->GetFunctions(regex, offsets);
for (DIERef ref : offsets)
ResolveFunction(ref, include_inlines, sc_list);
// Return the number of variable that were appended to the list
return sc_list.GetSize() - original_size;