Skip to content

Commit fd20d77

Browse files
committed
[Swift] lldb: Adjust code after UnwindPlan pointer const qualification
See llvm#134246 (cherry picked from commit 4ee1ea1)
1 parent d8b25be commit fd20d77

File tree

1 file changed

+11
-11
lines changed

1 file changed

+11
-11
lines changed

lldb/source/Plugins/LanguageRuntime/Swift/SwiftLanguageRuntime.cpp

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2486,7 +2486,7 @@ static llvm::Expected<addr_t> ReadPtrFromAddr(Process &process, addr_t addr,
24862486
/// access to those here would be challenging.
24872487
static llvm::Expected<addr_t> GetCFA(Process &process, RegisterContext &regctx,
24882488
addr_t pc_offset,
2489-
UnwindPlan &unwind_plan) {
2489+
const UnwindPlan &unwind_plan) {
24902490
auto *row = unwind_plan.GetRowForFunctionOffset(pc_offset);
24912491
if (!row)
24922492
return llvm::createStringError(
@@ -2516,22 +2516,22 @@ static llvm::Expected<addr_t> GetCFA(Process &process, RegisterContext &regctx,
25162516
cfa_loc.GetValueType());
25172517
}
25182518

2519-
static UnwindPlanSP GetUnwindPlanForAsyncRegister(FuncUnwinders &unwinders,
2520-
Target &target,
2521-
Thread &thread) {
2519+
static std::shared_ptr<const UnwindPlan>
2520+
GetUnwindPlanForAsyncRegister(FuncUnwinders &unwinders, Target &target,
2521+
Thread &thread) {
25222522
// We cannot trust compiler emitted unwind plans, as they respect the
25232523
// swifttail calling convention, which assumes the async register is _not_
25242524
// restored and therefore it is not tracked by compiler plans. If LLDB uses
25252525
// those plans, it may take "no info" to mean "register not clobbered". For
25262526
// those reasons, always favour the assembly plan first, it will try to track
25272527
// the async register by assuming the usual arm calling conventions.
2528-
if (UnwindPlanSP asm_plan = unwinders.GetAssemblyUnwindPlan(target, thread))
2528+
if (auto asm_plan = unwinders.GetAssemblyUnwindPlan(target, thread))
25292529
return asm_plan;
25302530
// In the unlikely case the assembly plan is not available, try all others.
25312531
return unwinders.GetUnwindPlanAtNonCallSite(target, thread);
25322532
}
25332533

2534-
static llvm::Expected<UnwindPlanSP>
2534+
static llvm::Expected<std::shared_ptr<const UnwindPlan>>
25352535
GetAsmUnwindPlan(Address pc, SymbolContext &sc, Thread &thread) {
25362536
FuncUnwindersSP unwinders =
25372537
pc.GetModule()->GetUnwindTable().GetFuncUnwindersContainingAddress(pc,
@@ -2541,7 +2541,7 @@ GetAsmUnwindPlan(Address pc, SymbolContext &sc, Thread &thread) {
25412541
"function unwinder at address 0x%8.8" PRIx64,
25422542
pc.GetFileAddress());
25432543

2544-
UnwindPlanSP unwind_plan = GetUnwindPlanForAsyncRegister(
2544+
auto unwind_plan = GetUnwindPlanForAsyncRegister(
25452545
*unwinders, thread.GetProcess()->GetTarget(), thread);
25462546
if (!unwind_plan)
25472547
return llvm::createStringError(
@@ -2551,8 +2551,8 @@ GetAsmUnwindPlan(Address pc, SymbolContext &sc, Thread &thread) {
25512551
return unwind_plan;
25522552
}
25532553

2554-
static llvm::Expected<uint32_t> GetFpRegisterNumber(UnwindPlan &unwind_plan,
2555-
RegisterContext &regctx) {
2554+
static llvm::Expected<uint32_t>
2555+
GetFpRegisterNumber(const UnwindPlan &unwind_plan, RegisterContext &regctx) {
25562556
uint32_t fp_unwind_regdomain;
25572557
if (!regctx.ConvertBetweenRegisterKinds(
25582558
lldb::eRegisterKindGeneric, LLDB_REGNUM_GENERIC_FP,
@@ -2580,7 +2580,7 @@ struct FrameSetupInfo {
25802580
/// compared against it.
25812581
/// 2. The CFA offset at which FP is stored, meaningless in the frameless case.
25822582
static llvm::Expected<FrameSetupInfo>
2583-
GetFrameSetupInfo(UnwindPlan &unwind_plan, RegisterContext &regctx) {
2583+
GetFrameSetupInfo(const UnwindPlan &unwind_plan, RegisterContext &regctx) {
25842584
using AbstractRegisterLocation = UnwindPlan::Row::AbstractRegisterLocation;
25852585

25862586
llvm::Expected<uint32_t> fp_unwind_regdomain =
@@ -2645,7 +2645,7 @@ GetFrameSetupInfo(UnwindPlan &unwind_plan, RegisterContext &regctx) {
26452645
static llvm::Expected<addr_t> ReadAsyncContextRegisterFromUnwind(
26462646
SymbolContext &sc, Process &process, Address pc, Address func_start_addr,
26472647
RegisterContext &regctx, AsyncUnwindRegisterNumbers regnums) {
2648-
llvm::Expected<UnwindPlanSP> unwind_plan =
2648+
llvm::Expected<std::shared_ptr<const UnwindPlan>> unwind_plan =
26492649
GetAsmUnwindPlan(pc, sc, regctx.GetThread());
26502650
if (!unwind_plan)
26512651
return unwind_plan.takeError();

0 commit comments

Comments
 (0)