[LifetimeChecker] Update the debug scope when changing insertion point.

<rdar://problem/36679700>
This commit is contained in:
Davide Italiano
2018-01-22 14:45:08 -08:00
parent 38190fac57
commit 3d9eb3d7e5
2 changed files with 42 additions and 0 deletions

View File

@@ -2436,6 +2436,7 @@ handleConditionalDestroys(SILValue ControlVariableAddr) {
auto &Availability = CDElt.Availability;
B.setInsertionPoint(Release);
B.setCurrentDebugScope(Release->getDebugScope());
// Value types and root classes don't require any fancy handling.
// Just conditionally destroy each memory element, and for classes,
@@ -2507,10 +2508,12 @@ handleConditionalDestroys(SILValue ControlVariableAddr) {
// If true, self.init or super.init was called and self was consumed.
B.setInsertionPoint(ConsumedBlock->begin());
B.setCurrentDebugScope(ConsumedBlock->begin()->getDebugScope());
processUninitializedRelease(Release, true, B.getInsertionPoint());
// If false, self is uninitialized and must be freed.
B.setInsertionPoint(DeallocBlock->begin());
B.setCurrentDebugScope(DeallocBlock->begin()->getDebugScope());
destroyMemoryElements(Loc, Availability);
processUninitializedRelease(Release, false, B.getInsertionPoint());
@@ -2541,11 +2544,13 @@ handleConditionalDestroys(SILValue ControlVariableAddr) {
// If true, self was consumed or is fully initialized.
B.setInsertionPoint(LiveBlock->begin());
B.setCurrentDebugScope(LiveBlock->begin()->getDebugScope());
emitReleaseOfSelfWhenNotConsumed(Loc, Release);
isDeadRelease = false;
// If false, self is uninitialized and must be freed.
B.setInsertionPoint(DeallocBlock->begin());
B.setCurrentDebugScope(DeallocBlock->begin()->getDebugScope());
destroyMemoryElements(Loc, Availability);
processUninitializedRelease(Release, false, B.getInsertionPoint());