Skip to content
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
2 changes: 1 addition & 1 deletion lib/SILGen/SILGenExpr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -404,7 +404,7 @@ void SILGenFunction::emitExprInto(Expr *E, Initialization *I,
FormalEvaluationScope writeback(*this);
auto lv = emitLValue(load->getSubExpr(),
SGFAccessKind::BorrowedAddressRead);
emitCopyLValueInto(E, std::move(lv), I);
emitCopyLValueInto(L ? *L : E, std::move(lv), I);
return;
}

Expand Down
17 changes: 17 additions & 0 deletions test/SILGen/guardlet_debuginfo.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
// RUN: %target-swift-emit-silgen -g -Xllvm -sil-print-debuginfo %s | %FileCheck %s

class A {
func foo() {
{ [weak self] in
// Check that column 14 -- the start "guard" -- is used as the debug location,
// as other locations are considered implicit.
// CHECK: switch_enum
// CHECK-SAME: guardlet_debuginfo.swift":[[@LINE+1]]:13
guard let self else { return }
print(self)
}()
}
}

let a = A()
a.foo()