mirror of
https://github.com/xomboverlord/ldc.git
synced 2026-01-26 01:23:13 +01:00
Fix catch clause codegen.
In the 2.064 frontend, the catch variables have a zero initializer, so DtoDeclarationExp overwrote the actually caught exception with null.
This commit is contained in:
committed by
Kai Nacke
parent
55c02f725a
commit
2b800b8732
@@ -60,13 +60,11 @@ void IRLandingPadCatchInfo::toIR()
|
||||
catchStmt->var->ir.irLocal = new IrLocal(catchStmt->var);
|
||||
LLValue* catch_var = gIR->func()->gen->landingPadInfo.getExceptionStorage();
|
||||
catchStmt->var->ir.irLocal->value = gIR->ir->CreateBitCast(catch_var, getPtrToType(DtoType(catchStmt->var->type)));
|
||||
}
|
||||
} else {
|
||||
// this will alloca if we haven't already and take care of nested refs
|
||||
DtoDeclarationExp(catchStmt->var);
|
||||
|
||||
// this will alloca if we haven't already and take care of nested refs
|
||||
DtoDeclarationExp(catchStmt->var);
|
||||
|
||||
// the exception will only be stored in catch_var. copy it over if necessary
|
||||
if (catchStmt->var->ir.irLocal->value != gIR->func()->gen->landingPadInfo.getExceptionStorage()) {
|
||||
// the exception will only be stored in catch_var. copy it over if necessary
|
||||
LLValue* exc = gIR->ir->CreateBitCast(DtoLoad(gIR->func()->gen->landingPadInfo.getExceptionStorage()), DtoType(catchStmt->var->type));
|
||||
DtoStore(exc, catchStmt->var->ir.irLocal->value);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user