From f894a7809c6d70cc290c0b8d3b1c0e5cd993efcd Mon Sep 17 00:00:00 2001 From: David Nadlinger Date: Sat, 11 May 2013 23:26:38 +0200 Subject: [PATCH] Update catch landingpad codegen to match latest druntime change. --- ir/irlandingpad.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/ir/irlandingpad.cpp b/ir/irlandingpad.cpp index 55b0e54d..2d6adb01 100644 --- a/ir/irlandingpad.cpp +++ b/ir/irlandingpad.cpp @@ -163,8 +163,11 @@ void IRLandingPad::constructLandingPad(llvm::BasicBlock* inBB) // if it is a first catch and some catch allocated storage, store exception object if(isFirstCatch && catch_var) { - LLType* objectTy = DtoType(ClassDeclaration::object->type); - gIR->ir->CreateStore(gIR->ir->CreateBitCast(eh_ptr, objectTy), catch_var); + // eh_ptr is a pointer to _d_exception, which has a reference + // to the Throwable object at offset 0. + LLType *objectPtrTy = DtoType(ClassDeclaration::object->type->pointerTo()); + LLValue *objectPtr = gIR->ir->CreateBitCast(eh_ptr, objectPtrTy); + gIR->ir->CreateStore(gIR->ir->CreateLoad(objectPtr), catch_var); isFirstCatch = false; } // create next block