]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - test/Index/complete-objc-message-id.m
Vendor import of clang trunk r290819:
[FreeBSD/FreeBSD.git] / test / Index / complete-objc-message-id.m
1 // Note: the run lines follow their respective tests, since line/column
2 // matter in this test.
3
4 @interface A
5 + (id)alloc;
6 + (id)init;
7 + (id)new;
8 + (Class)class;
9 + (Class)superclass;
10 - (id)retain;
11 - (id)autorelease;
12 - (id)superclass;
13 @end
14
15 @interface B : A
16 - (int)B_method;
17 @end
18
19 @interface Unrelated
20 + (id)icky;
21 @end
22
23 void message_id(B *b) {
24   [[A alloc] init];
25   [[b retain] B_method];
26   [[b superclass] B_method];
27 }
28
29 @implementation Unrelated
30 + (id)alloc {
31   return [A alloc];
32 }
33 @end
34
35 @protocol P1
36 - (int)P1_method1;
37 + (int)P1_method2;
38 @end
39
40 @protocol P2 <P1>
41 - (int)P2_method1;
42 + (int)P2_method2;
43 @end
44
45 void message_qualified_id(id<P2> ip2) {
46   [ip2 P1_method];
47    ip2 P1_method];
48 }
49
50 // RUN: c-index-test -code-completion-at=%s:24:14 %s | FileCheck -check-prefix=CHECK-CC1 %s
51 // CHECK-CC1: ObjCInstanceMethodDecl:{ResultType id}{TypedText autorelease}
52 // CHECK-CC1-NOT: B_method
53 // CHECK-CC1: ObjCInstanceMethodDecl:{ResultType id}{TypedText retain}
54 // RUN: c-index-test -code-completion-at=%s:25:15 %s | FileCheck -check-prefix=CHECK-CC2 %s
55 // CHECK-CC2: ObjCInstanceMethodDecl:{ResultType id}{TypedText autorelease}
56 // CHECK-CC2: ObjCInstanceMethodDecl:{ResultType int}{TypedText B_method}
57 // CHECK-CC2: ObjCInstanceMethodDecl:{ResultType id}{TypedText retain}
58 // RUN: c-index-test -code-completion-at=%s:26:19 %s | FileCheck -check-prefix=CHECK-CC3 %s
59 // CHECK-CC3: ObjCInstanceMethodDecl:{ResultType id}{TypedText autorelease}
60 // CHECK-CC3-NOT: B_method
61 // CHECK-CC3: ObjCInstanceMethodDecl:{ResultType id}{TypedText retain}
62
63
64 // RUN: c-index-test -code-completion-at=%s:31:13 %s | FileCheck -check-prefix=CHECK-SELECTOR-PREF %s
65 // CHECK-SELECTOR-PREF: ObjCClassMethodDecl:{ResultType id}{TypedText alloc} (32)
66 // CHECK-SELECTOR-PREF: ObjCClassMethodDecl:{ResultType Class}{TypedText class} (35)
67 // CHECK-SELECTOR-PREF: ObjCClassMethodDecl:{ResultType id}{TypedText init} (35)
68 // CHECK-SELECTOR-PREF: ObjCClassMethodDecl:{ResultType id}{TypedText new} (35)
69 // CHECK-SELECTOR-PREF: ObjCClassMethodDecl:{ResultType Class}{TypedText superclass} (35)
70
71 // RUN: c-index-test -code-completion-at=%s:46:8 %s | FileCheck -check-prefix=CHECK-INSTANCE-QUAL-ID %s
72 // RUN: c-index-test -code-completion-at=%s:47:8 %s | FileCheck -check-prefix=CHECK-INSTANCE-QUAL-ID %s
73 // CHECK-INSTANCE-QUAL-ID: ObjCInstanceMethodDecl:{ResultType int}{TypedText P1_method1} (37)
74 // CHECK-INSTANCE-QUAL-ID: ObjCInstanceMethodDecl:{ResultType int}{TypedText P2_method1} (35)