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 Sambucint idx; 23*f4a2713aSLionel Sambucid p; 24*f4a2713aSLionel Sambuc 25*f4a2713aSLionel Sambucid testArray() { 26*f4a2713aSLionel Sambuc NSMutableArray *array; 27*f4a2713aSLionel Sambuc array[idx] = p; 28*f4a2713aSLionel Sambuc NSArray *arr = @[ p, p ]; 29*f4a2713aSLionel Sambuc return array[idx]; 30*f4a2713aSLionel Sambuc} 31*f4a2713aSLionel Sambuc 32*f4a2713aSLionel SambucNSString *key; 33*f4a2713aSLionel Sambucid newObject, oldObject; 34*f4a2713aSLionel Sambuc 35*f4a2713aSLionel Sambucvoid testDict() { 36*f4a2713aSLionel Sambuc NSMutableDictionary *dictionary; 37*f4a2713aSLionel Sambuc oldObject = dictionary[key]; 38*f4a2713aSLionel Sambuc dictionary[key] = newObject; 39*f4a2713aSLionel Sambuc NSDictionary *dict = @{ key: newObject, key: oldObject }; 40*f4a2713aSLionel Sambuc} 41*f4a2713aSLionel Sambuc 42*f4a2713aSLionel Sambuc// RUN: c-index-test -index-file -target x86_64-apple-macosx10.7 %s | FileCheck %s 43*f4a2713aSLionel Sambuc 44*f4a2713aSLionel Sambuc// CHECK: [indexEntityReference]: kind: variable | name: idx | USR: c:@idx | lang: C | cursor: DeclRefExpr=idx:22:5 | loc: 27:9 45*f4a2713aSLionel Sambuc// CHECK-NEXT: [indexEntityReference]: kind: variable | name: p | USR: c:@p | lang: C | cursor: DeclRefExpr=p:23:4 | loc: 27:16 | <parent>:: kind: function | name: testArray | USR: c:@F@testArray | lang: C | container: [testArray:25:4] | refkind: direct 46*f4a2713aSLionel Sambuc// CHECK-NEXT: [indexEntityReference]: kind: objc-instance-method | name: setObject:atIndexedSubscript: 47*f4a2713aSLionel Sambuc// CHECK-NEXT: [indexEntityReference]: kind: objc-class | name: NSArray 48*f4a2713aSLionel Sambuc// CHECK-NEXT: [indexEntityReference]: kind: objc-class-method | name: arrayWithObjects:count: 49*f4a2713aSLionel Sambuc// CHECK-NEXT: [indexEntityReference]: kind: variable | name: p | USR: c:@p | lang: C | cursor: DeclRefExpr=p:23:4 | loc: 28:21 50*f4a2713aSLionel Sambuc// CHECK-NEXT: [indexEntityReference]: kind: variable | name: p | USR: c:@p | lang: C | cursor: DeclRefExpr=p:23:4 | loc: 28:24 51*f4a2713aSLionel Sambuc// CHECK-NEXT: [indexEntityReference]: kind: variable | name: idx | USR: c:@idx | lang: C | cursor: DeclRefExpr=idx:22:5 | loc: 29:16 52*f4a2713aSLionel Sambuc// CHECK-NEXT: [indexEntityReference]: kind: objc-instance-method | name: objectAtIndexedSubscript: 53*f4a2713aSLionel Sambuc// CHECK-NEXT: [indexDeclaration]: kind: variable | name: key 54*f4a2713aSLionel Sambuc 55*f4a2713aSLionel Sambuc// CHECK: [indexEntityReference]: kind: variable | name: oldObject 56*f4a2713aSLionel Sambuc// CHECK-NEXT: [indexEntityReference]: kind: variable | name: key | USR: c:@key | lang: C | cursor: DeclRefExpr=key:32:11 | loc: 37:26 57*f4a2713aSLionel Sambuc// CHECK-NEXT: [indexEntityReference]: kind: objc-instance-method | name: objectForKeyedSubscript: 58*f4a2713aSLionel Sambuc// CHECK-NEXT: [indexEntityReference]: kind: variable | name: key | USR: c:@key | lang: C | cursor: DeclRefExpr=key:32:11 | loc: 38:14 59*f4a2713aSLionel Sambuc// CHECK-NEXT: [indexEntityReference]: kind: variable | name: newObject | USR: c:@newObject | lang: C | cursor: DeclRefExpr=newObject:33:4 | loc: 38:21 60*f4a2713aSLionel Sambuc// CHECK-NEXT: [indexEntityReference]: kind: objc-instance-method | name: setObject:forKeyedSubscript: 61*f4a2713aSLionel Sambuc// CHECK-NEXT: [indexEntityReference]: kind: objc-class | name: NSDictionary 62*f4a2713aSLionel Sambuc// CHECK-NEXT: [indexEntityReference]: kind: objc-class-method | name: dictionaryWithObjects:forKeys:count: 63*f4a2713aSLionel Sambuc// CHECK-NEXT: [indexEntityReference]: kind: variable | name: key | USR: c:@key | lang: C | cursor: DeclRefExpr=key:32:11 | loc: 39:27 64*f4a2713aSLionel Sambuc// CHECK-NEXT: [indexEntityReference]: kind: variable | name: newObject | USR: c:@newObject | lang: C | cursor: DeclRefExpr=newObject:33:4 | loc: 39:32 65*f4a2713aSLionel Sambuc// CHECK-NEXT: [indexEntityReference]: kind: variable | name: key | USR: c:@key | lang: C | cursor: DeclRefExpr=key:32:11 | loc: 39:43 66*f4a2713aSLionel Sambuc// CHECK-NEXT: [indexEntityReference]: kind: variable | name: oldObject | USR: c:@oldObject | lang: C | cursor: DeclRefExpr=oldObject:33:15 | loc: 39:48 67