summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Transforms/Scalar/ObjCARC.cpp
diff options
context:
space:
mode:
authorDan Gohman <gohman@apple.com>2011-09-14 18:33:34 +0000
committerDan Gohman <gohman@apple.com>2011-09-14 18:33:34 +0000
commitfca43c21c32185ab64ec43e296327a9b9b64b690 (patch)
treed3d0e59825030650b98152def2b59a8327b0aa94 /llvm/lib/Transforms/Scalar/ObjCARC.cpp
parent41899f3bacaf1e9b38cb7f2772c2cf871da5214d (diff)
downloadbcm5719-llvm-fca43c21c32185ab64ec43e296327a9b9b64b690.tar.gz
bcm5719-llvm-fca43c21c32185ab64ec43e296327a9b9b64b690.zip
Don't mark objc_retainBlock as nounwind. It calls user copy constructors
which could theoretically throw. llvm-svn: 139710
Diffstat (limited to 'llvm/lib/Transforms/Scalar/ObjCARC.cpp')
-rw-r--r--llvm/lib/Transforms/Scalar/ObjCARC.cpp6
1 files changed, 4 insertions, 2 deletions
diff --git a/llvm/lib/Transforms/Scalar/ObjCARC.cpp b/llvm/lib/Transforms/Scalar/ObjCARC.cpp
index f978f571c6c..f7e0cd4fe14 100644
--- a/llvm/lib/Transforms/Scalar/ObjCARC.cpp
+++ b/llvm/lib/Transforms/Scalar/ObjCARC.cpp
@@ -425,9 +425,10 @@ static bool IsAlwaysTail(InstructionClass Class) {
/// IsNoThrow - Test if the given class represents instructions which are always
/// safe to mark with the nounwind attribute..
static bool IsNoThrow(InstructionClass Class) {
+ // objc_retainBlock is not nounwind because it calls user copy constructors
+ // which could theoretically throw.
return Class == IC_Retain ||
Class == IC_RetainRV ||
- Class == IC_RetainBlock ||
Class == IC_Release ||
Class == IC_Autorelease ||
Class == IC_AutoreleaseRV ||
@@ -1605,7 +1606,8 @@ Constant *ObjCARCOpt::getRetainBlockCallee(Module *M) {
std::vector<Type *> Params;
Params.push_back(PointerType::getUnqual(Type::getInt8Ty(C)));
AttrListPtr Attributes;
- Attributes.addAttr(~0u, Attribute::NoUnwind);
+ // objc_retainBlock is not nounwind because it calls user copy constructors
+ // which could theoretically throw.
RetainBlockCallee =
M->getOrInsertFunction(
"objc_retainBlock",
OpenPOWER on IntegriCloud