• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1// RUN: c-index-test core -print-source-symbols -- %s -target x86_64-apple-macosx10.7 | FileCheck %s
2
3@interface Base
4// CHECK: [[@LINE-1]]:12 | class/ObjC | Base | c:objc(cs)Base | _OBJC_CLASS_$_Base | Decl | rel: 0
5-(void)meth;
6// CHECK: [[@LINE-1]]:1 | instance-method/ObjC | meth | c:objc(cs)Base(im)meth | -[Base meth] | Decl,Dyn,RelChild | rel: 1
7// CHECK-NEXT: RelChild | Base | c:objc(cs)Base
8@end
9
10void foo();
11// CHECK: [[@LINE+1]]:6 | function/C | goo | c:@F@goo | _goo | Def | rel: 0
12void goo(Base *b) {
13  // CHECK: [[@LINE+2]]:3 | function/C | foo | c:@F@foo | _foo | Ref,Call,RelCall | rel: 1
14  // CHECK-NEXT: RelCall | goo | c:@F@goo
15  foo();
16  // CHECK: [[@LINE+3]]:6 | instance-method/ObjC | meth | c:objc(cs)Base(im)meth | -[Base meth] | Ref,Call,Dyn,RelRec,RelCall | rel: 2
17  // CHECK-NEXT: RelCall | goo | c:@F@goo
18  // CHECK-NEXT: RelRec | Base | c:objc(cs)Base
19  [b meth];
20}
21
22// CHECK: [[@LINE+1]]:11 | protocol/ObjC | Prot1 | c:objc(pl)Prot1 | <no-cgname> | Decl | rel: 0
23@protocol Prot1
24@end
25
26// CHECK: [[@LINE+3]]:11 | protocol/ObjC | Prot2 | c:objc(pl)Prot2 | <no-cgname> | Decl | rel: 0
27// CHECK: [[@LINE+2]]:17 | protocol/ObjC | Prot1 | c:objc(pl)Prot1 | <no-cgname> | Ref,RelBase | rel: 1
28// CHECK-NEXT: RelBase | Prot2 | c:objc(pl)Prot2
29@protocol Prot2<Prot1>
30@end
31
32// CHECK: [[@LINE+7]]:12 | class/ObjC | Sub | c:objc(cs)Sub | _OBJC_CLASS_$_Sub | Decl | rel: 0
33// CHECK: [[@LINE+6]]:18 | class/ObjC | Base | c:objc(cs)Base | _OBJC_CLASS_$_Base | Ref,RelBase | rel: 1
34// CHECK-NEXT: RelBase | Sub | c:objc(cs)Sub
35// CHECK: [[@LINE+4]]:23 | protocol/ObjC | Prot2 | c:objc(pl)Prot2 | <no-cgname> | Ref,RelBase | rel: 1
36// CHECK-NEXT: RelBase | Sub | c:objc(cs)Sub
37// CHECK: [[@LINE+2]]:30 | protocol/ObjC | Prot1 | c:objc(pl)Prot1 | <no-cgname> | Ref,RelBase | rel: 1
38// CHECK-NEXT: RelBase | Sub | c:objc(cs)Sub
39@interface Sub : Base<Prot2, Prot1>
40@end
41
42@interface NSArray<ObjectType> : Base
43// CHECK-NOT: ObjectType
44-(ObjectType)getit;
45@end
46
47// CHECK: [[@LINE+1]]:6 | function/C | over_func | c:@F@over_func#I# | __Z9over_funci | Decl | rel: 0
48void over_func(int x) __attribute__((overloadable));
49// CHECK: [[@LINE+1]]:6 | function/C | over_func | c:@F@over_func#f# | __Z9over_funcf | Decl | rel: 0
50void over_func(float x) __attribute__((overloadable));
51
52// CHECK: [[@LINE+1]]:6 | enum/C | MyEnum | c:@E@MyEnum | <no-cgname> | Def | rel: 0
53enum MyEnum {
54  // CHECK: [[@LINE+2]]:3 | enumerator/C | EnumeratorInNamed | c:@E@MyEnum@EnumeratorInNamed | <no-cgname> | Def,RelChild | rel: 1
55  // CHECK-NEXT: RelChild | MyEnum | c:@E@MyEnum
56  EnumeratorInNamed
57};
58
59// CHECK: [[@LINE+1]]:1 | enum/C | <no-name> | c:@Ea@One | <no-cgname> | Def | rel: 0
60enum {
61  // CHECK: [[@LINE+2]]:3 | enumerator/C | One | c:@Ea@One@One | <no-cgname> | Def,RelChild | rel: 1
62  // CHECK-NEXT: RelChild | <no-name> | c:@Ea@One
63  One,
64  // CHECK: [[@LINE+2]]:3 | enumerator/C | Two | c:@Ea@One@Two | <no-cgname> | Def,RelChild | rel: 1
65  // CHECK-NEXT: RelChild | <no-name> | c:@Ea@One
66  Two,
67};
68
69// CHECK: [[@LINE+1]]:13 | type-alias/C | jmp_buf | c:index-source.m@T@jmp_buf | <no-cgname> | Def | rel: 0
70typedef int jmp_buf[(18)];
71// CHECK: [[@LINE+2]]:12 | function/C | setjmp | c:@F@setjmp | _setjmp | Decl | rel: 0
72// CHECK: [[@LINE+1]]:19 | type-alias/C | jmp_buf | c:index-source.m@T@jmp_buf | <no-cgname> | Ref | rel: 0
73extern int setjmp(jmp_buf);
74
75@class I1;
76@interface I1
77// CHECK: [[@LINE+1]]:1 | instance-method/ObjC | meth | c:objc(cs)I1(im)meth | -[I1 meth] | Decl,Dyn,RelChild | rel: 1
78-(void)meth;
79@end
80
81@interface I2
82@property (readwrite) id prop;
83@end
84
85// CHECK: [[@LINE+2]]:17 | field/ObjC | _prop | c:objc(cs)I2@_prop | <no-cgname> | Def,Impl,RelChild | rel: 1
86// CHECK-NEXT: RelChild | I2 | c:objc(cs)I2
87@implementation I2
88// CHECK: [[@LINE+5]]:13 | instance-property/ObjC | prop | c:objc(cs)I2(py)prop | <no-cgname> | Ref | rel: 0
89// CHECK: [[@LINE+4]]:13 | instance-method/ObjC | prop | c:objc(cs)I2(im)prop | -[I2 prop] | Def,RelChild | rel: 1
90// CHECK-NEXT: RelChild | I2 | c:objc(cs)I2
91// CHECK: [[@LINE+2]]:13 | instance-method/ObjC | setProp: | c:objc(cs)I2(im)setProp: | -[I2 setProp:] | Def,RelChild | rel: 1
92// CHECK-NEXT: RelChild | I2 | c:objc(cs)I2
93@synthesize prop = _prop;
94@end
95
96@interface I3
97@property (readwrite) id prop;
98-(id)prop;
99-(void)setProp:(id)p;
100@end
101
102@implementation I3
103// CHECK: [[@LINE+3]]:13 | instance-property/ObjC | prop | c:objc(cs)I3(py)prop | <no-cgname> | Ref | rel: 0
104// CHECK: [[@LINE+2]]:13 | instance-method/ObjC | prop | c:objc(cs)I3(im)prop | -[I3 prop] | Def,RelChild | rel: 1
105// CHECK: [[@LINE+1]]:13 | instance-method/ObjC | setProp: | c:objc(cs)I3(im)setProp: | -[I3 setProp:] | Def,RelChild | rel: 1
106@synthesize prop = _prop;
107@end
108