diff options
author | Daniel Dunbar <daniel@zuster.org> | 2009-08-03 21:20:07 +0000 |
---|---|---|
committer | Daniel Dunbar <daniel@zuster.org> | 2009-08-03 21:20:07 +0000 |
commit | a1d8bcd33ec766e4d38ccda65d1244e187821296 (patch) | |
tree | f73f2fca33bb6d41cff69b9de8712692c3ba013b /clang/lib | |
parent | 72ddac6cb860b6c969ce54210b1c4d8d79f8f5a1 (diff) | |
download | bcm5719-llvm-a1d8bcd33ec766e4d38ccda65d1244e187821296.tar.gz bcm5719-llvm-a1d8bcd33ec766e4d38ccda65d1244e187821296.zip |
When generating cleanup blocks for Obj-C @finally, mark them as catch all blocks
from the perspective of LLVM exception handling. Otherwise the C++ personality
function may decide not to run them, if it only detects cleanup handlers.
- Test case for this is exceptions.m in llvm-test.
llvm-svn: 77999
Diffstat (limited to 'clang/lib')
-rw-r--r-- | clang/lib/CodeGen/CGObjCMac.cpp | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/clang/lib/CodeGen/CGObjCMac.cpp b/clang/lib/CodeGen/CGObjCMac.cpp index cc1a4392ce4..3c61cb8f7f7 100644 --- a/clang/lib/CodeGen/CGObjCMac.cpp +++ b/clang/lib/CodeGen/CGObjCMac.cpp @@ -5470,7 +5470,10 @@ CGObjCNonFragileABIMac::EmitTryOrSynchronizedStmt(CodeGen::CodeGenFunction &CGF, // We use a cleanup unless there was already a catch all. if (!HasCatchAll) { - SelectorArgs.push_back(llvm::ConstantInt::get(llvm::Type::Int32Ty, 0)); + // Even though this is a cleanup, treat it as a catch all to avoid the C++ + // personality behavior of terminating the process if only cleanups are + // found in the exception handling stack. + SelectorArgs.push_back(llvm::Constant::getNullValue(ObjCTypes.Int8PtrTy)); Handlers.push_back(std::make_pair((const ParmVarDecl*) 0, (const Stmt*) 0)); } |