mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2026-04-20 16:17:38 +00:00
Fix misue of iterator pointing to erased object. Uncovered by
_GLIBCXX_DEBUG. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@37793 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user