From cc52794da818133b72fd7b81141d5d4e902c0061 Mon Sep 17 00:00:00 2001 From: Anthony Latsis Date: Sat, 5 Jul 2025 16:53:44 +0100 Subject: [PATCH 1/9] [Swift] lldb: Adjust calls to clang::DiagnosticsEngine ctor (now takes ref vs. ptr) See https://github.com/llvm/llvm-project/pull/106271 (cherry picked from commit 78fe2cfe874db28b5a23ea5f23c8ceee4f523e31) --- lldb/source/Plugins/TypeSystem/Swift/SwiftASTContext.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lldb/source/Plugins/TypeSystem/Swift/SwiftASTContext.cpp b/lldb/source/Plugins/TypeSystem/Swift/SwiftASTContext.cpp index 0f89f96a1baef..0070f932ac24a 100644 --- a/lldb/source/Plugins/TypeSystem/Swift/SwiftASTContext.cpp +++ b/lldb/source/Plugins/TypeSystem/Swift/SwiftASTContext.cpp @@ -1886,10 +1886,10 @@ void SwiftASTContext::AddExtraClangCC1Args( std::string diags; llvm::raw_string_ostream os(diags); - auto diagOpts = llvm::makeIntrusiveRefCnt(); + clang::DiagnosticOptions diagOpts; clang::DiagnosticsEngine clangDiags( new clang::DiagnosticIDs(), diagOpts, - new clang::TextDiagnosticPrinter(os, diagOpts.get())); + new clang::TextDiagnosticPrinter(os, diagOpts)); if (!clang::CompilerInvocation::CreateFromArgs(invocation, clangArgs, clangDiags)) { From aab396bba30d3450cb85fb2d50f52612ed20e554 Mon Sep 17 00:00:00 2001 From: Anthony Latsis Date: Sat, 5 Jul 2025 17:44:08 +0100 Subject: [PATCH 2/9] [Swift] lldb: Adjust code after result type change in `lldb_private::formatters::ExtractIndexFromString` See https://github.com/llvm/llvm-project/pull/138297 (cherry picked from commit 250d993dc5d32afcacffc51258e0ba5967756bbd) --- lldb/source/Plugins/Language/Swift/SwiftArray.cpp | 7 ++++--- .../source/Plugins/Language/Swift/SwiftHashedContainer.cpp | 7 ++++--- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/lldb/source/Plugins/Language/Swift/SwiftArray.cpp b/lldb/source/Plugins/Language/Swift/SwiftArray.cpp index b268df9ade462..244f15de9e0d8 100644 --- a/lldb/source/Plugins/Language/Swift/SwiftArray.cpp +++ b/lldb/source/Plugins/Language/Swift/SwiftArray.cpp @@ -559,11 +559,12 @@ llvm::Expected lldb_private::formatters::swift::ArraySyntheticFrontEnd:: return llvm::createStringError("Type has no child named '%s'", name.AsCString()); const char *item_name = name.GetCString(); - uint32_t idx = ExtractIndexFromString(item_name); - if (idx == UINT32_MAX || idx >= CalculateNumChildrenIgnoringErrors()) + auto optional_idx = ExtractIndexFromString(item_name); + if (!optional_idx || + optional_idx.value() >= CalculateNumChildrenIgnoringErrors()) return llvm::createStringError("Type has no child named '%s'", name.AsCString()); - return idx; + return optional_idx.value(); } SyntheticChildrenFrontEnd * diff --git a/lldb/source/Plugins/Language/Swift/SwiftHashedContainer.cpp b/lldb/source/Plugins/Language/Swift/SwiftHashedContainer.cpp index a0cb25846ac0d..e942753a44028 100644 --- a/lldb/source/Plugins/Language/Swift/SwiftHashedContainer.cpp +++ b/lldb/source/Plugins/Language/Swift/SwiftHashedContainer.cpp @@ -747,9 +747,10 @@ HashedSyntheticChildrenFrontEnd::GetIndexOfChildWithName(ConstString name) { return llvm::createStringError("Type has no child named '%s'", name.AsCString()); const char *item_name = name.GetCString(); - uint32_t idx = ExtractIndexFromString(item_name); - if (idx == UINT32_MAX || idx >= CalculateNumChildrenIgnoringErrors()) + auto optional_idx = ExtractIndexFromString(item_name); + if (!optional_idx || + optional_idx.value() >= CalculateNumChildrenIgnoringErrors()) return llvm::createStringError("Type has no child named '%s'", name.AsCString()); - return idx; + return optional_idx.value(); } From b8afbaeaba87ea960b6ed03dda2259c72bcfbde8 Mon Sep 17 00:00:00 2001 From: Anthony Latsis Date: Sat, 5 Jul 2025 18:02:59 +0100 Subject: [PATCH 3/9] [Swift] lldb: Refactor uses of `Function::GetAddressRange` after its removal See: https://github.com/llvm/llvm-project/pull/132923 https://github.com/llvm/llvm-project/pull/128515 https://github.com/llvm/llvm-project/pull/125847 (cherry picked from commit fcf65ee1c46700b585b266c9ff310a12e14a02ca) --- .../Swift/SwiftLanguageRuntime.cpp | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/lldb/source/Plugins/LanguageRuntime/Swift/SwiftLanguageRuntime.cpp b/lldb/source/Plugins/LanguageRuntime/Swift/SwiftLanguageRuntime.cpp index 0a8754f10f0b3..f866dd64caf8d 100644 --- a/lldb/source/Plugins/LanguageRuntime/Swift/SwiftLanguageRuntime.cpp +++ b/lldb/source/Plugins/LanguageRuntime/Swift/SwiftLanguageRuntime.cpp @@ -1187,8 +1187,7 @@ void SwiftLanguageRuntime::FindFunctionPointersInCall( if (target_context.symbol) fn_ptr_address = target_context.symbol->GetAddress(); else if (target_context.function) - fn_ptr_address = - target_context.function->GetAddressRange().GetBaseAddress(); + fn_ptr_address = target_context.function->GetAddress(); } } } @@ -2700,9 +2699,11 @@ DoesContinuationPointToSameFunction(addr_t async_reg, SymbolContext &sc, Address continuation_addr; continuation_addr.SetLoadAddress(process.FixCodeAddress(*continuation_ptr), &process.GetTarget()); - if (sc.function) - return sc.function->GetAddressRange().ContainsLoadAddress( - continuation_addr, &process.GetTarget()); + if (sc.function) { + AddressRange unused_range; + return sc.function->GetRangeContainingLoadAddress( + continuation_addr.GetOffset(), process.GetTarget(), unused_range); + } assert(sc.symbol); return sc.symbol->ContainsFileAddress(continuation_addr.GetFileAddress()); } @@ -2736,8 +2737,7 @@ static llvm::Expected IsIndirectContext(Process &process, uint32_t prologue_size = sc.function ? sc.function->GetPrologueByteSize() : sc.symbol->GetPrologueByteSize(); Address func_start_addr = - sc.function ? sc.function->GetAddressRange().GetBaseAddress() - : sc.symbol->GetAddress(); + sc.function ? sc.function->GetAddress() : sc.symbol->GetAddress(); // Include one instruction after the prologue. This is where breakpoints // by function name are set, so it's important to get this point right. This // instruction is exactly at address "base + prologue", so adding 1 @@ -2788,7 +2788,7 @@ SwiftLanguageRuntime::GetRuntimeUnwindPlan(ProcessSP process_sp, Address func_start_addr; ConstString mangled_name; if (sc.function) { - func_start_addr = sc.function->GetAddressRange().GetBaseAddress(); + func_start_addr = sc.function->GetAddress(); mangled_name = sc.function->GetMangled().GetMangledName(); } else if (sc.symbol) { func_start_addr = sc.symbol->GetAddress(); From 8b6280e1227c70943190280337eeaa898802349e Mon Sep 17 00:00:00 2001 From: Anthony Latsis Date: Sat, 5 Jul 2025 18:19:19 +0100 Subject: [PATCH 4/9] [Swift] lldb: Adjust code after result type change in `UnwindPlan::Row::GetOffset` See https://github.com/llvm/llvm-project/pull/134662 (cherry picked from commit ef0d652cac25d4f9826c5eff4a61e7d01521b9e7) --- .../Plugins/LanguageRuntime/Swift/SwiftLanguageRuntime.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lldb/source/Plugins/LanguageRuntime/Swift/SwiftLanguageRuntime.cpp b/lldb/source/Plugins/LanguageRuntime/Swift/SwiftLanguageRuntime.cpp index f866dd64caf8d..743e225bd7cb3 100644 --- a/lldb/source/Plugins/LanguageRuntime/Swift/SwiftLanguageRuntime.cpp +++ b/lldb/source/Plugins/LanguageRuntime/Swift/SwiftLanguageRuntime.cpp @@ -2580,7 +2580,7 @@ static llvm::Expected GetFpRegisterNumber(UnwindPlan &unwind_plan, } struct FrameSetupInfo { - addr_t frame_setup_func_offset; + int64_t frame_setup_func_offset; int fp_cfa_offset; }; @@ -2621,7 +2621,7 @@ GetFrameSetupInfo(UnwindPlan &unwind_plan, RegisterContext ®ctx) { // This is a frameless function, use large positive offset so that a PC can // still be compared against it. if (it == fp_locs.end()) - return FrameSetupInfo{std::numeric_limits::max(), 0}; + return FrameSetupInfo{std::numeric_limits::max(), 0}; // This is an async function with a frame. The prologue roughly follows this // sequence of instructions: @@ -2668,7 +2668,7 @@ static llvm::Expected ReadAsyncContextRegisterFromUnwind( // Is PC before the frame formation? If so, use async register directly. // This handles frameless functions, as frame_setup_func_offset is INT_MAX. addr_t pc_offset = pc.GetFileAddress() - func_start_addr.GetFileAddress(); - if (pc_offset < frame_setup->frame_setup_func_offset) + if ((int64_t)pc_offset < frame_setup->frame_setup_func_offset) return ReadRegisterAsAddress(regctx, regnums.GetRegisterKind(), regnums.async_ctx_regnum); From 4fe55982a0855cac873b72fec6471006255294d0 Mon Sep 17 00:00:00 2001 From: Anthony Latsis Date: Sat, 5 Jul 2025 18:36:10 +0100 Subject: [PATCH 5/9] [Swift] lldb: Fix local var redeclaration error I assume the error fell out of https://github.com/swiftlang/llvm-project/pull/10593, which apparently was not built/tested. (cherry picked from commit 58d795ceeb71e137512f140da2631f063e224505) --- .../Language/Swift/FoundationValueTypes.cpp | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/lldb/source/Plugins/Language/Swift/FoundationValueTypes.cpp b/lldb/source/Plugins/Language/Swift/FoundationValueTypes.cpp index 48a1c08316079..3643fce29232e 100644 --- a/lldb/source/Plugins/Language/Swift/FoundationValueTypes.cpp +++ b/lldb/source/Plugins/Language/Swift/FoundationValueTypes.cpp @@ -672,13 +672,16 @@ class URLComponentsSyntheticChildrenFrontEnd m_synth_frontend_up->Update(); #define COMPONENT(Name, PrettyName, ID) \ - auto index_or_err = m_synth_frontend_up->GetIndexOfChildWithName(g__##Name); \ - if (!index_or_err) { \ - LLDB_LOG_ERROR(GetLog(LLDBLog::DataFormatters), index_or_err.takeError(), \ - "{0}"); \ - return ChildCacheState::eRefetch; \ + { \ + auto index_or_err = \ + m_synth_frontend_up->GetIndexOfChildWithName(g__##Name); \ + if (!index_or_err) { \ + LLDB_LOG_ERROR(GetLog(LLDBLog::DataFormatters), \ + index_or_err.takeError(), "{0}"); \ + return ChildCacheState::eRefetch; \ + } \ + m_##Name = m_synth_frontend_up->GetChildAtIndex(*index_or_err).get(); \ } \ - m_##Name = m_synth_frontend_up->GetChildAtIndex(*index_or_err).get(); \ if (m_##Name) \ m_##Name->SetName(GetNameFor##Name()); #include "URLComponents.def" From 68fba0b3459d75d3eb577e4080b6a175f8ef754d Mon Sep 17 00:00:00 2001 From: Michael Buch Date: Sun, 27 Apr 2025 08:18:57 +0100 Subject: [PATCH 6/9] [lldb][Swift][NFC] Adjust GetFunctionDisplayName to take SymbolContext by reference The API was changed upstream for the C++ plugin. This patch adjusts the API implementation for Swift (cherry picked from commit 0685cec185cd9d18ac44c3b8d36fcdf9e0579418) --- .../Plugins/Language/Swift/SwiftLanguage.cpp | 18 +++++++++--------- .../Plugins/Language/Swift/SwiftLanguage.h | 2 +- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/lldb/source/Plugins/Language/Swift/SwiftLanguage.cpp b/lldb/source/Plugins/Language/Swift/SwiftLanguage.cpp index 0b794e519a0cf..30491ff2c2082 100644 --- a/lldb/source/Plugins/Language/Swift/SwiftLanguage.cpp +++ b/lldb/source/Plugins/Language/Swift/SwiftLanguage.cpp @@ -1717,20 +1717,20 @@ bool SwiftLanguage::IsUninitializedReference(ValueObject &valobj) { } bool SwiftLanguage::GetFunctionDisplayName( - const SymbolContext *sc, const ExecutionContext *exe_ctx, + const SymbolContext &sc, const ExecutionContext *exe_ctx, FunctionNameRepresentation representation, Stream &s) { switch (representation) { case Language::FunctionNameRepresentation::eName: // No need to customize this. return false; case Language::FunctionNameRepresentation::eNameWithNoArgs: { - if (!sc->function) + if (!sc.function) return false; - if (sc->function->GetLanguage() != eLanguageTypeSwift) + if (sc.function->GetLanguage() != eLanguageTypeSwift) return false; std::string display_name = SwiftLanguageRuntime::DemangleSymbolAsString( - sc->function->GetMangled().GetMangledName().GetStringRef(), - SwiftLanguageRuntime::eSimplified, sc, exe_ctx); + sc.function->GetMangled().GetMangledName().GetStringRef(), + SwiftLanguageRuntime::eSimplified, &sc, exe_ctx); if (display_name.empty()) return false; s << display_name; @@ -1744,12 +1744,12 @@ bool SwiftLanguage::GetFunctionDisplayName( const InlineFunctionInfo *inline_info = NULL; VariableListSP variable_list_sp; bool get_function_vars = true; - if (sc->block) { - Block *inline_block = sc->block->GetContainingInlinedBlock(); + if (sc.block) { + Block *inline_block = sc.block->GetContainingInlinedBlock(); if (inline_block) { get_function_vars = false; - inline_info = sc->block->GetInlinedFunctionInfo(); + inline_info = sc.block->GetInlinedFunctionInfo(); if (inline_info) variable_list_sp = inline_block->GetBlockVariableList(true); } @@ -1757,7 +1757,7 @@ bool SwiftLanguage::GetFunctionDisplayName( if (get_function_vars) { variable_list_sp = - sc->function->GetBlock(true).GetBlockVariableList(true); + sc.function->GetBlock(true).GetBlockVariableList(true); } VariableList args; diff --git a/lldb/source/Plugins/Language/Swift/SwiftLanguage.h b/lldb/source/Plugins/Language/Swift/SwiftLanguage.h index 71b64fe488e47..5beef342d3ec1 100644 --- a/lldb/source/Plugins/Language/Swift/SwiftLanguage.h +++ b/lldb/source/Plugins/Language/Swift/SwiftLanguage.h @@ -64,7 +64,7 @@ class SwiftLanguage : public Language { bool IsUninitializedReference(ValueObject &valobj) override; - bool GetFunctionDisplayName(const SymbolContext *sc, + bool GetFunctionDisplayName(const SymbolContext &sc, const ExecutionContext *exe_ctx, FunctionNameRepresentation representation, Stream &s) override; From 8b31fb73129b4cbd156ce6e8baaeafc6e0053c0c Mon Sep 17 00:00:00 2001 From: Anthony Latsis Date: Mon, 7 Jul 2025 16:19:58 +0100 Subject: [PATCH 7/9] [Swift] lldb: Adjust code after `UnwindPlan` pointer const qualification See https://github.com/llvm/llvm-project/pull/134246 (cherry picked from commit 4ee1ea1d64815456767bda219146971a4591aee7) --- .../Swift/SwiftLanguageRuntime.cpp | 22 +++++++++---------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/lldb/source/Plugins/LanguageRuntime/Swift/SwiftLanguageRuntime.cpp b/lldb/source/Plugins/LanguageRuntime/Swift/SwiftLanguageRuntime.cpp index 743e225bd7cb3..fa63184464679 100644 --- a/lldb/source/Plugins/LanguageRuntime/Swift/SwiftLanguageRuntime.cpp +++ b/lldb/source/Plugins/LanguageRuntime/Swift/SwiftLanguageRuntime.cpp @@ -2497,7 +2497,7 @@ static llvm::Expected ReadPtrFromAddr(Process &process, addr_t addr, /// access to those here would be challenging. static llvm::Expected GetCFA(Process &process, RegisterContext ®ctx, addr_t pc_offset, - UnwindPlan &unwind_plan) { + const UnwindPlan &unwind_plan) { auto *row = unwind_plan.GetRowForFunctionOffset(pc_offset); if (!row) return llvm::createStringError( @@ -2527,22 +2527,22 @@ static llvm::Expected GetCFA(Process &process, RegisterContext ®ctx, cfa_loc.GetValueType()); } -static UnwindPlanSP GetUnwindPlanForAsyncRegister(FuncUnwinders &unwinders, - Target &target, - Thread &thread) { +static std::shared_ptr +GetUnwindPlanForAsyncRegister(FuncUnwinders &unwinders, Target &target, + Thread &thread) { // We cannot trust compiler emitted unwind plans, as they respect the // swifttail calling convention, which assumes the async register is _not_ // restored and therefore it is not tracked by compiler plans. If LLDB uses // those plans, it may take "no info" to mean "register not clobbered". For // those reasons, always favour the assembly plan first, it will try to track // the async register by assuming the usual arm calling conventions. - if (UnwindPlanSP asm_plan = unwinders.GetAssemblyUnwindPlan(target, thread)) + if (auto asm_plan = unwinders.GetAssemblyUnwindPlan(target, thread)) return asm_plan; // In the unlikely case the assembly plan is not available, try all others. return unwinders.GetUnwindPlanAtNonCallSite(target, thread); } -static llvm::Expected +static llvm::Expected> GetAsmUnwindPlan(Address pc, SymbolContext &sc, Thread &thread) { FuncUnwindersSP unwinders = pc.GetModule()->GetUnwindTable().GetFuncUnwindersContainingAddress(pc, @@ -2552,7 +2552,7 @@ GetAsmUnwindPlan(Address pc, SymbolContext &sc, Thread &thread) { "function unwinder at address 0x%8.8" PRIx64, pc.GetFileAddress()); - UnwindPlanSP unwind_plan = GetUnwindPlanForAsyncRegister( + auto unwind_plan = GetUnwindPlanForAsyncRegister( *unwinders, thread.GetProcess()->GetTarget(), thread); if (!unwind_plan) return llvm::createStringError( @@ -2562,8 +2562,8 @@ GetAsmUnwindPlan(Address pc, SymbolContext &sc, Thread &thread) { return unwind_plan; } -static llvm::Expected GetFpRegisterNumber(UnwindPlan &unwind_plan, - RegisterContext ®ctx) { +static llvm::Expected +GetFpRegisterNumber(const UnwindPlan &unwind_plan, RegisterContext ®ctx) { uint32_t fp_unwind_regdomain; if (!regctx.ConvertBetweenRegisterKinds( lldb::eRegisterKindGeneric, LLDB_REGNUM_GENERIC_FP, @@ -2591,7 +2591,7 @@ struct FrameSetupInfo { /// compared against it. /// 2. The CFA offset at which FP is stored, meaningless in the frameless case. static llvm::Expected -GetFrameSetupInfo(UnwindPlan &unwind_plan, RegisterContext ®ctx) { +GetFrameSetupInfo(const UnwindPlan &unwind_plan, RegisterContext ®ctx) { using AbstractRegisterLocation = UnwindPlan::Row::AbstractRegisterLocation; llvm::Expected fp_unwind_regdomain = @@ -2656,7 +2656,7 @@ GetFrameSetupInfo(UnwindPlan &unwind_plan, RegisterContext ®ctx) { static llvm::Expected ReadAsyncContextRegisterFromUnwind( SymbolContext &sc, Process &process, Address pc, Address func_start_addr, RegisterContext ®ctx, AsyncUnwindRegisterNumbers regnums) { - llvm::Expected unwind_plan = + llvm::Expected> unwind_plan = GetAsmUnwindPlan(pc, sc, regctx.GetThread()); if (!unwind_plan) return unwind_plan.takeError(); From 5b22e3fde18057393d73239529482eecdef4b78b Mon Sep 17 00:00:00 2001 From: Anthony Latsis Date: Mon, 7 Jul 2025 16:40:39 +0100 Subject: [PATCH 8/9] [Swift] lldb: Adjust code after result type change in `lldb_private::TypeSystem::GetIndexOfChildWithName` See https://github.com/llvm/llvm-project/pull/136693. (cherry picked from commit 61cac61217e8e8c5e9b9222b92aa06112f0929aa) --- .../LanguageRuntime/Swift/SwiftLanguageRuntime.cpp | 5 +++-- .../Plugins/TypeSystem/Swift/TypeSystemSwift.cpp | 10 ++++++++-- lldb/source/Plugins/TypeSystem/Swift/TypeSystemSwift.h | 8 ++++---- 3 files changed, 15 insertions(+), 8 deletions(-) diff --git a/lldb/source/Plugins/LanguageRuntime/Swift/SwiftLanguageRuntime.cpp b/lldb/source/Plugins/LanguageRuntime/Swift/SwiftLanguageRuntime.cpp index fa63184464679..691519f984e25 100644 --- a/lldb/source/Plugins/LanguageRuntime/Swift/SwiftLanguageRuntime.cpp +++ b/lldb/source/Plugins/LanguageRuntime/Swift/SwiftLanguageRuntime.cpp @@ -1612,13 +1612,14 @@ class ProjectionSyntheticChildren : public SyntheticChildren { return nullptr; } - size_t GetIndexOfChildWithName(ConstString name) override { + llvm::Expected GetIndexOfChildWithName(ConstString name) override { for (size_t idx = 0; idx < m_projection->field_projections.size(); idx++) { if (m_projection->field_projections.at(idx).name == name) return idx; } - return UINT32_MAX; + return llvm::createStringError("Type has no child named '%s'", + name.AsCString()); } lldb::ChildCacheState Update() override { diff --git a/lldb/source/Plugins/TypeSystem/Swift/TypeSystemSwift.cpp b/lldb/source/Plugins/TypeSystem/Swift/TypeSystemSwift.cpp index cda4161a07d21..4e74e0bfe11f8 100644 --- a/lldb/source/Plugins/TypeSystem/Swift/TypeSystemSwift.cpp +++ b/lldb/source/Plugins/TypeSystem/Swift/TypeSystemSwift.cpp @@ -154,13 +154,19 @@ bool TypeSystemSwift::ShouldTreatScalarValueAsAddress( .AnySet(eTypeInstanceIsPointer | eTypeIsReference); } -uint32_t TypeSystemSwift::GetIndexOfChildWithName( +llvm::Expected TypeSystemSwift::GetIndexOfChildWithName( opaque_compiler_type_t type, llvm::StringRef name, ExecutionContext *exe_ctx, bool omit_empty_base_classes) { std::vector child_indexes; size_t num_child_indexes = GetIndexOfChildMemberWithName( type, name, exe_ctx, omit_empty_base_classes, child_indexes); - return num_child_indexes == 1 ? child_indexes.front() : UINT32_MAX; + + if (num_child_indexes == 1) { + return child_indexes.front(); + } + + return llvm::createStringError("Type has no child named '%s'", + name.str().c_str()); } lldb::Format TypeSystemSwift::GetFormat(opaque_compiler_type_t type) { diff --git a/lldb/source/Plugins/TypeSystem/Swift/TypeSystemSwift.h b/lldb/source/Plugins/TypeSystem/Swift/TypeSystemSwift.h index 8646ffb598ecc..a9dac3b7a7187 100644 --- a/lldb/source/Plugins/TypeSystem/Swift/TypeSystemSwift.h +++ b/lldb/source/Plugins/TypeSystem/Swift/TypeSystemSwift.h @@ -327,10 +327,10 @@ class TypeSystemSwift : public TypeSystem { /// Lookup a child given a name. This function will match base class names /// and member names in \p type only, not descendants. - uint32_t GetIndexOfChildWithName(lldb::opaque_compiler_type_t type, - llvm::StringRef name, - ExecutionContext *exe_ctx, - bool omit_empty_base_classes) override; + llvm::Expected + GetIndexOfChildWithName(lldb::opaque_compiler_type_t type, + llvm::StringRef name, ExecutionContext *exe_ctx, + bool omit_empty_base_classes) override; CompilerType GetLValueReferenceType(lldb::opaque_compiler_type_t type) override { From 8cb9958e152809af7b2394b64e51426121eb8194 Mon Sep 17 00:00:00 2001 From: Anthony Latsis Date: Thu, 10 Jul 2025 01:48:55 +0100 Subject: [PATCH 9/9] [unittests] LLDB: Fix build failure after removal of `CompilerType::GetIndexOfFieldWithName` overload See https://github.com/llvm/llvm-project/pull/135963. `CompilerType::GetIndexOfChildWithName` has an additional parameter in our fork. (cherry picked from commit a4be6a2fb5b5bbfd86db46b9a6f0145c12a4d58f) --- lldb/unittests/Platform/PlatformSiginfoTest.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lldb/unittests/Platform/PlatformSiginfoTest.cpp b/lldb/unittests/Platform/PlatformSiginfoTest.cpp index 621c36c3b8dc4..470a32935065e 100644 --- a/lldb/unittests/Platform/PlatformSiginfoTest.cpp +++ b/lldb/unittests/Platform/PlatformSiginfoTest.cpp @@ -61,7 +61,9 @@ class PlatformSiginfoTest : public ::testing::Test { for (auto field_name : llvm::split(path, '.')) { uint64_t bit_offset; std::string name; - auto index_or_err = field_type.GetIndexOfChildWithName(field_name, false); + lldb_private::ExecutionContext exe_ctx{}; + auto index_or_err = + field_type.GetIndexOfChildWithName(field_name, &exe_ctx, false); ASSERT_FALSE(!index_or_err); field_type = field_type.GetFieldAtIndex(*index_or_err, name, &bit_offset, nullptr, nullptr);