blob: 8e6d9770916bfd355f222855a43cab21f5720b9e [file] [log] [blame]
Douglas Gregor98146a62010-03-09 13:06:04 +00001@interface Foo
2- (int)compare:(Foo*)other;
3@end
4
Douglas Gregore0610a42010-03-09 20:57:01 +00005@implementation Foo
6- (int)compare:(Foo*)other {
7 return 0;
Douglas Gregor81d34662010-04-20 15:39:42 +00008 (void)@encode(Foo);
Douglas Gregore0610a42010-03-09 20:57:01 +00009}
10@end
11
Ted Kremeneka333c662010-05-12 05:29:33 +000012// From <rdar://problem/7971430>, the 'barType' referenced in the ivar
13// declarations should be annotated as TypeRefs.
14typedef int * barType;
15@interface Bar
16{
17 barType iVar;
18 barType iVar1, iVar2;
19}
20@end
21@implementation Bar
22- (void) method
23{
24 barType local = iVar;
25}
26@end
27
Ted Kremenek20f9ba72010-05-12 06:03:33 +000028// RUN: c-index-test -test-annotate-tokens=%s:1:1:27:1 %s | FileCheck %s
Ted Kremenekfbd84ca2010-05-05 00:55:23 +000029// CHECK: Punctuation: "@" [1:1 - 1:2] ObjCInterfaceDecl=Foo:1:12
30// CHECK: Keyword: "interface" [1:2 - 1:11] ObjCInterfaceDecl=Foo:1:12
Douglas Gregor98146a62010-03-09 13:06:04 +000031// CHECK: Identifier: "Foo" [1:12 - 1:15] ObjCInterfaceDecl=Foo:1:12
32// CHECK: Punctuation: "-" [2:1 - 2:2] ObjCInstanceMethodDecl=compare::2:1
Ted Kremenekfbd84ca2010-05-05 00:55:23 +000033// CHECK: Punctuation: "(" [2:3 - 2:4] ObjCInstanceMethodDecl=compare::2:1
34// CHECK: Keyword: "int" [2:4 - 2:7] ObjCInstanceMethodDecl=compare::2:1
35// CHECK: Punctuation: ")" [2:7 - 2:8] ObjCInstanceMethodDecl=compare::2:1
36// CHECK: Identifier: "compare" [2:8 - 2:15] ObjCInstanceMethodDecl=compare::2:1
37// CHECK: Punctuation: ":" [2:15 - 2:16] ObjCInstanceMethodDecl=compare::2:1
38// CHECK: Punctuation: "(" [2:16 - 2:17] ObjCInstanceMethodDecl=compare::2:1
Douglas Gregor98146a62010-03-09 13:06:04 +000039// CHECK: Identifier: "Foo" [2:17 - 2:20] ObjCClassRef=Foo:1:12
Ted Kremenekfbd84ca2010-05-05 00:55:23 +000040// CHECK: Punctuation: "*" [2:20 - 2:21] ParmDecl=other:2:22 (Definition)
41// CHECK: Punctuation: ")" [2:21 - 2:22] ParmDecl=other:2:22 (Definition)
Douglas Gregor98146a62010-03-09 13:06:04 +000042// CHECK: Identifier: "other" [2:22 - 2:27] ParmDecl=other:2:22 (Definition)
Ted Kremenekfbd84ca2010-05-05 00:55:23 +000043// CHECK: Punctuation: ";" [2:27 - 2:28] ObjCInstanceMethodDecl=compare::2:1
44// CHECK: Punctuation: "@" [3:1 - 3:2] ObjCInterfaceDecl=Foo:1:12
45// CHECK: Keyword: "end" [3:2 - 3:5] ObjCInterfaceDecl=Foo:1:12
Douglas Gregore0610a42010-03-09 20:57:01 +000046// CHECK: Punctuation: "@" [5:1 - 5:2] ObjCImplementationDecl=Foo:5:1 (Definition)
Ted Kremenekfbd84ca2010-05-05 00:55:23 +000047// CHECK: Keyword: "implementation" [5:2 - 5:16] ObjCImplementationDecl=Foo:5:1 (Definition)
48// CHECK: Identifier: "Foo" [5:17 - 5:20] ObjCImplementationDecl=Foo:5:1 (Definition)
Douglas Gregore0610a42010-03-09 20:57:01 +000049// CHECK: Punctuation: "-" [6:1 - 6:2] ObjCInstanceMethodDecl=compare::6:1 (Definition)
Ted Kremenekfbd84ca2010-05-05 00:55:23 +000050// CHECK: Punctuation: "(" [6:3 - 6:4] ObjCInstanceMethodDecl=compare::6:1 (Definition)
51// CHECK: Keyword: "int" [6:4 - 6:7] ObjCInstanceMethodDecl=compare::6:1 (Definition)
52// CHECK: Punctuation: ")" [6:7 - 6:8] ObjCInstanceMethodDecl=compare::6:1 (Definition)
53// CHECK: Identifier: "compare" [6:8 - 6:15] ObjCInstanceMethodDecl=compare::6:1 (Definition)
54// CHECK: Punctuation: ":" [6:15 - 6:16] ObjCInstanceMethodDecl=compare::6:1 (Definition)
55// CHECK: Punctuation: "(" [6:16 - 6:17] ObjCInstanceMethodDecl=compare::6:1 (Definition)
Douglas Gregore0610a42010-03-09 20:57:01 +000056// CHECK: Identifier: "Foo" [6:17 - 6:20] ObjCClassRef=Foo:1:12
Ted Kremenekfbd84ca2010-05-05 00:55:23 +000057// CHECK: Punctuation: "*" [6:20 - 6:21] ParmDecl=other:6:22 (Definition)
58// CHECK: Punctuation: ")" [6:21 - 6:22] ParmDecl=other:6:22 (Definition)
Douglas Gregore0610a42010-03-09 20:57:01 +000059// CHECK: Identifier: "other" [6:22 - 6:27] ParmDecl=other:6:22 (Definition)
Ted Kremenekfbd84ca2010-05-05 00:55:23 +000060// CHECK: Punctuation: "{" [6:28 - 6:29] UnexposedStmt=
61// CHECK: Keyword: "return" [7:3 - 7:9] UnexposedStmt=
62// CHECK: Literal: "0" [7:10 - 7:11] UnexposedExpr=
63// CHECK: Punctuation: ";" [7:11 - 7:12] UnexposedStmt=
64// CHECK: Punctuation: "(" [8:3 - 8:4] UnexposedExpr=
65// CHECK: Keyword: "void" [8:4 - 8:8] UnexposedExpr=
66// CHECK: Punctuation: ")" [8:8 - 8:9] UnexposedExpr=
67// CHECK: Punctuation: "@" [8:9 - 8:10] UnexposedExpr=
68// CHECK: Keyword: "encode" [8:10 - 8:16] UnexposedExpr=
69// CHECK: Punctuation: "(" [8:16 - 8:17] UnexposedExpr=
Douglas Gregor81d34662010-04-20 15:39:42 +000070// CHECK: Identifier: "Foo" [8:17 - 8:20] ObjCClassRef=Foo:1:12
Ted Kremenekfbd84ca2010-05-05 00:55:23 +000071// CHECK: Punctuation: ")" [8:20 - 8:21] UnexposedExpr=
72// CHECK: Punctuation: ";" [8:21 - 8:22] UnexposedStmt=
73// CHECK: Punctuation: "}" [9:1 - 9:2] UnexposedStmt=
74// CHECK: Punctuation: "@" [10:1 - 10:2] ObjCImplementationDecl=Foo:5:1 (Definition)
75// CHECK: Keyword: "end" [10:2 - 10:5]
Ted Kremeneka333c662010-05-12 05:29:33 +000076// CHECK: Keyword: "typedef" [14:1 - 14:8]
77// CHECK: Keyword: "int" [14:9 - 14:12]
78// CHECK: Punctuation: "*" [14:13 - 14:14]
79// CHECK: Identifier: "barType" [14:15 - 14:22] TypedefDecl=barType:14:15 (Definition)
80// CHECK: Punctuation: ";" [14:22 - 14:23]
81// CHECK: Punctuation: "@" [15:1 - 15:2] ObjCInterfaceDecl=Bar:15:12
82// CHECK: Keyword: "interface" [15:2 - 15:11] ObjCInterfaceDecl=Bar:15:12
83// CHECK: Identifier: "Bar" [15:12 - 15:15] ObjCInterfaceDecl=Bar:15:12
84// CHECK: Punctuation: "{" [16:1 - 16:2] ObjCInterfaceDecl=Bar:15:12
85// CHECK: Identifier: "barType" [17:5 - 17:12] TypeRef=barType:14:15
86// CHECK: Identifier: "iVar" [17:13 - 17:17] ObjCIvarDecl=iVar:17:13 (Definition)
87// CHECK: Punctuation: ";" [17:17 - 17:18] ObjCInterfaceDecl=Bar:15:12
88// CHECK: Identifier: "barType" [18:5 - 18:12] TypeRef=barType:14:15
89// CHECK: Identifier: "iVar1" [18:13 - 18:18] ObjCIvarDecl=iVar1:18:13 (Definition)
90// CHECK: Punctuation: "," [18:18 - 18:19] ObjCIvarDecl=iVar2:18:20 (Definition)
91// CHECK: Identifier: "iVar2" [18:20 - 18:25] ObjCIvarDecl=iVar2:18:20 (Definition)
92// CHECK: Punctuation: ";" [18:25 - 18:26] ObjCInterfaceDecl=Bar:15:12
93// CHECK: Punctuation: "}" [19:1 - 19:2] ObjCInterfaceDecl=Bar:15:12
94// CHECK: Punctuation: "@" [20:1 - 20:2] ObjCInterfaceDecl=Bar:15:12
95// CHECK: Keyword: "end" [20:2 - 20:5] ObjCInterfaceDecl=Bar:15:12
96// CHECK: Punctuation: "@" [21:1 - 21:2] ObjCImplementationDecl=Bar:21:1 (Definition)
97// CHECK: Keyword: "implementation" [21:2 - 21:16] ObjCImplementationDecl=Bar:21:1 (Definition)
98// CHECK: Identifier: "Bar" [21:17 - 21:20] ObjCImplementationDecl=Bar:21:1 (Definition)
99// CHECK: Punctuation: "-" [22:1 - 22:2] ObjCInstanceMethodDecl=method:22:1 (Definition)
100// CHECK: Punctuation: "(" [22:3 - 22:4] ObjCInstanceMethodDecl=method:22:1 (Definition)
101// CHECK: Keyword: "void" [22:4 - 22:8] ObjCInstanceMethodDecl=method:22:1 (Definition)
102// CHECK: Punctuation: ")" [22:8 - 22:9] ObjCInstanceMethodDecl=method:22:1 (Definition)
103// CHECK: Identifier: "method" [22:10 - 22:16] ObjCInstanceMethodDecl=method:22:1 (Definition)
104// CHECK: Punctuation: "{" [23:1 - 23:2] UnexposedStmt=
105// CHECK: Identifier: "barType" [24:5 - 24:12] TypeRef=barType:14:15
106// CHECK: Identifier: "local" [24:13 - 24:18] VarDecl=local:24:13 (Definition)
107// CHECK: Punctuation: "=" [24:19 - 24:20] VarDecl=local:24:13 (Definition)
108// CHECK: Identifier: "iVar" [24:21 - 24:25] MemberRefExpr=iVar:17:13
109// CHECK: Punctuation: ";" [24:25 - 24:26] UnexposedStmt=
110// CHECK: Punctuation: "}" [25:1 - 25:2] UnexposedStmt=
111// CHECK: Punctuation: "@" [26:1 - 26:2] ObjCImplementationDecl=Bar:21:1 (Definition)
112// CHECK: Keyword: "end" [26:2 - 26:5]
113