2010-05-25 13:58:43 +08:00
|
|
|
/* Run lines are at the end, since line/column matter in this test. */
|
|
|
|
|
|
|
|
@interface A
|
|
|
|
- (void)method:(int)x;
|
|
|
|
@end
|
|
|
|
|
|
|
|
@implementation A
|
|
|
|
- (void)method:(int)x {
|
|
|
|
A *a = [A method:1];
|
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.
llvm-svn: 114225
2010-09-18 06:25:06 +08:00
|
|
|
blarg * blah = wibble;
|
|
|
|
A *a2;
|
|
|
|
z = [a2 method:1];
|
2010-09-18 06:41:34 +08:00
|
|
|
blah ? blech : [a2 method:1];
|
2010-09-18 09:28:11 +08:00
|
|
|
(a * a2)([a2 method:1]);
|
2010-09-18 10:10:40 +08:00
|
|
|
B *a = [a2 method:1];
|
2010-05-25 13:58:43 +08:00
|
|
|
}
|
|
|
|
@end
|
|
|
|
|
2010-10-12 05:37:58 +08:00
|
|
|
// RUN: env CINDEXTEST_CODE_COMPLETE_PATTERNS=1 c-index-test -code-completion-at=%s:9:20 %s 2>%t | FileCheck -check-prefix=CHECK-CC1 %s
|
2010-05-25 13:58:43 +08:00
|
|
|
// RUN: not grep error %t
|
2011-10-19 05:20:17 +08:00
|
|
|
// CHECK-CC1: NotImplemented:{ResultType char[]}{TypedText @encode}{LeftParen (}{Placeholder type-name}{RightParen )}
|
2010-05-28 08:49:12 +08:00
|
|
|
// CHECK-CC1-NOT: NotImplemented:{TypedText _Bool}
|
2010-05-25 13:58:43 +08:00
|
|
|
// CHECK-CC1: VarDecl:{ResultType A *}{TypedText a}
|
2011-10-19 05:20:17 +08:00
|
|
|
// CHECK-CC1: NotImplemented:{ResultType size_t}{TypedText sizeof}{LeftParen (}{Placeholder expression-or-type}{RightParen )}
|
2010-05-25 13:58:43 +08:00
|
|
|
|
2013-12-06 00:25:25 +08:00
|
|
|
// Test case for fix committed in r145441.
|
2011-12-01 07:03:25 +08:00
|
|
|
// RUN: env CINDEXTEST_CODE_COMPLETE_PATTERNS=1 c-index-test -code-completion-at=%s:9:20 %s -fms-compatibility | FileCheck -check-prefix=CHECK-CC1 %s
|
|
|
|
|
2010-10-12 05:37:58 +08:00
|
|
|
// RUN: env CINDEXTEST_CODE_COMPLETE_PATTERNS=1 c-index-test -code-completion-at=%s:10:24 %s | FileCheck -check-prefix=CHECK-CC2 %s
|
2011-10-19 05:20:17 +08:00
|
|
|
// CHECK-CC2: NotImplemented:{ResultType char[]}{TypedText @encode}{LeftParen (}{Placeholder type-name}{RightParen )}
|
2010-05-28 08:49:12 +08:00
|
|
|
// CHECK-CC2: NotImplemented:{TypedText _Bool}
|
|
|
|
// CHECK-CC2: VarDecl:{ResultType A *}{TypedText a}
|
2011-10-19 05:20:17 +08:00
|
|
|
// CHECK-CC2: NotImplemented:{ResultType size_t}{TypedText sizeof}{LeftParen (}{Placeholder expression-or-type}{RightParen )}
|
2010-10-12 05:37:58 +08:00
|
|
|
// RUN: env CINDEXTEST_CODE_COMPLETE_PATTERNS=1 c-index-test -code-completion-at=%s:12:11 %s | FileCheck -check-prefix=CHECK-CC3 %s
|
2010-10-19 08:03:23 +08:00
|
|
|
// CHECK-CC3: ObjCInstanceMethodDecl:{ResultType void}{TypedText method:}{Placeholder (int)} (32)
|
2010-10-12 05:37:58 +08:00
|
|
|
// RUN: env CINDEXTEST_CODE_COMPLETE_PATTERNS=1 c-index-test -code-completion-at=%s:13:22 %s | FileCheck -check-prefix=CHECK-CC3 %s
|
|
|
|
// RUN: env CINDEXTEST_CODE_COMPLETE_PATTERNS=1 c-index-test -code-completion-at=%s:14:16 %s | FileCheck -check-prefix=CHECK-CC3 %s
|
|
|
|
// RUN: env CINDEXTEST_CODE_COMPLETE_PATTERNS=1 c-index-test -code-completion-at=%s:15:14 %s | FileCheck -check-prefix=CHECK-CC3 %s
|