mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
[sil] Delete SILInstruction::removeFromParent().
This is a very easily misused API since it allows for users to leak instructions if they are not careful. This commit removes this API and replaces the small number of uses of this API with higher level APIs that accomplish the same task without using removeFromParent(). There were no API users that specifically required removeFromParent. An example of one way we were using removeFromParent is to move a SILInstruction to the front of a block. That does not require exposing an API like removeFromParent()... we can just create a higher level API like the one added in this commit: SILInstruction::moveFront(SILBasicBlock *). rdar://31276565
This commit is contained in:
@@ -2237,8 +2237,7 @@ handleConditionalDestroys(SILValue ControlVariableAddr) {
|
||||
}
|
||||
case DIKind::Yes:
|
||||
// super.init() already called, just release the value.
|
||||
Release->removeFromParent();
|
||||
B.getInsertionBB()->insert(B.getInsertionPoint(), Release);
|
||||
Release->moveBefore(&*B.getInsertionPoint());
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user