[Lldb-commits] [PATCH] D110401: [nfc] [lldb] DWZ 05/17: Use DIERef for DIEToDeclMap m_die_to_decl

Jan Kratochvil via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Fri Sep 24 03:12:23 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/D110401

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
@@ -79,11 +79,10 @@
       DeclContextToFileDIERefMap;
   typedef llvm::DenseMap<DIERef, lldb_private::OptionalClangModuleID>
       DIERefToModuleMap;
-  typedef llvm::DenseMap<const DWARFDebugInfoEntry *, clang::Decl *>
-      DIEToDeclMap;
+  typedef llvm::DenseMap<DIERef, clang::Decl *> DIERefToDeclMap;
 
   lldb_private::TypeSystemClang &m_ast;
-  DIEToDeclMap m_die_to_decl;
+  DIERefToDeclMap m_dieref_to_decl;
   DIERefToDeclContextMap m_dieref_to_decl_ctx;
   DeclContextToFileDIERefMap m_decl_ctx_to_filedieref;
   DIERefToModuleMap m_dieref_to_module;
Index: lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
===================================================================
--- lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
+++ lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
@@ -3136,20 +3136,21 @@
     return nullptr;
   }
 
-  DIEToDeclMap::iterator cache_pos = m_die_to_decl.find(die.GetDIE());
-  if (cache_pos != m_die_to_decl.end())
+  DIERef dieref = *die.GetDIERef();
+  DIERefToDeclMap::iterator cache_pos = m_dieref_to_decl.find(dieref);
+  if (cache_pos != m_dieref_to_decl.end())
     return cache_pos->second;
 
   if (DWARFDIE spec_die = die.GetReferencedDIE(DW_AT_specification)) {
     clang::Decl *decl = GetClangDeclForDIE(spec_die);
-    m_die_to_decl[die.GetDIE()] = decl;
+    m_dieref_to_decl[dieref] = decl;
     return decl;
   }
 
   if (DWARFDIE abstract_origin_die =
           die.GetReferencedDIE(DW_AT_abstract_origin)) {
     clang::Decl *decl = GetClangDeclForDIE(abstract_origin_die);
-    m_die_to_decl[die.GetDIE()] = decl;
+    m_dieref_to_decl[dieref] = decl;
     return decl;
   }
 
@@ -3213,7 +3214,7 @@
     break;
   }
 
-  m_die_to_decl[die.GetDIE()] = decl;
+  m_dieref_to_decl[dieref] = decl;
 
   return decl;
 }


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D110401.374792.patch
Type: text/x-patch
Size: 2076 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20210924/ffe52964/attachment.bin>


More information about the lldb-commits mailing list