annotate clang/test/Index/index-subscripting-literals.m @ 207:2e18cbf3894f

LLVM12
author Shinji KONO <kono@ie.u-ryukyu.ac.jp>
date Tue, 08 Jun 2021 06:07:14 +0900
parents 1d019706d866
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
150
anatofuz
parents:
diff changeset
1 @interface NSArray
anatofuz
parents:
diff changeset
2 - (id)objectAtIndexedSubscript:(int)index;
anatofuz
parents:
diff changeset
3 + (id)arrayWithObjects:(id *)objects count:(unsigned)count;
anatofuz
parents:
diff changeset
4 @end
anatofuz
parents:
diff changeset
5
anatofuz
parents:
diff changeset
6 @interface NSMutableArray : NSArray
anatofuz
parents:
diff changeset
7 - (id)objectAtIndexedSubscript:(int)index;
anatofuz
parents:
diff changeset
8 - (void)setObject:(id)object atIndexedSubscript:(int)index;
anatofuz
parents:
diff changeset
9 @end
anatofuz
parents:
diff changeset
10
anatofuz
parents:
diff changeset
11 @interface NSDictionary
anatofuz
parents:
diff changeset
12 - (id)objectForKeyedSubscript:(id)key;
anatofuz
parents:
diff changeset
13 + (id)dictionaryWithObjects:(id *)objects forKeys:(id *)keys count:(unsigned)count;
anatofuz
parents:
diff changeset
14 @end
anatofuz
parents:
diff changeset
15
anatofuz
parents:
diff changeset
16 @interface NSMutableDictionary : NSDictionary
anatofuz
parents:
diff changeset
17 - (void)setObject:(id)object forKeyedSubscript:(id)key;
anatofuz
parents:
diff changeset
18 @end
anatofuz
parents:
diff changeset
19
anatofuz
parents:
diff changeset
20 @class NSString;
anatofuz
parents:
diff changeset
21
anatofuz
parents:
diff changeset
22 int idx;
anatofuz
parents:
diff changeset
23 id p;
anatofuz
parents:
diff changeset
24
anatofuz
parents:
diff changeset
25 id testArray() {
anatofuz
parents:
diff changeset
26 NSMutableArray *array;
anatofuz
parents:
diff changeset
27 array[idx] = p;
anatofuz
parents:
diff changeset
28 NSArray *arr = @[ p, p ];
anatofuz
parents:
diff changeset
29 return array[idx];
anatofuz
parents:
diff changeset
30 }
anatofuz
parents:
diff changeset
31
anatofuz
parents:
diff changeset
32 NSString *key;
anatofuz
parents:
diff changeset
33 id newObject, oldObject;
anatofuz
parents:
diff changeset
34
anatofuz
parents:
diff changeset
35 void testDict() {
anatofuz
parents:
diff changeset
36 NSMutableDictionary *dictionary;
anatofuz
parents:
diff changeset
37 oldObject = dictionary[key];
anatofuz
parents:
diff changeset
38 dictionary[key] = newObject;
anatofuz
parents:
diff changeset
39 NSDictionary *dict = @{ key: newObject, key: oldObject };
anatofuz
parents:
diff changeset
40 }
anatofuz
parents:
diff changeset
41
anatofuz
parents:
diff changeset
42 // RUN: c-index-test -index-file -target x86_64-apple-macosx10.7 %s | FileCheck %s
anatofuz
parents:
diff changeset
43
anatofuz
parents:
diff changeset
44 // CHECK: [indexEntityReference]: kind: variable | name: idx | USR: c:@idx | lang: C | cursor: DeclRefExpr=idx:22:5 | loc: 27:9
anatofuz
parents:
diff changeset
45 // 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 | role: ref
anatofuz
parents:
diff changeset
46 // CHECK-NEXT: [indexEntityReference]: kind: objc-instance-method | name: setObject:atIndexedSubscript:
anatofuz
parents:
diff changeset
47 // CHECK-NEXT: [indexEntityReference]: kind: objc-class | name: NSArray
anatofuz
parents:
diff changeset
48 // CHECK-NEXT: [indexEntityReference]: kind: objc-class-method | name: arrayWithObjects:count:
anatofuz
parents:
diff changeset
49 // CHECK-NEXT: [indexEntityReference]: kind: variable | name: p | USR: c:@p | lang: C | cursor: DeclRefExpr=p:23:4 | loc: 28:21
anatofuz
parents:
diff changeset
50 // CHECK-NEXT: [indexEntityReference]: kind: variable | name: p | USR: c:@p | lang: C | cursor: DeclRefExpr=p:23:4 | loc: 28:24
anatofuz
parents:
diff changeset
51 // CHECK-NEXT: [indexEntityReference]: kind: variable | name: idx | USR: c:@idx | lang: C | cursor: DeclRefExpr=idx:22:5 | loc: 29:16
anatofuz
parents:
diff changeset
52 // CHECK-NEXT: [indexEntityReference]: kind: objc-instance-method | name: objectAtIndexedSubscript:
anatofuz
parents:
diff changeset
53 // CHECK-NEXT: [indexDeclaration]: kind: variable | name: key
anatofuz
parents:
diff changeset
54
anatofuz
parents:
diff changeset
55 // CHECK: [indexEntityReference]: kind: variable | name: oldObject
anatofuz
parents:
diff changeset
56 // CHECK-NEXT: [indexEntityReference]: kind: variable | name: key | USR: c:@key | lang: C | cursor: DeclRefExpr=key:32:11 | loc: 37:26
anatofuz
parents:
diff changeset
57 // CHECK-NEXT: [indexEntityReference]: kind: objc-instance-method | name: objectForKeyedSubscript:
anatofuz
parents:
diff changeset
58 // CHECK-NEXT: [indexEntityReference]: kind: variable | name: key | USR: c:@key | lang: C | cursor: DeclRefExpr=key:32:11 | loc: 38:14
anatofuz
parents:
diff changeset
59 // CHECK-NEXT: [indexEntityReference]: kind: variable | name: newObject | USR: c:@newObject | lang: C | cursor: DeclRefExpr=newObject:33:4 | loc: 38:21
anatofuz
parents:
diff changeset
60 // CHECK-NEXT: [indexEntityReference]: kind: objc-instance-method | name: setObject:forKeyedSubscript:
anatofuz
parents:
diff changeset
61 // CHECK-NEXT: [indexEntityReference]: kind: objc-class | name: NSDictionary
anatofuz
parents:
diff changeset
62 // CHECK-NEXT: [indexEntityReference]: kind: objc-class-method | name: dictionaryWithObjects:forKeys:count:
anatofuz
parents:
diff changeset
63 // CHECK-NEXT: [indexEntityReference]: kind: variable | name: key | USR: c:@key | lang: C | cursor: DeclRefExpr=key:32:11 | loc: 39:27
anatofuz
parents:
diff changeset
64 // CHECK-NEXT: [indexEntityReference]: kind: variable | name: newObject | USR: c:@newObject | lang: C | cursor: DeclRefExpr=newObject:33:4 | loc: 39:32
anatofuz
parents:
diff changeset
65 // CHECK-NEXT: [indexEntityReference]: kind: variable | name: key | USR: c:@key | lang: C | cursor: DeclRefExpr=key:32:11 | loc: 39:43
anatofuz
parents:
diff changeset
66 // CHECK-NEXT: [indexEntityReference]: kind: variable | name: oldObject | USR: c:@oldObject | lang: C | cursor: DeclRefExpr=oldObject:33:15 | loc: 39:48