[docs] Add LICENSE.txt to the root of the mono-repo
[llvm-project.git] / clang / test / Index / cursor-dynamic-call.mm
blob33d1c68558f1d939c4565fdf61a2a07a261ac898
2 struct SB {
3   virtual void meth();
4 };
6 struct SS : public SB {
7   void submeth() {
8     this->meth();
9     SB::meth();
10   }
13 @interface IB
14 -(void)meth;
15 +(void)ClsMeth;
16 @end
18 @interface IS : IB
19 -(void)submeth;
20 +(void)ClsMeth;
21 @end
23 @implementation IS
24 -(void)submeth {
25   [self meth];
26   [super meth];
28 +(void)ClsMeth {
29   [super ClsMeth];
31 @end
33 void foo(SS *ss, IS* is, Class cls) {
34   ss->meth();
35   [is meth];
36   [IB ClsMeth];
37   [cls ClsMeth];
40 @interface NSObject
41 +(id)alloc;
42 -(id)init;
43 @end
45 @interface Test : NSObject
46 @end
48 void test2() {
49   id o = [[Test alloc] init];
52 @interface Test2 : NSObject
53 @property (assign) id someProp;
54 @end
56 void test3(Test2 *o) {
57   id v = o.someProp;
60 // RUN: c-index-test -cursor-at=%s:8:11 \
61 // RUN:              -cursor-at=%s:9:11 \
62 // RUN:              -cursor-at=%s:25:11 \
63 // RUN:              -cursor-at=%s:26:11 \
64 // RUN:              -cursor-at=%s:29:11 \
65 // RUN:              -cursor-at=%s:34:9 \
66 // RUN:              -cursor-at=%s:35:9 \
67 // RUN:              -cursor-at=%s:36:9 \
68 // RUN:              -cursor-at=%s:37:9 \
69 // RUN:              -cursor-at=%s:49:26 \
70 // RUN:              -cursor-at=%s:57:12 \
71 // RUN:       %s | FileCheck %s
73 // CHECK:     8:11 MemberRefExpr=meth:3:16 {{.*}} Dynamic-call
74 // CHECK-NOT: 9:9 {{.*}} Dynamic-call
75 // CHECK:     25:3 ObjCMessageExpr=meth:14:8 {{.*}} Dynamic-call Receiver-type=ObjCObjectPointer
76 // CHECK-NOT: 26:3 {{.*}} Dynamic-call
77 // CHECK-NOT: 29:3 {{.*}} Dynamic-call
78 // CHECK:     29:3 {{.*}} Receiver-type=ObjCInterface
79 // CHECK:     34:7 MemberRefExpr=meth:3:16 {{.*}} Dynamic-call Receiver-type=Pointer
80 // CHECK:     35:3 ObjCMessageExpr=meth:14:8 {{.*}} Dynamic-call Receiver-type=ObjCObjectPointer
81 // CHECK-NOT: 36:3 {{.*}} Dynamic-call
82 // CHECK:     36:3 {{.*}} Receiver-type=ObjCInterface
83 // CHECK:     37:3 ObjCMessageExpr=ClsMeth:15:8 {{.*}} Dynamic-call Receiver-type=ObjCClass
84 // CHECK-NOT: 49:10 {{.*}} Dynamic-call
85 // CHECK:     57:12 MemberRefExpr=someProp:53:23 {{.*}} Dynamic-call  Receiver-type=ObjCObjectPointer