[llvm-commits] [125692] Fix compilation of:

clattner at apple.com clattner at apple.com
Tue Apr 3 13:52:42 PDT 2007


Revision: 125692
Author:   clattner
Date:     2007-04-03 13:52:42 -0700 (Tue, 03 Apr 2007)

Log Message:
-----------
Fix compilation of:

@interface B 
-(int)bar;
@end

@interface A
-(void) Foo:(int) state;
@end

@implementation A 
- (void) Foo:(int) state {

        int wasResponded = 0;
        @try {
        if (state) {
           B * b = 0;
           @try { }
           @finally {
             wasResponded = ![b bar];
           }
        }
        }
        @finally {
        }
}
@end

With -fexceptions.

Modified Paths:
--------------
    apple-local/branches/llvm/gcc/llvm-convert.cpp

Modified: apple-local/branches/llvm/gcc/llvm-convert.cpp
===================================================================
--- apple-local/branches/llvm/gcc/llvm-convert.cpp	2007-04-03 17:23:51 UTC (rev 125691)
+++ apple-local/branches/llvm/gcc/llvm-convert.cpp	2007-04-03 20:52:42 UTC (rev 125692)
@@ -2659,6 +2659,7 @@
   BasicBlock::iterator InsertPt;
   if (Instruction *I = dyn_cast<Instruction>(FirstVal)) {
     InsertPt = I;                      // Insert after the init instruction.
+    
     // If the instruction is an alloca in the entry block, the insert point
     // will be before the alloca.  Advance to the AllocaInsertionPoint if we are
     // before it.
@@ -2671,6 +2672,13 @@
         }
       }
     }
+    
+    // If the instruction is an invoke, the init is inserted on the normal edge.
+    if (InvokeInst *II = dyn_cast<InvokeInst>(I)) {
+      InsertPt = II->getNormalDest()->begin();
+      while (isa<PHINode>(InsertPt))
+        ++InsertPt;
+    }
   } else {
     InsertPt = AllocaInsertionPoint;   // Insert after the allocas.
   }





More information about the llvm-commits mailing list