Files
swift-mirror/test/DebugInfo/closure-capture-linetable.swift
Emil Pedersen 77df2fb6d7 [SILGen] [DebugInfo] Mark closure capture instructions as prologue
Instructions generated as part of SILGenProlog for closure capture
must be marked as in prologue, as stepping on them in LLDB is
invalid. The debugger is not supposed to stop with the location of
the variable being captured, in a state where the variable isn't
available yet.

rdar://176463223
2026-05-20 14:03:01 +01:00

24 lines
686 B
Swift

// RUN: %target-swift-frontend %s -emit-sil -Xllvm -sil-print-debuginfo -Xllvm -sil-print-debuginfo-verbose -g -o - | %FileCheck %s
var escapee = {}
func bar() {
var arr = [1.0, 2, 3]
escapee = {
// Make sure that the project_box is marked as part of the prologue.
// CHECK: sil private @$s4main3baryyFyycfU_
// CHECK: bb0(%0 : @closureCapture ${ var Array<Double> }):
// CHECK: %1 = project_box %0, 0, loc {{.*}} isImplicit: false, isAutoGenerated: false, isHiddenFromDebugInfo: false, isInPrologue: true
// CHECK: debug_value %1, var, name "arr", argno 1, expr op_deref
for _ in arr {}
arr = []
}
}
func main() {
bar()
escapee()
}
main()