mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
MoveOnlyAddressChecker: Reintroduce debug info for variables after reassignment.
After a value is consumed, we emit a `debug_value undef` to indicate that the variable value is no longer valid to the debugger. However, once a value is reassigned, it becomes valid again, so emit a `debug_value %original_address` to reassociate the variable with the valid memory location. rdar://109218404
This commit is contained in:
@@ -64,3 +64,26 @@ bool swift::hasNonTrivialNonDebugTransitiveUsers(
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
DebugVarCarryingInst DebugVarCarryingInst::getFromValue(SILValue value) {
|
||||
if (auto *svi = dyn_cast<SingleValueInstruction>(value)) {
|
||||
if (auto result = VarDeclCarryingInst(svi)) {
|
||||
switch (result.getKind()) {
|
||||
case VarDeclCarryingInst::Kind::Invalid:
|
||||
llvm_unreachable("ShouldKind have never seen this");
|
||||
case VarDeclCarryingInst::Kind::DebugValue:
|
||||
case VarDeclCarryingInst::Kind::AllocStack:
|
||||
case VarDeclCarryingInst::Kind::AllocBox:
|
||||
return DebugVarCarryingInst(svi);
|
||||
case VarDeclCarryingInst::Kind::GlobalAddr:
|
||||
case VarDeclCarryingInst::Kind::RefElementAddr:
|
||||
return DebugVarCarryingInst();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (auto *use = getSingleDebugUse(value))
|
||||
return DebugVarCarryingInst(use->getUser());
|
||||
|
||||
return DebugVarCarryingInst();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user