xref: /llvm-project/clang/test/Index/index-decls.m (revision 0f1c1be1968076d6f96f8a7bcc4a15cf195ecd97)
1@interface I
2@property (readonly) id prop;
3 -(id)prop;
4@end
5
6@interface I()
7@property (assign,readwrite) id prop;
8@end
9
10@implementation I
11@synthesize prop = _prop;
12@end
13
14@interface I1
15__attribute__((something)) @interface I2 @end
16@end
17
18@interface I3
19@property (assign,readwrite) id auto_prop;
20@end
21
22@implementation I3
23-(void)meth {
24  _auto_prop = 0;
25}
26@end
27
28int test1() {
29  extern int extvar;
30  extvar = 2;
31  extern int extfn();
32  return extfn();
33}
34
35@interface I4
36@property (assign, nonatomic) id prop;
37-(id)prop;
38-(void)setProp:(id)p;
39@end
40
41@implementation I4
42@synthesize prop = _prop;
43-(id)prop {
44  return 0;
45}
46-(void)setProp:(id)p {
47}
48@end
49
50@class I5;
51@interface I5
52-(void)meth;
53@property (class) int c;
54@end
55
56// RUN: c-index-test -index-file %s -target x86_64-apple-macosx10.7 > %t
57// RUN: FileCheck %s -input-file=%t
58// CHECK: [indexDeclaration]: kind: objc-class | name: I | {{.*}} | loc: 1:12
59// CHECK: [indexDeclaration]: kind: objc-instance-method | name: prop | {{.*}} | loc: 3:7
60// CHECK: [indexDeclaration]: kind: objc-property | name: prop | {{.*}} | loc: 2:25
61// CHECK: [indexDeclaration]: kind: objc-category | name:  | {{.*}} | loc: 6:12
62// CHECK: [indexDeclaration]: kind: objc-instance-method | name: setProp: | {{.*}} | loc: 7:33
63// CHECK: [indexDeclaration]: kind: objc-property | name: prop | {{.*}} | loc: 7:33
64
65// CHECK: [indexDeclaration]: kind: objc-instance-method | name: prop | {{.*}} | loc: 11:13 | {{.*}} | lexical-container: [I:10:17]
66// CHECK: [indexDeclaration]: kind: objc-instance-method | name: setProp: | {{.*}} | loc: 11:13 | {{.*}} | lexical-container: [I:10:17]
67// CHECK: [indexDeclaration]: kind: objc-ivar | name: _prop | {{.*}} | loc: 11:20
68
69// CHECK: [indexDeclaration]: kind: objc-ivar | name: _auto_prop | {{.*}} | loc: 19:33
70// CHECK: [indexEntityReference]: kind: objc-ivar | name: _auto_prop | {{.*}} | loc: 24:3
71
72// CHECK: [indexDeclaration]: kind: function | name: test1 | {{.*}} | loc: 28:5
73// CHECK: [indexDeclaration]: kind: variable | name: extvar | {{.*}} | loc: 29:14
74// CHECK: [indexEntityReference]: kind: variable | name: extvar | {{.*}} | loc: 30:3
75// CHECK: [indexDeclaration]: kind: function | name: extfn | {{.*}} | loc: 31:14
76// CHECK: [indexEntityReference]: kind: function | name: extfn | {{.*}} | loc: 32:10
77
78// CHECK: [indexDeclaration]: kind: objc-class | name: I4 | {{.*}} | loc: 35:12
79// CHECK: [indexEntityReference]: kind: objc-property | name: prop | {{.*}} | cursor: ObjCSynthesizeDecl=prop:36:34 (Definition) | loc: 42:13 | <parent>:: kind: objc-class | name: I4 | {{.*}} | container: [I4:41:17] | refkind: direct
80// CHECK-NOT: [indexDeclaration]: kind: objc-instance-method {{.*}} loc: 36:
81// CHECK-NOT: [indexDeclaration]: kind: objc-instance-method {{.*}} loc: 42:
82
83// CHECK: [indexDeclaration]: kind: objc-instance-method | name: meth | {{.*}} loc: 52:8 | {{.*}} | isRedecl: 0 | isDef: 0 |
84// CHECK: [indexDeclaration]: kind: objc-property | name: c | USR: c:objc(cs)I5(cpy)c | lang: ObjC | cursor: ObjCPropertyDecl=c:53:23 [class,] | loc: 53:23
85