Skip to content

Commit 5fa67e0

Browse files
committed
[sil] Change two SILInstruction::removeFromParent => SILInstruction::eraseFromParent.
removeFromParent should only be used when one is moving a SILInstruction from one block to another or in preparation for deleting an instruction. In this case, we are removing these two SILInstructions from their parent block and leaking the instruction. The right thing to do is to use eraseFromParent. <rdar://problem/31276565>
1 parent a11fceb commit 5fa67e0

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

lib/SIL/SILBuilder.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -364,7 +364,7 @@ SILValue SILBuilder::emitThickToObjCMetatype(SILLocation Loc, SILValue Op,
364364
if (metatypeInst->use_empty() &&
365365
metatypeInst->getParent() == getInsertionBB()) {
366366
auto origLoc = metatypeInst->getLoc();
367-
metatypeInst->removeFromParent();
367+
metatypeInst->eraseFromParent();
368368
return createMetatype(origLoc, Ty);
369369
}
370370
}
@@ -382,7 +382,7 @@ SILValue SILBuilder::emitObjCToThickMetatype(SILLocation Loc, SILValue Op,
382382
if (metatypeInst->use_empty() &&
383383
metatypeInst->getParent() == getInsertionBB()) {
384384
auto origLoc = metatypeInst->getLoc();
385-
metatypeInst->removeFromParent();
385+
metatypeInst->eraseFromParent();
386386
return createMetatype(origLoc, Ty);
387387
}
388388
}

0 commit comments

Comments
 (0)