1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61
|
// RUN: %target-sil-opt %s
// REQUIRES: concurrency
// This test ensures that the SILVerifier does enforce that concurrent functions
// must have non-box parameters in canonical SIL for loadable types.
sil_stage canonical
import Builtin
func f(_: @escaping @Sendable () -> ())
@_hasMissingDesignatedInitializers
class F {
func useConcurrent(_: @escaping @Sendable () -> ())
init()
}
enum FakeOptional<T> {
case none
case some(T)
}
struct Int {
var _value: Builtin.Int64
}
class Klass {}
////////////////////
// Loadable Type //
////////////////////
sil @$s37concurrentfunction_capturediagnostics1fyyyyJcF : $@convention(thin) (@guaranteed @Sendable @callee_guaranteed () -> ()) -> ()
sil @$sSi22_builtinIntegerLiteralSiBI_tcfC : $@convention(method) (Builtin.IntLiteral, @thin Int.Type) -> Int // user: %5
sil @$s37concurrentfunction_capturediagnostics20testCaseTrivialValueyyFyyJcfU_ : $@convention(thin) @Sendable (@guaranteed { var Int }) -> () // user: %10
// testCaseTrivialValue()
sil hidden [ossa] @$s37concurrentfunction_capturediagnostics20testCaseTrivialValueyyF : $@convention(thin) () -> () {
bb0:
%0 = alloc_box ${ var Int }, var, name "i" // users: %34, %8, %1
%1 = project_box %0 : ${ var Int }, 0 // users: %30, %26, %18, %9, %6
%2 = integer_literal $Builtin.IntLiteral, 17 // user: %5
%3 = metatype $@thin Int.Type // user: %5
// function_ref Int.init(_builtinIntegerLiteral:)
%4 = function_ref @$sSi22_builtinIntegerLiteralSiBI_tcfC : $@convention(method) (Builtin.IntLiteral, @thin Int.Type) -> Int // user: %5
%5 = apply %4(%2, %3) : $@convention(method) (Builtin.IntLiteral, @thin Int.Type) -> Int // user: %6
store %5 to [trivial] %1 : $*Int // id: %6
// function_ref closure #1 in testCaseTrivialValue()
%7 = function_ref @$s37concurrentfunction_capturediagnostics20testCaseTrivialValueyyFyyJcfU_ : $@convention(thin) @Sendable (@guaranteed { var Int }) -> () // user: %10
%8 = copy_value %0 : ${ var Int } // user: %10
%10 = partial_apply [callee_guaranteed] %7(%8) : $@convention(thin) @Sendable (@guaranteed { var Int }) -> () // users: %13, %12
// function_ref f(_:)
%11 = function_ref @$s37concurrentfunction_capturediagnostics1fyyyyJcF : $@convention(thin) (@guaranteed @Sendable @callee_guaranteed () -> ()) -> () // user: %12
%12 = apply %11(%10) : $@convention(thin) (@guaranteed @Sendable @callee_guaranteed () -> ()) -> ()
destroy_value %10 : $@Sendable @callee_guaranteed () -> () // id: %13
destroy_value %0 : ${ var Int }
%35 = tuple () // user: %36
return %35 : $() // id: %36
} // end sil function '$s37concurrentfunction_capturediagnostics20testCaseTrivialValueyyF'
|