From 9d84136cce8ccc365d7148fe0cf7684572ee8d72 Mon Sep 17 00:00:00 2001 From: Felipe de Azevedo Piovezan Date: Tue, 4 Mar 2025 14:22:59 -0800 Subject: [PATCH] [lldb][swift] Adjust language plugin to changes in FilterForLineBreakpoints (cherry picked from commit 01b70ba99f62924f8cf56d08b8655aef456b0cd2) --- .../Plugins/Language/Swift/SwiftLanguage.cpp | 24 +++++++++++-------- .../Plugins/Language/Swift/SwiftLanguage.h | 3 ++- 2 files changed, 16 insertions(+), 11 deletions(-) diff --git a/lldb/source/Plugins/Language/Swift/SwiftLanguage.cpp b/lldb/source/Plugins/Language/Swift/SwiftLanguage.cpp index 832187bc45e79..27098878430d4 100644 --- a/lldb/source/Plugins/Language/Swift/SwiftLanguage.cpp +++ b/lldb/source/Plugins/Language/Swift/SwiftLanguage.cpp @@ -1852,16 +1852,20 @@ SwiftLanguage::GetDemangledFunctionNameWithoutArguments(Mangled mangled) const { return mangled_name; } -bool SwiftLanguage::IgnoreForLineBreakpoints(const SymbolContext &sc) const { - // If we don't have a function, conservatively return false. - if (!sc.function) - return false; - llvm::StringRef name = - sc.function->GetMangled().GetMangledName().GetStringRef(); - // In async functions, ignore await resume ("Q") funclets, these only - // deallocate the async context and task_switch back to user code. - return SwiftLanguageRuntime::IsSwiftAsyncAwaitResumePartialFunctionSymbol( - name); +void SwiftLanguage::FilterForLineBreakpoints( + llvm::SmallVectorImpl &sc_list) const { + llvm::erase_if(sc_list, [](const SymbolContext &sc) { + // If we don't have a function, conservatively keep this sc. + if (!sc.function) + return false; + + // In async functions, ignore await resume ("Q") funclets, these only + // deallocate the async context and task_switch back to user code. + llvm::StringRef name = + sc.function->GetMangled().GetMangledName().GetStringRef(); + return SwiftLanguageRuntime::IsSwiftAsyncAwaitResumePartialFunctionSymbol( + name); + }); } std::optional diff --git a/lldb/source/Plugins/Language/Swift/SwiftLanguage.h b/lldb/source/Plugins/Language/Swift/SwiftLanguage.h index 191a03ccf1712..b6da165402b5e 100644 --- a/lldb/source/Plugins/Language/Swift/SwiftLanguage.h +++ b/lldb/source/Plugins/Language/Swift/SwiftLanguage.h @@ -97,7 +97,8 @@ class SwiftLanguage : public Language { llvm::StringRef GetInstanceVariableName() override { return "self"; } /// Override that skips breakpoints inside await resume ("Q") async funclets. - bool IgnoreForLineBreakpoints(const SymbolContext &sc) const override; + void FilterForLineBreakpoints( + llvm::SmallVectorImpl &) const override; //------------------------------------------------------------------ // PluginInterface protocol