Skip to content

Commit 1f0225b

Browse files
authored
Merge pull request swiftlang#35995 from adrian-prantl/concurrent-prologue-locs
2 parents 65a9052 + 625e660 commit 1f0225b

File tree

2 files changed

+28
-3
lines changed

2 files changed

+28
-3
lines changed

lib/SILGen/SILGenProlog.cpp

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -468,7 +468,10 @@ void SILGenFunction::emitProlog(CaptureInfo captureInfo,
468468
case ActorIsolation::ActorInstance: {
469469
assert(selfParam && "no self parameter for ActorInstance isolation");
470470
ManagedValue selfArg = ManagedValue::forUnmanaged(F.getSelfArgument());
471-
actor = selfArg.borrow(*this, F.getLocation()).getValue();
471+
actor = selfArg
472+
.borrow(*this, RegularLocation::getAutoGeneratedLocation(
473+
F.getLocation()))
474+
.getValue();
472475
break;
473476
}
474477

@@ -492,7 +495,8 @@ void SILGenFunction::emitProlog(CaptureInfo captureInfo,
492495
}
493496
}
494497

495-
emitHopToCurrentExecutor(F.getLocation());
498+
emitHopToCurrentExecutor(
499+
RegularLocation::getAutoGeneratedLocation(F.getLocation()));
496500
}
497501

498502
SILValue SILGenFunction::emitLoadActorExecutor(VarDecl *actorDecl) {
@@ -510,7 +514,7 @@ SILValue SILGenFunction::emitLoadGlobalActorExecutor(Type globalActor) {
510514
assert(sharedInstanceDecl && "no shared actor field in global actor");
511515
SubstitutionMap subs =
512516
actorType->getContextSubstitutionMap(SGM.SwiftModule, nominal);
513-
SILLocation loc = F.getLocation();
517+
SILLocation loc = RegularLocation::getAutoGeneratedLocation(F.getLocation());
514518
Type instanceType =
515519
actorType->getTypeOfMember(SGM.SwiftModule, sharedInstanceDecl);
516520

test/SILGen/concurrent_prologue.swift

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
// RUN: %target-swift-frontend -emit-silgen %s -module-name a -swift-version 5 -enable-experimental-concurrency -Xllvm -sil-print-debuginfo -emit-verbose-sil -parse-as-library | %FileCheck %s
2+
// REQUIRES: concurrency
3+
4+
// Test that the async dispatch code in the prologue has auto-generated debug
5+
// locations.
6+
7+
@MainActor func f() async -> Int {
8+
// CHECK: {{^sil .*}}@$s1a1fSiyYF
9+
// CHECK: %0 = metatype {{.*}}loc "{{.*}}.swift":[[@LINE-2]]:17,{{.*}}:auto_gen
10+
// CHECK: %1 = function_ref {{.*}}loc "{{.*}}.swift":[[@LINE-3]]:17,{{.*}}:auto_gen
11+
// CHECK: %2 = apply %1(%0) {{.*}}loc "{{.*}}.swift":[[@LINE-4]]:17,{{.*}}:auto_gen
12+
// CHECK: begin_borrow {{.*}}loc "{{.*}}.swift":[[@LINE-5]]:17,{{.*}}:auto_gen
13+
// CHECK: hop_to_executor {{.*}}loc "{{.*}}.swift":[[@LINE-6]]:17,{{.*}}:auto_gen
14+
// CHECK: // end sil function '$s1a1fSiyYF'
15+
return 23
16+
}
17+
@main struct Main {
18+
static func main() async {
19+
let x = await f();
20+
}
21+
}

0 commit comments

Comments
 (0)