Argyrios Kyrtzidis | b6df6821 | 2012-07-02 23:54:36 +0000 | [diff] [blame] | 1 | |
| 2 | struct SB { |
| 3 | virtual void meth(); |
| 4 | }; |
| 5 | |
| 6 | struct SS : public SB { |
| 7 | void submeth() { |
| 8 | this->meth(); |
| 9 | SB::meth(); |
| 10 | } |
| 11 | }; |
| 12 | |
| 13 | @interface IB |
| 14 | -(void)meth; |
| 15 | +(void)ClsMeth; |
| 16 | @end |
| 17 | |
| 18 | @interface IS : IB |
| 19 | -(void)submeth; |
| 20 | +(void)ClsMeth; |
| 21 | @end |
| 22 | |
| 23 | @implementation IS |
| 24 | -(void)submeth { |
| 25 | [self meth]; |
| 26 | [super meth]; |
| 27 | } |
| 28 | +(void)ClsMeth { |
| 29 | [super ClsMeth]; |
| 30 | } |
| 31 | @end |
| 32 | |
| 33 | void foo(SS *ss, IS* is, Class cls) { |
| 34 | ss->meth(); |
| 35 | [is meth]; |
| 36 | [IB ClsMeth]; |
| 37 | [cls ClsMeth]; |
| 38 | } |
| 39 | |
Argyrios Kyrtzidis | 6cc5f73 | 2014-11-10 23:21:35 +0000 | [diff] [blame] | 40 | @interface NSObject |
| 41 | +(id)alloc; |
| 42 | -(id)init; |
| 43 | @end |
| 44 | |
| 45 | @interface Test : NSObject |
| 46 | @end |
| 47 | |
| 48 | void test2() { |
| 49 | id o = [[Test alloc] init]; |
| 50 | } |
| 51 | |
Argyrios Kyrtzidis | b6df6821 | 2012-07-02 23:54:36 +0000 | [diff] [blame] | 52 | // RUN: c-index-test -cursor-at=%s:8:11 \ |
| 53 | // RUN: -cursor-at=%s:9:11 \ |
| 54 | // RUN: -cursor-at=%s:25:11 \ |
| 55 | // RUN: -cursor-at=%s:26:11 \ |
| 56 | // RUN: -cursor-at=%s:29:11 \ |
| 57 | // RUN: -cursor-at=%s:34:9 \ |
| 58 | // RUN: -cursor-at=%s:35:9 \ |
| 59 | // RUN: -cursor-at=%s:36:9 \ |
| 60 | // RUN: -cursor-at=%s:37:9 \ |
Argyrios Kyrtzidis | 6cc5f73 | 2014-11-10 23:21:35 +0000 | [diff] [blame] | 61 | // RUN: -cursor-at=%s:49:26 \ |
Argyrios Kyrtzidis | b6df6821 | 2012-07-02 23:54:36 +0000 | [diff] [blame] | 62 | // RUN: %s | FileCheck %s |
| 63 | |
| 64 | // CHECK: 8:11 MemberRefExpr=meth:3:16 {{.*}} Dynamic-call |
| 65 | // CHECK-NOT: 9:9 {{.*}} Dynamic-call |
Argyrios Kyrtzidis | b26a24c | 2012-11-01 02:01:34 +0000 | [diff] [blame] | 66 | // CHECK: 25:3 ObjCMessageExpr=meth:14:8 {{.*}} Dynamic-call Receiver-type=ObjCObjectPointer |
Argyrios Kyrtzidis | b6df6821 | 2012-07-02 23:54:36 +0000 | [diff] [blame] | 67 | // CHECK-NOT: 26:3 {{.*}} Dynamic-call |
| 68 | // CHECK-NOT: 29:3 {{.*}} Dynamic-call |
Argyrios Kyrtzidis | b26a24c | 2012-11-01 02:01:34 +0000 | [diff] [blame] | 69 | // CHECK: 29:3 {{.*}} Receiver-type=ObjCInterface |
Argyrios Kyrtzidis | b6df6821 | 2012-07-02 23:54:36 +0000 | [diff] [blame] | 70 | // CHECK: 34:7 MemberRefExpr=meth:3:16 {{.*}} Dynamic-call |
Argyrios Kyrtzidis | b26a24c | 2012-11-01 02:01:34 +0000 | [diff] [blame] | 71 | // CHECK: 35:3 ObjCMessageExpr=meth:14:8 {{.*}} Dynamic-call Receiver-type=ObjCObjectPointer |
Argyrios Kyrtzidis | b6df6821 | 2012-07-02 23:54:36 +0000 | [diff] [blame] | 72 | // CHECK-NOT: 36:3 {{.*}} Dynamic-call |
Argyrios Kyrtzidis | b26a24c | 2012-11-01 02:01:34 +0000 | [diff] [blame] | 73 | // CHECK: 36:3 {{.*}} Receiver-type=ObjCInterface |
| 74 | // CHECK: 37:3 ObjCMessageExpr=ClsMeth:15:8 {{.*}} Dynamic-call Receiver-type=ObjCClass |
Argyrios Kyrtzidis | 6cc5f73 | 2014-11-10 23:21:35 +0000 | [diff] [blame] | 75 | // CHECK-NOT: 49:10 {{.*}} Dynamic-call |