[Lldb-commits] [PATCH] D156774: [lldb][DWARFASTParserClang] Resolve nested types when parsing structures

Vlad Serebrennikov via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Sun Aug 20 03:23:52 PDT 2023


Endill updated this revision to Diff 551811.
Endill added a comment.

Follow the `DW_TAG_subprogram` approach for `DW_TAG_enum_type`, `DW_TAG_structure_type`, and `DW_TAG_union_type`: rely on `ParseType()` called afterwards instead of eagerly parsing them.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D156774/new/

https://reviews.llvm.org/D156774

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
@@ -157,7 +157,7 @@
   bool ParseChildMembers(
       const DWARFDIE &die, lldb_private::CompilerType &class_compiler_type,
       std::vector<std::unique_ptr<clang::CXXBaseSpecifier>> &base_classes,
-      std::vector<DWARFDIE> &member_function_dies,
+      std::vector<DWARFDIE> &member_function_and_type_dies,
       DelayedPropertyList &delayed_properties,
       const lldb::AccessType default_accessibility,
       lldb_private::ClangASTImporter::LayoutInfo &layout_info);
Index: lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
===================================================================
--- lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
+++ lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
@@ -2149,14 +2149,14 @@
 
     std::vector<std::unique_ptr<clang::CXXBaseSpecifier>> bases;
     // Parse members and base classes first
-    std::vector<DWARFDIE> member_function_dies;
+    std::vector<DWARFDIE> member_function_and_type_dies;
 
     DelayedPropertyList delayed_properties;
-    ParseChildMembers(die, clang_type, bases, member_function_dies,
+    ParseChildMembers(die, clang_type, bases, member_function_and_type_dies,
                       delayed_properties, default_accessibility, layout_info);
 
-    // Now parse any methods if there were any...
-    for (const DWARFDIE &die : member_function_dies)
+    // Now parse any methods or nested types if there were any...
+    for (const DWARFDIE &die : member_function_and_type_dies)
       dwarf->ResolveType(die);
 
     if (type_is_objc_object_or_interface) {
@@ -2999,7 +2999,7 @@
 bool DWARFASTParserClang::ParseChildMembers(
     const DWARFDIE &parent_die, CompilerType &class_clang_type,
     std::vector<std::unique_ptr<clang::CXXBaseSpecifier>> &base_classes,
-    std::vector<DWARFDIE> &member_function_dies,
+    std::vector<DWARFDIE> &member_function_and_type_dies,
     DelayedPropertyList &delayed_properties,
     const AccessType default_accessibility,
     ClangASTImporter::LayoutInfo &layout_info) {
@@ -3028,8 +3028,11 @@
       break;
 
     case DW_TAG_subprogram:
+    case DW_TAG_enumeration_type:
+    case DW_TAG_structure_type:
+    case DW_TAG_union_type:
       // Let the type parsing code handle this one for us.
-      member_function_dies.push_back(die);
+      member_function_and_type_dies.push_back(die);
       break;
 
     case DW_TAG_inheritance:


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D156774.551811.patch
Type: text/x-patch
Size: 2664 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20230820/a4c88596/attachment.bin>


More information about the lldb-commits mailing list