https://github.com/Michael137 created https://github.com/llvm/llvm-project/pull/151668
Continuation from https://github.com/llvm/llvm-project/pull/151489 >From 6fa2b6e3acaeffd5fd55f46eded372944ba2c328 Mon Sep 17 00:00:00 2001 From: Michael Buch <michaelbuc...@gmail.com> Date: Thu, 31 Jul 2025 14:50:59 +0100 Subject: [PATCH] Namespaces and global variables to IterationAction --- .../SymbolFile/DWARF/AppleDWARFIndex.cpp | 18 ++++++------ .../SymbolFile/DWARF/AppleDWARFIndex.h | 8 ++--- .../Plugins/SymbolFile/DWARF/DWARFIndex.cpp | 8 ++--- .../Plugins/SymbolFile/DWARF/DWARFIndex.h | 14 ++++----- .../SymbolFile/DWARF/DebugNamesDWARFIndex.cpp | 26 ++++++++--------- .../SymbolFile/DWARF/DebugNamesDWARFIndex.h | 11 +++---- .../SymbolFile/DWARF/ManualDWARFIndex.cpp | 16 +++++----- .../SymbolFile/DWARF/ManualDWARFIndex.h | 9 +++--- .../SymbolFile/DWARF/SymbolFileDWARF.cpp | 29 ++++++++++++------- 9 files changed, 75 insertions(+), 64 deletions(-) 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 ®ex, - 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 ®ex, 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 ®ex, - 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 ®ex, - 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 ®ex, - 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 ®ex, - 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 ®ex, - 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 ®ex, - 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 IterationAction::Continue; auto *dwarf_cu = llvm::dyn_cast<DWARFCompileUnit>(die.GetCU()); if (!dwarf_cu) - return true; + return IterationAction::Continue; sc.comp_unit = GetCompUnitForDWARFCompUnit(*dwarf_cu); if (parent_decl_ctx) { @@ -2368,7 +2368,7 @@ void SymbolFileDWARF::FindGlobalVariables( if (!actual_parent_decl_ctx || (actual_parent_decl_ctx != parent_decl_ctx && !parent_decl_ctx.IsContainedInLookup(actual_parent_decl_ctx))) - return true; + return IterationAction::Continue; } } @@ -2382,7 +2382,10 @@ void SymbolFileDWARF::FindGlobalVariables( variables.RemoveVariableAtIndex(pruned_idx); } - return variables.GetSize() - original_size < max_matches; + if (variables.GetSize() - original_size < max_matches) + return IterationAction::Continue; + + return IterationAction::Stop; }); // Return the number of variable that were appended to the list @@ -2422,12 +2425,15 @@ void SymbolFileDWARF::FindGlobalVariables(const RegularExpression ®ex, DWARFCompileUnit *dwarf_cu = llvm::dyn_cast<DWARFCompileUnit>(die.GetCU()); if (!dwarf_cu) - return true; + return IterationAction::Continue; sc.comp_unit = GetCompUnitForDWARFCompUnit(*dwarf_cu); ParseAndAppendGlobalVariable(sc, die, variables); - return variables.GetSize() - original_size < max_matches; + if (variables.GetSize() - original_size < max_matches) + return IterationAction::Continue; + + return IterationAction::Stop; }); } @@ -2847,14 +2853,17 @@ SymbolFileDWARF::FindNamespace(ConstString name, m_index->GetNamespacesWithParents(name, parent_decl_ctx, [&](DWARFDIE die) { if (!DIEInDeclContext(parent_decl_ctx, die, only_root_namespaces)) - return true; // The containing decl contexts don't match + return IterationAction::Continue; DWARFASTParser *dwarf_ast = GetDWARFParser(*die.GetCU()); if (!dwarf_ast) - return true; + return IterationAction::Continue; namespace_decl_ctx = dwarf_ast->GetDeclContextForUIDFromDWARF(die); - return !namespace_decl_ctx.IsValid(); + if (namespace_decl_ctx.IsValid()) + return IterationAction::Stop; + + return IterationAction::Continue; }); if (log && namespace_decl_ctx) { @@ -3295,7 +3304,7 @@ size_t SymbolFileDWARF::ParseVariablesForContext(const SymbolContext &sc) { variables->AddVariableIfUnique(var_sp); ++vars_added; } - return true; + return IterationAction::Continue; }); } return vars_added; _______________________________________________ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits