[Lldb-commits] [lldb] [lldb] Index static const members of classes, structs and unions as global variables in DWARF 4 and earlier (PR #111859)

Pavel Labath via lldb-commits lldb-commits at lists.llvm.org
Tue Nov 5 06:46:05 PST 2024


================
@@ -362,6 +369,18 @@ void ManualDWARFIndex::IndexUnitImpl(DWARFUnit &unit,
         set.namespaces.Insert(ConstString(name), ref);
       break;
 
+    case DW_TAG_member: {
+      // In DWARF 4 and earlier `static const` members of a struct, a class or a
+      // union have an entry tag `DW_TAG_member`, and are also tagged as
+      // `DW_AT_declaration`, but otherwise follow the same rules as
+      // `DW_TAG_variable`.
+      bool parent_is_class_type = false;
+      if (auto parent = die.GetParent())
+        parent_is_class_type = DWARFDIE(&unit, parent).IsStructUnionOrClass();
----------------
labath wrote:

No, because `parent` is a DWARFDebugInfoEntry, not a DWARFDIE :P

It's a (not entirely fortunate) result of trying to avoid any high level (expensive) operations, and of the fact that lldb's DWARFDebugInfoEntry (unlike the llvm) fork actually provides some functionality instead of being a simple data holder.

https://github.com/llvm/llvm-project/pull/111859


More information about the lldb-commits mailing list