Files
swift-mirror/test/DebugInfo/WeakCapture.swift
Erik Eckstein 1d3724666f tests: convert about 400 tests to the new mangling by using the -new-mangling-for-tests option
When the new mangling is enabled permanently, the option can be removed from the RUN command lines again.
2017-01-24 15:27:45 -08:00

24 lines
676 B
Swift

// RUN: %target-swift-frontend -Xllvm -new-mangling-for-tests %s -emit-ir -g -o - | %FileCheck %s
class A {
init(handler: (() -> ())) { }
}
class B { }
// CHECK: define {{.*}} @_T011WeakCapture8functionyyF()
func function() {
let b = B()
// Ensure that the local b and its weak copy are distinct local variables.
// CHECK: call void @llvm.dbg.{{.*}}(metadata %C11WeakCapture1B*
// CHECK-SAME: metadata [[B:.*]], metadata
// CHECK: call void @llvm.dbg.{{.*}}(metadata %swift.weak*
// CHECK-NOT: metadata [[B]]
// CHECK: call
A(handler: { [weak b] _ in
if b != nil { }
})
}
function()