aboutsummaryrefslogtreecommitdiff
path: root/lib/Sema/TreeTransform.h
diff options
context:
space:
mode:
authorJohn McCall <rjmccall@apple.com>2011-07-27 01:07:15 +0000
committerJohn McCall <rjmccall@apple.com>2011-07-27 01:07:15 +0000
commit990567cb60e8530ba01b41d4e056e32b44b95ec0 (patch)
tree8f85e629bf057a38f2f2cf4f4e744c50a6f1fb1f /lib/Sema/TreeTransform.h
parentdfb6ae1d8d114772bd91b7079c7e4bf4b517e63c (diff)
Clean up the analysis of the collection operand to ObjC
for-in statements; specifically, make sure to close over any temporaries or cleanups it might require. In ARC, this has implications for the lifetime of the collection, so emit it with a retain and release it upon exit from the loop. rdar://problem/9817306 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@136204 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Sema/TreeTransform.h')
-rw-r--r--lib/Sema/TreeTransform.h15
1 files changed, 14 insertions, 1 deletions
diff --git a/lib/Sema/TreeTransform.h b/lib/Sema/TreeTransform.h
index 2221fc0c21..373339a2cb 100644
--- a/lib/Sema/TreeTransform.h
+++ b/lib/Sema/TreeTransform.h
@@ -1200,7 +1200,16 @@ public:
Stmt *Body) {
return getSema().ActOnObjCAutoreleasePoolStmt(AtLoc, Body);
}
-
+
+ /// \brief Build the collection operand to a new Objective-C fast
+ /// enumeration statement.
+ ///
+ /// By default, performs semantic analysis to build the new statement.
+ /// Subclasses may override this routine to provide different behavior.
+ ExprResult RebuildObjCForCollectionOperand(SourceLocation forLoc,
+ Expr *collection) {
+ return getSema().ActOnObjCForCollectionOperand(forLoc, collection);
+ }
/// \brief Build a new Objective-C fast enumeration statement.
///
@@ -5519,6 +5528,10 @@ TreeTransform<Derived>::TransformObjCForCollectionStmt(
ExprResult Collection = getDerived().TransformExpr(S->getCollection());
if (Collection.isInvalid())
return StmtError();
+ Collection = getDerived().RebuildObjCForCollectionOperand(S->getForLoc(),
+ Collection.take());
+ if (Collection.isInvalid())
+ return StmtError();
// Transform the body.
StmtResult Body = getDerived().TransformStmt(S->getBody());