mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
The current approach has several problems: - Types that are not inout types but loadable may incorrectly get marked as inout types. - When inout arguments get inlined or otherwise optimized LLDB cannot rely on the type to decide to dereference that value. - One argument may get represented by different types in the same function depending on what code is generated for it. Fixes rdar://problem/rdar://problem/39023374
20 lines
545 B
Swift
20 lines
545 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: call void @llvm.dbg.declare(metadata %swift.weak** %{{.*}} !DIExpression(DW_OP_deref)),
|