add method, correct comment

llvm-svn: 30584
This commit is contained in:
Chris Lattner 2006-09-23 04:03:45 +00:00
parent 1da0ab2f58
commit 4091f4690a
2 changed files with 17 additions and 6 deletions

View File

@ -109,10 +109,14 @@ public:
///
void eraseFromParent();
/// moveBefore - Unlink this instruction from its current function and
/// insert it into the function that MovePos lives in, right before
/// MovePos.
/// moveBefore - Unlink this basic block from its current function and
/// insert it into the function that MovePos lives in, right before MovePos.
void moveBefore(BasicBlock *MovePos);
/// moveAfter - Unlink this basic block from its current function and
/// insert it into the function that MovePos lives in, right after MovePos.
void moveAfter(BasicBlock *MovePos);
/// getSinglePredecessor - If this basic block has a single predecessor block,
/// return the block, otherwise return a null pointer.

View File

@ -103,14 +103,21 @@ void BasicBlock::eraseFromParent() {
getParent()->getBasicBlockList().erase(this);
}
/// moveBefore - Unlink this instruction from its current function and
/// insert it into the function that MovePos lives in, right before
/// MovePos.
/// moveBefore - Unlink this basic block from its current function and
/// insert it into the function that MovePos lives in, right before MovePos.
void BasicBlock::moveBefore(BasicBlock *MovePos) {
MovePos->getParent()->getBasicBlockList().splice(MovePos,
getParent()->getBasicBlockList(), this);
}
/// moveAfter - Unlink this basic block from its current function and
/// insert it into the function that MovePos lives in, right after MovePos.
void BasicBlock::moveAfter(BasicBlock *MovePos) {
Function::iterator I = MovePos;
MovePos->getParent()->getBasicBlockList().splice(++I,
getParent()->getBasicBlockList(), this);
}
TerminatorInst *BasicBlock::getTerminator() {
if (InstList.empty()) return 0;