summaryrefslogtreecommitdiffstats
path: root/lldb/source/Plugins/SymbolFile
diff options
context:
space:
mode:
authorPavel Labath <pavel@labath.sk>2019-07-25 08:22:05 +0000
committerPavel Labath <pavel@labath.sk>2019-07-25 08:22:05 +0000
commitf46e8974dea4f8c6f4f9655a7e24d196af54862c (patch)
tree516b3e4a291eefae66a08fc3bcf1d674e313c91d /lldb/source/Plugins/SymbolFile
parent5c606cef796ebcd9165719955fe46fa1ace2d124 (diff)
downloadbcm5719-llvm-f46e8974dea4f8c6f4f9655a7e24d196af54862c.tar.gz
bcm5719-llvm-f46e8974dea4f8c6f4f9655a7e24d196af54862c.zip
SymbolVendor: Remove the type list member
Summary: Similarly to the compile unit lists, the list of types can also be managed by the symbol file itself. Since the only purpose of this list seems to be to maintain an owning reference to all the types a symbol file has created (items are only ever added to the list, never retrieved), I remove the passthrough functions in SymbolVendor and Module. I also tighten the interface of the function (return a reference instead of a pointer, make it protected instead of public). Reviewers: clayborg, JDevlieghere, jingham Subscribers: lldb-commits Differential Revision: https://reviews.llvm.org/D65135 llvm-svn: 366994
Diffstat (limited to 'lldb/source/Plugins/SymbolFile')
-rw-r--r--lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp6
-rw-r--r--lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp12
-rw-r--r--lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h4
-rw-r--r--lldb/source/Plugins/SymbolFile/NativePDB/SymbolFileNativePDB.cpp6
-rw-r--r--lldb/source/Plugins/SymbolFile/PDB/SymbolFilePDB.cpp8
-rw-r--r--lldb/source/Plugins/SymbolFile/PDB/SymbolFilePDB.h2
6 files changed, 13 insertions, 25 deletions
diff --git a/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp b/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
index 161589e01fb..b2240e2421e 100644
--- a/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
+++ b/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
@@ -188,7 +188,7 @@ TypeSP DWARFASTParserClang::ParseTypeFromDWO(const DWARFDIE &die, Log *log) {
nullptr, LLDB_INVALID_UID, Type::eEncodingInvalid,
&dwo_type_sp->GetDeclaration(), type, Type::eResolveStateForward));
- dwarf->GetTypeList()->Insert(type_sp);
+ dwarf->GetTypeList().Insert(type_sp);
dwarf->GetDIEToType()[die.GetDIE()] = type_sp.get();
clang::TagDecl *tag_decl = ClangASTContext::GetAsTagDecl(type);
if (tag_decl)
@@ -434,7 +434,7 @@ TypeSP DWARFASTParserClang::ParseTypeFromDWARF(const SymbolContext &sc,
return nullptr;
}
- TypeList *type_list = dwarf->GetTypeList();
+ TypeList &type_list = dwarf->GetTypeList();
if (type_is_new_ptr)
*type_is_new_ptr = true;
@@ -1672,7 +1672,7 @@ TypeSP DWARFASTParserClang::ParseTypeFromDWARF(const SymbolContext &sc,
// We are ready to put this type into the uniqued list up at the module
// level
- type_list->Insert(type_sp);
+ type_list.Insert(type_sp);
dwarf->GetDIEToType()[die.GetDIE()] = type_sp.get();
}
diff --git a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
index 3b6d8da2312..362e1525864 100644
--- a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
+++ b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
@@ -202,15 +202,13 @@ SymbolFile *SymbolFileDWARF::CreateInstance(ObjectFile *obj_file) {
/*dwo_section_list*/ nullptr);
}
-TypeList *SymbolFileDWARF::GetTypeList() {
+TypeList &SymbolFileDWARF::GetTypeList() {
// This method can be called without going through the symbol vendor so we
// need to lock the module.
std::lock_guard<std::recursive_mutex> guard(GetModuleMutex());
- SymbolFileDWARFDebugMap *debug_map_symfile = GetDebugMapSymfile();
- if (debug_map_symfile)
+ if (SymbolFileDWARFDebugMap *debug_map_symfile = GetDebugMapSymfile())
return debug_map_symfile->GetTypeList();
- else
- return m_obj_file->GetModule()->GetTypeList();
+ return SymbolFile::GetTypeList();
}
void SymbolFileDWARF::GetTypes(const DWARFDIE &die, dw_offset_t min_die_offset,
dw_offset_t max_die_offset, uint32_t type_mask,
@@ -2971,9 +2969,7 @@ TypeSP SymbolFileDWARF::ParseType(const SymbolContext &sc, const DWARFDIE &die,
Log *log = LogChannelDWARF::GetLogIfAll(DWARF_LOG_DEBUG_INFO);
TypeSP type_sp = dwarf_ast->ParseTypeFromDWARF(sc, die, log, type_is_new_ptr);
if (type_sp) {
- TypeList *type_list = GetTypeList();
- if (type_list)
- type_list->Insert(type_sp);
+ GetTypeList().Insert(type_sp);
if (die.Tag() == DW_TAG_subprogram) {
std::string scope_qualified_name(GetDeclContextForUID(die.GetID())
diff --git a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h
index 6daa060b9a0..bf53ad6a82a 100644
--- a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h
+++ b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h
@@ -186,8 +186,6 @@ public:
size_t FindTypes(const std::vector<lldb_private::CompilerContext> &context,
bool append, lldb_private::TypeMap &types) override;
- lldb_private::TypeList *GetTypeList() override;
-
size_t GetTypes(lldb_private::SymbolContextScope *sc_scope,
lldb::TypeClass type_mask,
lldb_private::TypeList &type_list) override;
@@ -331,6 +329,8 @@ protected:
lldb::CompUnitSP ParseCompileUnitAtIndex(uint32_t index) override;
+ lldb_private::TypeList &GetTypeList() override;
+
virtual DWARFUnit *
GetDWARFCompileUnit(lldb_private::CompileUnit *comp_unit);
diff --git a/lldb/source/Plugins/SymbolFile/NativePDB/SymbolFileNativePDB.cpp b/lldb/source/Plugins/SymbolFile/NativePDB/SymbolFileNativePDB.cpp
index 9585b35152f..e7ff32832b9 100644
--- a/lldb/source/Plugins/SymbolFile/NativePDB/SymbolFileNativePDB.cpp
+++ b/lldb/source/Plugins/SymbolFile/NativePDB/SymbolFileNativePDB.cpp
@@ -729,7 +729,7 @@ TypeSP SymbolFileNativePDB::GetOrCreateType(PdbTypeSymId type_id) {
TypeSP type = CreateAndCacheType(type_id);
if (type)
- m_obj_file->GetModule()->GetTypeList()->Insert(type);
+ GetTypeList().Insert(type);
return type;
}
@@ -1283,7 +1283,7 @@ size_t SymbolFileNativePDB::ParseTypes(CompileUnit &comp_unit) {
if (m_done_full_type_scan)
return 0;
- size_t old_count = m_obj_file->GetModule()->GetTypeList()->GetSize();
+ const size_t old_count = GetTypeList().GetSize();
LazyRandomTypeCollection &types = m_index->tpi().typeCollection();
// First process the entire TPI stream.
@@ -1313,7 +1313,7 @@ size_t SymbolFileNativePDB::ParseTypes(CompileUnit &comp_unit) {
GetOrCreateTypedef(global);
}
- size_t new_count = m_obj_file->GetModule()->GetTypeList()->GetSize();
+ const size_t new_count = GetTypeList().GetSize();
m_done_full_type_scan = true;
diff --git a/lldb/source/Plugins/SymbolFile/PDB/SymbolFilePDB.cpp b/lldb/source/Plugins/SymbolFile/PDB/SymbolFilePDB.cpp
index c6c25fd719c..4fea49c287a 100644
--- a/lldb/source/Plugins/SymbolFile/PDB/SymbolFilePDB.cpp
+++ b/lldb/source/Plugins/SymbolFile/PDB/SymbolFilePDB.cpp
@@ -557,9 +557,7 @@ lldb_private::Type *SymbolFilePDB::ResolveTypeUID(lldb::user_id_t type_uid) {
lldb::TypeSP result = pdb->CreateLLDBTypeFromPDBType(*pdb_type);
if (result) {
m_types.insert(std::make_pair(type_uid, result));
- auto type_list = GetTypeList();
- if (type_list)
- type_list->Insert(result);
+ GetTypeList().Insert(result);
}
return result.get();
}
@@ -1516,10 +1514,6 @@ size_t SymbolFilePDB::FindTypes(
return 0;
}
-lldb_private::TypeList *SymbolFilePDB::GetTypeList() {
- return m_obj_file->GetModule()->GetTypeList();
-}
-
void SymbolFilePDB::GetTypesForPDBSymbol(const llvm::pdb::PDBSymbol &pdb_symbol,
uint32_t type_mask,
TypeCollection &type_collection) {
diff --git a/lldb/source/Plugins/SymbolFile/PDB/SymbolFilePDB.h b/lldb/source/Plugins/SymbolFile/PDB/SymbolFilePDB.h
index 13bff40958f..fc33202566f 100644
--- a/lldb/source/Plugins/SymbolFile/PDB/SymbolFilePDB.h
+++ b/lldb/source/Plugins/SymbolFile/PDB/SymbolFilePDB.h
@@ -138,8 +138,6 @@ public:
void FindTypesByRegex(const lldb_private::RegularExpression &regex,
uint32_t max_matches, lldb_private::TypeMap &types);
- lldb_private::TypeList *GetTypeList() override;
-
size_t GetTypes(lldb_private::SymbolContextScope *sc_scope,
lldb::TypeClass type_mask,
lldb_private::TypeList &type_list) override;
OpenPOWER on IntegriCloud