Ted Kremenek | b3f7542 | 2012-03-06 20:06:06 +0000 | [diff] [blame] | 1 | typedef 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 | void test_literals(id k1, id o1, id k2, id o2, id k3) { |
| 33 | id objects = @[ o1, o2 ]; |
| 34 | id dict = @{ k1 : o1, |
| 35 | k2 : o2, |
| 36 | k3 : @17 }; |
| 37 | } |
| 38 | |
| 39 | |
| 40 | // RUN: c-index-test -test-annotate-tokens=%s:33:1:37:1 %s | FileCheck -check-prefix=CHECK-LITERALS %s |
| 41 | |
| 42 | // CHECK-LITERALS: Identifier: "id" [33:3 - 33:5] TypeRef=id:0:0 |
| 43 | // CHECK-LITERALS: Identifier: "objects" [33:6 - 33:13] VarDecl=objects:33:6 (Definition) |
| 44 | // CHECK-LITERALS: Punctuation: "=" [33:14 - 33:15] VarDecl=objects:33:6 (Definition) |
| 45 | // CHECK-LITERALS: Punctuation: "@" [33:16 - 33:17] UnexposedExpr= |
| 46 | // CHECK-LITERALS: Punctuation: "[" [33:17 - 33:18] UnexposedExpr= |
| 47 | // CHECK-LITERALS: Identifier: "o1" [33:19 - 33:21] DeclRefExpr=o1:32:30 |
| 48 | // CHECK-LITERALS: Punctuation: "," [33:21 - 33:22] UnexposedExpr= |
| 49 | // CHECK-LITERALS: Identifier: "o2" [33:23 - 33:25] DeclRefExpr=o2:32:44 |
| 50 | // CHECK-LITERALS: Punctuation: "]" [33:26 - 33:27] UnexposedExpr= |
| 51 | // CHECK-LITERALS: Punctuation: ";" [33:27 - 33:28] DeclStmt= |
| 52 | // CHECK-LITERALS: Identifier: "id" [34:3 - 34:5] TypeRef=id:0:0 |
| 53 | // CHECK-LITERALS: Identifier: "dict" [34:6 - 34:10] VarDecl=dict:34:6 (Definition) |
| 54 | // CHECK-LITERALS: Punctuation: "=" [34:11 - 34:12] VarDecl=dict:34:6 (Definition) |
| 55 | // CHECK-LITERALS: Punctuation: "@" [34:13 - 34:14] UnexposedExpr= |
| 56 | // CHECK-LITERALS: Punctuation: "{" [34:14 - 34:15] UnexposedExpr= |
| 57 | // CHECK-LITERALS: Identifier: "k1" [34:16 - 34:18] DeclRefExpr=k1:32:23 |
| 58 | // CHECK-LITERALS: Punctuation: ":" [34:19 - 34:20] UnexposedExpr= |
| 59 | // CHECK-LITERALS: Identifier: "o1" [34:21 - 34:23] DeclRefExpr=o1:32:30 |
| 60 | // CHECK-LITERALS: Punctuation: "," [34:23 - 34:24] UnexposedExpr= |
| 61 | // CHECK-LITERALS: Identifier: "k2" [35:16 - 35:18] DeclRefExpr=k2:32:37 |
| 62 | // CHECK-LITERALS: Punctuation: ":" [35:19 - 35:20] UnexposedExpr= |
| 63 | // CHECK-LITERALS: Identifier: "o2" [35:21 - 35:23] DeclRefExpr=o2:32:44 |
| 64 | // CHECK-LITERALS: Punctuation: "," [35:23 - 35:24] UnexposedExpr= |
| 65 | // CHECK-LITERALS: Identifier: "k3" [36:16 - 36:18] DeclRefExpr=k3:32:51 |
| 66 | // CHECK-LITERALS: Punctuation: ":" [36:19 - 36:20] UnexposedExpr= |
| 67 | // CHECK-LITERALS: Punctuation: "@" [36:21 - 36:22] UnexposedExpr= |
| 68 | // CHECK-LITERALS: Literal: "17" [36:22 - 36:24] IntegerLiteral= |
| 69 | // CHECK-LITERALS: Punctuation: "}" [36:25 - 36:26] UnexposedExpr= |
| 70 | // CHECK-LITERALS: Punctuation: ";" [36:26 - 36:27] DeclStmt= |
| 71 | // CHECK-LITERALS: Punctuation: "}" [37:1 - 37:2] CompoundStmt= |
| 72 | |