diff options
author | John McCall <rjmccall@apple.com> | 2012-03-30 05:43:39 +0000 |
---|---|---|
committer | John McCall <rjmccall@apple.com> | 2012-03-30 05:43:39 +0000 |
commit | 29bbd1a33edfd3c81c35d5076530c2867a05bddc (patch) | |
tree | 17d6384d260b32377d067b703f2d82c2c01a8eee /lib/Sema/SemaStmt.cpp | |
parent | 26945addf1660d2c54af7be57bc9adb7ccc50a24 (diff) |
Handle placeholder expressions in an ObjC for-collection loop.
The way we handle this implicitly removes the ability to use
property l-values in this position, but that's really okay.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@153729 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Sema/SemaStmt.cpp')
-rw-r--r-- | lib/Sema/SemaStmt.cpp | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/lib/Sema/SemaStmt.cpp b/lib/Sema/SemaStmt.cpp index 39e8a1a1b9..97c8eb04e9 100644 --- a/lib/Sema/SemaStmt.cpp +++ b/lib/Sema/SemaStmt.cpp @@ -1079,10 +1079,18 @@ Sema::ActOnForStmt(SourceLocation ForLoc, SourceLocation LParenLoc, /// x can be an arbitrary l-value expression. Bind it up as a /// full-expression. StmtResult Sema::ActOnForEachLValueExpr(Expr *E) { + // Reduce placeholder expressions here. Note that this rejects the + // use of pseudo-object l-values in this position. + ExprResult result = CheckPlaceholderExpr(E); + if (result.isInvalid()) return StmtError(); + E = result.take(); + CheckImplicitConversions(E); - ExprResult Result = MaybeCreateExprWithCleanups(E); - if (Result.isInvalid()) return StmtError(); - return Owned(static_cast<Stmt*>(Result.get())); + + result = MaybeCreateExprWithCleanups(E); + if (result.isInvalid()) return StmtError(); + + return Owned(static_cast<Stmt*>(result.take())); } ExprResult |