diff options
author | David Greene <greened@obbligato.org> | 2007-06-29 02:45:24 +0000 |
---|---|---|
committer | David Greene <greened@obbligato.org> | 2007-06-29 02:45:24 +0000 |
commit | 451d1a6ecd3e4d56abf17ec25c818c2fe3c25984 (patch) | |
tree | 87032df7deac842e4fac562253e715409a861efb /llvm/lib/CodeGen/MachineBasicBlock.cpp | |
parent | 9feb7f5846cce0d40db9e4689f8178f5fa570bc3 (diff) | |
download | bcm5719-llvm-451d1a6ecd3e4d56abf17ec25c818c2fe3c25984.tar.gz bcm5719-llvm-451d1a6ecd3e4d56abf17ec25c818c2fe3c25984.zip |
Fix misue of iterator pointing to erased object. Uncovered by
_GLIBCXX_DEBUG.
llvm-svn: 37793
Diffstat (limited to 'llvm/lib/CodeGen/MachineBasicBlock.cpp')
-rw-r--r-- | llvm/lib/CodeGen/MachineBasicBlock.cpp | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/llvm/lib/CodeGen/MachineBasicBlock.cpp b/llvm/lib/CodeGen/MachineBasicBlock.cpp index da062b1559e..ba428c5bdb3 100644 --- a/llvm/lib/CodeGen/MachineBasicBlock.cpp +++ b/llvm/lib/CodeGen/MachineBasicBlock.cpp @@ -176,10 +176,10 @@ void MachineBasicBlock::removeSuccessor(MachineBasicBlock *succ) { Successors.erase(I); } -void MachineBasicBlock::removeSuccessor(succ_iterator I) { +MachineBasicBlock::succ_iterator MachineBasicBlock::removeSuccessor(succ_iterator I) { assert(I != Successors.end() && "Not a current successor!"); (*I)->removePredecessor(this); - Successors.erase(I); + return(Successors.erase(I)); } void MachineBasicBlock::addPredecessor(MachineBasicBlock *pred) { @@ -273,7 +273,7 @@ bool MachineBasicBlock::CorrectExtraCFGEdges(MachineBasicBlock *DestA, ++SI; } else { // Otherwise, this is a superfluous edge, remove it. - removeSuccessor(SI); + SI = removeSuccessor(SI); MadeChange = true; } } |