diff --git a/lldb/source/Plugins/SymbolFile/DWARF/AppleDWARFIndex.cpp b/lldb/source/Plugins/SymbolFile/DWARF/AppleDWARFIndex.cpp index d2edfe14b2bae..b5c4667332f24 100644 --- a/lldb/source/Plugins/SymbolFile/DWARF/AppleDWARFIndex.cpp +++ b/lldb/source/Plugins/SymbolFile/DWARF/AppleDWARFIndex.cpp @@ -182,20 +182,22 @@ void AppleDWARFIndex::GetGlobalVariables( } void AppleDWARFIndex::GetObjCMethods( - ConstString class_name, llvm::function_ref callback) { + ConstString class_name, + llvm::function_ref callback) { if (!m_apple_objc_up) return; - SearchFor(*m_apple_objc_up, class_name, callback); + SearchFor(*m_apple_objc_up, class_name, IterationActionAdaptor(callback)); } void AppleDWARFIndex::GetCompleteObjCClass( ConstString class_name, bool must_be_implementation, - llvm::function_ref callback) { + llvm::function_ref callback) { if (!m_apple_types_up) return; llvm::SmallVector decl_dies; - auto converted_cb = DIERefCallback(callback, class_name); + auto adapted_cb = IterationActionAdaptor(callback); + auto converted_cb = DIERefCallback(adapted_cb, class_name); for (const auto &entry : m_apple_types_up->equal_range(class_name)) { if (HasImplementationFlag(entry)) { diff --git a/lldb/source/Plugins/SymbolFile/DWARF/AppleDWARFIndex.h b/lldb/source/Plugins/SymbolFile/DWARF/AppleDWARFIndex.h index 74da0b2d051f6..33ac61b510fff 100644 --- a/lldb/source/Plugins/SymbolFile/DWARF/AppleDWARFIndex.h +++ b/lldb/source/Plugins/SymbolFile/DWARF/AppleDWARFIndex.h @@ -10,6 +10,7 @@ #define LLDB_SOURCE_PLUGINS_SYMBOLFILE_DWARF_APPLEDWARFINDEX_H #include "Plugins/SymbolFile/DWARF/DWARFIndex.h" +#include "lldb/lldb-private-enumerations.h" #include "llvm/DebugInfo/DWARF/DWARFAcceleratorTable.h" namespace lldb_private::plugin { @@ -50,11 +51,12 @@ class AppleDWARFIndex : public DWARFIndex { void GetGlobalVariables( DWARFUnit &cu, llvm::function_ref callback) override; - void GetObjCMethods(ConstString class_name, - llvm::function_ref callback) override; + void GetObjCMethods( + ConstString class_name, + llvm::function_ref callback) override; void GetCompleteObjCClass( ConstString class_name, bool must_be_implementation, - llvm::function_ref callback) override; + llvm::function_ref callback) override; void GetTypes(ConstString name, llvm::function_ref callback) override; void GetTypes(const DWARFDeclContext &context, diff --git a/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp b/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp index 781c1c6c5745d..4c6c3054ba179 100644 --- a/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp +++ b/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp @@ -37,6 +37,7 @@ #include "lldb/Utility/LLDBAssert.h" #include "lldb/Utility/Log.h" #include "lldb/Utility/StreamString.h" +#include "lldb/lldb-private-enumerations.h" #include "clang/AST/CXXInheritance.h" #include "clang/AST/DeclBase.h" @@ -2223,7 +2224,7 @@ bool DWARFASTParserClang::CompleteRecordType(const DWARFDIE &die, if (class_name) { dwarf->GetObjCMethods(class_name, [&](DWARFDIE method_die) { method_die.ResolveType(); - return true; + return IterationAction::Continue; }); for (DelayedAddObjCClassProperty &property : delayed_properties) diff --git a/lldb/source/Plugins/SymbolFile/DWARF/DWARFIndex.h b/lldb/source/Plugins/SymbolFile/DWARF/DWARFIndex.h index 6718024a42e8c..84749341ea57a 100644 --- a/lldb/source/Plugins/SymbolFile/DWARF/DWARFIndex.h +++ b/lldb/source/Plugins/SymbolFile/DWARF/DWARFIndex.h @@ -44,12 +44,12 @@ class DWARFIndex { virtual void GetGlobalVariables( DWARFUnit &cu, llvm::function_ref callback) = 0; - virtual void - GetObjCMethods(ConstString class_name, - llvm::function_ref callback) = 0; - virtual void - GetCompleteObjCClass(ConstString class_name, bool must_be_implementation, - llvm::function_ref callback) = 0; + virtual void GetObjCMethods( + ConstString class_name, + llvm::function_ref callback) = 0; + virtual void GetCompleteObjCClass( + ConstString class_name, bool must_be_implementation, + llvm::function_ref callback) = 0; virtual void GetTypes(ConstString name, llvm::function_ref callback) = 0; virtual void GetTypes(const DWARFDeclContext &context, diff --git a/lldb/source/Plugins/SymbolFile/DWARF/DebugNamesDWARFIndex.cpp b/lldb/source/Plugins/SymbolFile/DWARF/DebugNamesDWARFIndex.cpp index 8944005ab356a..2ec876dd552c0 100644 --- a/lldb/source/Plugins/SymbolFile/DWARF/DebugNamesDWARFIndex.cpp +++ b/lldb/source/Plugins/SymbolFile/DWARF/DebugNamesDWARFIndex.cpp @@ -257,7 +257,7 @@ void DebugNamesDWARFIndex::GetGlobalVariables( void DebugNamesDWARFIndex::GetCompleteObjCClass( ConstString class_name, bool must_be_implementation, - llvm::function_ref callback) { + llvm::function_ref callback) { // Keep a list of incomplete types as fallback for when we don't find the // complete type. std::vector incomplete_types; @@ -283,7 +283,7 @@ void DebugNamesDWARFIndex::GetCompleteObjCClass( } for (DWARFDIE die : incomplete_types) - if (!callback(die)) + if (callback(die) == IterationAction::Stop) return; m_fallback.GetCompleteObjCClass(class_name, must_be_implementation, callback); diff --git a/lldb/source/Plugins/SymbolFile/DWARF/DebugNamesDWARFIndex.h b/lldb/source/Plugins/SymbolFile/DWARF/DebugNamesDWARFIndex.h index deee6b7c30516..0340cb4a16fc7 100644 --- a/lldb/source/Plugins/SymbolFile/DWARF/DebugNamesDWARFIndex.h +++ b/lldb/source/Plugins/SymbolFile/DWARF/DebugNamesDWARFIndex.h @@ -36,12 +36,12 @@ class DebugNamesDWARFIndex : public DWARFIndex { void GetGlobalVariables( DWARFUnit &cu, llvm::function_ref callback) override; - void - GetObjCMethods(ConstString class_name, - llvm::function_ref callback) override {} + void GetObjCMethods( + ConstString class_name, + llvm::function_ref callback) override {} void GetCompleteObjCClass( ConstString class_name, bool must_be_implementation, - llvm::function_ref callback) override; + llvm::function_ref callback) override; /// Uses DWARF5's IDX_parent fields, when available, to speed up this query. void GetFullyQualifiedType( diff --git a/lldb/source/Plugins/SymbolFile/DWARF/ManualDWARFIndex.cpp b/lldb/source/Plugins/SymbolFile/DWARF/ManualDWARFIndex.cpp index 45179274c8b4f..004c9dd35ec08 100644 --- a/lldb/source/Plugins/SymbolFile/DWARF/ManualDWARFIndex.cpp +++ b/lldb/source/Plugins/SymbolFile/DWARF/ManualDWARFIndex.cpp @@ -438,18 +438,20 @@ void ManualDWARFIndex::GetGlobalVariables( } void ManualDWARFIndex::GetObjCMethods( - ConstString class_name, llvm::function_ref callback) { + ConstString class_name, + llvm::function_ref callback) { Index(); m_set.objc_class_selectors.Find( - class_name, DIERefCallback(callback, class_name.GetStringRef())); + class_name, DIERefCallback(IterationActionAdaptor(callback), + class_name.GetStringRef())); } void ManualDWARFIndex::GetCompleteObjCClass( ConstString class_name, bool must_be_implementation, - llvm::function_ref callback) { + llvm::function_ref callback) { Index(); - m_set.types.Find(class_name, - DIERefCallback(callback, class_name.GetStringRef())); + m_set.types.Find(class_name, DIERefCallback(IterationActionAdaptor(callback), + class_name.GetStringRef())); } void ManualDWARFIndex::GetTypes( diff --git a/lldb/source/Plugins/SymbolFile/DWARF/ManualDWARFIndex.h b/lldb/source/Plugins/SymbolFile/DWARF/ManualDWARFIndex.h index 746170cad2985..6a71068d5aa20 100644 --- a/lldb/source/Plugins/SymbolFile/DWARF/ManualDWARFIndex.h +++ b/lldb/source/Plugins/SymbolFile/DWARF/ManualDWARFIndex.h @@ -40,11 +40,12 @@ class ManualDWARFIndex : public DWARFIndex { void GetGlobalVariables( DWARFUnit &unit, llvm::function_ref callback) override; - void GetObjCMethods(ConstString class_name, - llvm::function_ref callback) override; + void GetObjCMethods( + ConstString class_name, + llvm::function_ref callback) override; void GetCompleteObjCClass( ConstString class_name, bool must_be_implementation, - llvm::function_ref callback) override; + llvm::function_ref callback) override; void GetTypes(ConstString name, llvm::function_ref callback) override; void GetTypes(const DWARFDeclContext &context, diff --git a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp index 42a66ce75d6d6..170631d4ed365 100644 --- a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp +++ b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp @@ -1663,7 +1663,8 @@ SymbolFileDWARF::GetCompUnitForDWARFCompUnit(DWARFCompileUnit &dwarf_cu) { } void SymbolFileDWARF::GetObjCMethods( - ConstString class_name, llvm::function_ref callback) { + ConstString class_name, + llvm::function_ref callback) { m_index->GetObjCMethods(class_name, callback); } @@ -2993,18 +2994,18 @@ TypeSP SymbolFileDWARF::FindCompleteObjCDefinitionTypeForDIE( // Don't try and resolve the DIE we are looking for with the DIE // itself! if (type_die == die || !IsStructOrClassTag(type_die.Tag())) - return true; + return IterationAction::Continue; if (must_be_implementation) { const bool try_resolving_type = type_die.GetAttributeValueAsUnsigned( DW_AT_APPLE_objc_complete_type, 0); if (!try_resolving_type) - return true; + return IterationAction::Continue; } Type *resolved_type = ResolveType(type_die, false, true); if (!resolved_type || resolved_type == DIE_IS_BEING_PARSED) - return true; + return IterationAction::Continue; DEBUG_PRINTF( "resolved 0x%8.8" PRIx64 " from %s to 0x%8.8" PRIx64 @@ -3016,7 +3017,7 @@ TypeSP SymbolFileDWARF::FindCompleteObjCDefinitionTypeForDIE( if (die) GetDIEToType()[die.GetDIE()] = resolved_type; type_sp = resolved_type->shared_from_this(); - return false; + return IterationAction::Stop; }); return type_sp; } diff --git a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h index 3ec538da8cf77..5042d919d9d42 100644 --- a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h +++ b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h @@ -220,8 +220,9 @@ class SymbolFileDWARF : public SymbolFileCommon { CompileUnit *GetCompUnitForDWARFCompUnit(DWARFCompileUnit &dwarf_cu); - virtual void GetObjCMethods(ConstString class_name, - llvm::function_ref callback); + virtual void + GetObjCMethods(ConstString class_name, + llvm::function_ref callback); DebugMacrosSP ParseDebugMacros(lldb::offset_t *offset); diff --git a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDwo.cpp b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDwo.cpp index 52de3abca4b77..60d87c3fc2559 100644 --- a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDwo.cpp +++ b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDwo.cpp @@ -120,7 +120,7 @@ SymbolFileDWARFDwo::GetForwardDeclCompilerTypeToDIE() { void SymbolFileDWARFDwo::GetObjCMethods( lldb_private::ConstString class_name, - llvm::function_ref callback) { + llvm::function_ref callback) { GetBaseSymbolFile().GetObjCMethods(class_name, callback); } diff --git a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDwo.h b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDwo.h index 1ab6494f8ef7f..d906e09fe81ab 100644 --- a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDwo.h +++ b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDwo.h @@ -10,6 +10,7 @@ #define LLDB_SOURCE_PLUGINS_SYMBOLFILE_DWARF_SYMBOLFILEDWARFDWO_H #include "SymbolFileDWARF.h" +#include "lldb/lldb-private-enumerations.h" #include namespace lldb_private::plugin { @@ -34,8 +35,9 @@ class SymbolFileDWARFDwo : public SymbolFileDWARF { DWARFCompileUnit *GetDWOCompileUnitForHash(uint64_t hash); - void GetObjCMethods(ConstString class_name, - llvm::function_ref callback) override; + void GetObjCMethods( + ConstString class_name, + llvm::function_ref callback) override; llvm::Expected GetTypeSystemForLanguage(lldb::LanguageType language) override;