Improve code completion in failure cases in two ways:
  1) Suppress diagnostics as soon as we form the code-completion
  token, so we don't get any error/warning spew from the early
  end-of-file.
  2) If we consume a code-completion token when we weren't expecting
  one, go into a code-completion recovery path that produces the best
  results it can based on the context that the parser is in.

llvm-svn: 104585
diff --git a/clang/lib/Parse/ParseExpr.cpp b/clang/lib/Parse/ParseExpr.cpp
index ed27f3b..b036e56 100644
--- a/clang/lib/Parse/ParseExpr.cpp
+++ b/clang/lib/Parse/ParseExpr.cpp
@@ -222,7 +222,7 @@
 Parser::OwningExprResult Parser::ParseAssignmentExpression() {
   if (Tok.is(tok::code_completion)) {
     Actions.CodeCompleteOrdinaryName(CurScope, Action::CCC_Expression);
-    ConsumeToken();
+    ConsumeCodeCompletionToken();
   }
 
   if (Tok.is(tok::kw_throw))
@@ -906,7 +906,7 @@
     return ParsePostfixExpressionSuffix(ParseBlockLiteralExpression());
   case tok::code_completion:
     Actions.CodeCompleteOrdinaryName(CurScope, Action::CCC_Expression);
-    ConsumeToken();
+    ConsumeCodeCompletionToken();
     return ParseCastExpression(isUnaryExpression, isAddressOfOperand, 
                                NotCastExpr, TypeOfCast);
   case tok::l_square:
@@ -975,7 +975,7 @@
 
       if (Tok.is(tok::code_completion)) {
         Actions.CodeCompleteCall(CurScope, LHS.get(), 0, 0);
-        ConsumeToken();
+        ConsumeCodeCompletionToken();
       }
       
       if (Tok.isNot(tok::r_paren)) {
@@ -1029,7 +1029,7 @@
         Actions.CodeCompleteMemberReferenceExpr(CurScope, LHS.get(),
                                                 OpLoc, OpKind == tok::arrow);
         
-        ConsumeToken();
+        ConsumeCodeCompletionToken();
       }
       
       if (MayBePseudoDestructor) {
@@ -1562,7 +1562,7 @@
     if (Tok.is(tok::code_completion)) {
       if (Completer)
         (Actions.*Completer)(CurScope, Data, Exprs.data(), Exprs.size());
-      ConsumeToken();
+      ConsumeCodeCompletionToken();
     }
     
     OwningExprResult Expr(ParseAssignmentExpression());