Files
swift-mirror/test/DebugInfo/weak-self-capture.swift
2024-07-23 11:06:12 -07:00

20 lines
509 B
Swift

// RUN: %target-swift-frontend %s -emit-ir -g -o - | %FileCheck %s
public class ClosureMaker {
var a : Int
init (a : Int) { self.a = a }
public func getClosure() -> (() -> Int) {
return { [weak self] () -> Int in
if let _self = self {
return _self.a
} else {
return 0
}
}
}
}
// CHECK: define {{.*}} @"$s4main12ClosureMakerC03getB0SiycyFSiycfU_"
// CHECK: #dbg_declare(ptr %{{.*}} !DIExpression(DW_OP_deref)