summaryrefslogtreecommitdiffstats
path: root/clang/lib/CodeGen/CGObjC.cpp
diff options
context:
space:
mode:
authorJohn McCall <rjmccall@apple.com>2011-07-07 06:58:02 +0000
committerJohn McCall <rjmccall@apple.com>2011-07-07 06:58:02 +0000
commit4db5c3c83a22268ff0eeaa6ca7fd500668533487 (patch)
tree64decea6f573f5fce3cc231a02c8520270bc922c /clang/lib/CodeGen/CGObjC.cpp
parent54677c15f351d9caf35b88853d6bb54f055b27f7 (diff)
downloadbcm5719-llvm-4db5c3c83a22268ff0eeaa6ca7fd500668533487.tar.gz
bcm5719-llvm-4db5c3c83a22268ff0eeaa6ca7fd500668533487.zip
In ARC, reclaim all return values of retainable type, not just those
where we have an immediate need of a retained value. As an exception, don't do this when the call is made as the immediate operand of a __bridge retain. This is more in the way of a workaround than an actual guarantee, so it's acceptable to be brittle here. rdar://problem/9504800 llvm-svn: 134605
Diffstat (limited to 'clang/lib/CodeGen/CGObjC.cpp')
-rw-r--r--clang/lib/CodeGen/CGObjC.cpp8
1 files changed, 8 insertions, 0 deletions
diff --git a/clang/lib/CodeGen/CGObjC.cpp b/clang/lib/CodeGen/CGObjC.cpp
index d8ce1f4a755..1b271ef2af8 100644
--- a/clang/lib/CodeGen/CGObjC.cpp
+++ b/clang/lib/CodeGen/CGObjC.cpp
@@ -2333,6 +2333,14 @@ tryEmitARCRetainScalarExpr(CodeGenFunction &CGF, const Expr *e) {
return TryEmitResult(result, true);
}
+ // For reclaims, emit the subexpression as a retained call and
+ // skip the consumption.
+ case CK_ObjCReclaimReturnedObject: {
+ llvm::Value *result = emitARCRetainCall(CGF, ce->getSubExpr());
+ if (resultType) result = CGF.Builder.CreateBitCast(result, resultType);
+ return TryEmitResult(result, true);
+ }
+
case CK_GetObjCProperty: {
llvm::Value *result = emitARCRetainCall(CGF, ce);
if (resultType) result = CGF.Builder.CreateBitCast(result, resultType);
OpenPOWER on IntegriCloud