[llvm-commits] CVS: llvm/lib/CodeGen/MachineBasicBlock.cpp

David Greene greened at obbligato.org
Thu Jun 28 19:43:24 PDT 2007



Changes in directory llvm/lib/CodeGen:

MachineBasicBlock.cpp updated: 1.47 -> 1.48
---
Log message:

Fix misue of iterator pointing to erased object.  Uncovered by
_GLIBCXX_DEBUG.


---
Diffs of the changes:  (+3 -3)

 MachineBasicBlock.cpp |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)


Index: llvm/lib/CodeGen/MachineBasicBlock.cpp
diff -u llvm/lib/CodeGen/MachineBasicBlock.cpp:1.47 llvm/lib/CodeGen/MachineBasicBlock.cpp:1.48
--- llvm/lib/CodeGen/MachineBasicBlock.cpp:1.47	Mon Jun 18 17:43:31 2007
+++ llvm/lib/CodeGen/MachineBasicBlock.cpp	Thu Jun 28 21:43:02 2007
@@ -176,10 +176,10 @@
   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 @@
       ++SI;
     } else {
       // Otherwise, this is a superfluous edge, remove it.
-      removeSuccessor(SI);
+      SI = removeSuccessor(SI);
       MadeChange = true;
     }
   }






More information about the llvm-commits mailing list