summaryrefslogtreecommitdiff
path: root/clang/test/Index/file-refs.m
diff options
context:
space:
mode:
authorZancanaro; Carlo <czan8762@plang3.cs.usyd.edu.au>2012-09-24 09:58:17 +1000
committerZancanaro; Carlo <czan8762@plang3.cs.usyd.edu.au>2012-09-24 09:58:17 +1000
commit222e2a7620e6520ffaf4fc4e69d79c18da31542e (patch)
tree7bfbc05bfa3b41c8f9d2e56d53a0bc3e310df239 /clang/test/Index/file-refs.m
parent3d206f03985b50beacae843d880bccdc91a9f424 (diff)
Add the clang library to the repo (with some of my changes, too).
Diffstat (limited to 'clang/test/Index/file-refs.m')
-rw-r--r--clang/test/Index/file-refs.m91
1 files changed, 91 insertions, 0 deletions
diff --git a/clang/test/Index/file-refs.m b/clang/test/Index/file-refs.m
new file mode 100644
index 0000000..3f21c9e
--- /dev/null
+++ b/clang/test/Index/file-refs.m
@@ -0,0 +1,91 @@
+@class Foo;
+
+@interface Foo
+-(id)setWithInt:(int)i andFloat:(float)f;
+@end
+
+@implementation Foo
+-(id)setWithInt:(int)i andFloat:(float)f {
+ return self;
+}
+@end
+
+void test(Foo *foo) {
+ [foo setWithInt:0 andFloat:0];
+ [foo setWithInt: 2 andFloat: 3];
+}
+
+@protocol Prot1
+-(void)protMeth;
+@end
+
+@protocol Prot2<Prot1>
+@end
+
+@interface Base<Prot2>
+@end
+
+@interface Sub : Base
+-(void)protMeth;
+@end
+
+@implementation Sub
+-(void)protMeth {}
+@end
+
+void test2(Sub *s, id<Prot1> p) {
+ [s protMeth];
+ [p protMeth];
+}
+
+
+// RUN: c-index-test \
+
+// RUN: -file-refs-at=%s:7:18 \
+// CHECK: ObjCImplementationDecl=Foo:7:17 (Definition)
+
+// FIXME: There should not be 2 for the same range.
+// CHECK-NEXT: ObjCInterfaceDecl=Foo:1:8 =[1:8 - 1:11]
+// CHECK-NEXT: ObjCClassRef=Foo:3:12 =[1:8 - 1:11]
+
+// CHECK-NEXT: ObjCInterfaceDecl=Foo:3:12 =[3:12 - 3:15]
+// CHECK-NEXT: ObjCImplementationDecl=Foo:7:17 (Definition) =[7:17 - 7:20]
+// CHECK-NEXT: ObjCClassRef=Foo:3:12 =[13:11 - 13:14]
+
+// RUN: -file-refs-at=%s:4:10 \
+// CHECK-NEXT: ObjCInstanceMethodDecl=setWithInt:andFloat::4:6
+// CHECK-NEXT: ObjCInstanceMethodDecl=setWithInt:andFloat::4:6 =[4:6 - 4:16]
+// CHECK-NEXT: ObjCInstanceMethodDecl=setWithInt:andFloat::8:6 (Definition) =[8:6 - 8:16]
+// CHECK-NEXT: ObjCMessageExpr=setWithInt:andFloat::4:6 =[14:8 - 14:18]
+// CHECK-NEXT: ObjCMessageExpr=setWithInt:andFloat::4:6 =[15:8 - 15:18]
+
+// RUN: -file-refs-at=%s:15:27 \
+// CHECK-NEXT: ObjCMessageExpr=setWithInt:andFloat::4:6
+// CHECK-NEXT: ObjCInstanceMethodDecl=setWithInt:andFloat::4:6 =[4:24 - 4:32]
+// CHECK-NEXT: ObjCInstanceMethodDecl=setWithInt:andFloat::8:6 (Definition) =[8:24 - 8:32]
+// CHECK-NEXT: ObjCMessageExpr=setWithInt:andFloat::4:6 =[14:21 - 14:29]
+// CHECK-NEXT: ObjCMessageExpr=setWithInt:andFloat::4:6 =[15:22 - 15:30]
+
+// RUN: -file-refs-at=%s:18:13 \
+// CHECK-NEXT: ObjCProtocolDecl=Prot1:18:11 (Definition)
+// CHECK-NEXT: ObjCProtocolDecl=Prot1:18:11 (Definition) =[18:11 - 18:16]
+// CHECK-NEXT: ObjCProtocolRef=Prot1:18:11 =[22:17 - 22:22]
+// CHECK-NEXT: ObjCProtocolRef=Prot1:18:11 =[36:23 - 36:28]
+
+// RUN: -file-refs-at=%s:38:10 \
+// CHECK-NEXT: ObjCMessageExpr=protMeth:19:8
+// CHECK-NEXT: ObjCInstanceMethodDecl=protMeth:19:8 =[19:8 - 19:16]
+// CHECK-NEXT: ObjCInstanceMethodDecl=protMeth:29:8 [Overrides @19:8] =[29:8 - 29:16]
+// CHECK-NEXT: ObjCInstanceMethodDecl=protMeth:33:8 (Definition) [Overrides @19:8] =[33:8 - 33:16]
+// CHECK-NEXT: ObjCMessageExpr=protMeth:29:8 =[37:6 - 37:14]
+// CHECK-NEXT: ObjCMessageExpr=protMeth:19:8 =[38:6 - 38:14]
+
+// RUN: -file-refs-at=%s:33:12 \
+// CHECK-NEXT: ObjCInstanceMethodDecl=protMeth:33:8 (Definition) [Overrides @19:8]
+// CHECK-NEXT: ObjCInstanceMethodDecl=protMeth:19:8 =[19:8 - 19:16]
+// CHECK-NEXT: ObjCInstanceMethodDecl=protMeth:29:8 [Overrides @19:8] =[29:8 - 29:16]
+// CHECK-NEXT: ObjCInstanceMethodDecl=protMeth:33:8 (Definition) [Overrides @19:8] =[33:8 - 33:16]
+// CHECK-NEXT: ObjCMessageExpr=protMeth:29:8 =[37:6 - 37:14]
+// CHECK-NEXT: ObjCMessageExpr=protMeth:19:8 =[38:6 - 38:14]
+
+// RUN: %s | FileCheck %s