Move isSuccessor() offline, change it to use std::find.

llvm-svn: 37190
This commit is contained in:
Evan Cheng 2007-05-17 23:58:53 +00:00
parent 07aa66887c
commit a92b2b38ff
2 changed files with 7 additions and 6 deletions

View 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,

View 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();
}