mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
Prior to this patch, a "guard let" was being lowered with an implicit debug location, causing it to be dropped in later stages of the compiler, and making it impossible to set a breakpoint in that line. This was tracked down to a piece of code in `SILGenFunction::emitExprInto`, which takes an optional Location parameter that was being ignored in one code path.
18 lines
456 B
Swift
18 lines
456 B
Swift
// RUN: %target-swift-emit-silgen -g -Xllvm -sil-print-debuginfo %s | %FileCheck %s
|
|
|
|
class A {
|
|
func foo() {
|
|
{ [weak self] in
|
|
// Check that column 14 -- the start "guard" -- is used as the debug location,
|
|
// as other locations are considered implicit.
|
|
// CHECK: switch_enum
|
|
// CHECK-SAME: guardlet_debuginfo.swift":[[@LINE+1]]:13
|
|
guard let self else { return }
|
|
print(self)
|
|
}()
|
|
}
|
|
}
|
|
|
|
let a = A()
|
|
a.foo()
|