Skip to content

Commit fbf4c92

Browse files
committed
Update the scope of SILBuilder in ClosureCloner.
This is something that every visit() function needs to do and these manual overloads forgot to. I tried to come up with a more general solution, but due the rather nested inheritance of SILCloner this turned out harde than expected. rdar://107984038
1 parent 35fcc37 commit fbf4c92

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

lib/SILOptimizer/Mandatory/CapturePromotion.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -687,6 +687,7 @@ void ClosureCloner::visitEndAccessInst(EndAccessInst *eai) {
687687
/// The two relevant cases are a direct load from a promoted address argument or
688688
/// a load of a struct_element_addr of a promoted address argument.
689689
void ClosureCloner::visitLoadBorrowInst(LoadBorrowInst *lbi) {
690+
getBuilder().setCurrentDebugScope(getOpScope(lbi->getDebugScope()));
690691
assert(lbi->getFunction()->hasOwnership() &&
691692
"We should only see a load borrow in ownership qualified SIL");
692693
if (SILValue value = getProjectBoxMappedVal(lbi->getOperand())) {
@@ -729,6 +730,7 @@ void ClosureCloner::visitLoadBorrowInst(LoadBorrowInst *lbi) {
729730
/// The two relevant cases are a direct load from a promoted address argument or
730731
/// a load of a struct_element_addr of a promoted address argument.
731732
void ClosureCloner::visitLoadInst(LoadInst *li) {
733+
getBuilder().setCurrentDebugScope(getOpScope(li->getDebugScope()));
732734
if (SILValue value = getProjectBoxMappedVal(li->getOperand())) {
733735
// Loads of the address argument get eliminated completely; the uses of
734736
// the loads get mapped to uses of the new object type argument.

0 commit comments

Comments
 (0)