Skip to content

[lldb][DWARFIndex][NFC] Change GetNamespace/GetGlobalVariables APIs to use IterationAction #151668

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Conversation

Michael137
Copy link
Member

Continuation from #151489

@llvmbot
Copy link
Member

llvmbot commented Aug 1, 2025

@llvm/pr-subscribers-lldb

Author: Michael Buch (Michael137)

Changes

Continuation from #151489


Patch is 22.60 KiB, truncated to 20.00 KiB below, full version: https://github.com/llvm/llvm-project/pull/151668.diff

9 Files Affected:

  • (modified) lldb/source/Plugins/SymbolFile/DWARF/AppleDWARFIndex.cpp (+9-9)
  • (modified) lldb/source/Plugins/SymbolFile/DWARF/AppleDWARFIndex.h (+4-4)
  • (modified) lldb/source/Plugins/SymbolFile/DWARF/DWARFIndex.cpp (+4-4)
  • (modified) lldb/source/Plugins/SymbolFile/DWARF/DWARFIndex.h (+7-7)
  • (modified) lldb/source/Plugins/SymbolFile/DWARF/DebugNamesDWARFIndex.cpp (+13-13)
  • (modified) lldb/source/Plugins/SymbolFile/DWARF/DebugNamesDWARFIndex.h (+6-5)
  • (modified) lldb/source/Plugins/SymbolFile/DWARF/ManualDWARFIndex.cpp (+8-8)
  • (modified) lldb/source/Plugins/SymbolFile/DWARF/ManualDWARFIndex.h (+5-4)
  • (modified) lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp (+19-10)
