diff options
author | Anders Carlsson <andersca@mac.com> | 2009-06-04 02:18:15 +0000 |
---|---|---|
committer | Anders Carlsson <andersca@mac.com> | 2009-06-04 02:18:15 +0000 |
commit | c4ee170b0c71f61fb1dec273d15fb11c29449a88 (patch) | |
tree | fb51835e4d3174e212bcc7fde62c697b7d524cbb /lib/Parse/ParseStmt.cpp | |
parent | 482cb848a3e86dea7ab85b4bd2b344e3e6c468d1 (diff) |
Make sure to call FullExpr before parsing anything else.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@72834 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Parse/ParseStmt.cpp')
-rw-r--r-- | lib/Parse/ParseStmt.cpp | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/lib/Parse/ParseStmt.cpp b/lib/Parse/ParseStmt.cpp index 758b662a23..f041d7dfd7 100644 --- a/lib/Parse/ParseStmt.cpp +++ b/lib/Parse/ParseStmt.cpp @@ -550,6 +550,8 @@ Parser::OwningStmtResult Parser::ParseIfStatement() { if (ParseParenExprOrCondition(CondExp)) return StmtError(); + FullExprArg FullCondExp(Actions.FullExpr(CondExp)); + // C99 6.8.4p3 - In C99, the body of the if statement is a scope, even if // there is no compound stmt. C90 does not have this clause. We only do this // if the body isn't a compound statement to avoid push/pop in common cases. @@ -631,7 +633,7 @@ Parser::OwningStmtResult Parser::ParseIfStatement() { if (ElseStmt.isInvalid()) ElseStmt = Actions.ActOnNullStmt(ElseStmtLoc); - return Actions.ActOnIfStmt(IfLoc, Actions.FullExpr(CondExp), move(ThenStmt), + return Actions.ActOnIfStmt(IfLoc, FullCondExp, move(ThenStmt), ElseLoc, move(ElseStmt)); } @@ -752,6 +754,8 @@ Parser::OwningStmtResult Parser::ParseWhileStatement() { if (ParseParenExprOrCondition(Cond)) return StmtError(); + FullExprArg FullCond(Actions.FullExpr(Cond)); + // C99 6.8.5p5 - In C99, the body of the if statement is a scope, even if // there is no compound stmt. C90 does not have this clause. We only do this // if the body isn't a compound statement to avoid push/pop in common cases. @@ -776,7 +780,7 @@ Parser::OwningStmtResult Parser::ParseWhileStatement() { if (Cond.isInvalid() || Body.isInvalid()) return StmtError(); - return Actions.ActOnWhileStmt(WhileLoc, Actions.FullExpr(Cond), move(Body)); + return Actions.ActOnWhileStmt(WhileLoc, FullCond, move(Body)); } /// ParseDoStatement |