Skip to content

Commit 6051867

Browse files
Merge pull request #81495 from rastogishubham/AttachDebugLoc6.2
Set debug location to Coroutine call expression
2 parents 54b0070 + cf204f2 commit 6051867

File tree

2 files changed

+21
-1
lines changed

2 files changed

+21
-1
lines changed

lib/IRGen/GenCall.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5019,6 +5019,8 @@ static void emitRetconCoroutineEntry(
50195019
for (auto *arg : finalArguments) {
50205020
arguments.push_back(arg);
50215021
}
5022+
ArtificialLocation Loc(IGF.getDebugScope(), IGF.IGM.DebugInfo.get(),
5023+
IGF.Builder);
50225024
llvm::Value *id = IGF.Builder.CreateIntrinsicCall(idIntrinsic, arguments);
50235025

50245026
// Call 'llvm.coro.begin', just for consistency with the normal pattern.
@@ -5125,7 +5127,6 @@ void irgen::emitYieldOnceCoroutineEntry(
51255127
allocFn = IGF.IGM.getOpaquePtr(IGF.IGM.getMallocFn());
51265128
}
51275129

5128-
ArtificialLocation Loc(IGF.getDebugScope(), IGF.IGM.DebugInfo.get(), IGF.Builder);
51295130
emitRetconCoroutineEntry(IGF, fnType, buffer,
51305131
llvm::Intrinsic::coro_id_retcon_once,
51315132
getYieldOnceCoroutineBufferSize(IGF.IGM),
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
// REQUIRES: swift_feature_CoroutineAccessors
2+
// RUN: %target-swift-frontend %s -g -c -O -o - -emit-irgen -enable-experimental-feature CoroutineAccessors | %FileCheck %s
3+
4+
// This test checks to made sure that the ReadAccessor s26CoroutineAccessorsDebugLoc1SV3irmSivr that has a call to @llvm.coro.id.retcon.once, also has a debug location set.
5+
6+
// CHECK-LABEL: @"$s26CoroutineAccessorsDebugLoc1SV3irmSivr"
7+
// CHECK: %{{.*}} = call token ({{.*}}) @llvm.coro.id.retcon.once({{.*}}), !dbg ![[DBGLOC:[0-9]+]]
8+
// CHECK-NEXT: %{{.*}} = call ptr @llvm.coro.begin({{.*}}), !dbg ![[DBGLOC]]
9+
10+
public struct S {
11+
public var o: any AnyObject
12+
public var _i: Int = 0
13+
14+
public var irm: Int {
15+
_read {
16+
yield _i
17+
}
18+
} // public var irm
19+
}

0 commit comments

Comments
 (0)