[cfe-commits] r77999 - /cfe/trunk/lib/CodeGen/CGObjCMac.cpp
Daniel Dunbar
daniel at zuster.org
Mon Aug 3 14:20:07 PDT 2009
Author: ddunbar
Date: Mon Aug 3 16:20:07 2009
New Revision: 77999
URL: http://llvm.org/viewvc/llvm-project?rev=77999&view=rev
Log:
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.
Modified:
cfe/trunk/lib/CodeGen/CGObjCMac.cpp
Modified: cfe/trunk/lib/CodeGen/CGObjCMac.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGObjCMac.cpp?rev=77999&r1=77998&r2=77999&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGObjCMac.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGObjCMac.cpp Mon Aug 3 16:20:07 2009
@@ -5470,7 +5470,10 @@
// 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));
}
More information about the cfe-commits
mailing list