diff options
author | Pavel Labath <pavel@labath.sk> | 2019-07-31 08:25:25 +0000 |
---|---|---|
committer | Pavel Labath <pavel@labath.sk> | 2019-07-31 08:25:25 +0000 |
commit | d2deeb4490ed6fad5832c8958afa6ead283cf85a (patch) | |
tree | f3e8084a0ac1d42682a4385fa95d7de5924a5f4a /lldb/source/Plugins/SymbolFile/Symtab/SymbolFileSymtab.cpp | |
parent | d65c166e35dbc3432d7b3ad5a7eb6fe7b9e7e211 (diff) | |
download | bcm5719-llvm-d2deeb4490ed6fad5832c8958afa6ead283cf85a.tar.gz bcm5719-llvm-d2deeb4490ed6fad5832c8958afa6ead283cf85a.zip |
SymbolVendor: Remove the object file member variable
Summary:
The last responsibility of the SymbolVendor was to hold an owning
reference to the object file (in case symbols are being read from a
different file than the main module). As SymbolFile classes already hold
a non-owning reference to the object file, we can easily remove this
responsibility of the SymbolVendor by making the SymbolFile reference
owning.
Reviewers: JDevlieghere, clayborg, jingham
Subscribers: lldb-commits
Differential Revision: https://reviews.llvm.org/D65401
llvm-svn: 367392
Diffstat (limited to 'lldb/source/Plugins/SymbolFile/Symtab/SymbolFileSymtab.cpp')
-rw-r--r-- | lldb/source/Plugins/SymbolFile/Symtab/SymbolFileSymtab.cpp | 26 |
1 files changed, 13 insertions, 13 deletions
diff --git a/lldb/source/Plugins/SymbolFile/Symtab/SymbolFileSymtab.cpp b/lldb/source/Plugins/SymbolFile/Symtab/SymbolFileSymtab.cpp index 2782fce4d62..91f49e8babb 100644 --- a/lldb/source/Plugins/SymbolFile/Symtab/SymbolFileSymtab.cpp +++ b/lldb/source/Plugins/SymbolFile/Symtab/SymbolFileSymtab.cpp @@ -43,8 +43,8 @@ const char *SymbolFileSymtab::GetPluginDescriptionStatic() { return "Reads debug symbols from an object file's symbol table."; } -SymbolFile *SymbolFileSymtab::CreateInstance(ObjectFile *obj_file) { - return new SymbolFileSymtab(obj_file); +SymbolFile *SymbolFileSymtab::CreateInstance(ObjectFileSP objfile_sp) { + return new SymbolFileSymtab(std::move(objfile_sp)); } size_t SymbolFileSymtab::GetTypes(SymbolContextScope *sc_scope, @@ -53,16 +53,16 @@ size_t SymbolFileSymtab::GetTypes(SymbolContextScope *sc_scope, return 0; } -SymbolFileSymtab::SymbolFileSymtab(ObjectFile *obj_file) - : SymbolFile(obj_file), m_source_indexes(), m_func_indexes(), +SymbolFileSymtab::SymbolFileSymtab(ObjectFileSP objfile_sp) + : SymbolFile(std::move(objfile_sp)), m_source_indexes(), m_func_indexes(), m_code_indexes(), m_objc_class_name_to_index() {} SymbolFileSymtab::~SymbolFileSymtab() {} uint32_t SymbolFileSymtab::CalculateAbilities() { uint32_t abilities = 0; - if (m_obj_file) { - const Symtab *symtab = m_obj_file->GetSymtab(); + if (m_objfile_sp) { + const Symtab *symtab = m_objfile_sp->GetSymtab(); if (symtab) { // The snippet of code below will get the indexes the module symbol table // entries that are code, data, or function related (debug info), sort @@ -122,10 +122,10 @@ CompUnitSP SymbolFileSymtab::ParseCompileUnitAtIndex(uint32_t idx) { // unit for the entire object file if (idx < m_source_indexes.size()) { const Symbol *cu_symbol = - m_obj_file->GetSymtab()->SymbolAtIndex(m_source_indexes[idx]); + m_objfile_sp->GetSymtab()->SymbolAtIndex(m_source_indexes[idx]); if (cu_symbol) - cu_sp = std::make_shared<CompileUnit>(m_obj_file->GetModule(), nullptr, - cu_symbol->GetName().AsCString(), 0, + cu_sp = std::make_shared<CompileUnit>(m_objfile_sp->GetModule(), nullptr, + cu_symbol->GetName().AsCString(), 0, eLanguageTypeUnknown, eLazyBoolNo); } return cu_sp; @@ -139,10 +139,10 @@ size_t SymbolFileSymtab::ParseFunctions(CompileUnit &comp_unit) { std::lock_guard<std::recursive_mutex> guard(GetModuleMutex()); size_t num_added = 0; // We must at least have a valid compile unit - const Symtab *symtab = m_obj_file->GetSymtab(); + const Symtab *symtab = m_objfile_sp->GetSymtab(); const Symbol *curr_symbol = nullptr; const Symbol *next_symbol = nullptr; - // const char *prefix = m_obj_file->SymbolPrefix(); + // const char *prefix = m_objfile_sp->SymbolPrefix(); // if (prefix == NULL) // prefix == ""; // @@ -248,12 +248,12 @@ uint32_t SymbolFileSymtab::ResolveSymbolContext(const Address &so_addr, SymbolContextItem resolve_scope, SymbolContext &sc) { std::lock_guard<std::recursive_mutex> guard(GetModuleMutex()); - if (m_obj_file->GetSymtab() == nullptr) + if (m_objfile_sp->GetSymtab() == nullptr) return 0; uint32_t resolved_flags = 0; if (resolve_scope & eSymbolContextSymbol) { - sc.symbol = m_obj_file->GetSymtab()->FindSymbolContainingFileAddress( + sc.symbol = m_objfile_sp->GetSymtab()->FindSymbolContainingFileAddress( so_addr.GetFileAddress()); if (sc.symbol) resolved_flags |= eSymbolContextSymbol; |