[Lldb-commits] [PATCH] D110400: [nfc] [lldb] DWZ 04/17: Use DIERef for DIEToModuleMap m_die_to_module

Jan Kratochvil via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Fri Sep 24 03:11:00 PDT 2021


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/D110400

Files:
  lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
  lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.h


Index: lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.h
===================================================================
--- lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.h
+++ lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.h
@@ -77,9 +77,8 @@
   typedef std::multimap<const clang::DeclContext *,
                         std::pair<SymbolFileDWARF *, DIERef>>
       DeclContextToFileDIERefMap;
-  typedef llvm::DenseMap<const DWARFDebugInfoEntry *,
-                         lldb_private::OptionalClangModuleID>
-      DIEToModuleMap;
+  typedef llvm::DenseMap<DIERef, lldb_private::OptionalClangModuleID>
+      DIERefToModuleMap;
   typedef llvm::DenseMap<const DWARFDebugInfoEntry *, clang::Decl *>
       DIEToDeclMap;
 
@@ -87,7 +86,7 @@
   DIEToDeclMap m_die_to_decl;
   DIERefToDeclContextMap m_dieref_to_decl_ctx;
   DeclContextToFileDIERefMap m_decl_ctx_to_filedieref;
-  DIEToModuleMap m_die_to_module;
+  DIERefToModuleMap m_dieref_to_module;
   std::unique_ptr<lldb_private::ClangASTImporter> m_clang_ast_importer_up;
   /// @}
 
Index: lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
===================================================================
--- lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
+++ lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
@@ -3271,8 +3271,9 @@
     const dw_tag_t tag = parent.Tag();
     if (tag == DW_TAG_module) {
       DWARFDIE module_die = parent;
-      auto it = m_die_to_module.find(module_die.GetDIE());
-      if (it != m_die_to_module.end())
+      DIERef module_dieref = *module_die.GetDIERef();
+      auto it = m_dieref_to_module.find(module_dieref);
+      if (it != m_dieref_to_module.end())
         return it->second;
       const char *name = module_die.GetAttributeValueAsString(DW_AT_name, 0);
       if (!name)
@@ -3280,7 +3281,7 @@
 
       OptionalClangModuleID id =
           m_ast.GetOrCreateClangModule(name, GetOwningClangModule(module_die));
-      m_die_to_module.insert({module_die.GetDIE(), id});
+      m_dieref_to_module.insert({module_dieref, id});
       return id;
     }
   }


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D110400.374791.patch
Type: text/x-patch
Size: 2137 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20210924/1d7d1f6e/attachment-0001.bin>


More information about the lldb-commits mailing list