Files
swift-mirror/test/DebugInfo/weak-self-capture.swift
Adrian Prantl 6632a200f2 Represent indirect function arguments in the DWARF expression instead of the type.
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
2018-04-03 09:46:58 -07:00

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)),