[Lldb-commits] [lldb] [lldb] Lookup static const members in FindGlobalVariables (PR #111859)

Pavel Labath via lldb-commits lldb-commits at lists.llvm.org
Mon Nov 4 00:53:16 PST 2024


================
@@ -362,6 +369,23 @@ 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_external` and `DW_AT_declaration`, but otherwise follow the
+      // same rules as `DW_TAG_variable`.
+      if (unit.GetVersion() >= 5)
+        break;
----------------
labath wrote:

Let's put this into the first switch statement (something like `case DW_TAG_member: if (unit.GetVersion() >= 5) continue; else break;`), so that we avoid parsing the attributes when we know we're not going to use them.

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


More information about the lldb-commits mailing list