• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1typedef unsigned char BOOL;
2
3@interface NSNumber @end
4
5@interface NSNumber (NSNumberCreation)
6+ (NSNumber *)numberWithChar:(char)value;
7+ (NSNumber *)numberWithUnsignedChar:(unsigned char)value;
8+ (NSNumber *)numberWithShort:(short)value;
9+ (NSNumber *)numberWithUnsignedShort:(unsigned short)value;
10+ (NSNumber *)numberWithInt:(int)value;
11+ (NSNumber *)numberWithUnsignedInt:(unsigned int)value;
12+ (NSNumber *)numberWithLong:(long)value;
13+ (NSNumber *)numberWithUnsignedLong:(unsigned long)value;
14+ (NSNumber *)numberWithLongLong:(long long)value;
15+ (NSNumber *)numberWithUnsignedLongLong:(unsigned long long)value;
16+ (NSNumber *)numberWithFloat:(float)value;
17+ (NSNumber *)numberWithDouble:(double)value;
18+ (NSNumber *)numberWithBool:(BOOL)value;
19@end
20
21@interface NSArray
22@end
23
24@interface NSArray (NSArrayCreation)
25+ (id)arrayWithObjects:(const id [])objects count:(unsigned long)cnt;
26@end
27
28@interface NSDictionary
29+ (id)dictionaryWithObjects:(const id [])objects forKeys:(const id [])keys count:(unsigned long)cnt;
30@end
31
32@interface NSValue
33+ (NSValue *)valueWithBytes:(const void *)value objCType:(const char *)type;
34@end
35
36typedef struct __attribute__((objc_boxable)) _c_struct {
37  int dummy;
38} c_struct;
39
40void test_literals(id k1, id o1, id k2, id o2, id k3, c_struct s) {
41  id objects = @[ o1, o2 ];
42  id dict = @{ k1 : o1,
43               k2 : o2,
44               k3 : @17 };
45  id val = @(s);
46}
47
48
49// RUN: c-index-test -test-annotate-tokens=%s:41:1:46:1 %s | FileCheck -check-prefix=CHECK-LITERALS %s
50
51// CHECK-LITERALS: Identifier: "id" [41:3 - 41:5] TypeRef=id:0:0
52// CHECK-LITERALS: Identifier: "objects" [41:6 - 41:13] VarDecl=objects:41:6 (Definition)
53// CHECK-LITERALS: Punctuation: "=" [41:14 - 41:15] VarDecl=objects:41:6 (Definition)
54// CHECK-LITERALS: Punctuation: "@" [41:16 - 41:17] UnexposedExpr=
55// CHECK-LITERALS: Punctuation: "[" [41:17 - 41:18] UnexposedExpr=
56// CHECK-LITERALS: Identifier: "o1" [41:19 - 41:21] DeclRefExpr=o1:40:30
57// CHECK-LITERALS: Punctuation: "," [41:21 - 41:22] UnexposedExpr=
58// CHECK-LITERALS: Identifier: "o2" [41:23 - 41:25] DeclRefExpr=o2:40:44
59// CHECK-LITERALS: Punctuation: "]" [41:26 - 41:27] UnexposedExpr=
60// CHECK-LITERALS: Punctuation: ";" [41:27 - 41:28] DeclStmt=
61// CHECK-LITERALS: Identifier: "id" [42:3 - 42:5] TypeRef=id:0:0
62// CHECK-LITERALS: Identifier: "dict" [42:6 - 42:10] VarDecl=dict:42:6 (Definition)
63// CHECK-LITERALS: Punctuation: "=" [42:11 - 42:12] VarDecl=dict:42:6 (Definition)
64// CHECK-LITERALS: Punctuation: "@" [42:13 - 42:14] UnexposedExpr=
65// CHECK-LITERALS: Punctuation: "{" [42:14 - 42:15] UnexposedExpr=
66// CHECK-LITERALS: Identifier: "k1" [42:16 - 42:18] DeclRefExpr=k1:40:23
67// CHECK-LITERALS: Punctuation: ":" [42:19 - 42:20] UnexposedExpr=
68// CHECK-LITERALS: Identifier: "o1" [42:21 - 42:23] DeclRefExpr=o1:40:30
69// CHECK-LITERALS: Punctuation: "," [42:23 - 42:24] UnexposedExpr=
70// CHECK-LITERALS: Identifier: "k2" [43:16 - 43:18] DeclRefExpr=k2:40:37
71// CHECK-LITERALS: Punctuation: ":" [43:19 - 43:20] UnexposedExpr=
72// CHECK-LITERALS: Identifier: "o2" [43:21 - 43:23] DeclRefExpr=o2:40:44
73// CHECK-LITERALS: Punctuation: "," [43:23 - 43:24] UnexposedExpr=
74// CHECK-LITERALS: Identifier: "k3" [44:16 - 44:18] DeclRefExpr=k3:40:51
75// CHECK-LITERALS: Punctuation: ":" [44:19 - 44:20] UnexposedExpr=
76// CHECK-LITERALS: Punctuation: "@" [44:21 - 44:22] UnexposedExpr=
77// CHECK-LITERALS: Literal: "17" [44:22 - 44:24] IntegerLiteral=
78// CHECK-LITERALS: Punctuation: "}" [44:25 - 44:26] UnexposedExpr=
79// CHECK-LITERALS: Punctuation: ";" [44:26 - 44:27] DeclStmt=
80// CHECK-LITERALS: Identifier: "id" [45:3 - 45:5] TypeRef=id:0:0
81// CHECK-LITERALS: Identifier: "val" [45:6 - 45:9] VarDecl=val:45:6 (Definition)
82// CHECK-LITERALS: Punctuation: "=" [45:10 - 45:11] VarDecl=val:45:6 (Definition)
83// CHECK-LITERALS: Punctuation: "@" [45:12 - 45:13] UnexposedExpr=
84// CHECK-LITERALS: Punctuation: "(" [45:13 - 45:14] ParenExpr=
85// CHECK-LITERALS: Identifier: "s" [45:14 - 45:15] DeclRefExpr=s:40:64
86// CHECK-LITERALS: Punctuation: ")" [45:15 - 45:16] ParenExpr=
87// CHECK-LITERALS: Punctuation: ";" [45:16 - 45:17] DeclStmt=
88// CHECK-LITERALS: Punctuation: "}" [46:1 - 46:2] CompoundStmt=
89
90