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 | bc15335e580bd29695df04c30d19c3b5a8192552 (patch) | |
tree | dc9442b83ba43c4825b70a9cdfd072b4f82d8be7 /clang/lib | |
parent | e0538b9669149e1d29d6d9b0a5a6ff04f60273fe (diff) | |
download | bcm5719-llvm-bc15335e580bd29695df04c30d19c3b5a8192552.tar.gz bcm5719-llvm-bc15335e580bd29695df04c30d19c3b5a8192552.zip |
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.
llvm-svn: 153729
Diffstat (limited to 'clang/lib')
-rw-r--r-- | clang/lib/Sema/SemaStmt.cpp | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/clang/lib/Sema/SemaStmt.cpp b/clang/lib/Sema/SemaStmt.cpp index 39e8a1a1b92..97c8eb04e9e 100644 --- a/clang/lib/Sema/SemaStmt.cpp +++ b/clang/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 |