Skip to content

Set debug location to Coroutine call expression #81495

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion lib/IRGen/GenCall.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5019,6 +5019,8 @@ static void emitRetconCoroutineEntry(
for (auto *arg : finalArguments) {
arguments.push_back(arg);
}
ArtificialLocation Loc(IGF.getDebugScope(), IGF.IGM.DebugInfo.get(),
IGF.Builder);
llvm::Value *id = IGF.Builder.CreateIntrinsicCall(idIntrinsic, arguments);

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

ArtificialLocation Loc(IGF.getDebugScope(), IGF.IGM.DebugInfo.get(), IGF.Builder);
emitRetconCoroutineEntry(IGF, fnType, buffer,
llvm::Intrinsic::coro_id_retcon_once,
getYieldOnceCoroutineBufferSize(IGF.IGM),
Expand Down
19 changes: 19 additions & 0 deletions test/IRGen/CoroutineAccessorsDebugLoc.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
// REQUIRES: swift_feature_CoroutineAccessors
// RUN: %target-swift-frontend %s -g -c -O -o - -emit-irgen -enable-experimental-feature CoroutineAccessors | %FileCheck %s

// 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.

// CHECK-LABEL: @"$s26CoroutineAccessorsDebugLoc1SV3irmSivr"
// CHECK: %{{.*}} = call token ({{.*}}) @llvm.coro.id.retcon.once({{.*}}), !dbg ![[DBGLOC:[0-9]+]]
// CHECK-NEXT: %{{.*}} = call ptr @llvm.coro.begin({{.*}}), !dbg ![[DBGLOC]]

public struct S {
public var o: any AnyObject
public var _i: Int = 0

public var irm: Int {
_read {
yield _i
}
} // public var irm
}