[llvm-branch-commits] [llvm-branch] r105935 - /llvm/branches/wendling/eh/include/llvm/Instructions.h

Bill Wendling isanbard at gmail.com
Mon Jun 14 00:12:14 PDT 2010


Author: void
Date: Mon Jun 14 02:12:14 2010
New Revision: 105935

URL: http://llvm.org/viewvc/llvm-project?rev=105935&view=rev
Log:
Return the correct number of successors and the correct successor for the given
index.

Modified:
    llvm/branches/wendling/eh/include/llvm/Instructions.h

Modified: llvm/branches/wendling/eh/include/llvm/Instructions.h
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/wendling/eh/include/llvm/Instructions.h?rev=105935&r1=105934&r2=105935&view=diff
==============================================================================
--- llvm/branches/wendling/eh/include/llvm/Instructions.h (original)
+++ llvm/branches/wendling/eh/include/llvm/Instructions.h Mon Jun 14 02:12:14 2010
@@ -2627,7 +2627,7 @@
 
   // Successor accessors.
   BasicBlock *getSuccessor(unsigned i) const {
-    assert(i < 2 + getNumCatches() && "Successor # out of range for invoke!");
+    assert(i < getNumSuccessors() && "Successor # out of range for invoke!");
 
     if (i == 0)
       return getNormalDest();
@@ -2635,7 +2635,10 @@
     if (i == 1)
       return getUnwindDest();
 
-    return getCatchDest(i - 2);
+    if (CatchAllDest != 0 && i == 2)
+      return getCatchAllDest();
+
+    return getCatchDest(i - (CatchAllDest != 0 ? 3 : 2));
   }
 
   void setSuccessor(unsigned idx, BasicBlock *NewSucc) {
@@ -2644,7 +2647,7 @@
   }
 
   unsigned getNumSuccessors() const {
-    return 2 + getNumCatches();
+    return (CatchAllDest != 0 ? 3 : 2) + getNumCatches();
   }
 
   // Methods for support type inquiry through isa, cast, and dyn_cast:





More information about the llvm-branch-commits mailing list