[Lldb-commits] [PATCH] D110403: [nfc] [lldb] DWZ 07/17: Use DIERef for DIEToVariableSP m_die_to_variable_sp and GetDIEToVariable()

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


jankratochvil created this revision.
jankratochvil added reviewers: labath, clayborg.
jankratochvil added a project: LLDB.
Herald added a subscriber: JDevlieghere.
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/D110403

Files:
  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
@@ -45,7 +45,7 @@
 protected:
   DIERefToTypePtr &GetDIERefToType() override;
 
-  DIEToVariableSP &GetDIEToVariable() override;
+  DIERefToVariableSP &GetDIERefToVariable() override;
 
   DIEToClangType &GetForwardDeclDieToClangType() override;
 
Index: lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDwo.cpp
===================================================================
--- lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDwo.cpp
+++ lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDwo.cpp
@@ -80,8 +80,8 @@
   return GetBaseSymbolFile().GetDIERefToType();
 }
 
-SymbolFileDWARF::DIEToVariableSP &SymbolFileDWARFDwo::GetDIEToVariable() {
-  return GetBaseSymbolFile().GetDIEToVariable();
+SymbolFileDWARF::DIERefToVariableSP &SymbolFileDWARFDwo::GetDIERefToVariable() {
+  return GetBaseSymbolFile().GetDIERefToVariable();
 }
 
 SymbolFileDWARF::DIEToClangType &
Index: lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h
===================================================================
--- lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h
+++ lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h
@@ -320,8 +320,7 @@
 
 protected:
   typedef llvm::DenseMap<DIERef, lldb_private::Type *> DIERefToTypePtr;
-  typedef llvm::DenseMap<const DWARFDebugInfoEntry *, lldb::VariableSP>
-      DIEToVariableSP;
+  typedef llvm::DenseMap<DIERef, lldb::VariableSP> DIERefToVariableSP;
   typedef llvm::DenseMap<const DWARFDebugInfoEntry *,
                          lldb::opaque_compiler_type_t>
       DIEToClangType;
@@ -460,7 +459,9 @@
 
   virtual DIERefToTypePtr &GetDIERefToType() { return m_dieref_to_type; }
 
-  virtual DIEToVariableSP &GetDIEToVariable() { return m_die_to_variable_sp; }
+  virtual DIERefToVariableSP &GetDIERefToVariable() {
+    return m_dieref_to_variable_sp;
+  }
 
   virtual DIEToClangType &GetForwardDeclDieToClangType() {
     return m_forward_decl_die_to_clang_type;
@@ -512,7 +513,7 @@
   std::unique_ptr<DWARFDebugRanges> m_ranges;
   UniqueDWARFASTTypeMap m_unique_ast_type_map;
   DIERefToTypePtr m_dieref_to_type;
-  DIEToVariableSP m_die_to_variable_sp;
+  DIERefToVariableSP m_dieref_to_variable_sp;
   DIEToClangType m_forward_decl_die_to_clang_type;
   ClangTypeToDIE m_forward_decl_clang_type_to_die;
   llvm::DenseMap<dw_offset_t, lldb_private::FileSpecList>
Index: lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
===================================================================
--- lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
+++ lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
@@ -3093,7 +3093,7 @@
   if (!die)
     return nullptr;
 
-  if (VariableSP var_sp = GetDIEToVariable()[die.GetDIE()])
+  if (VariableSP var_sp = GetDIERefToVariable()[*die.GetDIERef()])
     return var_sp; // Already been parsed!
 
   const dw_tag_t tag = die.Tag();
@@ -3428,9 +3428,9 @@
   // missing vital information to be able to be displayed in the debugger
   // (missing location due to optimization, etc)) so we don't re-parse this
   // DIE over and over later...
-  GetDIEToVariable()[die.GetDIE()] = var_sp;
+  GetDIERefToVariable()[*die.GetDIERef()] = var_sp;
   if (spec_die)
-    GetDIEToVariable()[spec_die.GetDIE()] = var_sp;
+    GetDIERefToVariable()[*spec_die.GetDIERef()] = var_sp;
 
   return var_sp;
 }
@@ -3495,7 +3495,7 @@
     dw_tag_t tag = die.Tag();
 
     // Check to see if we have already parsed this variable or constant?
-    VariableSP var_sp = GetDIEToVariable()[die.GetDIE()];
+    VariableSP var_sp = GetDIERefToVariable()[*die.GetDIERef()];
     if (var_sp) {
       if (cc_variable_list)
         cc_variable_list->AddVariableIfUnique(var_sp);


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D110403.374794.patch
Type: text/x-patch
Size: 3925 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20210924/4c8e4356/attachment.bin>


More information about the lldb-commits mailing list