xref: /minix3/external/bsd/llvm/dist/clang/test/Index/annotate-literals.m (revision f4a2713ac843a11c696ec80c0a5e3e5d80b4d338)
1*f4a2713aSLionel Sambuctypedef unsigned char BOOL;
2*f4a2713aSLionel Sambuc
3*f4a2713aSLionel Sambuc@interface NSNumber @end
4*f4a2713aSLionel Sambuc
5*f4a2713aSLionel Sambuc@interface NSNumber (NSNumberCreation)
6*f4a2713aSLionel Sambuc+ (NSNumber *)numberWithChar:(char)value;
7*f4a2713aSLionel Sambuc+ (NSNumber *)numberWithUnsignedChar:(unsigned char)value;
8*f4a2713aSLionel Sambuc+ (NSNumber *)numberWithShort:(short)value;
9*f4a2713aSLionel Sambuc+ (NSNumber *)numberWithUnsignedShort:(unsigned short)value;
10*f4a2713aSLionel Sambuc+ (NSNumber *)numberWithInt:(int)value;
11*f4a2713aSLionel Sambuc+ (NSNumber *)numberWithUnsignedInt:(unsigned int)value;
12*f4a2713aSLionel Sambuc+ (NSNumber *)numberWithLong:(long)value;
13*f4a2713aSLionel Sambuc+ (NSNumber *)numberWithUnsignedLong:(unsigned long)value;
14*f4a2713aSLionel Sambuc+ (NSNumber *)numberWithLongLong:(long long)value;
15*f4a2713aSLionel Sambuc+ (NSNumber *)numberWithUnsignedLongLong:(unsigned long long)value;
16*f4a2713aSLionel Sambuc+ (NSNumber *)numberWithFloat:(float)value;
17*f4a2713aSLionel Sambuc+ (NSNumber *)numberWithDouble:(double)value;
18*f4a2713aSLionel Sambuc+ (NSNumber *)numberWithBool:(BOOL)value;
19*f4a2713aSLionel Sambuc@end
20*f4a2713aSLionel Sambuc
21*f4a2713aSLionel Sambuc@interface NSArray
22*f4a2713aSLionel Sambuc@end
23*f4a2713aSLionel Sambuc
24*f4a2713aSLionel Sambuc@interface NSArray (NSArrayCreation)
25*f4a2713aSLionel Sambuc+ (id)arrayWithObjects:(const id [])objects count:(unsigned long)cnt;
26*f4a2713aSLionel Sambuc@end
27*f4a2713aSLionel Sambuc
28*f4a2713aSLionel Sambuc@interface NSDictionary
29*f4a2713aSLionel Sambuc+ (id)dictionaryWithObjects:(const id [])objects forKeys:(const id [])keys count:(unsigned long)cnt;
30*f4a2713aSLionel Sambuc@end
31*f4a2713aSLionel Sambuc
32*f4a2713aSLionel Sambucvoid test_literals(id k1, id o1, id k2, id o2, id k3) {
33*f4a2713aSLionel Sambuc  id objects = @[ o1, o2 ];
34*f4a2713aSLionel Sambuc  id dict = @{ k1 : o1,
35*f4a2713aSLionel Sambuc               k2 : o2,
36*f4a2713aSLionel Sambuc               k3 : @17 };
37*f4a2713aSLionel Sambuc}
38*f4a2713aSLionel Sambuc
39*f4a2713aSLionel Sambuc
40*f4a2713aSLionel Sambuc// RUN: c-index-test -test-annotate-tokens=%s:33:1:37:1 %s | FileCheck -check-prefix=CHECK-LITERALS %s
41*f4a2713aSLionel Sambuc
42*f4a2713aSLionel Sambuc// CHECK-LITERALS: Identifier: "id" [33:3 - 33:5] TypeRef=id:0:0
43*f4a2713aSLionel Sambuc// CHECK-LITERALS: Identifier: "objects" [33:6 - 33:13] VarDecl=objects:33:6 (Definition)
44*f4a2713aSLionel Sambuc// CHECK-LITERALS: Punctuation: "=" [33:14 - 33:15] VarDecl=objects:33:6 (Definition)
45*f4a2713aSLionel Sambuc// CHECK-LITERALS: Punctuation: "@" [33:16 - 33:17] UnexposedExpr=
46*f4a2713aSLionel Sambuc// CHECK-LITERALS: Punctuation: "[" [33:17 - 33:18] UnexposedExpr=
47*f4a2713aSLionel Sambuc// CHECK-LITERALS: Identifier: "o1" [33:19 - 33:21] DeclRefExpr=o1:32:30
48*f4a2713aSLionel Sambuc// CHECK-LITERALS: Punctuation: "," [33:21 - 33:22] UnexposedExpr=
49*f4a2713aSLionel Sambuc// CHECK-LITERALS: Identifier: "o2" [33:23 - 33:25] DeclRefExpr=o2:32:44
50*f4a2713aSLionel Sambuc// CHECK-LITERALS: Punctuation: "]" [33:26 - 33:27] UnexposedExpr=
51*f4a2713aSLionel Sambuc// CHECK-LITERALS: Punctuation: ";" [33:27 - 33:28] DeclStmt=
52*f4a2713aSLionel Sambuc// CHECK-LITERALS: Identifier: "id" [34:3 - 34:5] TypeRef=id:0:0
53*f4a2713aSLionel Sambuc// CHECK-LITERALS: Identifier: "dict" [34:6 - 34:10] VarDecl=dict:34:6 (Definition)
54*f4a2713aSLionel Sambuc// CHECK-LITERALS: Punctuation: "=" [34:11 - 34:12] VarDecl=dict:34:6 (Definition)
55*f4a2713aSLionel Sambuc// CHECK-LITERALS: Punctuation: "@" [34:13 - 34:14] UnexposedExpr=
56*f4a2713aSLionel Sambuc// CHECK-LITERALS: Punctuation: "{" [34:14 - 34:15] UnexposedExpr=
57*f4a2713aSLionel Sambuc// CHECK-LITERALS: Identifier: "k1" [34:16 - 34:18] DeclRefExpr=k1:32:23
58*f4a2713aSLionel Sambuc// CHECK-LITERALS: Punctuation: ":" [34:19 - 34:20] UnexposedExpr=
59*f4a2713aSLionel Sambuc// CHECK-LITERALS: Identifier: "o1" [34:21 - 34:23] DeclRefExpr=o1:32:30
60*f4a2713aSLionel Sambuc// CHECK-LITERALS: Punctuation: "," [34:23 - 34:24] UnexposedExpr=
61*f4a2713aSLionel Sambuc// CHECK-LITERALS: Identifier: "k2" [35:16 - 35:18] DeclRefExpr=k2:32:37
62*f4a2713aSLionel Sambuc// CHECK-LITERALS: Punctuation: ":" [35:19 - 35:20] UnexposedExpr=
63*f4a2713aSLionel Sambuc// CHECK-LITERALS: Identifier: "o2" [35:21 - 35:23] DeclRefExpr=o2:32:44
64*f4a2713aSLionel Sambuc// CHECK-LITERALS: Punctuation: "," [35:23 - 35:24] UnexposedExpr=
65*f4a2713aSLionel Sambuc// CHECK-LITERALS: Identifier: "k3" [36:16 - 36:18] DeclRefExpr=k3:32:51
66*f4a2713aSLionel Sambuc// CHECK-LITERALS: Punctuation: ":" [36:19 - 36:20] UnexposedExpr=
67*f4a2713aSLionel Sambuc// CHECK-LITERALS: Punctuation: "@" [36:21 - 36:22] UnexposedExpr=
68*f4a2713aSLionel Sambuc// CHECK-LITERALS: Literal: "17" [36:22 - 36:24] IntegerLiteral=
69*f4a2713aSLionel Sambuc// CHECK-LITERALS: Punctuation: "}" [36:25 - 36:26] UnexposedExpr=
70*f4a2713aSLionel Sambuc// CHECK-LITERALS: Punctuation: ";" [36:26 - 36:27] DeclStmt=
71*f4a2713aSLionel Sambuc// CHECK-LITERALS: Punctuation: "}" [37:1 - 37:2] CompoundStmt=
72*f4a2713aSLionel Sambuc
73