SymbolVendor: Move Symtab construction into the SymbolFile
Summary:
Instead of having SymbolVendor coordinate Symtab construction between
Symbol and Object files, make the SymbolVendor function a passthrough,
and put all of the logic into the SymbolFile.
Reviewers: clayborg, JDevlieghere, jingham, espindola
Subscribers: emaste, mgorny, arichardson, MaskRay, lldb-commits
Differential Revision: https://reviews.llvm.org/D65208
llvm-svn: 367086
diff --git a/lldb/source/Symbol/SymbolFile.cpp b/lldb/source/Symbol/SymbolFile.cpp
index 7688d18..223e678 100644
--- a/lldb/source/Symbol/SymbolFile.cpp
+++ b/lldb/source/Symbol/SymbolFile.cpp
@@ -200,6 +200,21 @@
(*m_compile_units)[idx] = cu_sp;
}
+Symtab *SymbolFile::GetSymtab() {
+ std::lock_guard<std::recursive_mutex> guard(GetModuleMutex());
+ if (m_symtab)
+ return m_symtab;
+
+ // Fetch the symtab from the main object file.
+ m_symtab = m_obj_file->GetModule()->GetObjectFile()->GetSymtab();
+
+ // Then add our symbols to it.
+ if (m_symtab)
+ AddSymbols(*m_symtab);
+
+ return m_symtab;
+}
+
void SymbolFile::Dump(Stream &s) {
s.PutCString("Types:\n");
m_type_list.Dump(&s, /*show_context*/ false);