When we run into an error parsing or type-checking the left-hand side
of a binary expression, continue on and parse the right-hand side of
the binary expression anyway, but don't call the semantic actions to
type-check. Previously, we would see the error and then, effectively,
skip tokens until the end of the statement. 

The result should be more useful recovery, both in the normal case
(we'll actually see errors beyond the first one in a statement), but
it also helps code completion do a much better job, because we do
"real" code completion on the right-hand side of an invalid binary
expression rather than completing with the recovery completion. For
example, given

  x = p->y

if there is no variable named "x", we can still complete after the p->
as a member expression. Along the recovery path, we would have
completed after the "->" as if we were in an expression context, which
is mostly useless.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@114225 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/test/Index/complete-recovery.m b/test/Index/complete-recovery.m
index fbd92c7..66084cd 100644
--- a/test/Index/complete-recovery.m
+++ b/test/Index/complete-recovery.m
@@ -7,7 +7,9 @@
 @implementation A
 - (void)method:(int)x {
   A *a = [A method:1];
-  blarg * blah = wibble
+  blarg * blah = wibble;
+  A *a2;
+  z = [a2 method:1];
 }
 @end
 
@@ -23,3 +25,5 @@
 // CHECK-CC2: NotImplemented:{TypedText _Bool}
 // CHECK-CC2: VarDecl:{ResultType A *}{TypedText a}
 // CHECK-CC2: NotImplemented:{TypedText sizeof}{LeftParen (}{Placeholder expression-or-type}{RightParen )}
+// RUN: c-index-test -code-completion-at=%s:12:11 -Xclang -code-completion-patterns %s | FileCheck -check-prefix=CHECK-CC3 %s
+// CHECK-CC3: ObjCInstanceMethodDecl:{ResultType void}{TypedText method:}{Placeholder (int)} (17)