diff options
author | Anders Carlsson <andersca@mac.com> | 2009-02-07 21:37:21 +0000 |
---|---|---|
committer | Anders Carlsson <andersca@mac.com> | 2009-02-07 21:37:21 +0000 |
commit | 273558fbd891a0872e620e0d3d109b92c1160d72 (patch) | |
tree | 792d82f2afad76ba4991e7f424b69ec3bb1ab77b /lib/CodeGen/CGObjCMac.cpp | |
parent | 190d00e1396214c77539c7095756b9ea38160463 (diff) |
Split the exception object out into its own stack.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@64032 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/CGObjCMac.cpp')
-rw-r--r-- | lib/CodeGen/CGObjCMac.cpp | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/lib/CodeGen/CGObjCMac.cpp b/lib/CodeGen/CGObjCMac.cpp index 6c6419e4f1..ba2f5262fd 100644 --- a/lib/CodeGen/CGObjCMac.cpp +++ b/lib/CodeGen/CGObjCMac.cpp @@ -1868,7 +1868,8 @@ void CGObjCMac::EmitTryOrSynchronizedStmt(CodeGen::CodeGenFunction &CGF, // through finally. CodeGenFunction::ObjCEHEntry EHEntry(FinallyBlock, FinallySwitch, DestCode); CGF.ObjCEHStack.push_back(&EHEntry); - + CGF.ObjCEHValueStack.push_back(0); + // Allocate memory for the exception data and rethrow pointer. llvm::Value *ExceptionData = CGF.CreateTempAlloca(ObjCTypes.ExceptionDataTy, "exceptiondata.ptr"); @@ -1913,7 +1914,7 @@ void CGObjCMac::EmitTryOrSynchronizedStmt(CodeGen::CodeGenFunction &CGF, llvm::Value *Caught = CGF.Builder.CreateCall(ObjCTypes.ExceptionExtractFn, ExceptionData, "caught"); - EHEntry.Exception = Caught; + CGF.ObjCEHValueStack.back() = Caught; if (!isTry) { CGF.Builder.CreateStore(Caught, RethrowPtr); @@ -2032,7 +2033,8 @@ void CGObjCMac::EmitTryOrSynchronizedStmt(CodeGen::CodeGenFunction &CGF, // this now, because the code in the @finally block is not in this // context. CGF.ObjCEHStack.pop_back(); - + CGF.ObjCEHValueStack.pop_back(); + // Emit the @finally block. CGF.EmitBlock(FinallyBlock); llvm::Value* CallTryExit = CGF.Builder.CreateLoad(CallTryExitPtr, "tmp"); @@ -2076,9 +2078,9 @@ void CGObjCMac::EmitThrowStmt(CodeGen::CodeGenFunction &CGF, ExceptionAsObject = CGF.Builder.CreateBitCast(Exception, ObjCTypes.ObjectPtrTy, "tmp"); } else { - assert((!CGF.ObjCEHStack.empty() && CGF.ObjCEHStack.back()->Exception) && + assert((!CGF.ObjCEHValueStack.empty() && CGF.ObjCEHValueStack.back()) && "Unexpected rethrow outside @catch block."); - ExceptionAsObject = CGF.ObjCEHStack.back()->Exception; + ExceptionAsObject = CGF.ObjCEHValueStack.back(); } CGF.Builder.CreateCall(ObjCTypes.ExceptionThrowFn, ExceptionAsObject); |