mirror of
https://github.com/apple/swift.git
synced 2026-10-26 20:15:53 +01:00
The opaque values test coverage I initially added will emit to stdout, which is noisy for people's logs if the test is failing for some other reason.
32 lines
1.3 KiB
Swift
32 lines
1.3 KiB
Swift
// RUN: %target-swift-emit-silgen-ossa -o /dev/null -enable-sil-opaque-values %s
|
|
// RUN: %target-swift-emit-silgen %s | %FileCheck %s
|
|
// RUN: %target-swift-emit-sil %s | %FileCheck -check-prefix=SIL %s
|
|
|
|
// This test makes sure that in various situations (ignoring errors), we
|
|
// properly handle deinits with move only types.
|
|
|
|
public struct FD: ~Copyable {
|
|
var i = 5
|
|
}
|
|
|
|
public func borrowVal(_ e : borrowing FD) {}
|
|
public func consumeVal(_ s: __owned FD) {}
|
|
|
|
// CHECK: sil hidden [ossa] @$s22moveonly_deinit_access0B17AccessConsumeTestyyAA2FDVzF : $@convention(thin) (@inout FD) -> () {
|
|
// CHECK: bb0([[ARG:%.*]] :
|
|
// CHECK: [[MARK:%.*]] = mark_unresolved_non_copyable_value [consumable_and_assignable] [[ARG]]
|
|
// CHECK: [[ACCESS:%.*]] = begin_access [deinit] [unknown] [[MARK]]
|
|
// CHECK: [[TAKE:%.*]] = load [take] [[ACCESS]]
|
|
// CHECK: apply {{%.*}}([[TAKE]]) : $@convention(thin) (@owned FD) -> ()
|
|
// CHECK: end_access [[ACCESS]]
|
|
// CHECK: } // end sil function '$s22moveonly_deinit_access0B17AccessConsumeTestyyAA2FDVzF'
|
|
//
|
|
// SIL: sil hidden @$s22moveonly_deinit_access0B17AccessConsumeTestyyAA2FDVzF : $@convention(thin) (@inout FD) -> () {
|
|
// SIL: begin_access [deinit] [static]
|
|
// SIL: } // end sil function '$s22moveonly_deinit_access0B17AccessConsumeTestyyAA2FDVzF'
|
|
func deinitAccessConsumeTest(_ x: inout FD) {
|
|
consumeVal(x)
|
|
x = FD()
|
|
}
|
|
|