xref: /minix3/external/bsd/llvm/dist/clang/test/Index/complete-super.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 Sambuctypedef int Bool;
5*f4a2713aSLionel Sambuc
6*f4a2713aSLionel Sambuc@interface A
7*f4a2713aSLionel Sambuc- (void)add:(int)x to:(int)y;
8*f4a2713aSLionel Sambuc+ (void)select:(Bool)condition first:(int)x second:(int)y;
9*f4a2713aSLionel Sambuc- (void)last;
10*f4a2713aSLionel Sambuc+ (void)last;
11*f4a2713aSLionel Sambuc@end
12*f4a2713aSLionel Sambuc
13*f4a2713aSLionel Sambuc@interface B : A
14*f4a2713aSLionel Sambuc- (void)add:(int)x to:(int)y;
15*f4a2713aSLionel Sambuc+ (void)select:(Bool)condition first:(int)x second:(int)y;
16*f4a2713aSLionel Sambuc@end
17*f4a2713aSLionel Sambuc
18*f4a2713aSLionel Sambuc@implementation B
19*f4a2713aSLionel Sambuc- (void)add:(int)a to:(int)b {
20*f4a2713aSLionel Sambuc  [super add:a to:b];
21*f4a2713aSLionel Sambuc}
22*f4a2713aSLionel Sambuc
23*f4a2713aSLionel Sambuc+ (void)select:(Bool)condition first:(int)a second:(int)b {
24*f4a2713aSLionel Sambuc  [super selector:condition first:a second:b];
25*f4a2713aSLionel Sambuc   super selector:condition first:a second:b];
26*f4a2713aSLionel Sambuc}
27*f4a2713aSLionel Sambuc@end
28*f4a2713aSLionel Sambuc
29*f4a2713aSLionel Sambuc@interface A (Cat)
30*f4a2713aSLionel Sambuc- (void)multiply:(int)x by:(int)y;
31*f4a2713aSLionel Sambuc@end
32*f4a2713aSLionel Sambuc
33*f4a2713aSLionel Sambuc@interface C : A
34*f4a2713aSLionel Sambuc@end
35*f4a2713aSLionel Sambuc
36*f4a2713aSLionel Sambuc@implementation C
37*f4a2713aSLionel Sambuc- (void)multiply:(int)a by:(int)b {
38*f4a2713aSLionel Sambuc  [super multiply:a by:b];
39*f4a2713aSLionel Sambuc}
40*f4a2713aSLionel Sambuc@end
41*f4a2713aSLionel Sambuc
42*f4a2713aSLionel Sambuc// Check "super" completion as a message receiver.
43*f4a2713aSLionel Sambuc// RUN: c-index-test -code-completion-at=%s:20:4 %s | FileCheck -check-prefix=CHECK-ADD-RECEIVER %s
44*f4a2713aSLionel Sambuc// CHECK-ADD-RECEIVER: ObjCInstanceMethodDecl:{ResultType void}{TypedText super}{HorizontalSpace  }{Text add:}{Placeholder a}{HorizontalSpace  }{Text to:}{Placeholder b} (20)
45*f4a2713aSLionel Sambuc
46*f4a2713aSLionel Sambuc// RUN: c-index-test -code-completion-at=%s:24:4 %s | FileCheck -check-prefix=CHECK-SELECT-RECEIVER %s
47*f4a2713aSLionel Sambuc// CHECK-SELECT-RECEIVER: ObjCClassMethodDecl:{ResultType void}{TypedText super}{HorizontalSpace  }{Text select:}{Placeholder condition}{HorizontalSpace  }{Text first:}{Placeholder a}{HorizontalSpace  }{Text second:}{Placeholder b} (20)
48*f4a2713aSLionel Sambuc
49*f4a2713aSLionel Sambuc// Check "super" completion at the first identifier
50*f4a2713aSLionel Sambuc// RUN: c-index-test -code-completion-at=%s:20:10 %s | FileCheck -check-prefix=CHECK-ADD-ADD %s
51*f4a2713aSLionel Sambuc// CHECK-ADD-ADD: ObjCInstanceMethodDecl:{ResultType void}{TypedText add:}{Placeholder a}{HorizontalSpace  }{Text to:}{Placeholder b} (20)
52*f4a2713aSLionel Sambuc// CHECK-ADD-ADD-NOT: add
53*f4a2713aSLionel Sambuc// CHECK-ADD-ADD: ObjCInstanceMethodDecl:{ResultType void}{TypedText last} (35)
54*f4a2713aSLionel Sambuc
55*f4a2713aSLionel Sambuc// RUN: c-index-test -code-completion-at=%s:24:10 %s | FileCheck -check-prefix=CHECK-SELECTOR-SELECTOR %s
56*f4a2713aSLionel Sambuc// CHECK-SELECTOR-SELECTOR: ObjCInstanceMethodDecl:{ResultType void}{TypedText last} (35)
57*f4a2713aSLionel Sambuc// CHECK-SELECTOR-SELECTOR: ObjCClassMethodDecl:{ResultType void}{TypedText select:}{Placeholder condition}{HorizontalSpace  }{Text first:}{Placeholder a}{HorizontalSpace  }{Text second:}{Placeholder b} (20)
58*f4a2713aSLionel Sambuc
59*f4a2713aSLionel Sambuc// Check "super" completion at the second identifier
60*f4a2713aSLionel Sambuc// RUN: c-index-test -code-completion-at=%s:20:16 %s | FileCheck -check-prefix=CHECK-ADD-TO %s
61*f4a2713aSLionel Sambuc// CHECK-ADD-TO: ObjCInstanceMethodDecl:{ResultType void}{Informative add:}{TypedText to:}{Placeholder b} (20)
62*f4a2713aSLionel Sambuc
63*f4a2713aSLionel Sambuc// RUN: c-index-test -code-completion-at=%s:24:28 %s | FileCheck -check-prefix=CHECK-SELECTOR-FIRST %s
64*f4a2713aSLionel Sambuc// CHECK-SELECTOR-FIRST: ObjCClassMethodDecl:{ResultType void}{Informative select:}{TypedText first:}{Placeholder a}{HorizontalSpace  }{Text second:}{Placeholder b} (20)
65*f4a2713aSLionel Sambuc
66*f4a2713aSLionel Sambuc// Check "super" completion at the third identifier
67*f4a2713aSLionel Sambuc// RUN: c-index-test -code-completion-at=%s:24:37 %s | FileCheck -check-prefix=CHECK-SELECTOR-SECOND %s
68*f4a2713aSLionel Sambuc// CHECK-SELECTOR-SECOND: ObjCClassMethodDecl:{ResultType void}{Informative select:}{Informative first:}{TypedText second:}{Placeholder b} (20)
69*f4a2713aSLionel Sambuc
70*f4a2713aSLionel Sambuc// Check "super" completion with missing '['.
71*f4a2713aSLionel Sambuc// RUN: c-index-test -code-completion-at=%s:25:10 %s | FileCheck -check-prefix=CHECK-SELECTOR-SELECTOR %s
72*f4a2713aSLionel Sambuc// RUN: c-index-test -code-completion-at=%s:25:28 %s | FileCheck -check-prefix=CHECK-SELECTOR-FIRST %s
73*f4a2713aSLionel Sambuc// RUN: c-index-test -code-completion-at=%s:25:37 %s | FileCheck -check-prefix=CHECK-SELECTOR-SECOND %s
74*f4a2713aSLionel Sambuc
75*f4a2713aSLionel Sambuc// Check "super" completion for a method declared in a category.
76*f4a2713aSLionel Sambuc// RUN: c-index-test -code-completion-at=%s:38:10 %s | FileCheck -check-prefix=CHECK-IN-CATEGORY %s
77*f4a2713aSLionel Sambuc// CHECK-IN-CATEGORY: ObjCInstanceMethodDecl:{ResultType void}{TypedText add:}{Placeholder (int)}{HorizontalSpace  }{TypedText to:}{Placeholder (int)} (35)
78*f4a2713aSLionel Sambuc// CHECK-IN-CATEGORY: ObjCInstanceMethodDecl:{ResultType void}{TypedText last} (35)
79*f4a2713aSLionel Sambuc// CHECK-IN-CATEGORY: ObjCInstanceMethodDecl:{ResultType void}{TypedText multiply:}{Placeholder a}{HorizontalSpace  }{Text by:}{Placeholder b} (20)
80*f4a2713aSLionel Sambuc
81