comparison ir/irlandingpad.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 15e9762bb620
children e1e93343fc11
comparison
equal deleted inserted replaced
1411:e57859ca8f1e 1412:3f5ea912149d
22 #else 22 #else
23 if(!catchstmt->var->nestedref) { 23 if(!catchstmt->var->nestedref) {
24 #endif 24 #endif
25 assert(!catchstmt->var->ir.irLocal); 25 assert(!catchstmt->var->ir.irLocal);
26 catchstmt->var->ir.irLocal = new IrLocal(catchstmt->var); 26 catchstmt->var->ir.irLocal = new IrLocal(catchstmt->var);
27 LLValue* catch_var = gIR->func()->landingPad.getExceptionStorage(); 27 LLValue* catch_var = gIR->func()->landingPadInfo.getExceptionStorage();
28 catchstmt->var->ir.irLocal->value = gIR->ir->CreateBitCast(catch_var, getPtrToType(DtoType(catchstmt->var->type))); 28 catchstmt->var->ir.irLocal->value = gIR->ir->CreateBitCast(catch_var, getPtrToType(DtoType(catchstmt->var->type)));
29 } 29 }
30 30
31 // this will alloca if we haven't already and take care of nested refs 31 // this will alloca if we haven't already and take care of nested refs
32 DtoDeclarationExp(catchstmt->var); 32 DtoDeclarationExp(catchstmt->var);
33 33
34 // the exception will only be stored in catch_var. copy it over if necessary 34 // the exception will only be stored in catch_var. copy it over if necessary
35 if(catchstmt->var->ir.irLocal->value != gIR->func()->landingPad.getExceptionStorage()) { 35 if(catchstmt->var->ir.irLocal->value != gIR->func()->landingPadInfo.getExceptionStorage()) {
36 LLValue* exc = gIR->ir->CreateBitCast(DtoLoad(gIR->func()->landingPad.getExceptionStorage()), DtoType(catchstmt->var->type)); 36 LLValue* exc = gIR->ir->CreateBitCast(DtoLoad(gIR->func()->landingPadInfo.getExceptionStorage()), DtoType(catchstmt->var->type));
37 DtoStore(exc, catchstmt->var->ir.irLocal->value); 37 DtoStore(exc, catchstmt->var->ir.irLocal->value);
38 } 38 }
39 } 39 }
40 40
41 // emit handler, if there is one 41 // emit handler, if there is one