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