Commit Graph

7 Commits

Author SHA1 Message Date
Joe Groff
acac14e757 SILGen: Copy the block before detaching a task for async methods called from ObjC.
The block needs to survive long enough for the task to get scheduled. Fixes rdar://76871310.
2021-05-03 15:31:22 -07:00
Joe Groff
fb199df1c7 SILGen: Support overriding/conforming to ObjC APIs with async error flag arguments. 2021-02-23 08:56:44 -08:00
Richard Howell
6b6e5b84a6 [Testing] Add missing REQUIRES: concurrency 2021-01-22 14:16:15 -08:00
Doug Gregor
3c38ffe0ea [Concurrency] await try -> try await
The `try await` ordering is both easier to read and indicates the order
of operations better, because the suspension point occurs first and
then one can observe a thrown error.
2020-12-23 13:21:59 -08:00
Joe Groff
0b0264cbdc SILGen: Implement native-to-foreign thunks for async interfaces with nullable completion handlers.
If the ObjC interface is passed a null completion handler, just discard the result of the native async call after it
finishes.
2020-12-15 17:21:35 -08:00
Joe Groff
5087e411c2 SILGen: Implement native-to-foreign thunks for async methods.
Bridging an async Swift method back to an ObjC completion-handler-based API requires
that the ObjC thunk spawn a task on which to execute the Swift async API and pass
its results back on to the completion handler.
2020-12-08 10:04:40 -08:00
Joe Groff
81b8cdcfd2 SILGen: Update emitForeignToNativeThunk to handle async methods.
So if we use an ObjC imported as async to conform to a Swift protocol, delegate a Swift subclass initializer, etc.,
we generate the conversion thunk to the Swift calling convention for the imported API.
2020-11-18 17:13:20 -08:00