add a new insertAfter method, patch by Tom Jablin!

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@62158 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Chris Lattner 2009-01-13 07:43:51 +00:00
parent acca9559f4
commit 3ff704fa2b
3 changed files with 17 additions and 0 deletions

View File

@ -384,6 +384,13 @@ public:
return New;
}
iterator insertAfter(iterator where, NodeTy *New) {
if (empty())
return insert(begin(), New);
else
return insert(++where, New);
}
NodeTy *remove(iterator &IT) {
assert(IT != end() && "Cannot remove end of list!");
NodeTy *Node = &*IT;

View File

@ -101,6 +101,10 @@ public:
/// immediately before the specified instruction.
void insertBefore(Instruction *InsertPos);
/// insertAfter - Insert an unlinked instructions into a basic block
/// immediately after the specified instruction.
void insertAfter(Instruction *InsertPos);
/// moveBefore - Unlink this instruction from its current basic block and
/// insert it into the basic block that MovePos lives in, right before
/// MovePos.

View File

@ -74,6 +74,12 @@ void Instruction::insertBefore(Instruction *InsertPos) {
InsertPos->getParent()->getInstList().insert(InsertPos, this);
}
/// insertAfter - Insert an unlinked instructions into a basic block
/// immediately after the specified instruction.
void Instruction::insertAfter(Instruction *InsertPos) {
InsertPos->getParent()->getInstList().insertAfter(InsertPos, this);
}
/// moveBefore - Unlink this instruction from its current basic block and
/// insert it into the basic block that MovePos lives in, right before
/// MovePos.