summaryrefslogtreecommitdiffstats
path: root/lldb/source/Core/Module.cpp
diff options
context:
space:
mode:
authorPavel Labath <pavel@labath.sk>2019-08-05 09:21:47 +0000
committerPavel Labath <pavel@labath.sk>2019-08-05 09:21:47 +0000
commitd5d47a3574823635fddef3bba3de37e2a5ea0d76 (patch)
tree1f0f9b4cde535e98639ac220cb6f45e80aab4dfd /lldb/source/Core/Module.cpp
parent8ed8353fc45e3906f7fd8dde1072bce7b54aca62 (diff)
downloadbcm5719-llvm-d5d47a3574823635fddef3bba3de37e2a5ea0d76.tar.gz
bcm5719-llvm-d5d47a3574823635fddef3bba3de37e2a5ea0d76.zip
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
Diffstat (limited to 'lldb/source/Core/Module.cpp')
-rw-r--r--lldb/source/Core/Module.cpp57
1 files changed, 23 insertions, 34 deletions
diff --git a/lldb/source/Core/Module.cpp b/lldb/source/Core/Module.cpp
index a926e4ade84..58a09275a9b 100644
--- a/lldb/source/Core/Module.cpp
+++ b/lldb/source/Core/Module.cpp
@@ -1061,6 +1061,12 @@ SymbolFile *Module::GetSymbolFile(bool can_create, Stream *feedback_strm) {
return nullptr;
}
+Symtab *Module::GetSymtab() {
+ if (SymbolFile *symbols = GetSymbolFile())
+ return symbols->GetSymtab();
+ return nullptr;
+}
+
void Module::SetFileSpecAndObjectName(const FileSpec &file,
ConstString object_name) {
// Container objects whose paths do not specify a file directly can call this
@@ -1231,9 +1237,8 @@ void Module::Dump(Stream *s) {
if (objfile)
objfile->Dump(s);
- SymbolVendor *symbols = GetSymbolVendor();
- if (symbols)
- symbols->Dump(s);
+ if (SymbolFile *symbols = GetSymbolFile())
+ symbols->Dump(*s);
s->IndentLess();
}
@@ -1309,13 +1314,9 @@ const Symbol *Module::FindFirstSymbolWithNameAndType(ConstString name,
Timer scoped_timer(
func_cat, "Module::FindFirstSymbolWithNameAndType (name = %s, type = %i)",
name.AsCString(), symbol_type);
- SymbolVendor *sym_vendor = GetSymbolVendor();
- if (sym_vendor) {
- Symtab *symtab = sym_vendor->GetSymtab();
- if (symtab)
- return symtab->FindFirstSymbolWithNameAndType(
- name, symbol_type, Symtab::eDebugAny, Symtab::eVisibilityAny);
- }
+ if (Symtab *symtab = GetSymtab())
+ return symtab->FindFirstSymbolWithNameAndType(
+ name, symbol_type, Symtab::eDebugAny, Symtab::eVisibilityAny);
return nullptr;
}
void Module::SymbolIndicesToSymbolContextList(
@@ -1343,12 +1344,8 @@ size_t Module::FindFunctionSymbols(ConstString name,
Timer scoped_timer(func_cat,
"Module::FindSymbolsFunctions (name = %s, mask = 0x%8.8x)",
name.AsCString(), name_type_mask);
- SymbolVendor *sym_vendor = GetSymbolVendor();
- if (sym_vendor) {
- Symtab *symtab = sym_vendor->GetSymtab();
- if (symtab)
- return symtab->FindFunctionSymbols(name, name_type_mask, sc_list);
- }
+ if (Symtab *symtab = GetSymtab())
+ return symtab->FindFunctionSymbols(name, name_type_mask, sc_list);
return 0;
}
@@ -1363,14 +1360,10 @@ size_t Module::FindSymbolsWithNameAndType(ConstString name,
func_cat, "Module::FindSymbolsWithNameAndType (name = %s, type = %i)",
name.AsCString(), symbol_type);
const size_t initial_size = sc_list.GetSize();
- SymbolVendor *sym_vendor = GetSymbolVendor();
- if (sym_vendor) {
- Symtab *symtab = sym_vendor->GetSymtab();
- if (symtab) {
- std::vector<uint32_t> symbol_indexes;
- symtab->FindAllSymbolsWithNameAndType(name, symbol_type, symbol_indexes);
- SymbolIndicesToSymbolContextList(symtab, symbol_indexes, sc_list);
- }
+ if (Symtab *symtab = GetSymtab()) {
+ std::vector<uint32_t> symbol_indexes;
+ symtab->FindAllSymbolsWithNameAndType(name, symbol_type, symbol_indexes);
+ SymbolIndicesToSymbolContextList(symtab, symbol_indexes, sc_list);
}
return sc_list.GetSize() - initial_size;
}
@@ -1387,16 +1380,12 @@ size_t Module::FindSymbolsMatchingRegExAndType(const RegularExpression &regex,
"Module::FindSymbolsMatchingRegExAndType (regex = %s, type = %i)",
regex.GetText().str().c_str(), symbol_type);
const size_t initial_size = sc_list.GetSize();
- SymbolVendor *sym_vendor = GetSymbolVendor();
- if (sym_vendor) {
- Symtab *symtab = sym_vendor->GetSymtab();
- if (symtab) {
- std::vector<uint32_t> symbol_indexes;
- symtab->FindAllSymbolsMatchingRexExAndType(
- regex, symbol_type, Symtab::eDebugAny, Symtab::eVisibilityAny,
- symbol_indexes);
- SymbolIndicesToSymbolContextList(symtab, symbol_indexes, sc_list);
- }
+ if (Symtab *symtab = GetSymtab()) {
+ std::vector<uint32_t> symbol_indexes;
+ symtab->FindAllSymbolsMatchingRexExAndType(
+ regex, symbol_type, Symtab::eDebugAny, Symtab::eVisibilityAny,
+ symbol_indexes);
+ SymbolIndicesToSymbolContextList(symtab, symbol_indexes, sc_list);
}
return sc_list.GetSize() - initial_size;
}
OpenPOWER on IntegriCloud