[Lldb-commits] [PATCH] D70645: RFC 1/3: Unify src<->dst DWARFASTParser for CopyUniqueClassMethodTypes()

Jan Kratochvil via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Sun Nov 24 12:44:37 PST 2019


jankratochvil created this revision.
jankratochvil added a reviewer: labath.
jankratochvil added a project: LLDB.
Herald added a subscriber: aprantl.
Herald added a reviewer: shafik.

This patchset is removing non-DWARF code from `DWARFUnit` as discussed with @labath.
For removing the dependency on `DWARFDIE.GetCU()` (further patch) I have found I can no longer find two different parsers in this case.
IIUC it would mean `DW_AT_language` is different between the defining and declaring DIE tree - which can happen (and `lldbassert` in this patch would fail then - this `lldbassert` is removed in the future patch anyway) but it would be a buggy DWARF in such case.
I do not plan to check it in yet. I plan to finish it for use by DWZ patchset first (D40474 <https://reviews.llvm.org/D40474> et al.). Asking whether this is a good way forward.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D70645

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


Index: lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
===================================================================
--- lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
+++ lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
@@ -3774,10 +3774,10 @@
     }
   }
 
-  DWARFASTParserClang *src_dwarf_ast_parser =
+  DWARFASTParserClang *dwarf_ast_parser =
       (DWARFASTParserClang *)src_die.GetDWARFParser();
-  DWARFASTParserClang *dst_dwarf_ast_parser =
-      (DWARFASTParserClang *)dst_die.GetDWARFParser();
+  lldbassert(dwarf_ast_parser ==
+             (DWARFASTParserClang *)dst_die.GetDWARFParser());
 
   // Now do the work of linking the DeclContexts and Types.
   if (fast_path) {
@@ -3788,12 +3788,12 @@
       dst_die = dst_name_to_die.GetValueAtIndexUnchecked(idx);
 
       clang::DeclContext *src_decl_ctx =
-          src_dwarf_ast_parser->m_die_to_decl_ctx[src_die.GetDIE()];
+          dwarf_ast_parser->m_die_to_decl_ctx[src_die.GetDIE()];
       if (src_decl_ctx) {
         LLDB_LOGF(log, "uniquing decl context %p from 0x%8.8x for 0x%8.8x",
                   static_cast<void *>(src_decl_ctx), src_die.GetOffset(),
                   dst_die.GetOffset());
-        dst_dwarf_ast_parser->LinkDeclContextToDIE(src_decl_ctx, dst_die);
+        dwarf_ast_parser->LinkDeclContextToDIE(src_decl_ctx, dst_die);
       } else {
         LLDB_LOGF(log,
                   "warning: tried to unique decl context from 0x%8.8x for "
@@ -3832,12 +3832,12 @@
 
         if (src_die && (src_die.Tag() == dst_die.Tag())) {
           clang::DeclContext *src_decl_ctx =
-              src_dwarf_ast_parser->m_die_to_decl_ctx[src_die.GetDIE()];
+              dwarf_ast_parser->m_die_to_decl_ctx[src_die.GetDIE()];
           if (src_decl_ctx) {
             LLDB_LOGF(log, "uniquing decl context %p from 0x%8.8x for 0x%8.8x",
                       static_cast<void *>(src_decl_ctx), src_die.GetOffset(),
                       dst_die.GetOffset());
-            dst_dwarf_ast_parser->LinkDeclContextToDIE(src_decl_ctx, dst_die);
+            dwarf_ast_parser->LinkDeclContextToDIE(src_decl_ctx, dst_die);
           } else {
             LLDB_LOGF(log,
                       "warning: tried to unique decl context from 0x%8.8x "
@@ -3887,12 +3887,12 @@
       if (dst_die) {
         // Both classes have the artificial types, link them
         clang::DeclContext *src_decl_ctx =
-            src_dwarf_ast_parser->m_die_to_decl_ctx[src_die.GetDIE()];
+            dwarf_ast_parser->m_die_to_decl_ctx[src_die.GetDIE()];
         if (src_decl_ctx) {
           LLDB_LOGF(log, "uniquing decl context %p from 0x%8.8x for 0x%8.8x",
                     static_cast<void *>(src_decl_ctx), src_die.GetOffset(),
                     dst_die.GetOffset());
-          dst_dwarf_ast_parser->LinkDeclContextToDIE(src_decl_ctx, dst_die);
+          dwarf_ast_parser->LinkDeclContextToDIE(src_decl_ctx, dst_die);
         } else {
           LLDB_LOGF(log,
                     "warning: tried to unique decl context from 0x%8.8x "


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D70645.230820.patch
Type: text/x-patch
Size: 3071 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20191124/d523f31c/attachment.bin>


More information about the lldb-commits mailing list