diff --git a/lldb/source/Plugins/SymbolFile/DWARF/AppleDWARFIndex.cpp b/lldb/source/Plugins/SymbolFile/DWARF/AppleDWARFIndex.cpp
index 9762ead3273da..8e09ce8650cb0 100644
--- a/lldb/source/Plugins/SymbolFile/DWARF/AppleDWARFIndex.cpp
+++ b/lldb/source/Plugins/SymbolFile/DWARF/AppleDWARFIndex.cpp
@@ -136,19 +136,19 @@ void AppleDWARFIndex::SearchFor(const llvm::AppleAcceleratorTable &table,
 }
 
 void AppleDWARFIndex::GetGlobalVariables(
-    ConstString basename, llvm::function_ref<bool(DWARFDIE die)> callback) {
+    ConstString basename, llvm::function_ref<IterationAction(DWARFDIE die)> callback) {
   if (!m_apple_names_up)
     return;
-  SearchFor(*m_apple_names_up, basename, callback);
+  SearchFor(*m_apple_names_up, basename, IterationActionAdaptor(callback));
 }
 
 void AppleDWARFIndex::GetGlobalVariables(
     const RegularExpression &regex,
-    llvm::function_ref<bool(DWARFDIE die)> callback) {
+    llvm::function_ref<IterationAction(DWARFDIE die)> callback) {
   if (!m_apple_names_up)
     return;
 
-  DIERefCallbackImpl converted_cb = DIERefCallback(callback, regex.GetText());
+  DIERefCallbackImpl converted_cb = DIERefCallback(IterationActionAdaptor(callback), regex.GetText());
 
   for (const auto &entry : m_apple_names_up->entries())
     if (std::optional<llvm::StringRef> name = entry.readName();
@@ -158,7 +158,7 @@ void AppleDWARFIndex::GetGlobalVariables(
 }
 
 void AppleDWARFIndex::GetGlobalVariables(
-    DWARFUnit &cu, llvm::function_ref<bool(DWARFDIE die)> callback) {
+    DWARFUnit &cu, llvm::function_ref<IterationAction(DWARFDIE die)> callback) {
   if (!m_apple_names_up)
     return;
 
@@ -169,7 +169,7 @@ void AppleDWARFIndex::GetGlobalVariables(
     return val.has_value() && *val >= lower_bound && *val < upper_bound;
   };
 
-  DIERefCallbackImpl converted_cb = DIERefCallback(callback);
+  DIERefCallbackImpl converted_cb = DIERefCallback(IterationActionAdaptor(callback));
   for (auto entry : m_apple_names_up->entries()) {
     if (is_in_range(entry.BaseEntry.getDIESectionOffset()))
       if (!converted_cb(entry.BaseEntry))
@@ -267,10 +267,10 @@ void AppleDWARFIndex::GetTypes(
 }
 
 void AppleDWARFIndex::GetNamespaces(
-    ConstString name, llvm::function_ref<bool(DWARFDIE die)> callback) {
+    ConstString name, llvm::function_ref<IterationAction(DWARFDIE die)> callback) {
   if (!m_apple_namespaces_up)
     return;
-  SearchFor(*m_apple_namespaces_up, name, callback);
+  SearchFor(*m_apple_namespaces_up, name, IterationActionAdaptor(callback));
 }
 
 void AppleDWARFIndex::GetFunctions(
@@ -298,7 +298,7 @@ void AppleDWARFIndex::GetFunctions(
 void AppleDWARFIndex::GetFunctions(
     const RegularExpression &regex,
     llvm::function_ref<IterationAction(DWARFDIE die)> callback) {
-  return GetGlobalVariables(regex, IterationActionAdaptor(callback));
+  return GetGlobalVariables(regex, callback);
 }
 
 void AppleDWARFIndex::Dump(Stream &s) {
diff --git a/lldb/source/Plugins/SymbolFile/DWARF/AppleDWARFIndex.h b/lldb/source/Plugins/SymbolFile/DWARF/AppleDWARFIndex.h
index c0f0eb646ee98..1965ba7b59d57 100644
--- a/lldb/source/Plugins/SymbolFile/DWARF/AppleDWARFIndex.h
+++ b/lldb/source/Plugins/SymbolFile/DWARF/AppleDWARFIndex.h
@@ -43,13 +43,13 @@ class AppleDWARFIndex : public DWARFIndex {
 
   void
   GetGlobalVariables(ConstString basename,
-                     llvm::function_ref<bool(DWARFDIE die)> callback) override;
+                     llvm::function_ref<IterationAction(DWARFDIE die)> callback) override;
   void
   GetGlobalVariables(const RegularExpression &regex,
-                     llvm::function_ref<bool(DWARFDIE die)> callback) override;
+                     llvm::function_ref<IterationAction(DWARFDIE die)> callback) override;
   void
   GetGlobalVariables(DWARFUnit &cu,
-                     llvm::function_ref<bool(DWARFDIE die)> callback) override;
+                     llvm::function_ref<IterationAction(DWARFDIE die)> callback) override;
   void GetObjCMethods(ConstString class_name,
                       llvm::function_ref<bool(DWARFDIE die)> callback) override;
   void GetCompleteObjCClass(
@@ -60,7 +60,7 @@ class AppleDWARFIndex : public DWARFIndex {
   void GetTypes(const DWARFDeclContext &context,
                 llvm::function_ref<bool(DWARFDIE die)> callback) override;
   void GetNamespaces(ConstString name,
-                     llvm::function_ref<bool(DWARFDIE die)> callback) override;
+                     llvm::function_ref<IterationAction(DWARFDIE die)> callback) override;
   void GetFunctions(
       const Module::LookupInfo &lookup_info, SymbolFileDWARF &dwarf,
       const CompilerDeclContext &parent_decl_ctx,
diff --git a/lldb/source/Plugins/SymbolFile/DWARF/DWARFIndex.cpp b/lldb/source/Plugins/SymbolFile/DWARF/DWARFIndex.cpp
index a8065061fdf21..579103046644d 100644
--- a/lldb/source/Plugins/SymbolFile/DWARF/DWARFIndex.cpp
+++ b/lldb/source/Plugins/SymbolFile/DWARF/DWARFIndex.cpp
@@ -165,16 +165,16 @@ bool DWARFIndex::ProcessTypeDIEMatchQuery(
 
 void DWARFIndex::GetNamespacesWithParents(
     ConstString name, const CompilerDeclContext &parent_decl_ctx,
-    llvm::function_ref<bool(DWARFDIE die)> callback) {
+    llvm::function_ref<IterationAction(DWARFDIE die)> callback) {
   GetNamespaces(name, [&](DWARFDIE die) {
     return ProcessNamespaceDieMatchParents(parent_decl_ctx, die, callback);
   });
 }
 
-bool DWARFIndex::ProcessNamespaceDieMatchParents(
+IterationAction DWARFIndex::ProcessNamespaceDieMatchParents(
     const CompilerDeclContext &parent_decl_ctx, DWARFDIE die,
-    llvm::function_ref<bool(DWARFDIE die)> callback) {
+    llvm::function_ref<IterationAction(DWARFDIE die)> callback) {
   if (!SymbolFileDWARF::DIEInDeclContext(parent_decl_ctx, die))
-    return true;
+    return IterationAction::Continue;
   return callback(die);
 }
diff --git a/lldb/source/Plugins/SymbolFile/DWARF/DWARFIndex.h b/lldb/source/Plugins/SymbolFile/DWARF/DWARFIndex.h
index 3578824e720fb..bef0d42441da6 100644
--- a/lldb/source/Plugins/SymbolFile/DWARF/DWARFIndex.h
+++ b/lldb/source/Plugins/SymbolFile/DWARF/DWARFIndex.h
@@ -35,15 +35,15 @@ class DWARFIndex {
   /// the consumer.
   virtual void
   GetGlobalVariables(ConstString basename,
-                     llvm::function_ref<bool(DWARFDIE die)> callback) = 0;
+                     llvm::function_ref<IterationAction(DWARFDIE die)> callback) = 0;
 
   virtual void
   GetGlobalVariables(const RegularExpression &regex,
-                     llvm::function_ref<bool(DWARFDIE die)> callback) = 0;
+                     llvm::function_ref<IterationAction(DWARFDIE die)> callback) = 0;
   /// \a cu must be the skeleton unit if possible, not GetNonSkeletonUnit().
   virtual void
   GetGlobalVariables(DWARFUnit &cu,
-                     llvm::function_ref<bool(DWARFDIE die)> callback) = 0;
+                     llvm::function_ref<IterationAction(DWARFDIE die)> callback) = 0;
   virtual void
   GetObjCMethods(ConstString class_name,
                  llvm::function_ref<bool(DWARFDIE die)> callback) = 0;
@@ -64,7 +64,7 @@ class DWARFIndex {
                         llvm::function_ref<bool(DWARFDIE die)> callback);
   virtual void
   GetNamespaces(ConstString name,
-                llvm::function_ref<bool(DWARFDIE die)> callback) = 0;
+                llvm::function_ref<IterationAction(DWARFDIE die)> callback) = 0;
   /// Get type DIEs meeting requires of \a query.
   /// in its decl parent chain as subset.  A base implementation is provided,
   /// Specializations should override this if they are able to provide a faster
@@ -79,7 +79,7 @@ class DWARFIndex {
   virtual void
   GetNamespacesWithParents(ConstString name,
                            const CompilerDeclContext &parent_decl_ctx,
-                           llvm::function_ref<bool(DWARFDIE die)> callback);
+                           llvm::function_ref<IterationAction(DWARFDIE die)> callback);
   virtual void
   GetFunctions(const Module::LookupInfo &lookup_info, SymbolFileDWARF &dwarf,
                const CompilerDeclContext &parent_decl_ctx,
@@ -139,9 +139,9 @@ class DWARFIndex {
   bool
   ProcessTypeDIEMatchQuery(TypeQuery &query, DWARFDIE die,
                            llvm::function_ref<bool(DWARFDIE die)> callback);
-  bool ProcessNamespaceDieMatchParents(
+  IterationAction ProcessNamespaceDieMatchParents(
       const CompilerDeclContext &parent_decl_ctx, DWARFDIE die,
-      llvm::function_ref<bool(DWARFDIE die)> callback);
+      llvm::function_ref<IterationAction(DWARFDIE die)> callback);
 
   /// Helper to convert callbacks that return an \c IterationAction
   /// to a callback that returns a \c bool, where \c true indicates
diff --git a/lldb/source/Plugins/SymbolFile/DWARF/DebugNamesDWARFIndex.cpp b/lldb/source/Plugins/SymbolFile/DWARF/DebugNamesDWARFIndex.cpp
index 3ae9fcc70893b..b998a21150883 100644
--- a/lldb/source/Plugins/SymbolFile/DWARF/DebugNamesDWARFIndex.cpp
+++ b/lldb/source/Plugins/SymbolFile/DWARF/DebugNamesDWARFIndex.cpp
@@ -178,13 +178,13 @@ void DebugNamesDWARFIndex::MaybeLogLookupError(llvm::Error error,
 }
 
 void DebugNamesDWARFIndex::GetGlobalVariables(
-    ConstString basename, llvm::function_ref<bool(DWARFDIE die)> callback) {
+    ConstString basename, llvm::function_ref<IterationAction(DWARFDIE die)> callback) {
   for (const DebugNames::Entry &entry :
        m_debug_names_up->equal_range(basename.GetStringRef())) {
     if (entry.tag() != DW_TAG_variable)
       continue;
 
-    if (!ProcessEntry(entry, callback))
+    if (!ProcessEntry(entry, IterationActionAdaptor(callback)))
       return;
   }
 
@@ -193,7 +193,7 @@ void DebugNamesDWARFIndex::GetGlobalVariables(
 
 void DebugNamesDWARFIndex::GetGlobalVariables(
     const RegularExpression &regex,
-    llvm::function_ref<bool(DWARFDIE die)> callback) {
+    llvm::function_ref<IterationAction(DWARFDIE die)> callback) {
   for (const DebugNames::NameIndex &ni: *m_debug_names_up) {
     for (DebugNames::NameTableEntry nte: ni) {
       Mangled mangled_name(nte.getString());
@@ -206,7 +206,7 @@ void DebugNamesDWARFIndex::GetGlobalVariables(
         if (entry_or->tag() != DW_TAG_variable)
           continue;
 
-        if (!ProcessEntry(*entry_or, callback))
+        if (!ProcessEntry(*entry_or, IterationActionAdaptor(callback)))
           return;
       }
       MaybeLogLookupError(entry_or.takeError(), ni, nte.getString());
@@ -217,7 +217,7 @@ void DebugNamesDWARFIndex::GetGlobalVariables(
 }
 
 void DebugNamesDWARFIndex::GetGlobalVariables(
-    DWARFUnit &cu, llvm::function_ref<bool(DWARFDIE die)> callback) {
+    DWARFUnit &cu, llvm::function_ref<IterationAction(DWARFDIE die)> callback) {
   uint64_t cu_offset = cu.GetOffset();
   bool found_entry_for_cu = false;
   for (const DebugNames::NameIndex &ni : *m_debug_names_up) {
@@ -242,7 +242,7 @@ void DebugNamesDWARFIndex::GetGlobalVariables(
           continue;
 
         found_entry_for_cu = true;
-        if (!ProcessEntry(*entry_or, callback))
+        if (!ProcessEntry(*entry_or, IterationActionAdaptor(callback)))
           return;
       }
       MaybeLogLookupError(entry_or.takeError(), ni, nte.getString());
@@ -482,13 +482,13 @@ void DebugNamesDWARFIndex::GetTypes(
 }
 
 void DebugNamesDWARFIndex::GetNamespaces(
-    ConstString name, llvm::function_ref<bool(DWARFDIE die)> callback) {
+    ConstString name, llvm::function_ref<IterationAction(DWARFDIE die)> callback) {
   for (const DebugNames::Entry &entry :
        m_debug_names_up->equal_range(name.GetStringRef())) {
     llvm::dwarf::Tag entry_tag = entry.tag();
     if (entry_tag == DW_TAG_namespace ||
         entry_tag == DW_TAG_imported_declaration) {
-      if (!ProcessEntry(entry, callback))
+      if (!ProcessEntry(entry, IterationActionAdaptor(callback)))
         return;
     }
   }
@@ -566,7 +566,7 @@ void DebugNamesDWARFIndex::GetTypesWithQuery(
 
 void DebugNamesDWARFIndex::GetNamespacesWithParents(
     ConstString name, const CompilerDeclContext &parent_decl_ctx,
-    llvm::function_ref<bool(DWARFDIE die)> callback) {
+    llvm::function_ref<IterationAction(DWARFDIE die)> callback) {
   std::vector<lldb_private::CompilerContext> parent_contexts =
       parent_decl_ctx.GetCompilerContext();
   llvm::SmallVector<CompilerContext> parent_named_contexts;
@@ -582,21 +582,21 @@ void DebugNamesDWARFIndex::GetNamespacesWithParents(
           getParentChain(entry);
       if (!parent_chain) {
         // Fallback: use the base class implementation.
-        if (!ProcessEntry(entry, [&](DWARFDIE die) {
+        if (!ProcessEntry(entry, IterationActionAdaptor([&](DWARFDIE die) {
               return ProcessNamespaceDieMatchParents(parent_decl_ctx, die,
                                                      callback);
-            }))
+            })))
           return;
         continue;
       }
 
       if (WithinParentChain(parent_named_contexts, *parent_chain)) {
-        if (!ProcessEntry(entry, [&](DWARFDIE die) {
+        if (!ProcessEntry(entry, IterationActionAdaptor([&](DWARFDIE die) {
               // After .debug_names filtering still sending to base class for
               // further filtering before calling the callback.
               return ProcessNamespaceDieMatchParents(parent_decl_ctx, die,
                                                      callback);
-            }))
+            })))
           // If the callback returns false, we're done.
           return;
       }
diff --git a/lldb/source/Plugins/SymbolFile/DWARF/DebugNamesDWARFIndex.h b/lldb/source/Plugins/SymbolFile/DWARF/DebugNamesDWARFIndex.h
index 210591904e419..ebf23cbab4253 100644
--- a/lldb/source/Plugins/SymbolFile/DWARF/DebugNamesDWARFIndex.h
+++ b/lldb/source/Plugins/SymbolFile/DWARF/DebugNamesDWARFIndex.h
@@ -13,6 +13,7 @@
 #include "Plugins/SymbolFile/DWARF/ManualDWARFIndex.h"
 #include "Plugins/SymbolFile/DWARF/SymbolFileDWARF.h"
 #include "lldb/Utility/ConstString.h"
+#include "lldb/lldb-private-enumerations.h"
 #include "llvm/DebugInfo/DWARF/DWARFAcceleratorTable.h"
 #include <optional>
 
@@ -28,13 +29,13 @@ class DebugNamesDWARFIndex : public DWARFIndex {
 
   void
   GetGlobalVariables(ConstString basename,
-                     llvm::function_ref<bool(DWARFDIE die)> callback) override;
+                     llvm::function_ref<IterationAction(DWARFDIE die)> callback) override;
   void
   GetGlobalVariables(const RegularExpression &regex,
-                     llvm::function_ref<bool(DWARFDIE die)> callback) override;
+                     llvm::function_ref<IterationAction(DWARFDIE die)> callback) override;
   void
   GetGlobalVariables(DWARFUnit &cu,
-                     llvm::function_ref<bool(DWARFDIE die)> callback) override;
+                     llvm::function_ref<IterationAction(DWARFDIE die)> callback) override;
   void
   GetObjCMethods(ConstString class_name,
                  llvm::function_ref<bool(DWARFDIE die)> callback) override {}
@@ -51,13 +52,13 @@ class DebugNamesDWARFIndex : public DWARFIndex {
   void GetTypes(const DWARFDeclContext &context,
                 llvm::function_ref<bool(DWARFDIE die)> callback) override;
   void GetNamespaces(ConstString name,
-                     llvm::function_ref<bool(DWARFDIE die)> callback) override;
+                     llvm::function_ref<IterationAction(DWARFDIE die)> callback) override;
   void
   GetTypesWithQuery(TypeQuery &query,
                     llvm::function_ref<bool(DWARFDIE die)> callback) override;
   void GetNamespacesWithParents(
       ConstString name, const CompilerDeclContext &parent_decl_ctx,
-      llvm::function_ref<bool(DWARFDIE die)> callback) override;
+      llvm::function_ref<IterationAction(DWARFDIE die)> callback) override;
   void GetFunctions(
       const Module::LookupInfo &lookup_info, SymbolFileDWARF &dwarf,
       const CompilerDeclContext &parent_decl_ctx,
diff --git a/lldb/source/Plugins/SymbolFile/DWARF/ManualDWARFIndex.cpp b/lldb/source/Plugins/SymbolFile/DWARF/ManualDWARFIndex.cpp
index f96ac7e8793e4..542dec110bd75 100644
--- a/lldb/source/Plugins/SymbolFile/DWARF/ManualDWARFIndex.cpp
+++ b/lldb/source/Plugins/SymbolFile/DWARF/ManualDWARFIndex.cpp
@@ -414,23 +414,23 @@ void ManualDWARFIndex::IndexUnitImpl(DWARFUnit &unit,
 }
 
 void ManualDWARFIndex::GetGlobalVariables(
-    ConstString basename, llvm::function_ref<bool(DWARFDIE die)> callback) {
+    ConstString basename, llvm::function_ref<IterationAction(DWARFDIE die)> callback) {
   Index();
   m_set.globals.Find(basename,
-                     DIERefCallback(callback, basename.GetStringRef()));
+                     DIERefCallback(IterationActionAdaptor(callback), basename.GetStringRef()));
 }
 
 void ManualDWARFIndex::GetGlobalVariables(
     const RegularExpression &regex,
-    llvm::function_ref<bool(DWARFDIE die)> callback) {
+    llvm::function_ref<IterationAction(DWARFDIE die)> callback) {
   Index();
-  m_set.globals.Find(regex, DIERefCallback(callback, regex.GetText()));
+  m_set.globals.Find(regex, DIERefCallback(IterationActionAdaptor(callback), regex.GetText()));
 }
 
 void ManualDWARFIndex::GetGlobalVariables(
-    DWARFUnit &unit, llvm::function_ref<bool(DWARFDIE die)> callback) {
+    DWARFUnit &unit, llvm::function_ref<IterationAction(DWARFDIE die)> callback) {
   Index();
-  m_set.globals.FindAllEntriesForUnit(unit, DIERefCallback(callback));
+  m_set.globals.FindAllEntriesForUnit(unit, DIERefCallback(IterationActionAdaptor(callback)));
 }
 
 void ManualDWARFIndex::GetObjCMethods(
@@ -464,9 +464,9 @@ void ManualDWARFIndex::GetTypes(
 }
 
 void ManualDWARFIndex::GetNamespaces(
-    ConstString name, llvm::function_ref<bool(DWARFDIE die)> callback) {
+    ConstString name, llvm::function_ref<IterationAction(DWARFDIE die)> callback) {
   Index();
-  m_set.namespaces.Find(name, DIERefCallback(callback, name.GetStringRef()));
+  m_set.namespaces.Find(name, DIERefCallback(IterationActionAdaptor(callback), name.GetStringRef()));
 }
 
 void ManualDWARFIndex::GetFunctions(
diff --git a/lldb/source/Plugins/SymbolFile/DWARF/ManualDWARFIndex.h b/lldb/source/Plugins/SymbolFile/DWARF/ManualDWARFIndex.h
index 5685ba456f423..d58f49f0001df 100644
--- a/lldb/source/Plugins/SymbolFile/DWARF/ManualDWARFIndex.h
+++ b/lldb/source/Plugins/SymbolFile/DWARF/ManualDWARFIndex.h
@@ -12,6 +12,7 @@
 #include "Plugins/SymbolFile/DWARF/DWARFIndex.h"
 #include "Plugins/SymbolFile/DWARF/ManualDWARFIndexSet.h"
 #include "Plugins/SymbolFile/DWARF/NameToDIE.h"
+#include "lldb/lldb-private-enumerations.h"
 #include "llvm/ADT/DenseSet.h"
 
 namespace lldb_private::plugin {
@@ -32,13 +33,13 @@ class ManualDWARFIndex : public DWARFIndex {
 
   void
   GetGlobalVariables(ConstString basename,
-                     llvm::function_ref<bool(DWARFDIE die)> callback) override;
+                     llvm::function_ref<IterationAction(DWARFDIE die)> callback) override;
   void
   GetGlobalVariables(const RegularExpression &regex,
-                     llvm::function_ref<bool(DWARFDIE die)> callback) override;
+                     llvm::function_ref<IterationAction(DWARFDIE die)> callback) override;
   void
   GetGlobalVariables(DWARFUnit &unit,
-                     llvm::function_ref<bool(DWARFDIE die)> callback) override;
+                     llvm::function_ref<IterationAction(DWARFDIE die)> callback) override;
   void GetObjCMethods(ConstString class_name,
                       llvm::function_ref<bool(DWARFDIE die)> callback) override;
   void GetCompleteObjCClass(
@@ -49,7 +50,7 @@ class ManualDWARFIndex : public DWARFIndex {
   void GetTypes(const DWARFDeclContext &context,
                 llvm::function_ref<bool(DWARFDIE die)> callback) override;
   void GetNamespaces(ConstString name,
-                     llvm::function_ref<bool(DWARFDIE die)> callback) override;
+                     llvm::function_ref<IterationAction(DWARFDIE die)> callback) override;
   void GetFunctions(
       const Module::LookupInfo &lookup_info, SymbolFileDWARF &dwarf,
       const CompilerDeclContext &parent_decl_ctx,
diff --git a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
index a3ba061424cc1..42a66ce75d6d6 100644
--- a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
+++ b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
@@ -2349,11 +2349,11 @@ void SymbolFileDWARF::FindGlobalVariables(
     assert(sc.module_sp);
 
     if (die.Tag() != DW_TAG_variable && die.Tag() != DW_TAG_member)
-      return true;
+      return Iterat...
[truncated]

Copy link

github-actions bot commented Aug 1, 2025

✅ With the latest revision this PR passed the C/C++ code formatter.

@Michael137 Michael137 merged commit 0bdb4a3 into llvm:main Aug 2, 2025
9 checks passed
@Michael137 Michael137 deleted the lldb/dwarf-index-iteration-action-get-namespace branch August 2, 2025 14:28
@llvm-ci
Copy link
Collaborator

llvm-ci commented Aug 2, 2025

LLVM Buildbot has detected a new failure on builder lldb-aarch64-ubuntu running on linaro-lldb-aarch64-ubuntu while building lldb at step 6 "test".

Full details are available at: https://lab.llvm.org/buildbot/#/builders/59/builds/22006

Here is the relevant piece of the build log for the reference
Step 6 (test) failure: build (failure)
...
PASS: lldb-unit :: ValueObject/./LLDBValueObjectTests/7/12 (2285 of 2294)
PASS: lldb-unit :: ValueObject/./LLDBValueObjectTests/9/12 (2286 of 2294)
PASS: lldb-unit :: tools/lldb-server/tests/./LLDBServerTests/0/2 (2287 of 2294)
PASS: lldb-unit :: tools/lldb-server/tests/./LLDBServerTests/1/2 (2288 of 2294)
PASS: lldb-unit :: Target/./TargetTests/11/14 (2289 of 2294)
PASS: lldb-unit :: Host/./HostTests/1/8 (2290 of 2294)
PASS: lldb-unit :: Host/./HostTests/7/8 (2291 of 2294)
PASS: lldb-unit :: Host/./HostTests/3/8 (2292 of 2294)
PASS: lldb-unit :: Process/gdb-remote/./ProcessGdbRemoteTests/8/9 (2293 of 2294)
UNRESOLVED: lldb-api :: tools/lldb-server/TestLldbGdbServer.py (2294 of 2294)
******************** TEST 'lldb-api :: tools/lldb-server/TestLldbGdbServer.py' FAILED ********************
Script:
--
/usr/bin/python3.10 /home/tcwg-buildbot/worker/lldb-aarch64-ubuntu/llvm-project/lldb/test/API/dotest.py -u CXXFLAGS -u CFLAGS --env LLVM_LIBS_DIR=/home/tcwg-buildbot/worker/lldb-aarch64-ubuntu/build/./lib --env LLVM_INCLUDE_DIR=/home/tcwg-buildbot/worker/lldb-aarch64-ubuntu/build/include --env LLVM_TOOLS_DIR=/home/tcwg-buildbot/worker/lldb-aarch64-ubuntu/build/./bin --arch aarch64 --build-dir /home/tcwg-buildbot/worker/lldb-aarch64-ubuntu/build/lldb-test-build.noindex --lldb-module-cache-dir /home/tcwg-buildbot/worker/lldb-aarch64-ubuntu/build/lldb-test-build.noindex/module-cache-lldb/lldb-api --clang-module-cache-dir /home/tcwg-buildbot/worker/lldb-aarch64-ubuntu/build/lldb-test-build.noindex/module-cache-clang/lldb-api --executable /home/tcwg-buildbot/worker/lldb-aarch64-ubuntu/build/./bin/lldb --compiler /home/tcwg-buildbot/worker/lldb-aarch64-ubuntu/build/./bin/clang --dsymutil /home/tcwg-buildbot/worker/lldb-aarch64-ubuntu/build/./bin/dsymutil --make /usr/bin/gmake --llvm-tools-dir /home/tcwg-buildbot/worker/lldb-aarch64-ubuntu/build/./bin --lldb-obj-root /home/tcwg-buildbot/worker/lldb-aarch64-ubuntu/build/tools/lldb --lldb-libs-dir /home/tcwg-buildbot/worker/lldb-aarch64-ubuntu/build/./lib --cmake-build-type Release /home/tcwg-buildbot/worker/lldb-aarch64-ubuntu/llvm-project/lldb/test/API/tools/lldb-server -p TestLldbGdbServer.py
--
Exit Code: 1

Command Output (stdout):
--
lldb version 22.0.0git (https://github.com/llvm/llvm-project.git revision 0bdb4a36465407a529405cc7b84c2d5acb6528c2)
  clang revision 0bdb4a36465407a529405cc7b84c2d5acb6528c2
  llvm revision 0bdb4a36465407a529405cc7b84c2d5acb6528c2
Skipping the following test categories: ['libc++', 'msvcstl', 'dsym', 'gmodules', 'debugserver', 'objc']

--
Command Output (stderr):
--
UNSUPPORTED: LLDB (/home/tcwg-buildbot/worker/lldb-aarch64-ubuntu/build/bin/clang-aarch64) :: test_Hc_then_Csignal_signals_correct_thread_launch_debugserver (TestLldbGdbServer.LldbGdbServerTestCase) (test case does not fall in any category of interest for this run) 
PASS: LLDB (/home/tcwg-buildbot/worker/lldb-aarch64-ubuntu/build/bin/clang-aarch64) :: test_Hc_then_Csignal_signals_correct_thread_launch_llgs (TestLldbGdbServer.LldbGdbServerTestCase)
PASS: LLDB (/home/tcwg-buildbot/worker/lldb-aarch64-ubuntu/build/bin/clang-aarch64) :: test_Hg_fails_on_another_pid_llgs (TestLldbGdbServer.LldbGdbServerTestCase)
PASS: LLDB (/home/tcwg-buildbot/worker/lldb-aarch64-ubuntu/build/bin/clang-aarch64) :: test_Hg_fails_on_minus_one_pid_llgs (TestLldbGdbServer.LldbGdbServerTestCase)
PASS: LLDB (/home/tcwg-buildbot/worker/lldb-aarch64-ubuntu/build/bin/clang-aarch64) :: test_Hg_fails_on_zero_pid_llgs (TestLldbGdbServer.LldbGdbServerTestCase)
UNSUPPORTED: LLDB (/home/tcwg-buildbot/worker/lldb-aarch64-ubuntu/build/bin/clang-aarch64) :: test_Hg_switches_to_3_threads_launch_debugserver (TestLldbGdbServer.LldbGdbServerTestCase) (test case does not fall in any category of interest for this run) 
PASS: LLDB (/home/tcwg-buildbot/worker/lldb-aarch64-ubuntu/build/bin/clang-aarch64) :: test_Hg_switches_to_3_threads_launch_llgs (TestLldbGdbServer.LldbGdbServerTestCase)
UNSUPPORTED: LLDB (/home/tcwg-buildbot/worker/lldb-aarch64-ubuntu/build/bin/clang-aarch64) :: test_P_and_p_thread_suffix_work_debugserver (TestLldbGdbServer.LldbGdbServerTestCase) (test case does not fall in any category of interest for this run) 
PASS: LLDB (/home/tcwg-buildbot/worker/lldb-aarch64-ubuntu/build/bin/clang-aarch64) :: test_P_and_p_thread_suffix_work_llgs (TestLldbGdbServer.LldbGdbServerTestCase)
UNSUPPORTED: LLDB (/home/tcwg-buildbot/worker/lldb-aarch64-ubuntu/build/bin/clang-aarch64) :: test_P_writes_all_gpr_registers_debugserver (TestLldbGdbServer.LldbGdbServerTestCase) (test case does not fall in any category of interest for this run) 
PASS: LLDB (/home/tcwg-buildbot/worker/lldb-aarch64-ubuntu/build/bin/clang-aarch64) :: test_P_writes_all_gpr_registers_llgs (TestLldbGdbServer.LldbGdbServerTestCase)
UNSUPPORTED: LLDB (/home/tcwg-buildbot/worker/lldb-aarch64-ubuntu/build/bin/clang-aarch64) :: test_attach_commandline_continue_app_exits_debugserver (TestLldbGdbServer.LldbGdbServerTestCase) (test case does not fall in any category of interest for this run) 
lldb-server exiting...
PASS: LLDB (/home/tcwg-buildbot/worker/lldb-aarch64-ubuntu/build/bin/clang-aarch64) :: test_attach_commandline_continue_app_exits_llgs (TestLldbGdbServer.LldbGdbServerTestCase)
UNSUPPORTED: LLDB (/home/tcwg-buildbot/worker/lldb-aarch64-ubuntu/build/bin/clang-aarch64) :: test_c_packet_works_debugserver (TestLldbGdbServer.LldbGdbServerTestCase) (test case does not fall in any category of interest for this run) 
lldb-server exiting...
PASS: LLDB (/home/tcwg-buildbot/worker/lldb-aarch64-ubuntu/build/bin/clang-aarch64) :: test_c_packet_works_llgs (TestLldbGdbServer.LldbGdbServerTestCase)
UNSUPPORTED: LLDB (/home/tcwg-buildbot/worker/lldb-aarch64-ubuntu/build/bin/clang-aarch64) :: test_first_launch_stop_reply_thread_matches_first_qC_debugserver (TestLldbGdbServer.LldbGdbServerTestCase) (test case does not fall in any category of interest for this run) 
PASS: LLDB (/home/tcwg-buildbot/worker/lldb-aarch64-ubuntu/build/bin/clang-aarch64) :: test_first_launch_stop_reply_thread_matches_first_qC_llgs (TestLldbGdbServer.LldbGdbServerTestCase)
UNSUPPORTED: LLDB (/home/tcwg-buildbot/worker/lldb-aarch64-ubuntu/build/bin/clang-aarch64) :: test_hardware_breakpoint_set_and_remove_work_debugserver (TestLldbGdbServer.LldbGdbServerTestCase) (test case does not fall in any category of interest for this run) 
lldb-server exiting...
PASS: LLDB (/home/tcwg-buildbot/worker/lldb-aarch64-ubuntu/build/bin/clang-aarch64) :: test_hardware_breakpoint_set_and_remove_work_llgs (TestLldbGdbServer.LldbGdbServerTestCase)

krishna2803 pushed a commit to krishna2803/llvm-project that referenced this pull request Aug 12, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants