1*f4a2713aSLionel Sambuc@interface NSArray 2*f4a2713aSLionel Sambuc- (id)objectAtIndexedSubscript:(int)index; 3*f4a2713aSLionel Sambuc+ (id)arrayWithObjects:(id *)objects count:(unsigned)count; 4*f4a2713aSLionel Sambuc@end 5*f4a2713aSLionel Sambuc 6*f4a2713aSLionel Sambuc@interface NSMutableArray : NSArray 7*f4a2713aSLionel Sambuc- (id)objectAtIndexedSubscript:(int)index; 8*f4a2713aSLionel Sambuc- (void)setObject:(id)object atIndexedSubscript:(int)index; 9*f4a2713aSLionel Sambuc@end 10*f4a2713aSLionel Sambuc 11*f4a2713aSLionel Sambuc@interface NSDictionary 12*f4a2713aSLionel Sambuc- (id)objectForKeyedSubscript:(id)key; 13*f4a2713aSLionel Sambuc+ (id)dictionaryWithObjects:(id *)objects forKeys:(id *)keys count:(unsigned)count; 14*f4a2713aSLionel Sambuc@end 15*f4a2713aSLionel Sambuc 16*f4a2713aSLionel Sambuc@interface NSMutableDictionary : NSDictionary 17*f4a2713aSLionel Sambuc- (void)setObject:(id)object forKeyedSubscript:(id)key; 18*f4a2713aSLionel Sambuc@end 19*f4a2713aSLionel Sambuc 20*f4a2713aSLionel Sambuc@class NSString; 21*f4a2713aSLionel Sambuc 22*f4a2713aSLionel Sambucid testArray(int index, id p) { 23*f4a2713aSLionel Sambuc NSMutableArray *array; 24*f4a2713aSLionel Sambuc array[3] = 0; 25*f4a2713aSLionel Sambuc NSArray *arr = @[ p, p ]; 26*f4a2713aSLionel Sambuc return array[index]; 27*f4a2713aSLionel Sambuc} 28*f4a2713aSLionel Sambuc 29*f4a2713aSLionel Sambucvoid testDict() { 30*f4a2713aSLionel Sambuc NSMutableDictionary *dictionary; 31*f4a2713aSLionel Sambuc NSString *key; 32*f4a2713aSLionel Sambuc id newObject, oldObject; 33*f4a2713aSLionel Sambuc oldObject = dictionary[key]; 34*f4a2713aSLionel Sambuc dictionary[key] = newObject; 35*f4a2713aSLionel Sambuc NSDictionary *dict = @{ key: newObject, key: oldObject }; 36*f4a2713aSLionel Sambuc} 37*f4a2713aSLionel Sambuc 38*f4a2713aSLionel Sambuc// RUN: c-index-test -test-annotate-tokens=%s:22:1:36:1 -target x86_64-apple-macosx10.7 %s | FileCheck %s 39*f4a2713aSLionel Sambuc// CHECK: Identifier: "array" [24:3 - 24:8] DeclRefExpr=array:23:19 40*f4a2713aSLionel Sambuc// CHECK: Punctuation: "[" [24:8 - 24:9] UnexposedExpr= 41*f4a2713aSLionel Sambuc// CHECK: Literal: "3" [24:9 - 24:10] IntegerLiteral= 42*f4a2713aSLionel Sambuc// CHECK: Punctuation: "]" [24:10 - 24:11] UnexposedExpr= 43*f4a2713aSLionel Sambuc// CHECK: Punctuation: "=" [24:12 - 24:13] BinaryOperator= 44*f4a2713aSLionel Sambuc// CHECK: Literal: "0" [24:14 - 24:15] IntegerLiteral= 45*f4a2713aSLionel Sambuc// CHECK: Punctuation: ";" [24:15 - 24:16] CompoundStmt= 46*f4a2713aSLionel Sambuc// CHECK: Identifier: "NSArray" [25:3 - 25:10] ObjCClassRef=NSArray:1:12 47*f4a2713aSLionel Sambuc// CHECK: Punctuation: "*" [25:11 - 25:12] VarDecl=arr:25:12 (Definition) 48*f4a2713aSLionel Sambuc// CHECK: Identifier: "arr" [25:12 - 25:15] VarDecl=arr:25:12 (Definition) 49*f4a2713aSLionel Sambuc// CHECK: Punctuation: "=" [25:16 - 25:17] VarDecl=arr:25:12 (Definition) 50*f4a2713aSLionel Sambuc// CHECK: Punctuation: "@" [25:18 - 25:19] UnexposedExpr= 51*f4a2713aSLionel Sambuc// CHECK: Punctuation: "[" [25:19 - 25:20] UnexposedExpr= 52*f4a2713aSLionel Sambuc// CHECK: Identifier: "p" [25:21 - 25:22] DeclRefExpr=p:22:28 53*f4a2713aSLionel Sambuc// CHECK: Punctuation: "," [25:22 - 25:23] UnexposedExpr= 54*f4a2713aSLionel Sambuc// CHECK: Identifier: "p" [25:24 - 25:25] DeclRefExpr=p:22:28 55*f4a2713aSLionel Sambuc// CHECK: Punctuation: "]" [25:26 - 25:27] UnexposedExpr= 56*f4a2713aSLionel Sambuc// CHECK: Punctuation: ";" [25:27 - 25:28] DeclStmt= 57*f4a2713aSLionel Sambuc// CHECK: Keyword: "return" [26:3 - 26:9] ReturnStmt= 58*f4a2713aSLionel Sambuc// CHECK: Identifier: "array" [26:10 - 26:15] DeclRefExpr=array:23:19 59*f4a2713aSLionel Sambuc// CHECK: Punctuation: "[" [26:15 - 26:16] UnexposedExpr= 60*f4a2713aSLionel Sambuc// CHECK: Identifier: "index" [26:16 - 26:21] DeclRefExpr=index:22:18 61*f4a2713aSLionel Sambuc// CHECK: Punctuation: "]" [26:21 - 26:22] UnexposedExpr= 62*f4a2713aSLionel Sambuc// CHECK: Punctuation: ";" [26:22 - 26:23] CompoundStmt= 63*f4a2713aSLionel Sambuc 64*f4a2713aSLionel Sambuc// CHECK: Identifier: "oldObject" [33:3 - 33:12] DeclRefExpr=oldObject:32:17 65*f4a2713aSLionel Sambuc// CHECK: Punctuation: "=" [33:13 - 33:14] BinaryOperator= 66*f4a2713aSLionel Sambuc// CHECK: Identifier: "dictionary" [33:15 - 33:25] DeclRefExpr=dictionary:30:24 67*f4a2713aSLionel Sambuc// CHECK: Punctuation: "[" [33:25 - 33:26] UnexposedExpr= 68*f4a2713aSLionel Sambuc// CHECK: Identifier: "key" [33:26 - 33:29] DeclRefExpr=key:31:13 69*f4a2713aSLionel Sambuc// CHECK: Punctuation: "]" [33:29 - 33:30] UnexposedExpr= 70*f4a2713aSLionel Sambuc// CHECK: Punctuation: ";" [33:30 - 33:31] CompoundStmt= 71*f4a2713aSLionel Sambuc// CHECK: Identifier: "dictionary" [34:3 - 34:13] DeclRefExpr=dictionary:30:24 72*f4a2713aSLionel Sambuc// CHECK: Punctuation: "[" [34:13 - 34:14] UnexposedExpr= 73*f4a2713aSLionel Sambuc// CHECK: Identifier: "key" [34:14 - 34:17] DeclRefExpr=key:31:13 74*f4a2713aSLionel Sambuc// CHECK: Punctuation: "]" [34:17 - 34:18] UnexposedExpr= 75*f4a2713aSLionel Sambuc// CHECK: Punctuation: "=" [34:19 - 34:20] BinaryOperator= 76*f4a2713aSLionel Sambuc// CHECK: Identifier: "newObject" [34:21 - 34:30] DeclRefExpr=newObject:32:6 77*f4a2713aSLionel Sambuc// CHECK: Punctuation: ";" [34:30 - 34:31] CompoundStmt= 78*f4a2713aSLionel Sambuc// CHECK: Identifier: "NSDictionary" [35:3 - 35:15] ObjCClassRef=NSDictionary:11:12 79*f4a2713aSLionel Sambuc// CHECK: Punctuation: "*" [35:16 - 35:17] VarDecl=dict:35:17 (Definition) 80*f4a2713aSLionel Sambuc// CHECK: Identifier: "dict" [35:17 - 35:21] VarDecl=dict:35:17 (Definition) 81*f4a2713aSLionel Sambuc// CHECK: Punctuation: "=" [35:22 - 35:23] VarDecl=dict:35:17 (Definition) 82*f4a2713aSLionel Sambuc// CHECK: Punctuation: "@" [35:24 - 35:25] UnexposedExpr= 83*f4a2713aSLionel Sambuc// CHECK: Punctuation: "{" [35:25 - 35:26] UnexposedExpr= 84*f4a2713aSLionel Sambuc// CHECK: Identifier: "key" [35:27 - 35:30] DeclRefExpr=key:31:13 85*f4a2713aSLionel Sambuc// CHECK: Punctuation: ":" [35:30 - 35:31] UnexposedExpr= 86*f4a2713aSLionel Sambuc// CHECK: Identifier: "newObject" [35:32 - 35:41] DeclRefExpr=newObject:32:6 87*f4a2713aSLionel Sambuc// CHECK: Punctuation: "," [35:41 - 35:42] UnexposedExpr= 88*f4a2713aSLionel Sambuc// CHECK: Identifier: "key" [35:43 - 35:46] DeclRefExpr=key:31:13 89*f4a2713aSLionel Sambuc// CHECK: Punctuation: ":" [35:46 - 35:47] UnexposedExpr= 90*f4a2713aSLionel Sambuc// CHECK: Identifier: "oldObject" [35:48 - 35:57] DeclRefExpr=oldObject:32:17 91*f4a2713aSLionel Sambuc// CHECK: Punctuation: "}" [35:58 - 35:59] UnexposedExpr= 92*f4a2713aSLionel Sambuc// CHECK: Punctuation: ";" [35:59 - 35:60] DeclStmt= 93