Move isSuccessor() offline, change it to use std::find.
authorEvan Cheng <evan.cheng@apple.com>
Thu, 17 May 2007 23:58:53 +0000 (23:58 +0000)
committerEvan Cheng <evan.cheng@apple.com>
Thu, 17 May 2007 23:58:53 +0000 (23:58 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@37190 91177308-0d34-0410-b5e6-96231b3b80d8

include/llvm/CodeGen/MachineBasicBlock.h
lib/CodeGen/MachineBasicBlock.cpp

index 62394cfc9096b3971a71bc18792882b98cfee15b..b3578584e6339ba26470fdca5a9df9623cdebf29 100644 (file)
@@ -217,12 +217,7 @@ public:
   
   /// isSuccessor - Return true if the specified MBB is a successor of this
   /// block.
-  bool isSuccessor(MachineBasicBlock *MBB) const {
-    for (const_succ_iterator I = succ_begin(), E = succ_end(); I != E; ++I)
-      if (*I == MBB)
-        return true;
-    return false;
-  }
+  bool isSuccessor(MachineBasicBlock *MBB) const;
 
   /// getFirstTerminator - returns an iterator to the first terminator
   /// instruction of this basic block. If a terminator does not exist,
index 39780350dedf1def8020325ef70566a8dc2704e7..44f7f90a65b181c83291eb6103d82c74e8c2cc15 100644 (file)
@@ -192,3 +192,9 @@ void MachineBasicBlock::removePredecessor(MachineBasicBlock *pred) {
   assert(I != Predecessors.end() && "Pred is not a predecessor of this block!");
   Predecessors.erase(I);
 }
+
+bool MachineBasicBlock::isSuccessor(MachineBasicBlock *MBB) const {
+  std::vector<MachineBasicBlock *>::const_iterator I =
+    std::find(Successors.begin(), Successors.end(), MBB);
+  return I != Successors.end();
+}