Skip to content

Commit 80e8d3a

Browse files
Merge pull request swiftlang#81463 from rastogishubham/AttachDebugLoc
Set debug location to Coroutine call expression
2 parents 1a6962f + 17e756b commit 80e8d3a

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
@@ -5023,6 +5023,8 @@ static void emitRetconCoroutineEntry(
50235023
for (auto *arg : finalArguments) {
50245024
arguments.push_back(arg);
50255025
}
5026+
ArtificialLocation Loc(IGF.getDebugScope(), IGF.IGM.DebugInfo.get(),
5027+
IGF.Builder);
50265028
llvm::Value *id = IGF.Builder.CreateIntrinsicCall(idIntrinsic, arguments);
50275029

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

5130-
ArtificialLocation Loc(IGF.getDebugScope(), IGF.IGM.DebugInfo.get(), IGF.Builder);
51315132
emitRetconCoroutineEntry(IGF, fnType, buffer,
51325133
llvm::Intrinsic::coro_id_retcon_once,
51335134
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)