diff options
| author | Fariborz Jahanian <fjahanian@apple.com> | 2009-12-14 21:35:01 +0000 |
|---|---|---|
| committer | Fariborz Jahanian <fjahanian@apple.com> | 2009-12-14 21:35:01 +0000 |
| commit | 9ac0a04b297805d2dbc729baed7641934bbb8db4 (patch) | |
| tree | 23b18f8efc7c752d731b1482c7a98cd201f14a5d | |
| parent | 3974a80307d42545390084b7c2fbf5ff6390ec60 (diff) | |
| download | bcm5719-llvm-9ac0a04b297805d2dbc729baed7641934bbb8db4.tar.gz bcm5719-llvm-9ac0a04b297805d2dbc729baed7641934bbb8db4.zip | |
Patch to fix 32-bit @try failure with internal assertion when compiling
an Objective-C rethrow nested inside another try/catch block. (fixes radar 7466728).
llvm-svn: 91335
| -rw-r--r-- | clang/lib/CodeGen/CGObjCMac.cpp | 7 | ||||
| -rw-r--r-- | clang/test/CodeGenObjC/nested-rethrow.m | 24 |
2 files changed, 29 insertions, 2 deletions
diff --git a/clang/lib/CodeGen/CGObjCMac.cpp b/clang/lib/CodeGen/CGObjCMac.cpp index d847cea3894..fb920f0b09e 100644 --- a/clang/lib/CodeGen/CGObjCMac.cpp +++ b/clang/lib/CodeGen/CGObjCMac.cpp @@ -2541,8 +2541,11 @@ void CGObjCMac::EmitTryOrSynchronizedStmt(CodeGen::CodeGenFunction &CGF, // through finally. CGF.PushCleanupBlock(FinallyBlock); - CGF.ObjCEHValueStack.push_back(0); - + if (CGF.ObjCEHValueStack.empty()) + CGF.ObjCEHValueStack.push_back(0); + // If This is a nested @try, caught exception is that of enclosing @try. + else + CGF.ObjCEHValueStack.push_back(CGF.ObjCEHValueStack.back()); // Allocate memory for the exception data and rethrow pointer. llvm::Value *ExceptionData = CGF.CreateTempAlloca(ObjCTypes.ExceptionDataTy, "exceptiondata.ptr"); diff --git a/clang/test/CodeGenObjC/nested-rethrow.m b/clang/test/CodeGenObjC/nested-rethrow.m new file mode 100644 index 00000000000..187998ed006 --- /dev/null +++ b/clang/test/CodeGenObjC/nested-rethrow.m @@ -0,0 +1,24 @@ +// RUN: clang -cc1 -triple i386-apple-darwin9 -emit-llvm %s -o - | FileCheck %s + +#include <stdio.h> + +int main() +{ + @try { + @throw @"foo"; + } @catch (id e) { + @try { +// CHECK: call void @objc_exception_throw + @throw; + } @catch (id e) { + if (e) { + printf("caught \n"); + } else { + printf("caught (WRONG)\n"); + } + } @catch (...) { + printf("caught nothing (WRONG)\n"); + } + } +} + |

