File tree Expand file tree Collapse file tree 2 files changed +7
-3
lines changed Expand file tree Collapse file tree 2 files changed +7
-3
lines changed Original file line number Diff line number Diff line change @@ -1980,8 +1980,11 @@ class SourceFileScope {
19801980 // emitAsyncMainThreadStart will create argc and argv.
19811981 // Just set the main actor as the expected executor; we should
19821982 // already be running on it.
1983+ SILValue executor = sgm.TopLevelSGF ->emitMainExecutor (prologueLoc);
19831984 sgm.TopLevelSGF ->ExpectedExecutor =
1984- sgm.TopLevelSGF ->emitMainExecutor (prologueLoc);
1985+ sgm.TopLevelSGF ->B .createOptionalSome (
1986+ prologueLoc, executor,
1987+ SILType::getOptionalType (executor->getType ()));
19851988 } else {
19861989 // Create the argc and argv arguments.
19871990 auto entry = sgm.TopLevelSGF ->B .getInsertionBB ();
Original file line number Diff line number Diff line change 88// CHECK-NEXT: // function_ref
99// CHECK-NEXT: [[GET_MAIN:%.*]] = function_ref @swift_task_getMainExecutor
1010// CHECK-NEXT: [[MAIN:%.*]] = apply [[GET_MAIN]]()
11+ // CHECK-NEXT: [[MAIN_OPTIONAL:%[0-9]+]] = enum $Optional<Builtin.Executor>, #Optional.some!enumelt, [[MAIN]]
1112
1213actor MyActorImpl { }
1314
@@ -67,7 +68,7 @@ await printFromMyActor(value: a)
6768// CHECK: [[ACTORREF:%[0-9]+]] = begin_borrow {{%[0-9]+}} : $MyActorImpl
6869// CHECK: hop_to_executor [[ACTORREF]] : $MyActorImpl
6970// CHECK: {{%[0-9]+}} = apply [[PRINTFROMMYACTOR_FUNC]]([[AGLOBAL]])
70- // CHECK: hop_to_executor [[MAIN ]]
71+ // CHECK: hop_to_executor [[MAIN_OPTIONAL ]]
7172// CHECK: end_borrow [[ACTORREF]]
7273
7374if a < 10 {
@@ -121,6 +122,6 @@ if a < 10 {
121122 // CHECK: [[ACTORREF:%[0-9]+]] = begin_borrow {{%[0-9]+}} : $MyActorImpl
122123 // CHECK: hop_to_executor [[ACTORREF]] : $MyActorImpl
123124 // CHECK: {{%[0-9]+}} = apply [[PRINTFROMMYACTOR_FUNC]]([[AGLOBAL]])
124- // CHECK: hop_to_executor [[MAIN ]]
125+ // CHECK: hop_to_executor [[MAIN_OPTIONAL ]]
125126 // CHECK: end_borrow [[ACTORREF]]
126127}
You can’t perform that action at this time.
0 commit comments