annotate clang/test/Index/cursor-dynamic-call.mm @ 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
anatofuz
parents:
diff changeset
2 struct SB {
anatofuz
parents:
diff changeset
3 virtual void meth();
anatofuz
parents:
diff changeset
4 };
anatofuz
parents:
diff changeset
5
anatofuz
parents:
diff changeset
6 struct SS : public SB {
anatofuz
parents:
diff changeset
7 void submeth() {
anatofuz
parents:
diff changeset
8 this->meth();
anatofuz
parents:
diff changeset
9 SB::meth();
anatofuz
parents:
diff changeset
10 }
anatofuz
parents:
diff changeset
11 };
anatofuz
parents:
diff changeset
12
anatofuz
parents:
diff changeset
13 @interface IB
anatofuz
parents:
diff changeset
14 -(void)meth;
anatofuz
parents:
diff changeset
15 +(void)ClsMeth;
anatofuz
parents:
diff changeset
16 @end
anatofuz
parents:
diff changeset
17
anatofuz
parents:
diff changeset
18 @interface IS : IB
anatofuz
parents:
diff changeset
19 -(void)submeth;
anatofuz
parents:
diff changeset
20 +(void)ClsMeth;
anatofuz
parents:
diff changeset
21 @end
anatofuz
parents:
diff changeset
22
anatofuz
parents:
diff changeset
23 @implementation IS
anatofuz
parents:
diff changeset
24 -(void)submeth {
anatofuz
parents:
diff changeset
25 [self meth];
anatofuz
parents:
diff changeset
26 [super meth];
anatofuz
parents:
diff changeset
27 }
anatofuz
parents:
diff changeset
28 +(void)ClsMeth {
anatofuz
parents:
diff changeset
29 [super ClsMeth];
anatofuz
parents:
diff changeset
30 }
anatofuz
parents:
diff changeset
31 @end
anatofuz
parents:
diff changeset
32
anatofuz
parents:
diff changeset
33 void foo(SS *ss, IS* is, Class cls) {
anatofuz
parents:
diff changeset
34 ss->meth();
anatofuz
parents:
diff changeset
35 [is meth];
anatofuz
parents:
diff changeset
36 [IB ClsMeth];
anatofuz
parents:
diff changeset
37 [cls ClsMeth];
anatofuz
parents:
diff changeset
38 }
anatofuz
parents:
diff changeset
39
anatofuz
parents:
diff changeset
40 @interface NSObject
anatofuz
parents:
diff changeset
41 +(id)alloc;
anatofuz
parents:
diff changeset
42 -(id)init;
anatofuz
parents:
diff changeset
43 @end
anatofuz
parents:
diff changeset
44
anatofuz
parents:
diff changeset
45 @interface Test : NSObject
anatofuz
parents:
diff changeset
46 @end
anatofuz
parents:
diff changeset
47
anatofuz
parents:
diff changeset
48 void test2() {
anatofuz
parents:
diff changeset
49 id o = [[Test alloc] init];
anatofuz
parents:
diff changeset
50 }
anatofuz
parents:
diff changeset
51
anatofuz
parents:
diff changeset
52 @interface Test2 : NSObject
anatofuz
parents:
diff changeset
53 @property (assign) id someProp;
anatofuz
parents:
diff changeset
54 @end
anatofuz
parents:
diff changeset
55
anatofuz
parents:
diff changeset
56 void test3(Test2 *o) {
anatofuz
parents:
diff changeset
57 id v = o.someProp;
anatofuz
parents:
diff changeset
58 }
anatofuz
parents:
diff changeset
59
anatofuz
parents:
diff changeset
60 // RUN: c-index-test -cursor-at=%s:8:11 \
anatofuz
parents:
diff changeset
61 // RUN: -cursor-at=%s:9:11 \
anatofuz
parents:
diff changeset
62 // RUN: -cursor-at=%s:25:11 \
anatofuz
parents:
diff changeset
63 // RUN: -cursor-at=%s:26:11 \
anatofuz
parents:
diff changeset
64 // RUN: -cursor-at=%s:29:11 \
anatofuz
parents:
diff changeset
65 // RUN: -cursor-at=%s:34:9 \
anatofuz
parents:
diff changeset
66 // RUN: -cursor-at=%s:35:9 \
anatofuz
parents:
diff changeset
67 // RUN: -cursor-at=%s:36:9 \
anatofuz
parents:
diff changeset
68 // RUN: -cursor-at=%s:37:9 \
anatofuz
parents:
diff changeset
69 // RUN: -cursor-at=%s:49:26 \
anatofuz
parents:
diff changeset
70 // RUN: -cursor-at=%s:57:12 \
anatofuz
parents:
diff changeset
71 // RUN: %s | FileCheck %s
anatofuz
parents:
diff changeset
72
anatofuz
parents:
diff changeset
73 // CHECK: 8:11 MemberRefExpr=meth:3:16 {{.*}} Dynamic-call
anatofuz
parents:
diff changeset
74 // CHECK-NOT: 9:9 {{.*}} Dynamic-call
anatofuz
parents:
diff changeset
75 // CHECK: 25:3 ObjCMessageExpr=meth:14:8 {{.*}} Dynamic-call Receiver-type=ObjCObjectPointer
anatofuz
parents:
diff changeset
76 // CHECK-NOT: 26:3 {{.*}} Dynamic-call
anatofuz
parents:
diff changeset
77 // CHECK-NOT: 29:3 {{.*}} Dynamic-call
anatofuz
parents:
diff changeset
78 // CHECK: 29:3 {{.*}} Receiver-type=ObjCInterface
anatofuz
parents:
diff changeset
79 // CHECK: 34:7 MemberRefExpr=meth:3:16 {{.*}} Dynamic-call Receiver-type=Pointer
anatofuz
parents:
diff changeset
80 // CHECK: 35:3 ObjCMessageExpr=meth:14:8 {{.*}} Dynamic-call Receiver-type=ObjCObjectPointer
anatofuz
parents:
diff changeset
81 // CHECK-NOT: 36:3 {{.*}} Dynamic-call
anatofuz
parents:
diff changeset
82 // CHECK: 36:3 {{.*}} Receiver-type=ObjCInterface
anatofuz
parents:
diff changeset
83 // CHECK: 37:3 ObjCMessageExpr=ClsMeth:15:8 {{.*}} Dynamic-call Receiver-type=ObjCClass
anatofuz
parents:
diff changeset
84 // CHECK-NOT: 49:10 {{.*}} Dynamic-call
anatofuz
parents:
diff changeset
85 // CHECK: 57:12 MemberRefExpr=someProp:53:23 {{.*}} Dynamic-call Receiver-type=ObjCObjectPointer