[Lldb-commits] [PATCH] D110404: [nfc] [lldb] DWZ 08/17: Use DIERef for DIEToClangType m_forward_decl_die_to_clang_type and GetForwardDeclDieToClangType()

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

Files:
  lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.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
@@ -47,7 +47,7 @@
 
   DIERefToVariableSP &GetDIERefToVariable() override;
 
-  DIEToClangType &GetForwardDeclDieToClangType() override;
+  DIERefToClangType &GetForwardDeclDIERefToClangType() override;
 
   ClangTypeToDIE &GetForwardDeclClangTypeToDie() override;
 
Index: lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDwo.cpp
===================================================================
--- lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDwo.cpp
+++ lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDwo.cpp
@@ -84,9 +84,9 @@
   return GetBaseSymbolFile().GetDIERefToVariable();
 }
 
-SymbolFileDWARF::DIEToClangType &
-SymbolFileDWARFDwo::GetForwardDeclDieToClangType() {
-  return GetBaseSymbolFile().GetForwardDeclDieToClangType();
+SymbolFileDWARF::DIERefToClangType &
+SymbolFileDWARFDwo::GetForwardDeclDIERefToClangType() {
+  return GetBaseSymbolFile().GetForwardDeclDIERefToClangType();
 }
 
 SymbolFileDWARF::ClangTypeToDIE &
Index: lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h
===================================================================
--- lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h
+++ lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h
@@ -321,9 +321,8 @@
 protected:
   typedef llvm::DenseMap<DIERef, lldb_private::Type *> DIERefToTypePtr;
   typedef llvm::DenseMap<DIERef, lldb::VariableSP> DIERefToVariableSP;
-  typedef llvm::DenseMap<const DWARFDebugInfoEntry *,
-                         lldb::opaque_compiler_type_t>
-      DIEToClangType;
+  typedef llvm::DenseMap<DIERef, lldb::opaque_compiler_type_t>
+      DIERefToClangType;
   typedef llvm::DenseMap<lldb::opaque_compiler_type_t, DIERef> ClangTypeToDIE;
 
   SymbolFileDWARF(const SymbolFileDWARF &) = delete;
@@ -463,8 +462,8 @@
     return m_dieref_to_variable_sp;
   }
 
-  virtual DIEToClangType &GetForwardDeclDieToClangType() {
-    return m_forward_decl_die_to_clang_type;
+  virtual DIERefToClangType &GetForwardDeclDIERefToClangType() {
+    return m_forward_decl_dieref_to_clang_type;
   }
 
   virtual ClangTypeToDIE &GetForwardDeclClangTypeToDie() {
@@ -514,7 +513,7 @@
   UniqueDWARFASTTypeMap m_unique_ast_type_map;
   DIERefToTypePtr m_dieref_to_type;
   DIERefToVariableSP m_dieref_to_variable_sp;
-  DIEToClangType m_forward_decl_die_to_clang_type;
+  DIERefToClangType m_forward_decl_dieref_to_clang_type;
   ClangTypeToDIE m_forward_decl_clang_type_to_die;
   llvm::DenseMap<dw_offset_t, lldb_private::FileSpecList>
       m_type_unit_support_files;
Index: lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
===================================================================
--- lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
+++ lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
@@ -825,7 +825,8 @@
   CompilerType enumerator_clang_type;
   CompilerType clang_type;
   clang_type.SetCompilerType(
-      &m_ast, dwarf->GetForwardDeclDieToClangType().lookup(die.GetDIE()));
+      &m_ast,
+      dwarf->GetForwardDeclDIERefToClangType().lookup(*die.GetDIERef()));
   if (!clang_type) {
     if (attrs.type.IsValid()) {
       Type *enumerator_type =
@@ -1589,7 +1590,8 @@
   (void)tag_decl_kind;
   bool clang_type_was_created = false;
   clang_type.SetCompilerType(
-      &m_ast, dwarf->GetForwardDeclDieToClangType().lookup(die.GetDIE()));
+      &m_ast,
+      dwarf->GetForwardDeclDIERefToClangType().lookup(*die.GetDIERef()));
   if (!clang_type) {
     clang::DeclContext *decl_ctx =
         GetClangDeclContextContainingDIE(die, nullptr);
@@ -1726,7 +1728,7 @@
       // Can't assume m_ast.GetSymbolFile() is actually a
       // SymbolFileDWARF, it can be a SymbolFileDWARFDebugMap for Apple
       // binaries.
-      dwarf->GetForwardDeclDieToClangType()[die.GetDIE()] =
+      dwarf->GetForwardDeclDIERefToClangType()[*die.GetDIERef()] =
           clang_type.GetOpaqueQualType();
       dwarf->GetForwardDeclClangTypeToDie().try_emplace(
           ClangUtil::RemoveFastQualifiers(clang_type).GetOpaqueQualType(),


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D110404.374795.patch
Type: text/x-patch
Size: 4272 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20210924/70d98358/attachment-0001.bin>


More information about the lldb-commits mailing list