mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
* Add explicit calling convention on builtin GetCurrentTask This builtin function emits a call of swift_task_getCurrent, and user code can declare the same name function with slightly different signature at LLVM level (data size should be same) using @_silgen_name. In that case, IRGen insert cast inst to cast the function to the expected signature. But this cast inst drops calling convention info, so call inst was emitted without swiftcc. This patch changed to emit a call of swift_task_getCurrent with the explicit calling convention. * Add test case to ensure builtin function cc when conflict
17 lines
670 B
Plaintext
17 lines
670 B
Plaintext
// RUN: %target-swift-frontend -emit-ir -parse-sil %s -parse-stdlib | %FileCheck %s
|
|
|
|
import Builtin
|
|
import Swift
|
|
|
|
sil @entry : $@async @convention(thin) () -> () {
|
|
bb0:
|
|
%0 = function_ref @swift_task_getCurrent : $@convention(thin) () -> @owned Optional<Builtin.NativeObject>
|
|
// CHECK: call swiftcc {{.*}} @swift_task_getCurrent
|
|
%1 = apply %0() : $@convention(thin) () -> @owned Optional<Builtin.NativeObject>
|
|
// CHECK-NEXT: call swiftcc {{.*}} @swift_task_getCurrent
|
|
%3 = builtin "getCurrentAsyncTask"() : $Builtin.NativeObject
|
|
return undef : $()
|
|
}
|
|
|
|
sil hidden_external @swift_task_getCurrent : $@convention(thin) () -> @owned Optional<Builtin.NativeObject>
|