Remove SymbolVendor::GetSymtab

Summary:
This patch removes the GetSymtab method from the SymbolVendor, which is
a no-op as it's implementation just forwards to the relevant SymbolFile.
Instead it creates a Module::GetSymtab, which calls the SymbolFile
method directly.

All callers have been updated to use the Module method directly instead
of a two phase GetSymbolVendor->GetSymtab search, which leads to reduced
intentation in a lot of deeply nested code.

Reviewers: clayborg, JDevlieghere, jingham

Subscribers: lldb-commits

Differential Revision: https://reviews.llvm.org/D65569

llvm-svn: 367820
This commit is contained in:
Pavel Labath
2019-08-05 09:21:47 +00:00
parent 8ed8353fc4
commit d5d47a3574
9 changed files with 97 additions and 140 deletions

View File

@@ -290,11 +290,8 @@ SBSymbolContextList SBModule::FindCompileUnits(const SBFileSpec &sb_file_spec) {
}
static Symtab *GetUnifiedSymbolTable(const lldb::ModuleSP &module_sp) {
if (module_sp) {
SymbolVendor *symbols = module_sp->GetSymbolVendor();
if (symbols)
return symbols->GetSymtab();
}
if (module_sp)
return module_sp->GetSymtab();
return nullptr;
}
@@ -302,11 +299,8 @@ size_t SBModule::GetNumSymbols() {
LLDB_RECORD_METHOD_NO_ARGS(size_t, SBModule, GetNumSymbols);
ModuleSP module_sp(GetSP());
if (module_sp) {
Symtab *symtab = GetUnifiedSymbolTable(module_sp);
if (symtab)
return symtab->GetNumSymbols();
}
if (Symtab *symtab = GetUnifiedSymbolTable(module_sp))
return symtab->GetNumSymbols();
return 0;
}