[DebugInfo] Improve stepping behavior for switch case stmts

Assign the location of a switch statement's subject expression to all of
its case statements.

This improves the debugger's stepping behavior in switch statements.
Stepping into a switch now goes directly to the first matching case
(possibly one with a `where` clause that may or may not match). It's
still possible to set breakpoints within `where` clauses.

rdar://35628672
This commit is contained in:
Vedant Kumar
2018-03-06 15:06:02 -08:00
committed by Vedant Kumar
parent a0d9c2371a
commit f9372fdb62
5 changed files with 178 additions and 13 deletions

View File

@@ -521,3 +521,20 @@ void SILBuilder::emitShallowDestructureAddressOperation(
return P.createAddressProjection(*this, Loc, V).get();
});
}
DebugValueInst *SILBuilder::createDebugValue(SILLocation Loc, SILValue src,
SILDebugVariable Var) {
// Debug location overrides cannot apply to debug value instructions.
DebugLocOverrideRAII LocOverride{*this, None};
return insert(
DebugValueInst::create(getSILDebugLocation(Loc), src, getModule(), Var));
}
DebugValueAddrInst *SILBuilder::createDebugValueAddr(SILLocation Loc,
SILValue src,
SILDebugVariable Var) {
// Debug location overrides cannot apply to debug addr instructions.
DebugLocOverrideRAII LocOverride{*this, None};
return insert(DebugValueAddrInst::create(getSILDebugLocation(Loc), src,
getModule(), Var));
}