mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
This is necessary because we need to model its stack-allocation behavior, although I'm not yet doing that in this patch because StackNesting first needs to be taught to not try to move the deallocation. I'm not convinced that `async let` *should* be doing a stack allocation, but it undoubtedly *is* doing a stack allocation, and until we have an alternative to that, we will need to model it properly.
24 lines
676 B
Swift
24 lines
676 B
Swift
// RUN: %target-swiftc_driver %s -c -g -Onone -o - -Xllvm -sil-print-debuginfo -emit-sil -parse-as-library -module-name m | %FileCheck %s
|
|
|
|
// This test ensures that the hop_to_executor source location matches the end of the do block
|
|
|
|
func getTimestamp(x: Int) async -> Int {
|
|
return 40 + x
|
|
}
|
|
func work() {}
|
|
func foo() async {
|
|
do {
|
|
work()
|
|
async let timestamp2 = getTimestamp(x:2)
|
|
print(await timestamp2)
|
|
// CHECK: %{{[0-9]+}} = builtin "finishAsyncLet"(%{{[0-9]+}}, %{{[0-9]+}}) : $(), loc{{.*}}:[[@LINE+2]]
|
|
// CHECK-NEXT: hop_to_executor %0, loc * {{.*}}:[[@LINE+1]]
|
|
}
|
|
work()
|
|
}
|
|
@main enum entry {
|
|
static func main() async {
|
|
await foo()
|
|
}
|
|
}
|