Skip to content

Commit 75d040f

Browse files
committed
Update VariableNameInferrer for borrow/mutate accessors
1 parent d54044c commit 75d040f

File tree

2 files changed

+12
-1
lines changed

2 files changed

+12
-1
lines changed

lib/SIL/IR/SILValue.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -210,7 +210,7 @@ bool ValueBase::isBorrowAccessorResult() const {
210210
auto *apply = dyn_cast_or_null<ApplyInst>(getDefiningInstruction());
211211
if (!apply)
212212
return false;
213-
return apply->hasGuaranteedResult();
213+
return apply->hasGuaranteedResult() || apply->hasGuaranteedAddressResult();
214214
}
215215

216216
bool ValueBase::hasDebugTrace() const {

lib/SILOptimizer/Utils/VariableNameUtils.cpp

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -599,6 +599,17 @@ SILValue VariableNameInferrer::findDebugInfoProvidingValueHelper(
599599
}
600600
}
601601

602+
// Borrow/mutate accessor
603+
if (searchValue->isBorrowAccessorResult()) {
604+
if (auto fas =
605+
FullApplySite::isa(searchValue->getDefiningInstruction())) {
606+
if (auto selfParam = getNamePathComponentFromCallee(fas)) {
607+
searchValue = selfParam;
608+
continue;
609+
}
610+
}
611+
}
612+
602613
// Addressor accessor.
603614
if (auto ptrToAddr =
604615
dyn_cast<PointerToAddressInst>(stripAccessMarkers(searchValue))) {

0 commit comments

Comments
 (0)