aboutsummaryrefslogtreecommitdiff
path: root/lib/AST/ExprConstant.cpp
diff options
context:
space:
mode:
authorJohn McCall <rjmccall@apple.com>2011-09-10 01:16:55 +0000
committerJohn McCall <rjmccall@apple.com>2011-09-10 01:16:55 +0000
commitdc05b11c67331016473fbc7909827b1b89c9616b (patch)
tree65c8e307e0ccdcb67ebba0c530f476d59f87c09f /lib/AST/ExprConstant.cpp
parentb3321093f6ead084427eb4a6621832fc4ee2f5de (diff)
When converting a block pointer to an Objective-C pointer type, extend
the lifetime of the block by copying it to the heap, or else we'll get a dangling reference because the code working with the non-block-typed object will not know it needs to copy. There is some danger here, e.g. with assigning a block literal to an unsafe variable, but, well, it's an unsafe variable. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@139451 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/AST/ExprConstant.cpp')
-rw-r--r--lib/AST/ExprConstant.cpp2
1 files changed, 2 insertions, 0 deletions
diff --git a/lib/AST/ExprConstant.cpp b/lib/AST/ExprConstant.cpp
index eb35dd7c98..7ae4186423 100644
--- a/lib/AST/ExprConstant.cpp
+++ b/lib/AST/ExprConstant.cpp
@@ -1830,6 +1830,7 @@ bool IntExprEvaluator::VisitCastExpr(const CastExpr *E) {
case CK_ObjCProduceObject:
case CK_ObjCConsumeObject:
case CK_ObjCReclaimReturnedObject:
+ case CK_ObjCExtendBlockObject:
return false;
case CK_LValueToRValue:
@@ -2338,6 +2339,7 @@ bool ComplexExprEvaluator::VisitCastExpr(const CastExpr *E) {
case CK_ObjCProduceObject:
case CK_ObjCConsumeObject:
case CK_ObjCReclaimReturnedObject:
+ case CK_ObjCExtendBlockObject:
llvm_unreachable("invalid cast kind for complex value");
case CK_LValueToRValue: