|
| 1 | +// RUN: %empty-directory(%t) |
| 2 | +// RUN: %target-swift-frontend -emit-module-path=%t/RAD.swiftmodule -module-name=RAD -enable-experimental-feature RuntimeDiscoverableAttrs -disable-availability-checking %S/Inputs/runtime_attrs.swift |
| 3 | +// RUN: %target-swift-frontend -primary-file %s -emit-ir -I %t -swift-version 5 -enable-experimental-feature RuntimeDiscoverableAttrs -disable-availability-checking | %IRGenFileCheck %s |
| 4 | + |
| 5 | +// REQUIRES: asserts |
| 6 | +// REQUIRES: OS=macosx |
| 7 | +// REQUIRES: concurrency |
| 8 | + |
| 9 | +// CHECK: @"$s28runtime_attributes_on_actors9TestActorC15asyncExternallyyyKcvpfaAA17FlagForAsyncFuncsHF" |
| 10 | +// CHECK: @"$s28runtime_attributes_on_actors9TestActorC11doSomethingyyYaKcvpfaAA17FlagForAsyncFuncsHF" |
| 11 | +// CHECK: @"$s28runtime_attributes_on_actors9TestActorC11doSomethingyySiYacvpfaAA17FlagForAsyncFuncsHF" |
| 12 | +// CHECK: @"$s28runtime_attributes_on_actors9TestActorC11doSomething_1xySi_SaySiGztYacvpfaAA17FlagForAsyncFuncsHF" |
| 13 | +// CHECK: @"$s28runtime_attributes_on_actors13globalAsyncFnSaySSGyYacvpfaAA07FlagForF5FuncsHF" |
| 14 | + |
| 15 | +// CHECK: @"$s28runtime_attributes_on_actors17FlagForAsyncFuncsVHa" = internal constant |
| 16 | +// CHECK-SAME: i32 5 |
| 17 | +// CHECK-SAME: %swift.accessible_function* @"$s28runtime_attributes_on_actors9TestActorC15asyncExternallyyyKcvpfaAA17FlagForAsyncFuncsHF" |
| 18 | +// CHECK-SAME: %swift.accessible_function* @"$s28runtime_attributes_on_actors9TestActorC11doSomethingyyYaKcvpfaAA17FlagForAsyncFuncsHF" |
| 19 | +// CHECK-SAME: %swift.accessible_function* @"$s28runtime_attributes_on_actors9TestActorC11doSomethingyySiYacvpfaAA17FlagForAsyncFuncsHF" |
| 20 | +// CHECK-SAME: %swift.accessible_function* @"$s28runtime_attributes_on_actors9TestActorC11doSomething_1xySi_SaySiGztYacvpfaAA17FlagForAsyncFuncsHF" |
| 21 | +// CHECK-SAME: %swift.accessible_function* @"$s28runtime_attributes_on_actors13globalAsyncFnSaySSGyYacvpfaAA07FlagForF5FuncsHF" |
| 22 | + |
| 23 | +@runtimeMetadata |
| 24 | +struct FlagForAsyncFuncs { |
| 25 | + init<Act>(attachedTo: (Act) async throws -> Void) {} |
| 26 | + init<Act>(attachedTo: (Act, Int, inout [Int]) async throws -> Void) {} |
| 27 | + init<Act>(attachedTo: (Act, Int) async -> Void) {} |
| 28 | + init(attachedTo: () async -> [String]) {} |
| 29 | +} |
| 30 | + |
| 31 | +actor TestActor { |
| 32 | + // CHECK-LABEL: define hidden swiftcc void @"$s28runtime_attributes_on_actors9TestActorC15asyncExternallyyyKcvpfaAA17FlagForAsyncFuncs"(%T28runtime_attributes_on_actors17FlagForAsyncFuncsVSg* noalias nocapture sret(%T28runtime_attributes_on_actors17FlagForAsyncFuncsVSg) %0) |
| 33 | + @FlagForAsyncFuncs func asyncExternally() throws { |
| 34 | + } |
| 35 | + |
| 36 | + // CHECK-LABEL: define hidden swiftcc void @"$s28runtime_attributes_on_actors9TestActorC11doSomethingyyYaKcvpfaAA17FlagForAsyncFuncs"(%T28runtime_attributes_on_actors17FlagForAsyncFuncsVSg* noalias nocapture sret(%T28runtime_attributes_on_actors17FlagForAsyncFuncsVSg) %0) |
| 37 | + @FlagForAsyncFuncs func doSomething() async throws { |
| 38 | + } |
| 39 | + |
| 40 | + // CHECK-LABEL: define hidden swiftcc void @"$s28runtime_attributes_on_actors9TestActorC11doSomethingyySiYacvpfaAA17FlagForAsyncFuncs"(%T28runtime_attributes_on_actors17FlagForAsyncFuncsVSg* noalias nocapture sret(%T28runtime_attributes_on_actors17FlagForAsyncFuncsVSg) %0) |
| 41 | + @FlagForAsyncFuncs nonisolated func doSomething(_: Int) async { |
| 42 | + } |
| 43 | + |
| 44 | + // CHECK-LABEL: define hidden swiftcc void @"$s28runtime_attributes_on_actors9TestActorC11doSomething_1xySi_SaySiGztYacvpfaAA17FlagForAsyncFuncs"(%T28runtime_attributes_on_actors17FlagForAsyncFuncsVSg* noalias nocapture sret(%T28runtime_attributes_on_actors17FlagForAsyncFuncsVSg) %0) |
| 45 | + @FlagForAsyncFuncs func doSomething(_: Int, x: inout [Int]) async { |
| 46 | + } |
| 47 | +} |
| 48 | + |
| 49 | +// CHECK-LABEL: define hidden swiftcc void @"$s28runtime_attributes_on_actors13globalAsyncFnSaySSGyYacvpfaAA07FlagForF5Funcs"(%T28runtime_attributes_on_actors17FlagForAsyncFuncsVSg* noalias nocapture sret(%T28runtime_attributes_on_actors17FlagForAsyncFuncsVSg) %0) |
| 50 | +@FlagForAsyncFuncs |
| 51 | +func globalAsyncFn() async -> [String] { |
| 52 | + return [] |
| 53 | +} |
0 commit comments