mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
Refactor SILGen's ApplyOptions into an OptionSet, add a DoesNotAwait flag to go with DoesNotThrow, and sink it all down into SILInstruction.h. Then, replace the isNonThrowing() flag in ApplyInst and BeginApplyInst with getApplyOptions(), and plumb it through to TryApplyInst as well. Set the flag when SILGen emits a sync call to a reasync function. When set, this disables the SIL verifier check against calling async functions from sync functions. Finally, this allows us to add end-to-end tests for rdar://problem/71098795.
33 lines
956 B
Plaintext
33 lines
956 B
Plaintext
// RUN: %target-sil-opt -enable-objc-interop -enable-experimental-concurrency -enable-sil-verify-all=true %s | %target-sil-opt -enable-objc-interop -enable-experimental-concurrency -enable-sil-verify-all=true | %FileCheck %s
|
|
// REQUIRES: concurrency
|
|
|
|
sil_stage raw // CHECK: sil_stage raw
|
|
|
|
import Builtin
|
|
import Swift
|
|
|
|
actor Actor { }
|
|
|
|
// CHECK-LABEL: sil @test_hop_to_executor
|
|
sil @test_hop_to_executor : $@convention(thin) (@guaranteed Actor) -> () {
|
|
bb0(%0 : $Actor):
|
|
// CHECK: hop_to_executor %0 : $Actor
|
|
hop_to_executor %0 : $Actor
|
|
%2 = tuple ()
|
|
return %2 : $()
|
|
}
|
|
|
|
sil @some_async_function : $@convention(thin) @async () -> ()
|
|
|
|
// CHECK-LABEL: sil @test_noasync_call
|
|
sil @test_noasync_call : $@convention(thin) () -> () {
|
|
bb0:
|
|
// CHECK: apply [noasync]
|
|
%fn = function_ref @some_async_function : $@convention(thin) @async () -> ()
|
|
%result = apply [noasync] %fn() : $@convention(thin) @async () -> ()
|
|
%2 = tuple ()
|
|
return %2 : $()
|
|
}
|
|
|
|
|