jankratochvil created this revision. jankratochvil added reviewers: labath, clayborg. jankratochvil added a project: LLDB. Herald added a subscriber: JDevlieghere. Herald added a reviewer: shafik. jankratochvil requested review of this revision.
After D96236 <https://reviews.llvm.org/D96236> using just `DWARFDebugInfoEntry *` is ambiguous as it does not contain MainCU. `DIERef` (after D96239 <https://reviews.llvm.org/D96239>) does contain it and it has the same sizeof as `DWARFDebugInfoEntry *`. This replacement should have no real performance disadvantage. My question about upstreaming of this patchset. <https://reviews.llvm.org/D96236#3020116> Repository: rG LLVM Github Monorepo https://reviews.llvm.org/D110402 Files: lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDwo.cpp lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDwo.h
Index: lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDwo.h =================================================================== --- lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDwo.h +++ lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDwo.h @@ -43,7 +43,7 @@ llvm::Optional<uint32_t> GetDwoNum() override { return GetID() >> 32; } protected: - DIEToTypePtr &GetDIEToType() override; + DIERefToTypePtr &GetDIERefToType() override; DIEToVariableSP &GetDIEToVariable() override; Index: lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDwo.cpp =================================================================== --- lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDwo.cpp +++ lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDwo.cpp @@ -76,8 +76,8 @@ return cu; } -SymbolFileDWARF::DIEToTypePtr &SymbolFileDWARFDwo::GetDIEToType() { - return GetBaseSymbolFile().GetDIEToType(); +SymbolFileDWARF::DIERefToTypePtr &SymbolFileDWARFDwo::GetDIERefToType() { + return GetBaseSymbolFile().GetDIERefToType(); } SymbolFileDWARF::DIEToVariableSP &SymbolFileDWARFDwo::GetDIEToVariable() { Index: lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h =================================================================== --- lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h +++ lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h @@ -319,8 +319,7 @@ static lldb::LanguageType GetLanguageFamily(DWARFUnit &unit); protected: - typedef llvm::DenseMap<const DWARFDebugInfoEntry *, lldb_private::Type *> - DIEToTypePtr; + typedef llvm::DenseMap<DIERef, lldb_private::Type *> DIERefToTypePtr; typedef llvm::DenseMap<const DWARFDebugInfoEntry *, lldb::VariableSP> DIEToVariableSP; typedef llvm::DenseMap<const DWARFDebugInfoEntry *, @@ -459,7 +458,7 @@ void UpdateExternalModuleListIfNeeded(); - virtual DIEToTypePtr &GetDIEToType() { return m_die_to_type; } + virtual DIERefToTypePtr &GetDIERefToType() { return m_dieref_to_type; } virtual DIEToVariableSP &GetDIEToVariable() { return m_die_to_variable_sp; } @@ -512,7 +511,7 @@ NameToOffsetMap m_function_scope_qualified_name_map; std::unique_ptr<DWARFDebugRanges> m_ranges; UniqueDWARFASTTypeMap m_unique_ast_type_map; - DIEToTypePtr m_die_to_type; + DIERefToTypePtr m_dieref_to_type; DIEToVariableSP m_die_to_variable_sp; DIEToClangType m_forward_decl_die_to_clang_type; ClangTypeToDIE m_forward_decl_clang_type_to_die; Index: lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp =================================================================== --- lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp +++ lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp @@ -1545,7 +1545,7 @@ // to SymbolFileDWARF::ResolveClangOpaqueTypeDefinition are done. GetForwardDeclClangTypeToDie().erase(die_it); - Type *type = GetDIEToType().lookup(dwarf_die.GetDIE()); + Type *type = GetDIERefToType().lookup(*dwarf_die.GetDIERef()); Log *log(LogChannelDWARF::GetLogIfAny(DWARF_LOG_DEBUG_INFO | DWARF_LOG_TYPE_COMPLETION)); @@ -2537,7 +2537,7 @@ bool resolve_function_context) { TypeSP type_sp; if (die) { - Type *type_ptr = GetDIEToType().lookup(die.GetDIE()); + Type *type_ptr = GetDIERefToType().lookup(*die.GetDIERef()); if (type_ptr == nullptr) { SymbolContextScope *scope; if (auto *dwarf_cu = llvm::dyn_cast<DWARFCompileUnit>(die.GetCU())) @@ -2710,7 +2710,7 @@ type_die.GetID(), type_cu->GetID()); if (die) - GetDIEToType()[die.GetDIE()] = resolved_type; + GetDIERefToType()[*die.GetDIERef()] = resolved_type; type_sp = resolved_type->shared_from_this(); return false; }); Index: lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp =================================================================== --- lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp +++ lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp @@ -217,7 +217,7 @@ TypePayloadClang(GetOwningClangModule(die)))); dwarf->GetTypeList().Insert(type_sp); - dwarf->GetDIEToType()[die.GetDIE()] = type_sp.get(); + dwarf->GetDIERefToType()[*die.GetDIERef()] = type_sp.get(); clang::TagDecl *tag_decl = TypeSystemClang::GetAsTagDecl(type); if (tag_decl) { LinkDeclContextToDIE(tag_decl, die); @@ -460,20 +460,21 @@ die.GetTagAsCString(), die.GetName()); } - Type *type_ptr = dwarf->GetDIEToType().lookup(die.GetDIE()); + DIERef dieref = *die.GetDIERef(); + Type *type_ptr = dwarf->GetDIERefToType().lookup(dieref); if (type_ptr == DIE_IS_BEING_PARSED) return nullptr; if (type_ptr) return type_ptr->shared_from_this(); // Set a bit that lets us know that we are currently parsing this - dwarf->GetDIEToType()[die.GetDIE()] = DIE_IS_BEING_PARSED; + dwarf->GetDIERefToType()[dieref] = DIE_IS_BEING_PARSED; ParsedDWARFTypeAttributes attrs(die); if (DWARFDIE signature_die = attrs.signature.Reference()) { if (TypeSP type_sp = ParseTypeFromDWARF(sc, signature_die, type_is_new_ptr)) { - dwarf->GetDIEToType()[die.GetDIE()] = type_sp.get(); + dwarf->GetDIERefToType()[dieref] = type_sp.get(); if (clang::DeclContext *decl_ctx = GetCachedClangDeclContextForDIE(signature_die)) LinkDeclContextToDIE(decl_ctx, die); @@ -764,7 +765,7 @@ dwarf->GetUID(attrs.type.Reference()), encoding_data_type, &attrs.decl, clang_type, resolve_state, TypePayloadClang(GetOwningClangModule(die))); - dwarf->GetDIEToType()[die.GetDIE()] = type_sp.get(); + dwarf->GetDIERefToType()[*die.GetDIERef()] = type_sp.get(); return type_sp; } @@ -810,7 +811,7 @@ // We found a real definition for this type elsewhere so lets use // it and cache the fact that we found a complete type for this // die - dwarf->GetDIEToType()[die.GetDIE()] = type_sp.get(); + dwarf->GetDIERefToType()[*die.GetDIERef()] = type_sp.get(); clang::DeclContext *defn_decl_ctx = GetCachedClangDeclContextForDIE(dwarf->GetDIE(type_sp->GetID())); if (defn_decl_ctx) @@ -1030,7 +1031,7 @@ // Unfortunately classes don't like having stuff added // to them after their definitions are complete... - Type *type_ptr = dwarf->GetDIEToType()[die.GetDIE()]; + Type *type_ptr = dwarf->GetDIERefToType()[*die.GetDIERef()]; if (type_ptr && type_ptr != DIE_IS_BEING_PARSED) { return type_ptr->shared_from_this(); } @@ -1176,11 +1177,12 @@ // so we need to just have the class complete itself and // do things the right way, then our // DIE should then have an entry in the - // dwarf->GetDIEToType() map. First - // we need to modify the dwarf->GetDIEToType() so it + // dwarf->GetDIERefToType() map. First + // we need to modify the dwarf->GetDIERefToType() so it // doesn't think we are trying to parse this DIE // anymore... - dwarf->GetDIEToType()[die.GetDIE()] = NULL; + DIERef dieref = *die.GetDIERef(); + dwarf->GetDIERefToType()[dieref] = NULL; // Now we get the full type to force our class type to // complete itself using the clang::ExternalASTSource @@ -1190,7 +1192,7 @@ // The type for this DIE should have been filled in the // function call above - Type *type_ptr = dwarf->GetDIEToType()[die.GetDIE()]; + Type *type_ptr = dwarf->GetDIERefToType()[dieref]; if (type_ptr && type_ptr != DIE_IS_BEING_PARSED) { return type_ptr->shared_from_this(); } @@ -1402,7 +1404,7 @@ // level. type_list.Insert(type_sp); - dwarf->GetDIEToType()[die.GetDIE()] = type_sp.get(); + dwarf->GetDIERefToType()[*die.GetDIERef()] = type_sp.get(); return type_sp; } @@ -1443,7 +1445,7 @@ *unique_ast_entry_up)) { type_sp = unique_ast_entry_up->m_type_sp; if (type_sp) { - dwarf->GetDIEToType()[die.GetDIE()] = type_sp.get(); + dwarf->GetDIERefToType()[*die.GetDIERef()] = type_sp.get(); LinkDeclContextToDIE( GetCachedClangDeclContextForDIE(unique_ast_entry_up->m_die), die); return type_sp; @@ -1519,7 +1521,7 @@ // We found a real definition for this type elsewhere so lets use // it and cache the fact that we found a complete type for this // die - dwarf->GetDIEToType()[die.GetDIE()] = type_sp.get(); + dwarf->GetDIERefToType()[*die.GetDIERef()] = type_sp.get(); return type_sp; } } @@ -1575,7 +1577,7 @@ // We found a real definition for this type elsewhere so lets use // it and cache the fact that we found a complete type for this die - dwarf->GetDIEToType()[die.GetDIE()] = type_sp.get(); + dwarf->GetDIERefToType()[*die.GetDIERef()] = type_sp.get(); clang::DeclContext *defn_decl_ctx = GetCachedClangDeclContextForDIE(dwarf->GetDIE(type_sp->GetID())); if (defn_decl_ctx) @@ -2292,7 +2294,7 @@ SymbolFileDWARF *dwarf = die.GetDWARF(); // Supply the type _only_ if it has already been parsed - Type *func_type = dwarf->GetDIEToType().lookup(die.GetDIE()); + Type *func_type = dwarf->GetDIERefToType().lookup(*die.GetDIERef()); assert(func_type == nullptr || func_type != DIE_IS_BEING_PARSED); @@ -3605,14 +3607,15 @@ } Type *src_child_type = - dst_die.GetDWARF()->GetDIEToType()[src_die.GetDIE()]; + dst_die.GetDWARF()->GetDIERefToType()[*src_die.GetDIERef()]; if (src_child_type) { LLDB_LOGF(log, "uniquing type %p (uid=0x%" PRIx64 ") from 0x%8.8x for 0x%8.8x", static_cast<void *>(src_child_type), src_child_type->GetID(), src_die.GetOffset(), dst_die.GetOffset()); - dst_die.GetDWARF()->GetDIEToType()[dst_die.GetDIE()] = src_child_type; + dst_die.GetDWARF()->GetDIERefToType()[*dst_die.GetDIERef()] = + src_child_type; } else { LLDB_LOGF(log, "warning: tried to unique lldb_private::Type from " @@ -3649,14 +3652,14 @@ } Type *src_child_type = - dst_die.GetDWARF()->GetDIEToType()[src_die.GetDIE()]; + dst_die.GetDWARF()->GetDIERefToType()[*src_die.GetDIERef()]; if (src_child_type) { LLDB_LOGF( log, "uniquing type %p (uid=0x%" PRIx64 ") from 0x%8.8x for 0x%8.8x", static_cast<void *>(src_child_type), src_child_type->GetID(), src_die.GetOffset(), dst_die.GetOffset()); - dst_die.GetDWARF()->GetDIEToType()[dst_die.GetDIE()] = + dst_die.GetDWARF()->GetDIERefToType()[*dst_die.GetDIERef()] = src_child_type; } else { LLDB_LOGF(log, @@ -3704,14 +3707,15 @@ } Type *src_child_type = - dst_die.GetDWARF()->GetDIEToType()[src_die.GetDIE()]; + dst_die.GetDWARF()->GetDIERefToType()[*src_die.GetDIERef()]; if (src_child_type) { LLDB_LOGF( log, "uniquing type %p (uid=0x%" PRIx64 ") from 0x%8.8x for 0x%8.8x", static_cast<void *>(src_child_type), src_child_type->GetID(), src_die.GetOffset(), dst_die.GetOffset()); - dst_die.GetDWARF()->GetDIEToType()[dst_die.GetDIE()] = src_child_type; + dst_die.GetDWARF()->GetDIERefToType()[*dst_die.GetDIERef()] = + src_child_type; } else { LLDB_LOGF(log, "warning: tried to unique lldb_private::Type from "
_______________________________________________ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits