| 1 |
// Note: the run lines follow their respective tests, since line/column |
| 2 |
// matter in this test. |
| 3 |
|
| 4 |
void func(int x); |
| 5 |
typedef int Foo; |
| 6 |
typedef void (^FooBlock)(Foo *someParameter); |
| 7 |
|
| 8 |
@interface Obj |
| 9 |
@property (readwrite, nonatomic, copy) void (^onAction)(Obj *object); |
| 10 |
@property (readwrite, nonatomic) int foo; |
| 11 |
@end |
| 12 |
|
| 13 |
@interface Test : Obj |
| 14 |
@property (readwrite, nonatomic, copy) FooBlock onEventHandler; |
| 15 |
@property (readonly, nonatomic, copy) void (^onReadonly)(int *someParameter); |
| 16 |
@property (readwrite, nonatomic, copy) int (^processEvent)(int eventCode); |
| 17 |
@property (readonly, nonatomic, strong) Obj *obj; |
| 18 |
@end |
| 19 |
|
| 20 |
@implementation Test |
| 21 |
|
| 22 |
#define SELFY self |
| 23 |
|
| 24 |
- (void)test { |
| 25 |
self.foo = 2; |
| 26 |
[self takeInt: 2]; self.foo = 2; |
| 27 |
/* Comment */ self.foo = 2; |
| 28 |
SELFY.foo = 2 |
| 29 |
} |
| 30 |
|
| 31 |
// RUN: c-index-test -code-completion-at=%s:25:8 %s | FileCheck -check-prefix=CHECK-CC1 %s |
| 32 |
// RUN: c-index-test -code-completion-at=%s:26:27 %s | FileCheck -check-prefix=CHECK-CC1 %s |
| 33 |
// RUN: c-index-test -code-completion-at=%s:27:22 %s | FileCheck -check-prefix=CHECK-CC1 %s |
| 34 |
// RUN: c-index-test -code-completion-at=%s:28:9 %s | FileCheck -check-prefix=CHECK-CC1 %s |
| 35 |
// CHECK-CC1: ObjCPropertyDecl:{ResultType int}{TypedText foo} (37) |
| 36 |
// CHECK-CC1-NEXT: ObjCPropertyDecl:{ResultType Obj *}{TypedText obj} (35) |
| 37 |
// CHECK-CC1-NEXT: ObjCPropertyDecl:{ResultType void}{TypedText onAction}{LeftParen (}{Placeholder Obj *object}{RightParen )} (37) |
| 38 |
// CHECK-CC1-NEXT: ObjCPropertyDecl:{ResultType void (^)(Obj *)}{TypedText onAction}{Equal = }{Placeholder ^(Obj *object)} (40) |
| 39 |
// CHECK-CC1-NEXT: ObjCPropertyDecl:{ResultType void}{TypedText onEventHandler}{LeftParen (}{Placeholder Foo *someParameter}{RightParen )} (35) |
| 40 |
// CHECK-CC1-NEXT: ObjCPropertyDecl:{ResultType FooBlock}{TypedText onEventHandler}{Equal = }{Placeholder ^(Foo *someParameter)} (38) |
| 41 |
// CHECK-CC1-NEXT: ObjCPropertyDecl:{ResultType void}{TypedText onReadonly}{LeftParen (}{Placeholder int *someParameter}{RightParen )} (35) |
| 42 |
// CHECK-CC1-NEXT: ObjCPropertyDecl:{ResultType int}{TypedText processEvent}{LeftParen (}{Placeholder int eventCode}{RightParen )} (35) |
| 43 |
// CHECK-CC1-NEXT: ObjCPropertyDecl:{ResultType int (^)(int)}{TypedText processEvent}{Equal = }{Placeholder ^int(int eventCode)} (32) |
| 44 |
|
| 45 |
- (void) takeInt:(int)x { } |
| 46 |
|
| 47 |
- (int) testFailures { |
| 48 |
(self.foo); |
| 49 |
int x = self.foo; |
| 50 |
[self takeInt: self.foo]; |
| 51 |
if (self.foo) { |
| 52 |
func(self.foo); |
| 53 |
} |
| 54 |
return self.foo; |
| 55 |
} |
| 56 |
|
| 57 |
// RUN: c-index-test -code-completion-at=%s:48:9 %s | FileCheck -check-prefix=CHECK-NO %s |
| 58 |
// RUN: c-index-test -code-completion-at=%s:49:16 %s | FileCheck -check-prefix=CHECK-NO %s |
| 59 |
// RUN: c-index-test -code-completion-at=%s:50:23 %s | FileCheck -check-prefix=CHECK-NO %s |
| 60 |
// RUN: c-index-test -code-completion-at=%s:51:12 %s | FileCheck -check-prefix=CHECK-NO %s |
| 61 |
// RUN: c-index-test -code-completion-at=%s:54:15 %s | FileCheck -check-prefix=CHECK-NO %s |
| 62 |
// CHECK-NO: ObjCPropertyDecl:{ResultType int}{TypedText foo} (37) |
| 63 |
// CHECK-NO-NEXT: ObjCPropertyDecl:{ResultType Obj *}{TypedText obj} (35) |
| 64 |
// CHECK-NO-NEXT: ObjCPropertyDecl:{ResultType void (^)(Obj *)}{TypedText onAction} (37) |
| 65 |
// CHECK-NO-NEXT: ObjCPropertyDecl:{ResultType FooBlock}{TypedText onEventHandler} (35) |
| 66 |
// CHECK-NO-NEXT: ObjCPropertyDecl:{ResultType void (^)(int *)}{TypedText onReadonly} (35) |
| 67 |
// CHECK-NO-NEXT: ObjCPropertyDecl:{ResultType int (^)(int)}{TypedText processEvent} (35) |
| 68 |
|
| 69 |
// RUN: c-index-test -code-completion-at=%s:52:15 %s | FileCheck -check-prefix=CHECK-NO1 %s |
| 70 |
// CHECK-NO1: ObjCPropertyDecl:{ResultType int}{TypedText foo} (37) |
| 71 |
// CHECK-NO1-NEXT: ObjCPropertyDecl:{ResultType Obj *}{TypedText obj} (35) |
| 72 |
// CHECK-NO1-NEXT: ObjCPropertyDecl:{ResultType void (^)(Obj *)}{TypedText onAction} (37) |
| 73 |
// CHECK-NO1-NEXT: ObjCPropertyDecl:{ResultType FooBlock}{TypedText onEventHandler} (35) |
| 74 |
// CHECK-NO1-NEXT: ObjCPropertyDecl:{ResultType void (^)(int *)}{TypedText onReadonly} (35) |
| 75 |
// CHECK-NO1-NEXT: ObjCPropertyDecl:{ResultType int (^)(int)}{TypedText processEvent} (35) |
| 76 |
// CHECK-NO1-NEXT: OverloadCandidate:{ResultType void}{Text func}{LeftParen (}{CurrentParameter int x}{RightParen )} (1) |
| 77 |
@end |