Author: Adrian Prantl Date: 2019-11-13T14:07:20-08:00 New Revision: 3d30c142e147b772463f99a81b106898a9f04971
URL: https://github.com/llvm/llvm-project/commit/3d30c142e147b772463f99a81b106898a9f04971 DIFF: https://github.com/llvm/llvm-project/commit/3d30c142e147b772463f99a81b106898a9f04971.diff LOG: Rename clang-module-related *DWO* functions to *ClangModule* (NFC) This avoids confusing them with fission-related functionality. I also moved two accessor functions from DWARFDIE into static functions in DWARFASTParserClang were their only use is located. Added: Modified: lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp lldb/source/Plugins/SymbolFile/DWARF/DWARFDIE.cpp lldb/source/Plugins/SymbolFile/DWARF/DWARFDIE.h lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h Removed: ################################################################################ diff --git a/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp b/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp index f992a49a6dbc..7b8498303d22 100644 --- a/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp +++ b/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp @@ -135,9 +135,42 @@ static bool IsClangModuleFwdDecl(const DWARFDIE &Die) { return false; } +static DWARFDIE GetContainingClangModuleDIE(const DWARFDIE &die) { + if (die.IsValid()) { + DWARFDIE top_module_die; + // Now make sure this DIE is scoped in a DW_TAG_module tag and return true + // if so + for (DWARFDIE parent = die.GetParent(); parent.IsValid(); + parent = parent.GetParent()) { + const dw_tag_t tag = parent.Tag(); + if (tag == DW_TAG_module) + top_module_die = parent; + else if (tag == DW_TAG_compile_unit || tag == DW_TAG_partial_unit) + break; + } + + return top_module_die; + } + return DWARFDIE(); +} + +static lldb::ModuleSP GetContainingClangModule(const DWARFDIE &die) { + if (die.IsValid()) { + DWARFDIE clang_module_die = GetContainingClangModuleDIE(die); + + if (clang_module_die) { + const char *module_name = clang_module_die.GetName(); + if (module_name) + return die.GetDWARF()->GetExternalModule( + lldb_private::ConstString(module_name)); + } + } + return lldb::ModuleSP(); +} + TypeSP DWARFASTParserClang::ParseTypeFromClangModule(const DWARFDIE &die, Log *log) { - ModuleSP dwo_module_sp = die.GetContainingDWOModule(); + ModuleSP dwo_module_sp = GetContainingClangModule(die); if (!dwo_module_sp) return TypeSP(); @@ -873,7 +906,7 @@ TypeSP DWARFASTParserClang::ParseTypeFromDWARF(const SymbolContext &sc, if (class_type) { bool alternate_defn = false; if (class_type->GetID() != decl_ctx_die.GetID() || - decl_ctx_die.GetContainingDWOModuleDIE()) { + GetContainingClangModuleDIE(decl_ctx_die)) { alternate_defn = true; // We uniqued the parent class of this function to another @@ -887,11 +920,10 @@ TypeSP DWARFASTParserClang::ParseTypeFromDWARF(const SymbolContext &sc, CopyUniqueClassMethodTypes(decl_ctx_die, class_type_die, class_type, failures); - // FIXME do something with these failures that's smarter - // than - // just dropping them on the ground. Unfortunately classes - // don't like having stuff added to them after their - // definitions are complete... + // FIXME do something with these failures that's + // smarter than just dropping them on the ground. + // Unfortunately classes don't like having stuff added + // to them after their definitions are complete... type_ptr = dwarf->GetDIEToType()[die.GetDIE()]; if (type_ptr && type_ptr != DIE_IS_BEING_PARSED) { diff --git a/lldb/source/Plugins/SymbolFile/DWARF/DWARFDIE.cpp b/lldb/source/Plugins/SymbolFile/DWARF/DWARFDIE.cpp index 5ee0687995a1..c5411a17f274 100644 --- a/lldb/source/Plugins/SymbolFile/DWARF/DWARFDIE.cpp +++ b/lldb/source/Plugins/SymbolFile/DWARF/DWARFDIE.cpp @@ -406,39 +406,6 @@ bool DWARFDIE::IsMethod() const { return false; } -DWARFDIE -DWARFDIE::GetContainingDWOModuleDIE() const { - if (IsValid()) { - DWARFDIE top_module_die; - // Now make sure this DIE is scoped in a DW_TAG_module tag and return true - // if so - for (DWARFDIE parent = GetParent(); parent.IsValid(); - parent = parent.GetParent()) { - const dw_tag_t tag = parent.Tag(); - if (tag == DW_TAG_module) - top_module_die = parent; - else if (tag == DW_TAG_compile_unit || tag == DW_TAG_partial_unit) - break; - } - - return top_module_die; - } - return DWARFDIE(); -} - -lldb::ModuleSP DWARFDIE::GetContainingDWOModule() const { - if (IsValid()) { - DWARFDIE dwo_module_die = GetContainingDWOModuleDIE(); - - if (dwo_module_die) { - const char *module_name = dwo_module_die.GetName(); - if (module_name) - return GetDWARF()->GetDWOModule(lldb_private::ConstString(module_name)); - } - } - return lldb::ModuleSP(); -} - bool DWARFDIE::GetDIENamesAndRanges( const char *&name, const char *&mangled, DWARFRangeList &ranges, int &decl_file, int &decl_line, int &decl_column, int &call_file, diff --git a/lldb/source/Plugins/SymbolFile/DWARF/DWARFDIE.h b/lldb/source/Plugins/SymbolFile/DWARF/DWARFDIE.h index a779c589611a..87d52eee9dd9 100644 --- a/lldb/source/Plugins/SymbolFile/DWARF/DWARFDIE.h +++ b/lldb/source/Plugins/SymbolFile/DWARF/DWARFDIE.h @@ -22,10 +22,6 @@ class DWARFDIE : public DWARFBaseDIE { bool IsMethod() const; // Accessors - lldb::ModuleSP GetContainingDWOModule() const; - - DWARFDIE - GetContainingDWOModuleDIE() const; // Accessing information about a DIE const char *GetMangledName() const; diff --git a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp index dfa913280232..c0c10b21a747 100644 --- a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp +++ b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp @@ -1511,7 +1511,7 @@ bool SymbolFileDWARF::GetFunction(const DWARFDIE &die, SymbolContext &sc) { return false; } -lldb::ModuleSP SymbolFileDWARF::GetDWOModule(ConstString name) { +lldb::ModuleSP SymbolFileDWARF::GetExternalModule(ConstString name) { UpdateExternalModuleListIfNeeded(); const auto &pos = m_external_type_modules.find(name); if (pos != m_external_type_modules.end()) diff --git a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h index 616c7f45bb5a..1c8edfac7e5e 100644 --- a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h +++ b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h @@ -254,7 +254,7 @@ class SymbolFileDWARF : public lldb_private::SymbolFile, virtual lldb_private::DWARFExpression::LocationListFormat GetLocationListFormat() const; - lldb::ModuleSP GetDWOModule(lldb_private::ConstString name); + lldb::ModuleSP GetExternalModule(lldb_private::ConstString name); typedef std::map<lldb_private::ConstString, lldb::ModuleSP> ExternalTypeModuleMap; _______________________________________________ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits