add method, correct comment
authorChris Lattner <sabre@nondot.org>
Sat, 23 Sep 2006 04:03:45 +0000 (04:03 +0000)
committerChris Lattner <sabre@nondot.org>
Sat, 23 Sep 2006 04:03:45 +0000 (04:03 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@30584 91177308-0d34-0410-b5e6-96231b3b80d8

include/llvm/BasicBlock.h
lib/VMCore/BasicBlock.cpp

index 0f7b3e077e4f6b65a1824b5d38fd0d84d2909647..551ca4d6c2ea8747c3ace703645d39d93905adb3 100644 (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.
index 5ec497a88e69b2df93da5b0151df69d39380686d..afdd79e6aa4f8c97ff33e43a631324f339e62319 100644 (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;