summaryrefslogtreecommitdiffstats
path: root/lib/Parse/ParseStmt.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'lib/Parse/ParseStmt.cpp')
-rw-r--r--lib/Parse/ParseStmt.cpp8
1 files changed, 6 insertions, 2 deletions
diff --git a/lib/Parse/ParseStmt.cpp b/lib/Parse/ParseStmt.cpp
index 758b662..f041d7d 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
OpenPOWER on IntegriCloud