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