use smarter error recovery for do/while.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@60933 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Parse/ParseStmt.cpp b/lib/Parse/ParseStmt.cpp
index 45092aa..ed4563b 100644
--- a/lib/Parse/ParseStmt.cpp
+++ b/lib/Parse/ParseStmt.cpp
@@ -416,7 +416,7 @@
 
 /// ParseParenExprOrCondition:
 /// [C  ]     '(' expression ')'
-/// [C++]     '(' condition ')'
+/// [C++]     '(' condition ')'       [not allowed if OnlyAllowCondition=true]
 ///
 /// This function parses and performs error recovery on the specified condition
 /// or expression (depending on whether we're in C++ or C mode).  This function
@@ -425,7 +425,8 @@
 /// should try to recover harder.  It returns false if the condition is
 /// successfully parsed.  Note that a successful parse can still have semantic
 /// errors in the condition.
-bool Parser::ParseParenExprOrCondition(OwningExprResult &CondExp) {
+bool Parser::ParseParenExprOrCondition(OwningExprResult &CondExp,
+                                       bool OnlyAllowCondition) {
   SourceLocation LParenLoc = ConsumeParen();
   
   if (getLang().CPlusPlus)
@@ -769,8 +770,10 @@
     return StmtError();
   }
 
-  // Parse the condition.
-  OwningExprResult Cond(ParseSimpleParenExpression());
+  // Parse the parenthesized condition.
+  OwningExprResult Cond(Actions);
+  ParseParenExprOrCondition(Cond, true);
+  
   DoScope.Exit();
 
   if (Cond.isInvalid() || Body.isInvalid())