[PATCH] D102412: [coro] Preserve scope line for compiler generated functions
Dave Lee via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon May 17 17:56:02 PDT 2021
kastiglione updated this revision to Diff 346028.
kastiglione added a comment.
only propagate scope line when files are the same
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D102412/new/
https://reviews.llvm.org/D102412
Files:
llvm/lib/Transforms/Coroutines/CoroSplit.cpp
Index: llvm/lib/Transforms/Coroutines/CoroSplit.cpp
===================================================================
--- llvm/lib/Transforms/Coroutines/CoroSplit.cpp
+++ llvm/lib/Transforms/Coroutines/CoroSplit.cpp
@@ -850,14 +850,18 @@
auto &Context = NewF->getContext();
// For async functions / continuations, adjust the scope line of the
- // clone to the line number of the suspend point. The scope line is
+ // clone to the line number of the suspend point. However, only
+ // adjust the scope line when the files are the same. This
+ // restriction ensures compiler-generated functions don't
+ // inadvertently get non-sensical line numbers. The scope line is
// associated with all pre-prologue instructions. This avoids a jump
// in the linetable from the function declaration to the suspend point.
if (DISubprogram *SP = NewF->getSubprogram()) {
assert(SP != OrigF.getSubprogram() && SP->isDistinct());
if (ActiveSuspend)
if (auto DL = ActiveSuspend->getDebugLoc())
- SP->setScopeLine(DL->getLine());
+ if (SP->getFile() == DL->getFile())
+ SP->setScopeLine(DL->getLine());
// Update the linkage name to reflect the modified symbol name. It
// is necessary to update the linkage name in Swift, since the
// mangling changes for resume functions. It might also be the
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D102412.346028.patch
Type: text/x-patch
Size: 1357 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210518/356a9ab6/attachment.bin>
More information about the llvm-commits
mailing list