2009-11-18 00:44:22 +08:00
|
|
|
// Note: the run lines follow their respective tests, since line/column
|
|
|
|
// matter in this test.
|
2010-08-24 07:51:41 +08:00
|
|
|
#define nil (void*)0
|
2009-11-18 00:44:22 +08:00
|
|
|
@protocol FooTestProtocol
|
|
|
|
+ protocolClassMethod;
|
|
|
|
- protocolInstanceMethod : (int)value;
|
|
|
|
@end
|
|
|
|
@interface Foo <FooTestProtocol> {
|
|
|
|
void *isa;
|
|
|
|
}
|
|
|
|
+ (int)classMethod1:a withKeyword:(int)b;
|
|
|
|
+ (void)classMethod2;
|
|
|
|
+ new;
|
|
|
|
- instanceMethod1;
|
|
|
|
@end
|
|
|
|
|
|
|
|
@interface Foo (FooTestCategory)
|
|
|
|
+ categoryClassMethod;
|
|
|
|
- categoryInstanceMethod;
|
|
|
|
@end
|
|
|
|
|
|
|
|
void func() {
|
|
|
|
Foo *obj = [Foo new];
|
|
|
|
[obj xx];
|
|
|
|
}
|
2009-11-18 01:59:40 +08:00
|
|
|
|
|
|
|
@interface MyClass { }
|
|
|
|
+ (int)MyClassMethod:(id)obj;
|
|
|
|
- (int)MyInstMethod:(id)x second:(id)y;
|
|
|
|
@end
|
|
|
|
|
|
|
|
@interface MySubClass : MyClass { }
|
|
|
|
+ (int)MySubClassMethod;
|
|
|
|
- (int)MySubInstMethod;
|
|
|
|
@end
|
|
|
|
|
|
|
|
@implementation MyClass
|
|
|
|
+ (int)MyClassMethod:(id)obj {
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
+ (int)MyPrivateMethod {
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
- (int)MyInstMethod:(id)x second:(id)y {
|
|
|
|
return 2;
|
|
|
|
}
|
|
|
|
|
|
|
|
- (int)MyPrivateInstMethod {
|
|
|
|
return 3;
|
|
|
|
}
|
|
|
|
@end
|
2010-05-28 07:06:34 +08:00
|
|
|
MyClass *getMyClass();
|
2009-11-18 01:59:40 +08:00
|
|
|
@implementation MySubClass
|
|
|
|
+ (int)MySubClassMethod {
|
|
|
|
return 2;
|
|
|
|
}
|
|
|
|
|
|
|
|
+ (int)MySubPrivateMethod {
|
|
|
|
return [super MyPrivateMethod];
|
|
|
|
}
|
|
|
|
|
|
|
|
- (int)MySubInstMethod:(id)obj {
|
|
|
|
return [super MyInstMethod: obj second:obj];
|
|
|
|
}
|
|
|
|
|
|
|
|
- (int)MyInstMethod:(id)x second:(id)y {
|
|
|
|
return 3;
|
|
|
|
}
|
|
|
|
@end
|
|
|
|
|
|
|
|
void test_super_var(MySubClass *super) {
|
|
|
|
[super MyInstMethod: super second:super];
|
|
|
|
}
|
|
|
|
|
2009-11-18 08:06:18 +08:00
|
|
|
@protocol FooTestProtocol2
|
|
|
|
- (int)secondProtocolInstanceMethod;
|
|
|
|
@end
|
|
|
|
|
|
|
|
void test_qual_id(id<FooTestProtocol,FooTestProtocol2> ptr) {
|
|
|
|
[ptr protocolInstanceMethod:1];
|
|
|
|
}
|
|
|
|
|
2009-11-19 09:08:35 +08:00
|
|
|
@interface Overload
|
|
|
|
- (int)Method:(int)i;
|
|
|
|
- (int)Method;
|
|
|
|
- (int)Method:(float)f Arg1:(int)i1 Arg2:(int)i2;
|
|
|
|
- (int)Method:(float)f Arg1:(int)i1 OtherArg:(id)obj;
|
|
|
|
- (int)Method:(float)f SomeArg:(int)i1 OtherArg:(id)obj;
|
|
|
|
- (int)OtherMethod:(float)f Arg1:(int)i1 Arg2:(int)i2;
|
|
|
|
@end
|
|
|
|
|
|
|
|
void test_overload(Overload *ovl) {
|
|
|
|
[ovl Method:1 Arg1:1 OtherArg:ovl];
|
|
|
|
}
|
|
|
|
|
2009-12-23 08:21:46 +08:00
|
|
|
@interface Ellipsis
|
2010-08-24 07:51:41 +08:00
|
|
|
- (int)Method:(int)i, ...;
|
|
|
|
- (int)SentinelMethod:(int)i, ... __attribute__((sentinel(0,1)));
|
2009-12-23 08:21:46 +08:00
|
|
|
@end
|
|
|
|
void f(Ellipsis *e) {
|
|
|
|
[e Method:1, 2, 3];
|
|
|
|
}
|
|
|
|
|
2010-04-06 23:27:03 +08:00
|
|
|
@interface Overload2
|
|
|
|
+ (int)Method:(int)i;
|
|
|
|
+ (int)Method;
|
|
|
|
+ (int)Method:(float)f Arg1:(int)i1 Arg2:(int)i2;
|
|
|
|
+ (int)Method:(float)f Arg1:(int)i1 OtherArg:(id)obj;
|
|
|
|
+ (int)Method:(float)f SomeArg:(int)i1 OtherArg:(id)obj;
|
|
|
|
+ (int)OtherMethod:(float)f Arg1:(int)i1 Arg2:(int)i2;
|
|
|
|
@end
|
|
|
|
|
|
|
|
void test_overload2(void) {
|
|
|
|
[Overload2 Method:1 Arg1:1 OtherArg:ovl];
|
|
|
|
}
|
|
|
|
|
2010-04-07 00:40:00 +08:00
|
|
|
void msg_id(id x) {
|
|
|
|
[x Method:1 Arg1:1 OtherArg:ovl];
|
|
|
|
[[x blarg] Method:1 Arg1:1 OtherArg:ovl];
|
|
|
|
[id Method:1 Arg1:1 OtherArg:ovl];
|
|
|
|
}
|
|
|
|
|
2010-08-25 09:08:01 +08:00
|
|
|
@interface A
|
|
|
|
- (void)method1;
|
|
|
|
@end
|
|
|
|
|
|
|
|
@interface B : A
|
|
|
|
- (void)method2;
|
|
|
|
@end
|
|
|
|
|
|
|
|
void test_ranking(B *b) {
|
|
|
|
[b method1];
|
2010-09-16 00:23:04 +08:00
|
|
|
b method1];
|
|
|
|
}
|
|
|
|
|
2010-09-16 07:19:31 +08:00
|
|
|
void test_overload3(Overload *ovl) {
|
2010-09-16 00:23:04 +08:00
|
|
|
ovl Method:1 Arg1:1 OtherArg:ovl];
|
Implement code completion for Objective-C class message sends that are
missing the opening bracket '[', e.g.,
NSArray <CC>
at function scope. Previously, we would only give trivial completions
(const, volatile, etc.), because we're in a "declaration name"
scope. Now, we also provide completions for class methods of NSArray,
e.g.,
alloc
Note that we already had support for this after the first argument,
e.g.,
NSArray method:x <CC>
would get code completion for class methods of NSArray whose selector
starts with "method:". This was already present because we recover
as if NSArray method:x were a class message send missing the opening
bracket (which was committed in r114057).
llvm-svn: 114078
2010-09-16 23:14:18 +08:00
|
|
|
Overload2 Method:1 Arg1:1 OtherArg:ovl];
|
|
|
|
(Overload2 Method:1 Arg1:1 OtherArg:ovl]);
|
2010-08-25 09:08:01 +08:00
|
|
|
}
|
|
|
|
|
2010-09-17 00:06:31 +08:00
|
|
|
@interface C : B
|
|
|
|
- (void)method2;
|
|
|
|
- (void)method3;
|
|
|
|
@end
|
|
|
|
|
|
|
|
void test_redundancy(C *c) {
|
|
|
|
[c method2];
|
|
|
|
};
|
|
|
|
|
2010-11-09 05:12:30 +08:00
|
|
|
@protocol P
|
|
|
|
- (Class)class;
|
|
|
|
@end
|
|
|
|
|
|
|
|
@interface A () <P>
|
|
|
|
@end
|
|
|
|
|
|
|
|
@interface A ()
|
|
|
|
+ (void)class_method3;
|
|
|
|
@end
|
|
|
|
|
|
|
|
@interface A (Cat)
|
|
|
|
+ (void)class_method4;
|
|
|
|
@end
|
|
|
|
|
|
|
|
@implementation A
|
|
|
|
- (void)method5:(A*)a {
|
|
|
|
[[self class] class_method4];
|
|
|
|
}
|
|
|
|
@end
|
|
|
|
|
2011-02-16 03:17:31 +08:00
|
|
|
void test_missing_open_more() {
|
|
|
|
A *a = A class_method3];
|
|
|
|
}
|
|
|
|
|
2011-04-15 04:33:34 +08:00
|
|
|
void test_block_invoke(A *(^block1)(int),
|
|
|
|
int (^block2)(int),
|
|
|
|
id (^block3)(int)) {
|
|
|
|
[block1(5) init];
|
|
|
|
}
|
|
|
|
|
2011-07-30 15:55:26 +08:00
|
|
|
@interface DO
|
|
|
|
- (void)method:(in bycopy A*)ain result:(out byref A**)aout;
|
|
|
|
@end
|
|
|
|
|
|
|
|
void test_DO(DO *d, A* a) {
|
|
|
|
[d method:a aout:&a];
|
|
|
|
}
|
|
|
|
|
2015-06-20 02:27:52 +08:00
|
|
|
@interface Nullability
|
|
|
|
- (nonnull A *)method:(nullable A *)param;
|
|
|
|
@end
|
|
|
|
|
|
|
|
void test_Nullability(Nullability *n, A* a) {
|
|
|
|
[n method: a];
|
|
|
|
}
|
|
|
|
|
2009-11-18 00:44:22 +08:00
|
|
|
// RUN: c-index-test -code-completion-at=%s:23:19 %s | FileCheck -check-prefix=CHECK-CC1 %s
|
2012-09-27 00:39:56 +08:00
|
|
|
// CHECK-CC1: {TypedText categoryClassMethod} (35)
|
|
|
|
// CHECK-CC1: {TypedText classMethod1:}{Placeholder (id)}{HorizontalSpace }{TypedText withKeyword:}{Placeholder (int)} (35)
|
|
|
|
// CHECK-CC1: {TypedText classMethod2} (35)
|
2013-01-30 14:58:39 +08:00
|
|
|
// CHECK-CC1: {TypedText instanceMethod1} (35)
|
2012-09-27 00:39:56 +08:00
|
|
|
// CHECK-CC1: {TypedText new} (35)
|
|
|
|
// CHECK-CC1: {TypedText protocolClassMethod} (37)
|
2011-07-21 09:05:26 +08:00
|
|
|
// CHECK-CC1: Completion contexts:
|
|
|
|
// CHECK-CC1-NEXT: Objective-C class method
|
|
|
|
// CHECK-CC1-NEXT: Container Kind: ObjCInterfaceDecl
|
|
|
|
// CHECK-CC1-NEXT: Container is complete
|
|
|
|
// CHECK-CC1-NEXT: Container USR: c:objc(cs)Foo
|
2009-11-18 00:44:22 +08:00
|
|
|
// RUN: c-index-test -code-completion-at=%s:24:8 %s | FileCheck -check-prefix=CHECK-CC2 %s
|
|
|
|
// CHECK-CC2: {TypedText categoryInstanceMethod}
|
|
|
|
// CHECK-CC2: {TypedText instanceMethod1}
|
2010-08-30 03:47:46 +08:00
|
|
|
// CHECK-CC2: {TypedText protocolInstanceMethod:}{Placeholder (int)}
|
2011-07-21 09:05:26 +08:00
|
|
|
// CHECK-CC2: Completion contexts:
|
|
|
|
// CHECK-CC2-NEXT: Objective-C instance method
|
|
|
|
// CHECK-CC2-NEXT: Container Kind: ObjCInterfaceDecl
|
|
|
|
// CHECK-CC2-NEXT: Container is complete
|
|
|
|
// CHECK-CC2-NEXT: Container USR: c:objc(cs)Foo
|
2009-11-18 01:59:40 +08:00
|
|
|
// RUN: c-index-test -code-completion-at=%s:61:16 %s | FileCheck -check-prefix=CHECK-CC3 %s
|
2010-08-30 03:47:46 +08:00
|
|
|
// CHECK-CC3: ObjCClassMethodDecl:{ResultType int}{TypedText MyClassMethod:}{Placeholder (id)}
|
2009-12-19 02:53:37 +08:00
|
|
|
// CHECK-CC3: ObjCClassMethodDecl:{ResultType int}{TypedText MyPrivateMethod}
|
2009-11-18 01:59:40 +08:00
|
|
|
// RUN: c-index-test -code-completion-at=%s:65:16 %s | FileCheck -check-prefix=CHECK-CC4 %s
|
2010-10-19 05:05:04 +08:00
|
|
|
// CHECK-CC4: ObjCInstanceMethodDecl:{ResultType int}{TypedText MyInstMethod:}{Placeholder (id)}{HorizontalSpace }{TypedText second:}{Placeholder (id)}
|
2009-12-19 02:53:37 +08:00
|
|
|
// CHECK-CC4: ObjCInstanceMethodDecl:{ResultType int}{TypedText MyPrivateInstMethod}
|
2009-11-18 01:59:40 +08:00
|
|
|
// RUN: c-index-test -code-completion-at=%s:74:9 %s | FileCheck -check-prefix=CHECK-CC5 %s
|
2010-10-19 05:05:04 +08:00
|
|
|
// CHECK-CC5: ObjCInstanceMethodDecl:{ResultType int}{TypedText MyInstMethod:}{Placeholder (id)}{HorizontalSpace }{TypedText second:}{Placeholder (id)}
|
2009-12-19 02:53:37 +08:00
|
|
|
// CHECK-CC5: ObjCInstanceMethodDecl:{ResultType int}{TypedText MySubInstMethod}
|
2009-11-18 08:06:18 +08:00
|
|
|
// RUN: c-index-test -code-completion-at=%s:82:8 %s | FileCheck -check-prefix=CHECK-CC6 %s
|
2010-08-30 03:47:46 +08:00
|
|
|
// CHECK-CC6: ObjCInstanceMethodDecl:{ResultType id}{TypedText protocolInstanceMethod:}{Placeholder (int)}
|
2009-12-19 02:53:37 +08:00
|
|
|
// CHECK-CC6: ObjCInstanceMethodDecl:{ResultType int}{TypedText secondProtocolInstanceMethod}
|
2009-11-19 09:08:35 +08:00
|
|
|
// RUN: c-index-test -code-completion-at=%s:95:8 %s | FileCheck -check-prefix=CHECK-CC7 %s
|
2009-12-19 02:53:37 +08:00
|
|
|
// CHECK-CC7: ObjCInstanceMethodDecl:{ResultType int}{TypedText Method}
|
2010-08-30 03:47:46 +08:00
|
|
|
// CHECK-CC7: ObjCInstanceMethodDecl:{ResultType int}{TypedText Method:}{Placeholder (int)}
|
2010-10-19 05:05:04 +08:00
|
|
|
// CHECK-CC7: ObjCInstanceMethodDecl:{ResultType int}{TypedText Method:}{Placeholder (float)}{HorizontalSpace }{TypedText Arg1:}{Placeholder (int)}{HorizontalSpace }{TypedText Arg2:}{Placeholder (int)}
|
|
|
|
// CHECK-CC7: ObjCInstanceMethodDecl:{ResultType int}{TypedText Method:}{Placeholder (float)}{HorizontalSpace }{TypedText Arg1:}{Placeholder (int)}{HorizontalSpace }{TypedText OtherArg:}{Placeholder (id)}
|
|
|
|
// CHECK-CC7: ObjCInstanceMethodDecl:{ResultType int}{TypedText Method:}{Placeholder (float)}{HorizontalSpace }{TypedText SomeArg:}{Placeholder (int)}{HorizontalSpace }{TypedText OtherArg:}{Placeholder (id)}
|
|
|
|
// CHECK-CC7: ObjCInstanceMethodDecl:{ResultType int}{TypedText OtherMethod:}{Placeholder (float)}{HorizontalSpace }{TypedText Arg1:}{Placeholder (int)}{HorizontalSpace }{TypedText Arg2:}{Placeholder (int)}
|
2009-11-19 09:08:35 +08:00
|
|
|
// RUN: c-index-test -code-completion-at=%s:95:17 %s | FileCheck -check-prefix=CHECK-CC8 %s
|
2010-10-19 05:05:04 +08:00
|
|
|
// CHECK-CC8: ObjCInstanceMethodDecl:{ResultType int}{Informative Method:}{TypedText Arg1:}{Placeholder (int)}{HorizontalSpace }{TypedText Arg2:}{Placeholder (int)}
|
|
|
|
// CHECK-CC8: ObjCInstanceMethodDecl:{ResultType int}{Informative Method:}{TypedText Arg1:}{Placeholder (int)}{HorizontalSpace }{TypedText OtherArg:}{Placeholder (id)}
|
|
|
|
// CHECK-CC8: ObjCInstanceMethodDecl:{ResultType int}{Informative Method:}{TypedText SomeArg:}{Placeholder (int)}{HorizontalSpace }{TypedText OtherArg:}{Placeholder (id)}
|
2010-11-18 05:36:08 +08:00
|
|
|
// CHECK-CC8-NOT: ObjCInstanceMethodDecl:{ResultType int}{Informative Method:}{TypedText }
|
2009-11-19 09:08:35 +08:00
|
|
|
// RUN: c-index-test -code-completion-at=%s:95:24 %s | FileCheck -check-prefix=CHECK-CC9 %s
|
2010-08-30 03:47:46 +08:00
|
|
|
// CHECK-CC9: ObjCInstanceMethodDecl:{ResultType int}{Informative Method:}{Informative Arg1:}{TypedText Arg2:}{Placeholder (int)}
|
|
|
|
// CHECK-CC9: ObjCInstanceMethodDecl:{ResultType int}{Informative Method:}{Informative Arg1:}{TypedText OtherArg:}{Placeholder (id)}
|
2011-07-26 23:24:30 +08:00
|
|
|
// CHECK-CC9: Objective-C selector: Method:Arg1:
|
2009-12-07 17:54:55 +08:00
|
|
|
// RUN: c-index-test -code-completion-at=%s:61:11 %s | FileCheck -check-prefix=CHECK-CCA %s
|
2013-01-31 13:03:46 +08:00
|
|
|
// CHECK-CCA: TypedefDecl:{TypedText Class} (50)
|
|
|
|
// CHECK-CCA-NEXT: ObjCInterfaceDecl:{TypedText Foo} (50)
|
|
|
|
// CHECK-CCA-NOT: FunctionDecl:{ResultType void}{TypedText func}{LeftParen (}{RightParen )} (50)
|
|
|
|
// CHECK-CCA:FunctionDecl:{ResultType MyClass *}{TypedText getMyClass}{LeftParen (}{RightParen )} (50)
|
|
|
|
// CHECK-CCA: TypedefDecl:{TypedText id} (50)
|
|
|
|
// CHECK-CCA: ObjCInterfaceDecl:{TypedText MyClass} (50)
|
|
|
|
// CHECK-CCA: ObjCInterfaceDecl:{TypedText MySubClass} (50)
|
|
|
|
// CHECK-CCA: {ResultType Class}{TypedText self} (34)
|
|
|
|
// CHECK-CCA: {TypedText super} (40)
|
2009-12-23 08:21:46 +08:00
|
|
|
// RUN: c-index-test -code-completion-at=%s:103:6 %s | FileCheck -check-prefix=CHECK-CCB %s
|
2010-08-31 13:13:43 +08:00
|
|
|
// CHECK-CCB: ObjCInstanceMethodDecl:{ResultType int}{TypedText Method:}{Placeholder (int), ...}
|
|
|
|
// CHECK-CCB: ObjCInstanceMethodDecl:{ResultType int}{TypedText SentinelMethod:}{Placeholder (int), ...}{Text , nil}
|
2010-04-06 23:27:03 +08:00
|
|
|
// RUN: c-index-test -code-completion-at=%s:116:14 %s | FileCheck -check-prefix=CHECK-CCC %s
|
|
|
|
// CHECK-CCC: ObjCClassMethodDecl:{ResultType int}{TypedText Method}
|
2010-08-30 03:47:46 +08:00
|
|
|
// CHECK-CCC: ObjCClassMethodDecl:{ResultType int}{TypedText Method:}{Placeholder (int)}
|
2010-10-19 05:05:04 +08:00
|
|
|
// CHECK-CCC: ObjCClassMethodDecl:{ResultType int}{TypedText Method:}{Placeholder (float)}{HorizontalSpace }{TypedText Arg1:}{Placeholder (int)}{HorizontalSpace }{TypedText Arg2:}{Placeholder (int)}
|
|
|
|
// CHECK-CCC: ObjCClassMethodDecl:{ResultType int}{TypedText Method:}{Placeholder (float)}{HorizontalSpace }{TypedText Arg1:}{Placeholder (int)}{HorizontalSpace }{TypedText OtherArg:}{Placeholder (id)}
|
|
|
|
// CHECK-CCC: ObjCClassMethodDecl:{ResultType int}{TypedText Method:}{Placeholder (float)}{HorizontalSpace }{TypedText SomeArg:}{Placeholder (int)}{HorizontalSpace }{TypedText OtherArg:}{Placeholder (id)}
|
|
|
|
// CHECK-CCC: ObjCClassMethodDecl:{ResultType int}{TypedText OtherMethod:}{Placeholder (float)}{HorizontalSpace }{TypedText Arg1:}{Placeholder (int)}{HorizontalSpace }{TypedText Arg2:}{Placeholder (int)}
|
2010-04-06 23:27:03 +08:00
|
|
|
// RUN: c-index-test -code-completion-at=%s:116:23 %s | FileCheck -check-prefix=CHECK-CCD %s
|
2010-10-19 05:05:04 +08:00
|
|
|
// CHECK-CCD: ObjCClassMethodDecl:{ResultType int}{Informative Method:}{TypedText Arg1:}{Placeholder (int)}{HorizontalSpace }{TypedText Arg2:}{Placeholder (int)}
|
|
|
|
// CHECK-CCD: ObjCClassMethodDecl:{ResultType int}{Informative Method:}{TypedText Arg1:}{Placeholder (int)}{HorizontalSpace }{TypedText OtherArg:}{Placeholder (id)}
|
|
|
|
// CHECK-CCD: ObjCClassMethodDecl:{ResultType int}{Informative Method:}{TypedText SomeArg:}{Placeholder (int)}{HorizontalSpace }{TypedText OtherArg:}{Placeholder (id)}
|
2010-11-18 05:36:08 +08:00
|
|
|
// CHECK-CCD-NOT: ObjCClassMethodDecl:{ResultType int}{Informative Method:}{TypedText }
|
2011-07-26 23:24:30 +08:00
|
|
|
// CHECK-CCD: Objective-C selector: Method:
|
2010-04-06 23:27:03 +08:00
|
|
|
// RUN: c-index-test -code-completion-at=%s:116:30 %s | FileCheck -check-prefix=CHECK-CCE %s
|
2010-08-30 03:47:46 +08:00
|
|
|
// CHECK-CCE: ObjCClassMethodDecl:{ResultType int}{Informative Method:}{Informative Arg1:}{TypedText Arg2:}{Placeholder (int)}
|
|
|
|
// CHECK-CCE: ObjCClassMethodDecl:{ResultType int}{Informative Method:}{Informative Arg1:}{TypedText OtherArg:}{Placeholder (id)}
|
2010-04-06 23:27:03 +08:00
|
|
|
// RUN: c-index-test -code-completion-at=%s:61:11 %s | FileCheck -check-prefix=CHECK-CCF %s
|
|
|
|
// CHECK-CCF: TypedefDecl:{TypedText Class}
|
|
|
|
// CHECK-CCF: ObjCInterfaceDecl:{TypedText Foo}
|
2010-05-28 07:06:34 +08:00
|
|
|
// CHECK-CCF-NOT: FunctionDecl:{ResultType void}{TypedText func}{LeftParen (}{RightParen )}
|
2010-04-06 23:27:03 +08:00
|
|
|
// CHECK-CCF: TypedefDecl:{TypedText id}
|
|
|
|
// CHECK-CCF: ObjCInterfaceDecl:{TypedText MyClass}
|
|
|
|
// CHECK-CCF: ObjCInterfaceDecl:{TypedText MySubClass}
|
|
|
|
// CHECK-CCF: {ResultType Class}{TypedText self}
|
|
|
|
// CHECK-CCF: {TypedText super}
|
2010-04-07 00:40:00 +08:00
|
|
|
// RUN: c-index-test -code-completion-at=%s:120:6 %s | FileCheck -check-prefix=CHECK-CCG %s
|
2010-08-26 08:30:24 +08:00
|
|
|
// CHECK-CCG: ObjCInstanceMethodDecl:{ResultType id}{TypedText categoryInstanceMethod}
|
|
|
|
// CHECK-CCG: ObjCInstanceMethodDecl:{ResultType id}{TypedText instanceMethod1}
|
|
|
|
// CHECK-CCG: ObjCInstanceMethodDecl:{ResultType int}{TypedText Method}
|
2010-10-19 05:05:04 +08:00
|
|
|
// CHECK-CCG: ObjCInstanceMethodDecl:{ResultType int}{TypedText MyInstMethod:}{Placeholder (id)}{HorizontalSpace }{TypedText second:}{Placeholder (id)}
|
2010-08-26 08:30:24 +08:00
|
|
|
// CHECK-CCG: ObjCInstanceMethodDecl:{ResultType int}{TypedText MyPrivateInstMethod}
|
|
|
|
// CHECK-CCG: ObjCInstanceMethodDecl:{ResultType int}{TypedText MySubInstMethod}
|
2010-08-30 03:47:46 +08:00
|
|
|
// CHECK-CCG: ObjCInstanceMethodDecl:{ResultType id}{TypedText protocolInstanceMethod:}{Placeholder (int)}
|
2010-08-26 08:30:24 +08:00
|
|
|
// CHECK-CCG: ObjCInstanceMethodDecl:{ResultType int}{TypedText secondProtocolInstanceMethod}
|
2010-04-07 00:40:00 +08:00
|
|
|
// RUN: c-index-test -code-completion-at=%s:121:14 %s | FileCheck -check-prefix=CHECK-CCG %s
|
|
|
|
// RUN: c-index-test -code-completion-at=%s:122:7 %s | FileCheck -check-prefix=CHECK-CCH %s
|
|
|
|
// CHECK-CCH: ObjCClassMethodDecl:{ResultType id}{TypedText categoryClassMethod}
|
2010-10-19 05:05:04 +08:00
|
|
|
// CHECK-CCH: ObjCClassMethodDecl:{ResultType int}{TypedText classMethod1:}{Placeholder (id)}{HorizontalSpace }{TypedText withKeyword:}{Placeholder (int)}
|
2010-04-07 00:40:00 +08:00
|
|
|
// CHECK-CCH: ObjCClassMethodDecl:{ResultType void}{TypedText classMethod2}
|
|
|
|
// CHECK-CCH: ObjCClassMethodDecl:{ResultType int}{TypedText Method}
|
2010-08-30 03:47:46 +08:00
|
|
|
// CHECK-CCH: ObjCClassMethodDecl:{ResultType int}{TypedText Method:}{Placeholder (int)}
|
|
|
|
// CHECK-CCH: ObjCClassMethodDecl:{ResultType int}{TypedText MyClassMethod:}{Placeholder (id)}
|
2010-04-07 00:40:00 +08:00
|
|
|
// CHECK-CCH: ObjCClassMethodDecl:{ResultType int}{TypedText MyPrivateMethod}
|
|
|
|
// CHECK-CCH: ObjCClassMethodDecl:{ResultType int}{TypedText MySubClassMethod}
|
|
|
|
// CHECK-CCH: ObjCClassMethodDecl:{ResultType int}{TypedText MySubPrivateMethod}
|
|
|
|
// CHECK-CCH: ObjCClassMethodDecl:{ResultType id}{TypedText new}
|
2010-10-19 05:05:04 +08:00
|
|
|
// CHECK-CCH: ObjCClassMethodDecl:{ResultType int}{TypedText OtherMethod:}{Placeholder (float)}{HorizontalSpace }{TypedText Arg1:}{Placeholder (int)}{HorizontalSpace }{TypedText Arg2:}{Placeholder (int)}
|
2010-04-07 00:40:00 +08:00
|
|
|
// CHECK-CCH: ObjCClassMethodDecl:{ResultType id}{TypedText protocolClassMethod}
|
2010-08-25 09:08:01 +08:00
|
|
|
// RUN: c-index-test -code-completion-at=%s:134:6 %s | FileCheck -check-prefix=CHECK-CCI %s
|
2010-10-19 08:03:23 +08:00
|
|
|
// CHECK-CCI: ObjCInstanceMethodDecl:{ResultType void}{TypedText method1} (37)
|
|
|
|
// CHECK-CCI: ObjCInstanceMethodDecl:{ResultType void}{TypedText method2} (35)
|
2010-09-16 00:23:04 +08:00
|
|
|
|
2010-09-17 00:06:31 +08:00
|
|
|
// RUN: c-index-test -code-completion-at=%s:150:5 %s | FileCheck -check-prefix=CHECK-REDUNDANT %s
|
2010-10-19 08:03:23 +08:00
|
|
|
// CHECK-REDUNDANT: ObjCInstanceMethodDecl:{ResultType void}{TypedText method2} (35)
|
2010-09-17 00:06:31 +08:00
|
|
|
// CHECK-REDUNDANT-NOT: ObjCInstanceMethodDecl:{ResultType void}{TypedText method2}
|
2010-10-19 08:03:23 +08:00
|
|
|
// CHECK-REDUNDANT: ObjCInstanceMethodDecl:{ResultType void}{TypedText method3} (35)
|
2010-09-17 00:06:31 +08:00
|
|
|
|
2010-11-09 05:12:30 +08:00
|
|
|
// RUN: c-index-test -code-completion-at=%s:170:16 %s | FileCheck -check-prefix=CHECK-CLASS-RESULT %s
|
|
|
|
// CHECK-CLASS-RESULT: ObjCClassMethodDecl:{ResultType void}{TypedText class_method3} (35)
|
2012-09-27 00:39:56 +08:00
|
|
|
// CHECK-CLASS-RESULT: ObjCClassMethodDecl:{ResultType void}{TypedText class_method4} (35)
|
2010-11-09 05:12:30 +08:00
|
|
|
|
2011-04-15 04:33:34 +08:00
|
|
|
// RUN: c-index-test -code-completion-at=%s:181:4 %s | FileCheck -check-prefix=CHECK-BLOCK-RECEIVER %s
|
|
|
|
// CHECK-BLOCK-RECEIVER: ObjCInterfaceDecl:{TypedText A} (50)
|
|
|
|
// CHECK-BLOCK-RECEIVER: ObjCInterfaceDecl:{TypedText B} (50)
|
|
|
|
// CHECK-BLOCK-RECEIVER: ParmDecl:{ResultType A *(^)(int)}{TypedText block1} (34)
|
|
|
|
// CHECK-BLOCK-RECEIVER-NEXT: ParmDecl:{ResultType id (^)(int)}{TypedText block3} (34)
|
|
|
|
|
2010-09-16 00:23:04 +08:00
|
|
|
// Test code completion with a missing opening bracket:
|
|
|
|
// RUN: c-index-test -code-completion-at=%s:135:5 %s | FileCheck -check-prefix=CHECK-CCI %s
|
|
|
|
// RUN: c-index-test -code-completion-at=%s:139:7 %s | FileCheck -check-prefix=CHECK-CC7 %s
|
|
|
|
// RUN: c-index-test -code-completion-at=%s:139:16 %s | FileCheck -check-prefix=CHECK-CC8 %s
|
|
|
|
// RUN: c-index-test -code-completion-at=%s:139:23 %s | FileCheck -check-prefix=CHECK-CC9 %s
|
Implement code completion for Objective-C class message sends that are
missing the opening bracket '[', e.g.,
NSArray <CC>
at function scope. Previously, we would only give trivial completions
(const, volatile, etc.), because we're in a "declaration name"
scope. Now, we also provide completions for class methods of NSArray,
e.g.,
alloc
Note that we already had support for this after the first argument,
e.g.,
NSArray method:x <CC>
would get code completion for class methods of NSArray whose selector
starts with "method:". This was already present because we recover
as if NSArray method:x were a class message send missing the opening
bracket (which was committed in r114057).
llvm-svn: 114078
2010-09-16 23:14:18 +08:00
|
|
|
|
|
|
|
// RUN: c-index-test -code-completion-at=%s:140:14 %s | FileCheck -check-prefix=CHECK-CCC %s
|
|
|
|
// RUN: c-index-test -code-completion-at=%s:140:23 %s | FileCheck -check-prefix=CHECK-CCD %s
|
|
|
|
// RUN: c-index-test -code-completion-at=%s:140:30 %s | FileCheck -check-prefix=CHECK-CCE %s
|
|
|
|
// RUN: c-index-test -code-completion-at=%s:141:14 %s | FileCheck -check-prefix=CHECK-CCC %s
|
|
|
|
// RUN: c-index-test -code-completion-at=%s:141:23 %s | FileCheck -check-prefix=CHECK-CCD %s
|
|
|
|
// RUN: c-index-test -code-completion-at=%s:141:30 %s | FileCheck -check-prefix=CHECK-CCE %s
|
2010-11-09 05:12:30 +08:00
|
|
|
|
2011-02-16 03:17:31 +08:00
|
|
|
// RUN: c-index-test -code-completion-at=%s:175:12 %s | FileCheck -check-prefix=CHECK-CLASS-RESULT %s
|
2011-07-30 15:55:26 +08:00
|
|
|
|
|
|
|
// RUN: c-index-test -code-completion-at=%s:189:6 %s | FileCheck -check-prefix=CHECK-DISTRIB-OBJECTS %s
|
2011-11-09 10:13:45 +08:00
|
|
|
// CHECK-DISTRIB-OBJECTS: ObjCInstanceMethodDecl:{ResultType void}{TypedText method:}{Placeholder (in bycopy A *)}{HorizontalSpace }{TypedText result:}{Placeholder (out byref A **)} (35)
|
2015-06-20 02:27:52 +08:00
|
|
|
|
|
|
|
// RUN: c-index-test -code-completion-at=%s:197:6 %s | FileCheck -check-prefix=CHECK-NULLABLE %s
|
2015-06-25 06:02:08 +08:00
|
|
|
// CHECK-NULLABLE: ObjCInstanceMethodDecl:{ResultType A * _Nonnull}{TypedText method:}{Placeholder (nullable A *)}
|