diff gen/llvmhelpers.cpp @ 1412:3f5ea912149d

Fix #308 by giving finally code emitted by EnclosingTryFinally a different landing pad.
author Christian Kamm <kamm incasoftware de>
date Sat, 23 May 2009 00:23:39 +0200
parents e57859ca8f1e
children 638d16625da2
line wrap: on
line diff
--- a/gen/llvmhelpers.cpp	Fri May 22 21:38:01 2009 +0200
+++ b/gen/llvmhelpers.cpp	Sat May 23 00:23:39 2009 +0200
@@ -255,7 +255,12 @@
 void EnclosingTryFinally::emitCode(IRState * p)
 {
     if (tf->finalbody)
+    {
+        llvm::BasicBlock* oldpad = p->func()->landingPad;
+        p->func()->landingPad = landingPad;
         tf->finalbody->toIR(p);
+        p->func()->landingPad = oldpad;
+    }
 }
 
 ////////////////////////////////////////////////////////////////////////////////////////