aboutsummaryrefslogtreecommitdiff
path: root/test/Index
diff options
context:
space:
mode:
authorRoman Divacky <rdivacky@FreeBSD.org>2009-11-18 14:59:57 +0000
committerRoman Divacky <rdivacky@FreeBSD.org>2009-11-18 14:59:57 +0000
commitb3d5a323a5ca92ea73443499cee2f15db1ff0fb3 (patch)
tree60a1694bec5a44d15456acc880cb2f91619f66aa /test/Index
parent8f57cb0305232cb53fff00ef151ca716766f3437 (diff)
Notes
Diffstat (limited to 'test/Index')
-rw-r--r--test/Index/Inputs/c-index-pch.h7
-rw-r--r--test/Index/Inputs/foo.h8
-rw-r--r--test/Index/Inputs/lit.local.cfg1
-rw-r--r--test/Index/Inputs/objc.h11
-rw-r--r--test/Index/Inputs/t1.c28
-rw-r--r--test/Index/Inputs/t1.m20
-rw-r--r--test/Index/Inputs/t2.c11
-rw-r--r--test/Index/Inputs/t2.m13
-rw-r--r--test/Index/TestClassDecl.m52
-rw-r--r--test/Index/TestClassForwardDecl.m46
-rw-r--r--test/Index/c-index-api-loadTU-test.m224
-rw-r--r--test/Index/c-index-api-test.m2
-rw-r--r--test/Index/c-index-getCursor-test.m160
-rw-r--r--test/Index/c-index-pch.c8
-rw-r--r--test/Index/code-completion.cpp53
-rw-r--r--test/Index/comments.c18
-rw-r--r--test/Index/complete-member-access.m30
-rw-r--r--test/Index/complete-objc-message.m107
-rw-r--r--test/Index/complete-protocols.m25
-rw-r--r--test/Index/find-decls.c34
-rw-r--r--test/Index/find-defs.c26
-rw-r--r--test/Index/find-refs.c68
-rw-r--r--test/Index/multiple-redecls.c4
-rw-r--r--test/Index/objc-decls.m24
-rw-r--r--test/Index/objc-message.m60
-rw-r--r--test/Index/resolve-loc.c26
26 files changed, 931 insertions, 135 deletions
diff --git a/test/Index/Inputs/c-index-pch.h b/test/Index/Inputs/c-index-pch.h
new file mode 100644
index 0000000000000..6dda18000c2f6
--- /dev/null
+++ b/test/Index/Inputs/c-index-pch.h
@@ -0,0 +1,7 @@
+#ifndef C_INDEX_PCH_H
+#define C_INDEX_PCH_H
+
+void foo(int i, float f);
+extern int bar;
+
+#endif // C_INDEX_PCH_H
diff --git a/test/Index/Inputs/foo.h b/test/Index/Inputs/foo.h
new file mode 100644
index 0000000000000..7670c00dfbfe9
--- /dev/null
+++ b/test/Index/Inputs/foo.h
@@ -0,0 +1,8 @@
+extern int global_var;
+
+void foo_func(int param1);
+void bar_func(void);
+
+struct MyStruct {
+ int field_var;
+};
diff --git a/test/Index/Inputs/lit.local.cfg b/test/Index/Inputs/lit.local.cfg
new file mode 100644
index 0000000000000..e6f55eef7af5a
--- /dev/null
+++ b/test/Index/Inputs/lit.local.cfg
@@ -0,0 +1 @@
+config.suffixes = []
diff --git a/test/Index/Inputs/objc.h b/test/Index/Inputs/objc.h
new file mode 100644
index 0000000000000..c671addde59f0
--- /dev/null
+++ b/test/Index/Inputs/objc.h
@@ -0,0 +1,11 @@
+@interface Base {
+ int my_var;
+}
+-(int) my_var;
+-(void) my_method: (int)param;
++(void) my_method: (int)param;
+@end
+
+@interface Sub : Base
+-(void) my_method: (int)param;
+@end
diff --git a/test/Index/Inputs/t1.c b/test/Index/Inputs/t1.c
new file mode 100644
index 0000000000000..ceaad4c7f3a68
--- /dev/null
+++ b/test/Index/Inputs/t1.c
@@ -0,0 +1,28 @@
+#include "foo.h"
+
+void foo_func(int param1) {
+ int local_var = global_var;
+ for (int for_var = 100; for_var < 500; ++for_var) {
+ local_var = param1 + for_var;
+ }
+ bar_func();
+}
+
+struct S1 {
+ int x;
+};
+
+struct S2 {
+ int x;
+};
+
+void field_test(void) {
+ struct S1 s1;
+ s1.x = 0;
+ ((struct S2 *)0)->x = 0;
+
+ struct MyStruct ms;
+ ms.field_var = 10;
+}
+
+int (^CP)(int) = ^(int x) { return x * global_var; };
diff --git a/test/Index/Inputs/t1.m b/test/Index/Inputs/t1.m
new file mode 100644
index 0000000000000..b7c86cd6aac78
--- /dev/null
+++ b/test/Index/Inputs/t1.m
@@ -0,0 +1,20 @@
+#include "objc.h"
+
+static void foo() {
+ Base *base;
+ int x = [base my_var];
+ [base my_method:x];
+ [Base my_method:x];
+}
+
+@implementation Base
+-(int) my_var {
+ return my_var;
+}
+
+-(void) my_method: (int)param {
+}
+
++(void) my_method: (int)param {
+}
+@end
diff --git a/test/Index/Inputs/t2.c b/test/Index/Inputs/t2.c
new file mode 100644
index 0000000000000..76d5d6ceeb41f
--- /dev/null
+++ b/test/Index/Inputs/t2.c
@@ -0,0 +1,11 @@
+#include "foo.h"
+
+int global_var = 10;
+
+void bar_func(void) {
+ global_var += 100;
+ foo_func(global_var);
+
+ struct MyStruct *ms;
+ ms->field_var = 10;
+}
diff --git a/test/Index/Inputs/t2.m b/test/Index/Inputs/t2.m
new file mode 100644
index 0000000000000..3f103eeb1dc72
--- /dev/null
+++ b/test/Index/Inputs/t2.m
@@ -0,0 +1,13 @@
+#include "objc.h"
+
+static void foo() {
+ Sub *sub;
+ int x = [sub my_var];
+ [sub my_method:x];
+ [Sub my_method:x];
+}
+
+@implementation Sub
+-(void) my_method: (int)param {
+}
+@end
diff --git a/test/Index/TestClassDecl.m b/test/Index/TestClassDecl.m
new file mode 100644
index 0000000000000..7256d2bffaf5e
--- /dev/null
+++ b/test/Index/TestClassDecl.m
@@ -0,0 +1,52 @@
+// RUN: clang-cc -triple x86_64-apple-darwin10 -fobjc-nonfragile-abi -fblocks -emit-pch -x objective-c %s -o %t.ast
+// RUN: c-index-test -test-file-scan %t.ast %s | FileCheck -check-prefix=scan %s
+// RUN: c-index-test -test-load-tu %t.ast local | FileCheck -check-prefix=load %s
+
+// This test checks how the @class resolves as a cursor when there is a real definition
+// that follows. <rdar://problem/7383421>
+
+@class Foo;
+
+@interface Foo
+@end
+
+void function(Foo * arg)
+{
+ // nothing here.
+}
+
+// CHECK-scan: {start_line=1 start_col=1 end_line=7 end_col=1} Invalid Cursor => NoDeclFound
+// CHECK-scan: {start_line=8 start_col=1 end_line=8 end_col=7} Invalid Cursor => NotImplemented
+// CHECK-scan: {start_line=8 start_col=8 end_line=8 end_col=10} ObjCClassRef=Foo:8:1
+// CHECK-scan: {start_line=8 start_col=11 end_line=9 end_col=1} Invalid Cursor => NoDeclFound
+// CHECK-scan: {start_line=10 start_col=1 end_line=11 end_col=1} ObjCInterfaceDecl=Foo:10:1
+// CHECK-scan: {start_line=11 start_col=2 end_line=12 end_col=1} Invalid Cursor => NoDeclFound
+// CHECK-scan: {start_line=13 start_col=1 end_line=13 end_col=4} FunctionDecl=function:13:6
+// CHECK-scan: {start_line=13 start_col=5 end_line=13 end_col=5} Invalid Cursor => NoDeclFound
+// CHECK-scan: {start_line=13 start_col=6 end_line=13 end_col=14} FunctionDecl=function:13:6
+// CHECK-scan: {start_line=13 start_col=15 end_line=13 end_col=17} ObjCClassRef=Foo:13:21
+// CHECK-scan: {start_line=13 start_col=18 end_line=13 end_col=18} FunctionDecl=function:13:6
+// CHECK-scan: {start_line=13 start_col=19 end_line=13 end_col=19} ParmDecl=arg:13:21
+// CHECK-scan: {start_line=13 start_col=20 end_line=13 end_col=20} FunctionDecl=function:13:6
+// CHECK-scan: {start_line=13 start_col=21 end_line=13 end_col=23} ParmDecl=arg:13:21
+// CHECK-scan: {start_line=13 start_col=24 end_line=16 end_col=1} FunctionDecl=function:13:6
+// CHECK-scan: {start_line=16 start_col=2 end_line=52 end_col=1} Invalid Cursor => NoDeclFound
+
+// CHECK-load: <invalid loc>:0:0: TypedefDecl=__int128_t:0:0 [Context=TestClassDecl.m]
+// CHECK-load: <invalid loc>:0:0: TypedefDecl=__uint128_t:0:0 [Context=TestClassDecl.m]
+// CHECK-load: <invalid loc>:0:0: StructDecl=objc_selector:0:0 [Context=TestClassDecl.m]
+// CHECK-load: <invalid loc>:0:0: TypedefDecl=SEL:0:0 [Context=TestClassDecl.m]
+// CHECK-load: <invalid loc>:0:0: ObjCInterfaceDecl=Protocol:0:0 [Context=TestClassDecl.m]
+// CHECK-load: <invalid loc>:0:0: TypedefDecl=id:0:0 [Context=TestClassDecl.m]
+// CHECK-load: <invalid loc>:0:0: TypedefDecl=Class:0:0 [Context=TestClassDecl.m]
+// CHECK-load: <invalid loc>:80:16: StructDecl=__va_list_tag:80:16 [Context=TestClassDecl.m]
+// CHECK-load: <invalid loc>:80:42: FieldDecl=gp_offset:80:42 [Context=__va_list_tag]
+// CHECK-load: <invalid loc>:80:63: FieldDecl=fp_offset:80:63 [Context=__va_list_tag]
+// CHECK-load: <invalid loc>:80:81: FieldDecl=overflow_arg_area:80:81 [Context=__va_list_tag]
+// CHECK-load: <invalid loc>:80:107: FieldDecl=reg_save_area:80:107 [Context=__va_list_tag]
+// CHECK-load: <invalid loc>:80:123: TypedefDecl=__va_list_tag:80:123 [Context=TestClassDecl.m]
+// CHECK-load: <invalid loc>:80:159: TypedefDecl=__builtin_va_list:80:159 [Context=TestClassDecl.m]
+// CHECK-load: TestClassDecl.m:10:12: ObjCInterfaceDecl=Foo:10:1 [Context=TestClassDecl.m]
+// CHECK-load: TestClassDecl.m:13:6: FunctionDefn=function [Context=TestClassDecl.m]
+// CHECK-load: TestClassDecl.m:13:21: ParmDecl=arg:13:21 [Context=function]
+
diff --git a/test/Index/TestClassForwardDecl.m b/test/Index/TestClassForwardDecl.m
new file mode 100644
index 0000000000000..4584445d0b9e7
--- /dev/null
+++ b/test/Index/TestClassForwardDecl.m
@@ -0,0 +1,46 @@
+// RUN: clang-cc -triple x86_64-apple-darwin10 -fobjc-nonfragile-abi -fblocks -emit-pch -x objective-c %s -o %t.ast
+// RUN: c-index-test -test-file-scan %t.ast %s | FileCheck -check-prefix=scan %s
+// RUN: c-index-test -test-load-tu %t.ast local | FileCheck -check-prefix=load %s
+
+// This test checks how the @class resolves as a cursor when the @interface is implicitly defined.
+// See TestClassDecl.m for the corresponding test case. (<rdar://problem/7383421>)
+
+@class Foo;
+
+void function(Foo * arg)
+{
+ // nothing here.
+}
+
+// CHECK-scan: {start_line=1 start_col=1 end_line=7 end_col=1} Invalid Cursor => NoDeclFound
+// CHECK-scan: {start_line=8 start_col=1 end_line=8 end_col=7} Invalid Cursor => NotImplemented
+// CHECK-scan: {start_line=8 start_col=8 end_line=8 end_col=10} ObjCClassRef=Foo:8:1
+// CHECK-scan: {start_line=8 start_col=11 end_line=9 end_col=1} Invalid Cursor => NoDeclFound
+// CHECK-scan: {start_line=10 start_col=1 end_line=10 end_col=4} FunctionDecl=function:10:6
+// CHECK-scan: {start_line=10 start_col=5 end_line=10 end_col=5} Invalid Cursor => NoDeclFound
+// CHECK-scan: {start_line=10 start_col=6 end_line=10 end_col=14} FunctionDecl=function:10:6
+// CHECK-scan: {start_line=10 start_col=15 end_line=10 end_col=17} ObjCClassRef=Foo:10:21
+// CHECK-scan: {start_line=10 start_col=18 end_line=10 end_col=18} FunctionDecl=function:10:6
+// CHECK-scan: {start_line=10 start_col=19 end_line=10 end_col=19} ParmDecl=arg:10:21
+// CHECK-scan: {start_line=10 start_col=20 end_line=10 end_col=20} FunctionDecl=function:10:6
+// CHECK-scan: {start_line=10 start_col=21 end_line=10 end_col=23} ParmDecl=arg:10:21
+// CHECK-scan: {start_line=10 start_col=24 end_line=13 end_col=1} FunctionDecl=function:10:6
+// CHECK-scan: {start_line=13 start_col=2 end_line=46 end_col=1} Invalid Cursor => NoDeclFound
+
+// CHECK-load: <invalid loc>:0:0: TypedefDecl=__int128_t:0:0 [Context=TestClassForwardDecl.m]
+// CHECK-load: <invalid loc>:0:0: TypedefDecl=__uint128_t:0:0 [Context=TestClassForwardDecl.m]
+// CHECK-load: <invalid loc>:0:0: StructDecl=objc_selector:0:0 [Context=TestClassForwardDecl.m]
+// CHECK-load: <invalid loc>:0:0: TypedefDecl=SEL:0:0 [Context=TestClassForwardDecl.m]
+// CHECK-load: <invalid loc>:0:0: ObjCInterfaceDecl=Protocol:0:0 [Context=TestClassForwardDecl.m]
+// CHECK-load: <invalid loc>:0:0: TypedefDecl=id:0:0 [Context=TestClassForwardDecl.m]
+// CHECK-load: <invalid loc>:0:0: TypedefDecl=Class:0:0 [Context=TestClassForwardDecl.m]
+// CHECK-load: <invalid loc>:80:16: StructDecl=__va_list_tag:80:16 [Context=TestClassForwardDecl.m]
+// CHECK-load: <invalid loc>:80:42: FieldDecl=gp_offset:80:42 [Context=__va_list_tag]
+// CHECK-load: <invalid loc>:80:63: FieldDecl=fp_offset:80:63 [Context=__va_list_tag]
+// CHECK-load: <invalid loc>:80:81: FieldDecl=overflow_arg_area:80:81 [Context=__va_list_tag]
+// CHECK-load: <invalid loc>:80:107: FieldDecl=reg_save_area:80:107 [Context=__va_list_tag]
+// CHECK-load: <invalid loc>:80:123: TypedefDecl=__va_list_tag:80:123 [Context=TestClassForwardDecl.m]
+// CHECK-load: <invalid loc>:80:159: TypedefDecl=__builtin_va_list:80:159 [Context=TestClassForwardDecl.m]
+// CHECK-load: TestClassForwardDecl.m:10:6: FunctionDefn=function [Context=TestClassForwardDecl.m]
+// CHECK-load: TestClassForwardDecl.m:10:21: ParmDecl=arg:10:21 [Context=function]
+
diff --git a/test/Index/c-index-api-loadTU-test.m b/test/Index/c-index-api-loadTU-test.m
new file mode 100644
index 0000000000000..5427764ab7a7c
--- /dev/null
+++ b/test/Index/c-index-api-loadTU-test.m
@@ -0,0 +1,224 @@
+// RUN: clang-cc -triple x86_64-apple-darwin10 -fobjc-nonfragile-abi -fblocks -emit-pch -x objective-c %s -o %t.ast
+// RUN: c-index-test -test-load-tu %t.ast all | FileCheck %s
+
+// CHECK: <invalid loc>:0:0: TypedefDecl=__int128_t:0:0 [Context=c-index-api-loadTU-test.m]
+// CHECK: <invalid loc>:0:0: TypedefDecl=__uint128_t:0:0 [Context=c-index-api-loadTU-test.m]
+// CHECK: <invalid loc>:0:0: StructDecl=objc_selector:0:0 [Context=c-index-api-loadTU-test.m]
+// CHECK: <invalid loc>:0:0: TypedefDecl=SEL:0:0 [Context=c-index-api-loadTU-test.m]
+// CHECK: <invalid loc>:0:0: ObjCInterfaceDecl=Protocol:0:0 [Context=c-index-api-loadTU-test.m]
+// CHECK: <invalid loc>:0:0: TypedefDecl=id:0:0 [Context=c-index-api-loadTU-test.m]
+// CHECK: <invalid loc>:0:0: TypedefDecl=Class:0:0 [Context=c-index-api-loadTU-test.m]
+// CHECK: <invalid loc>:80:16: StructDecl=__va_list_tag:80:16 [Context=c-index-api-loadTU-test.m]
+// CHECK: <invalid loc>:80:42: FieldDecl=gp_offset:80:42 [Context=__va_list_tag]
+// CHECK: <invalid loc>:80:63: FieldDecl=fp_offset:80:63 [Context=__va_list_tag]
+// CHECK: <invalid loc>:80:81: FieldDecl=overflow_arg_area:80:81 [Context=__va_list_tag]
+// CHECK: <invalid loc>:80:107: FieldDecl=reg_save_area:80:107 [Context=__va_list_tag]
+// CHECK: <invalid loc>:80:123: TypedefDecl=__va_list_tag:80:123 [Context=c-index-api-loadTU-test.m]
+// CHECK: <invalid loc>:80:159: TypedefDecl=__builtin_va_list:80:159 [Context=c-index-api-loadTU-test.m]
+//
+
+@interface Foo
+{
+}
+
+- foo;
++ fooC;
+
+@end
+
+@interface Bar : Foo
+{
+}
+
+@end
+
+@interface Foo (FooCat)
+- (int) catMethodWithFloat:(float) fArg;
+- (float) floatMethod;
+@end
+
+@protocol Proto
+- pMethod;
+@end
+
+@protocol SubP <Proto>
+- spMethod;
+@end
+
+@interface Baz : Bar <SubP>
+{
+ int _anIVar;
+}
+
+- (Foo *) bazMethod;
+
+@end
+
+enum {
+ someEnum
+};
+
+// CHECK: c-index-api-loadTU-test.m:20:12: ObjCInterfaceDecl=Foo:20:1 [Context=c-index-api-loadTU-test.m]
+// CHECK: c-index-api-loadTU-test.m:24:1: ObjCInstanceMethodDecl=foo:24:1 [Context=Foo]
+// CHECK: c-index-api-loadTU-test.m:25:1: ObjCClassMethodDecl=fooC:25:1 [Context=Foo]
+// CHECK: c-index-api-loadTU-test.m:29:12: ObjCInterfaceDecl=Bar:29:1 [Context=c-index-api-loadTU-test.m]
+// CHECK: c-index-api-loadTU-test.m:29:18: ObjCSuperClassRef=Foo:29:1 [Context=Bar]
+// CHECK: c-index-api-loadTU-test.m:35:1: ObjCCategoryDecl=FooCat:35:1 [Context=c-index-api-loadTU-test.m]
+// CHECK: c-index-api-loadTU-test.m:20:1: ObjCClassRef=Foo:35:1 [Context=FooCat]
+// CHECK: c-index-api-loadTU-test.m:36:1: ObjCInstanceMethodDecl=catMethodWithFloat::36:1 [Context=FooCat]
+// CHECK: c-index-api-loadTU-test.m:37:1: ObjCInstanceMethodDecl=floatMethod:37:1 [Context=FooCat]
+// CHECK: c-index-api-loadTU-test.m:40:1: ObjCProtocolDecl=Proto:40:1 [Context=c-index-api-loadTU-test.m]
+// CHECK: c-index-api-loadTU-test.m:41:1: ObjCInstanceMethodDecl=pMethod:41:1 [Context=Proto]
+// CHECK: c-index-api-loadTU-test.m:44:1: ObjCProtocolDecl=SubP:44:1 [Context=c-index-api-loadTU-test.m]
+// CHECK: c-index-api-loadTU-test.m:40:1: ObjCProtocolRef=Proto:40:1 [Context=SubP]
+// CHECK: c-index-api-loadTU-test.m:45:1: ObjCInstanceMethodDecl=spMethod:45:1 [Context=SubP]
+// CHECK: c-index-api-loadTU-test.m:48:12: ObjCInterfaceDecl=Baz:48:1 [Context=c-index-api-loadTU-test.m]
+// CHECK: c-index-api-loadTU-test.m:48:18: ObjCSuperClassRef=Bar:48:1 [Context=Baz]
+// CHECK: c-index-api-loadTU-test.m:44:1: ObjCProtocolRef=SubP:44:1 [Context=Baz]
+// CHECK: c-index-api-loadTU-test.m:50:9: ObjCIvarDecl=_anIVar:50:9 [Context=Baz]
+// CHECK: c-index-api-loadTU-test.m:53:1: ObjCInstanceMethodDecl=bazMethod:53:1 [Context=Baz]
+// CHECK: c-index-api-loadTU-test.m:57:1: EnumDecl=:57:1 [Context=c-index-api-loadTU-test.m]
+// CHECK: c-index-api-loadTU-test.m:58:3: EnumConstantDecl=someEnum:58:3 [Context=]
+
+int main (int argc, const char * argv[]) {
+ Baz * bee;
+ id a = [bee foo];
+ id <SubP> c = [Foo fooC];
+ id <Proto> d;
+ d = c;
+ [d pMethod];
+ [bee catMethodWithFloat:[bee floatMethod]];
+ main(someEnum, (const char **)bee);
+}
+
+// CHECK: c-index-api-loadTU-test.m:83:5: FunctionDefn=main [Context=c-index-api-loadTU-test.m]
+// CHECK: c-index-api-loadTU-test.m:83:15: ParmDecl=argc:83:15 [Context=main]
+// CHECK: c-index-api-loadTU-test.m:83:34: ParmDecl=argv:83:34 [Context=main]
+// CHECK: c-index-api-loadTU-test.m:84:8: VarDecl=bee:84:8 [Context=main]
+// CHECK: c-index-api-loadTU-test.m:85:5: VarDecl=a:85:5 [Context=main]
+// CHECK: c-index-api-loadTU-test.m:86:12: VarDecl=c:86:12 [Context=main]
+// CHECK: c-index-api-loadTU-test.m:87:13: VarDecl=d:87:13 [Context=main]
+// CHECK: c-index-api-loadTU-test.m:84:2: ObjCClassRef=Baz:84:8 [Context:Baz]
+// CHECK: c-index-api-loadTU-test.m:84:3: ObjCClassRef=Baz:84:8 [Context:Baz]
+// CHECK: c-index-api-loadTU-test.m:84:4: ObjCClassRef=Baz:84:8 [Context:Baz]
+// CHECK: c-index-api-loadTU-test.m:84:6: VarDecl=bee:84:8 [Context:bee]
+// CHECK: c-index-api-loadTU-test.m:84:8: VarDecl=bee:84:8 [Context:bee]
+// CHECK: c-index-api-loadTU-test.m:84:9: VarDecl=bee:84:8 [Context:bee]
+// CHECK: c-index-api-loadTU-test.m:84:10: VarDecl=bee:84:8 [Context:bee]
+// CHECK: <invalid loc>:85:2: TypedefDecl=id:0:0 [Context:id]
+// CHECK: <invalid loc>:85:3: TypedefDecl=id:0:0 [Context:id]
+// CHECK: c-index-api-loadTU-test.m:85:5: VarDecl=a:85:5 [Context:a]
+// CHECK: c-index-api-loadTU-test.m:85:6: VarDecl=a:85:5 [Context:a]
+// CHECK: c-index-api-loadTU-test.m:85:7: VarDecl=a:85:5 [Context:a]
+// CHECK: c-index-api-loadTU-test.m:85:8: VarDecl=a:85:5 [Context:a]
+// CHECK: c-index-api-loadTU-test.m:85:9: ObjCSelectorRef=foo:24:1 [Context:a]
+// CHECK: c-index-api-loadTU-test.m:85:10: VarRef=bee:84:8 [Context:a]
+// CHECK: c-index-api-loadTU-test.m:85:11: VarRef=bee:84:8 [Context:a]
+// CHECK: c-index-api-loadTU-test.m:85:12: VarRef=bee:84:8 [Context:a]
+// CHECK: c-index-api-loadTU-test.m:85:13: ObjCSelectorRef=foo:24:1 [Context:a]
+// CHECK: c-index-api-loadTU-test.m:85:14: ObjCSelectorRef=foo:24:1 [Context:a]
+// CHECK: c-index-api-loadTU-test.m:85:15: ObjCSelectorRef=foo:24:1 [Context:a]
+// CHECK: c-index-api-loadTU-test.m:85:16: ObjCSelectorRef=foo:24:1 [Context:a]
+// CHECK: c-index-api-loadTU-test.m:85:17: ObjCSelectorRef=foo:24:1 [Context:a]
+// CHECK: <invalid loc>:86:2: TypedefDecl=id:0:0 [Context:id]
+// CHECK: <invalid loc>:86:3: TypedefDecl=id:0:0 [Context:id]
+// CHECK: c-index-api-loadTU-test.m:86:5: VarDecl=c:86:12 [Context:c]
+// CHECK: c-index-api-loadTU-test.m:86:6: ObjCProtocolRef=SubP:86:12 [Context:SubP]
+// CHECK: c-index-api-loadTU-test.m:86:7: ObjCProtocolRef=SubP:86:12 [Context:SubP]
+// CHECK: c-index-api-loadTU-test.m:86:8: ObjCProtocolRef=SubP:86:12 [Context:SubP]
+// CHECK: c-index-api-loadTU-test.m:86:9: ObjCProtocolRef=SubP:86:12 [Context:SubP]
+// CHECK: c-index-api-loadTU-test.m:86:10: VarDecl=c:86:12 [Context:c]
+// CHECK: c-index-api-loadTU-test.m:86:12: VarDecl=c:86:12 [Context:c]
+// CHECK: c-index-api-loadTU-test.m:86:13: VarDecl=c:86:12 [Context:c]
+// CHECK: c-index-api-loadTU-test.m:86:14: VarDecl=c:86:12 [Context:c]
+// CHECK: c-index-api-loadTU-test.m:86:15: VarDecl=c:86:12 [Context:c]
+// CHECK: c-index-api-loadTU-test.m:86:16: ObjCSelectorRef=fooC:25:1 [Context:c]
+// CHECK: c-index-api-loadTU-test.m:86:17: ObjCSelectorRef=fooC:25:1 [Context:c]
+// CHECK: c-index-api-loadTU-test.m:86:18: ObjCSelectorRef=fooC:25:1 [Context:c]
+// CHECK: c-index-api-loadTU-test.m:86:19: ObjCSelectorRef=fooC:25:1 [Context:c]
+// CHECK: c-index-api-loadTU-test.m:86:20: ObjCSelectorRef=fooC:25:1 [Context:c]
+// CHECK: c-index-api-loadTU-test.m:86:21: ObjCSelectorRef=fooC:25:1 [Context:c]
+// CHECK: c-index-api-loadTU-test.m:86:22: ObjCSelectorRef=fooC:25:1 [Context:c]
+// CHECK: c-index-api-loadTU-test.m:86:23: ObjCSelectorRef=fooC:25:1 [Context:c]
+// CHECK: c-index-api-loadTU-test.m:86:24: ObjCSelectorRef=fooC:25:1 [Context:c]
+// CHECK: c-index-api-loadTU-test.m:86:25: ObjCSelectorRef=fooC:25:1 [Context:c]
+// CHECK: <invalid loc>:87:2: TypedefDecl=id:0:0 [Context:id]
+// CHECK: <invalid loc>:87:3: TypedefDecl=id:0:0 [Context:id]
+// CHECK: c-index-api-loadTU-test.m:87:5: VarDecl=d:87:13 [Context:d]
+// CHECK: c-index-api-loadTU-test.m:87:6: ObjCProtocolRef=Proto:87:13 [Context:Proto]
+// CHECK: c-index-api-loadTU-test.m:87:7: ObjCProtocolRef=Proto:87:13 [Context:Proto]
+// CHECK: c-index-api-loadTU-test.m:87:8: ObjCProtocolRef=Proto:87:13 [Context:Proto]
+// CHECK: c-index-api-loadTU-test.m:87:9: ObjCProtocolRef=Proto:87:13 [Context:Proto]
+// CHECK: c-index-api-loadTU-test.m:87:10: ObjCProtocolRef=Proto:87:13 [Context:Proto]
+// CHECK: c-index-api-loadTU-test.m:87:11: VarDecl=d:87:13 [Context:d]
+// CHECK: c-index-api-loadTU-test.m:87:13: VarDecl=d:87:13 [Context:d]
+// CHECK: c-index-api-loadTU-test.m:88:2: VarRef=d:87:13 [Context:main]
+// CHECK: c-index-api-loadTU-test.m:88:6: VarRef=c:86:12 [Context:main]
+// CHECK: c-index-api-loadTU-test.m:89:2: ObjCSelectorRef=pMethod:41:1 [Context:main]
+// CHECK: c-index-api-loadTU-test.m:89:3: VarRef=d:87:13 [Context:main]
+// CHECK: c-index-api-loadTU-test.m:89:4: ObjCSelectorRef=pMethod:41:1 [Context:main]
+// CHECK: c-index-api-loadTU-test.m:89:5: ObjCSelectorRef=pMethod:41:1 [Context:main]
+// CHECK: c-index-api-loadTU-test.m:89:6: ObjCSelectorRef=pMethod:41:1 [Context:main]
+// CHECK: c-index-api-loadTU-test.m:89:7: ObjCSelectorRef=pMethod:41:1 [Context:main]
+// CHECK: c-index-api-loadTU-test.m:89:8: ObjCSelectorRef=pMethod:41:1 [Context:main]
+// CHECK: c-index-api-loadTU-test.m:89:9: ObjCSelectorRef=pMethod:41:1 [Context:main]
+// CHECK: c-index-api-loadTU-test.m:89:10: ObjCSelectorRef=pMethod:41:1 [Context:main]
+// CHECK: c-index-api-loadTU-test.m:89:11: ObjCSelectorRef=pMethod:41:1 [Context:main]
+// CHECK: c-index-api-loadTU-test.m:89:12: ObjCSelectorRef=pMethod:41:1 [Context:main]
+// CHECK: c-index-api-loadTU-test.m:90:2: ObjCSelectorRef=catMethodWithFloat::36:1 [Context:main]
+// CHECK: c-index-api-loadTU-test.m:90:3: VarRef=bee:84:8 [Context:main]
+// CHECK: c-index-api-loadTU-test.m:90:4: VarRef=bee:84:8 [Context:main]
+// CHECK: c-index-api-loadTU-test.m:90:5: VarRef=bee:84:8 [Context:main]
+// CHECK: c-index-api-loadTU-test.m:90:6: ObjCSelectorRef=catMethodWithFloat::36:1 [Context:main]
+// CHECK: c-index-api-loadTU-test.m:90:7: ObjCSelectorRef=catMethodWithFloat::36:1 [Context:main]
+// CHECK: c-index-api-loadTU-test.m:90:8: ObjCSelectorRef=catMethodWithFloat::36:1 [Context:main]
+// CHECK: c-index-api-loadTU-test.m:90:9: ObjCSelectorRef=catMethodWithFloat::36:1 [Context:main]
+// CHECK: c-index-api-loadTU-test.m:90:10: ObjCSelectorRef=catMethodWithFloat::36:1 [Context:main]
+// CHECK: c-index-api-loadTU-test.m:90:11: ObjCSelectorRef=catMethodWithFloat::36:1 [Context:main]
+// CHECK: c-index-api-loadTU-test.m:90:12: ObjCSelectorRef=catMethodWithFloat::36:1 [Context:main]
+// CHECK: c-index-api-loadTU-test.m:90:13: ObjCSelectorRef=catMethodWithFloat::36:1 [Context:main]
+// CHECK: c-index-api-loadTU-test.m:90:14: ObjCSelectorRef=catMethodWithFloat::36:1 [Context:main]
+// CHECK: c-index-api-loadTU-test.m:90:15: ObjCSelectorRef=catMethodWithFloat::36:1 [Context:main]
+// CHECK: c-index-api-loadTU-test.m:90:16: ObjCSelectorRef=catMethodWithFloat::36:1 [Context:main]
+// CHECK: c-index-api-loadTU-test.m:90:17: ObjCSelectorRef=catMethodWithFloat::36:1 [Context:main]
+// CHECK: c-index-api-loadTU-test.m:90:18: ObjCSelectorRef=catMethodWithFloat::36:1 [Context:main]
+// CHECK: c-index-api-loadTU-test.m:90:19: ObjCSelectorRef=catMethodWithFloat::36:1 [Context:main]
+// CHECK: c-index-api-loadTU-test.m:90:20: ObjCSelectorRef=catMethodWithFloat::36:1 [Context:main]
+// CHECK: c-index-api-loadTU-test.m:90:21: ObjCSelectorRef=catMethodWithFloat::36:1 [Context:main]
+// CHECK: c-index-api-loadTU-test.m:90:22: ObjCSelectorRef=catMethodWithFloat::36:1 [Context:main]
+// CHECK: c-index-api-loadTU-test.m:90:23: ObjCSelectorRef=catMethodWithFloat::36:1 [Context:main]
+// CHECK: c-index-api-loadTU-test.m:90:24: ObjCSelectorRef=catMethodWithFloat::36:1 [Context:main]
+// CHECK: c-index-api-loadTU-test.m:90:25: ObjCSelectorRef=catMethodWithFloat::36:1 [Context:main]
+// CHECK: c-index-api-loadTU-test.m:90:26: ObjCSelectorRef=floatMethod:37:1 [Context:main]
+// CHECK: c-index-api-loadTU-test.m:90:27: VarRef=bee:84:8 [Context:main]
+// CHECK: c-index-api-loadTU-test.m:90:28: VarRef=bee:84:8 [Context:main]
+// CHECK: c-index-api-loadTU-test.m:90:29: VarRef=bee:84:8 [Context:main]
+// CHECK: c-index-api-loadTU-test.m:90:30: ObjCSelectorRef=floatMethod:37:1 [Context:main]
+// CHECK: c-index-api-loadTU-test.m:90:31: ObjCSelectorRef=floatMethod:37:1 [Context:main]
+// CHECK: c-index-api-loadTU-test.m:90:32: ObjCSelectorRef=floatMethod:37:1 [Context:main]
+// CHECK: c-index-api-loadTU-test.m:90:33: ObjCSelectorRef=floatMethod:37:1 [Context:main]
+// CHECK: c-index-api-loadTU-test.m:90:34: ObjCSelectorRef=floatMethod:37:1 [Context:main]
+// CHECK: c-index-api-loadTU-test.m:90:35: ObjCSelectorRef=floatMethod:37:1 [Context:main]
+// CHECK: c-index-api-loadTU-test.m:90:36: ObjCSelectorRef=floatMethod:37:1 [Context:main]
+// CHECK: c-index-api-loadTU-test.m:90:37: ObjCSelectorRef=floatMethod:37:1 [Context:main]
+// CHECK: c-index-api-loadTU-test.m:90:38: ObjCSelectorRef=floatMethod:37:1 [Context:main]
+// CHECK: c-index-api-loadTU-test.m:90:39: ObjCSelectorRef=floatMethod:37:1 [Context:main]
+// CHECK: c-index-api-loadTU-test.m:90:40: ObjCSelectorRef=floatMethod:37:1 [Context:main]
+// CHECK: c-index-api-loadTU-test.m:90:41: ObjCSelectorRef=floatMethod:37:1 [Context:main]
+// CHECK: c-index-api-loadTU-test.m:90:42: ObjCSelectorRef=floatMethod:37:1 [Context:main]
+// CHECK: c-index-api-loadTU-test.m:90:43: ObjCSelectorRef=catMethodWithFloat::36:1 [Context:main]
+// CHECK: c-index-api-loadTU-test.m:91:3: FunctionRef=main:83:5 [Context:main]
+// CHECK: c-index-api-loadTU-test.m:91:4: FunctionRef=main:83:5 [Context:main]
+// CHECK: c-index-api-loadTU-test.m:91:5: FunctionRef=main:83:5 [Context:main]
+// CHECK: c-index-api-loadTU-test.m:91:6: FunctionRef=main:83:5 [Context:main]
+// CHECK: c-index-api-loadTU-test.m:91:8: EnumConstantRef=someEnum:58:3 [Context:main]
+// CHECK: c-index-api-loadTU-test.m:91:9: EnumConstantRef=someEnum:58:3 [Context:main]
+// CHECK: c-index-api-loadTU-test.m:91:10: EnumConstantRef=someEnum:58:3 [Context:main]
+// CHECK: c-index-api-loadTU-test.m:91:11: EnumConstantRef=someEnum:58:3 [Context:main]
+// CHECK: c-index-api-loadTU-test.m:91:12: EnumConstantRef=someEnum:58:3 [Context:main]
+// CHECK: c-index-api-loadTU-test.m:91:13: EnumConstantRef=someEnum:58:3 [Context:main]
+// CHECK: c-index-api-loadTU-test.m:91:14: EnumConstantRef=someEnum:58:3 [Context:main]
+// CHECK: c-index-api-loadTU-test.m:91:15: EnumConstantRef=someEnum:58:3 [Context:main]
+// CHECK: c-index-api-loadTU-test.m:91:33: VarRef=bee:84:8 [Context:main]
+// CHECK: c-index-api-loadTU-test.m:91:34: VarRef=bee:84:8 [Context:main]
+// CHECK: c-index-api-loadTU-test.m:91:35: VarRef=bee:84:8 [Context:main]
diff --git a/test/Index/c-index-api-test.m b/test/Index/c-index-api-test.m
index 20d4d7b45afd5..55669e7579cd9 100644
--- a/test/Index/c-index-api-test.m
+++ b/test/Index/c-index-api-test.m
@@ -1,4 +1,4 @@
-// RUN: clang-cc -triple x86_64-apple-darwin10 -emit-pch -x objective-c %s -o %t.ast &&
+// RUN: clang-cc -triple x86_64-apple-darwin10 -emit-pch -x objective-c %s -o %t.ast
// RUN: c-index-test %t.ast all | FileCheck %s
// CHECK: <invalid loc>:0:0: TypedefDecl=__int128_t:0:0 [Context=c-index-api-test.m]
diff --git a/test/Index/c-index-getCursor-test.m b/test/Index/c-index-getCursor-test.m
new file mode 100644
index 0000000000000..3653a9c2e2148
--- /dev/null
+++ b/test/Index/c-index-getCursor-test.m
@@ -0,0 +1,160 @@
+// RUN: clang-cc -triple x86_64-apple-darwin10 -fobjc-nonfragile-abi -fblocks -emit-pch -x objective-c %s -o %t.ast
+// RUN: c-index-test -test-file-scan %t.ast %s | FileCheck %s
+@interface Foo
+{
+}
+
+- foo;
++ fooC;
+
+@end
+
+@interface Bar : Foo
+{
+}
+
+@end
+
+@interface Foo (FooCat)
+- (int) catMethodWithFloat:(float) fArg;
+- (float) floatMethod;
+@end
+
+@protocol Proto
+- pMethod;
+@end
+
+@protocol SubP <Proto>
+- spMethod;
+@end
+
+@interface Baz : Bar <SubP>
+{
+ int _anIVar;
+}
+
+- (Foo *) bazMethod;
+
+@end
+
+enum {
+ someEnum
+};
+
+int main (int argc, const char * argv[]) {
+ Baz * bee;
+ id a = [bee foo];
+ id <SubP> c = [Foo fooC];
+ id <Proto> d;
+ d = c;
+ [d pMethod];
+ [bee catMethodWithFloat:[bee floatMethod]];
+ main(someEnum, (const char **)bee);
+}
+
+// CHECK: {start_line=1 start_col=1 end_line=2 end_col=62} Invalid Cursor => NoDeclFound
+// CHECK: {start_line=3 start_col=1 end_line=6 end_col=1} ObjCInterfaceDecl=Foo:3:1
+// CHECK: {start_line=7 start_col=1 end_line=7 end_col=6} ObjCInstanceMethodDecl=foo:7:1
+// CHECK: {start_line=7 start_col=7 end_line=7 end_col=7} ObjCInterfaceDecl=Foo:3:1
+// CHECK: {start_line=8 start_col=1 end_line=8 end_col=7} ObjCClassMethodDecl=fooC:8:1
+// CHECK: {start_line=8 start_col=8 end_line=10 end_col=1} ObjCInterfaceDecl=Foo:3:1
+// CHECK: {start_line=10 start_col=2 end_line=11 end_col=1} Invalid Cursor => NoDeclFound
+// CHECK: {start_line=12 start_col=1 end_line=16 end_col=1} ObjCInterfaceDecl=Bar:12:1
+// CHECK: {start_line=16 start_col=2 end_line=17 end_col=1} Invalid Cursor => NoDeclFound
+// CHECK: {start_line=18 start_col=1 end_line=18 end_col=24} ObjCCategoryDecl=FooCat:18:1
+// CHECK: {start_line=19 start_col=1 end_line=19 end_col=28} ObjCInstanceMethodDecl=catMethodWithFloat::19:1
+// CHECK: {start_line=19 start_col=29 end_line=19 end_col=33} ParmDecl=fArg:19:36
+// CHECK: {start_line=19 start_col=34 end_line=19 end_col=35} ObjCInstanceMethodDecl=catMethodWithFloat::19:1
+// CHECK: {start_line=19 start_col=36 end_line=19 end_col=39} ParmDecl=fArg:19:36
+// CHECK: {start_line=19 start_col=40 end_line=19 end_col=40} ObjCInstanceMethodDecl=catMethodWithFloat::19:1
+// CHECK: {start_line=19 start_col=41 end_line=19 end_col=41} ObjCCategoryDecl=FooCat:18:1
+// CHECK: {start_line=20 start_col=1 end_line=20 end_col=22} ObjCInstanceMethodDecl=floatMethod:20:1
+// CHECK: {start_line=20 start_col=23 end_line=21 end_col=1} ObjCCategoryDecl=FooCat:18:1
+// CHECK: {start_line=21 start_col=2 end_line=22 end_col=1} Invalid Cursor => NoDeclFound
+// CHECK: {start_line=23 start_col=1 end_line=23 end_col=16} ObjCProtocolDecl=Proto:23:1
+// CHECK: {start_line=24 start_col=1 end_line=24 end_col=10} ObjCInstanceMethodDecl=pMethod:24:1
+// CHECK: {start_line=24 start_col=11 end_line=25 end_col=1} ObjCProtocolDecl=Proto:23:1
+// CHECK: {start_line=25 start_col=2 end_line=26 end_col=1} Invalid Cursor => NoDeclFound
+// CHECK: {start_line=27 start_col=1 end_line=27 end_col=23} ObjCProtocolDecl=SubP:27:1
+// CHECK: {start_line=28 start_col=1 end_line=28 end_col=11} ObjCInstanceMethodDecl=spMethod:28:1
+// CHECK: {start_line=28 start_col=12 end_line=29 end_col=1} ObjCProtocolDecl=SubP:27:1
+// CHECK: {start_line=29 start_col=2 end_line=30 end_col=1} Invalid Cursor => NoDeclFound
+// CHECK: {start_line=31 start_col=1 end_line=33 end_col=4} ObjCInterfaceDecl=Baz:31:1
+// CHECK: {start_line=33 start_col=5 end_line=33 end_col=7} Invalid Cursor => NotImplemented
+// CHECK: {start_line=33 start_col=8 end_line=33 end_col=8} ObjCInterfaceDecl=Baz:31:1
+// CHECK: {start_line=33 start_col=9 end_line=33 end_col=15} Invalid Cursor => NotImplemented
+// CHECK: {start_line=33 start_col=16 end_line=35 end_col=1} ObjCInterfaceDecl=Baz:31:1
+// CHECK: {start_line=36 start_col=1 end_line=36 end_col=20} ObjCInstanceMethodDecl=bazMethod:36:1
+// CHECK: {start_line=36 start_col=21 end_line=38 end_col=1} ObjCInterfaceDecl=Baz:31:1
+// CHECK: {start_line=38 start_col=2 end_line=39 end_col=1} Invalid Cursor => NoDeclFound
+// CHECK: {start_line=40 start_col=1 end_line=41 end_col=2} EnumDecl=:40:1
+// CHECK: {start_line=41 start_col=3 end_line=41 end_col=10} EnumConstantDecl=someEnum:41:3
+// CHECK: {start_line=41 start_col=11 end_line=42 end_col=1} EnumDecl=:40:1
+// CHECK: {start_line=42 start_col=2 end_line=43 end_col=1} Invalid Cursor => NoDeclFound
+// CHECK: {start_line=44 start_col=1 end_line=44 end_col=3} FunctionDecl=main:44:5
+// CHECK: {start_line=44 start_col=4 end_line=44 end_col=4} Invalid Cursor => NoDeclFound
+// CHECK: {start_line=44 start_col=5 end_line=44 end_col=10} FunctionDecl=main:44:5
+// CHECK: {start_line=44 start_col=11 end_line=44 end_col=13} ParmDecl=argc:44:15
+// CHECK: {start_line=44 start_col=14 end_line=44 end_col=14} FunctionDecl=main:44:5
+// CHECK: {start_line=44 start_col=15 end_line=44 end_col=18} ParmDecl=argc:44:15
+// CHECK: {start_line=44 start_col=19 end_line=44 end_col=26} FunctionDecl=main:44:5
+// CHECK: {start_line=44 start_col=27 end_line=44 end_col=30} ParmDecl=argv:44:34
+// CHECK: {start_line=44 start_col=31 end_line=44 end_col=31} FunctionDecl=main:44:5
+// CHECK: {start_line=44 start_col=32 end_line=44 end_col=32} ParmDecl=argv:44:34
+// CHECK: {start_line=44 start_col=33 end_line=44 end_col=33} FunctionDecl=main:44:5
+// CHECK: {start_line=44 start_col=34 end_line=44 end_col=39} ParmDecl=argv:44:34
+// CHECK: {start_line=44 start_col=40 end_line=45 end_col=1} FunctionDecl=main:44:5
+// CHECK: {start_line=45 start_col=2 end_line=45 end_col=4} ObjCClassRef=Baz:45:8
+// CHECK: {start_line=45 start_col=5 end_line=45 end_col=5} FunctionDecl=main:44:5
+// CHECK: {start_line=45 start_col=6 end_line=45 end_col=6} VarDecl=bee:45:8
+// CHECK: {start_line=45 start_col=7 end_line=45 end_col=7} FunctionDecl=main:44:5
+// CHECK: {start_line=45 start_col=8 end_line=45 end_col=10} VarDecl=bee:45:8
+// CHECK: {start_line=45 start_col=11 end_line=46 end_col=1} FunctionDecl=main:44:5
+// CHECK: {start_line=46 start_col=2 end_line=46 end_col=3} TypedefDecl=id:0:0
+// CHECK: {start_line=46 start_col=4 end_line=46 end_col=4} FunctionDecl=main:44:5
+// CHECK: {start_line=46 start_col=5 end_line=46 end_col=8} VarDecl=a:46:5
+// CHECK: {start_line=46 start_col=9 end_line=46 end_col=9} ObjCSelectorRef=foo:7:1
+// CHECK: {start_line=46 start_col=10 end_line=46 end_col=12} VarRef=bee:45:8
+// CHECK: {start_line=46 start_col=13 end_line=46 end_col=17} ObjCSelectorRef=foo:7:1
+// CHECK: {start_line=46 start_col=18 end_line=47 end_col=1} FunctionDecl=main:44:5
+// CHECK: {start_line=47 start_col=2 end_line=47 end_col=3} TypedefDecl=id:0:0
+// CHECK: {start_line=47 start_col=4 end_line=47 end_col=4} FunctionDecl=main:44:5
+// CHECK: {start_line=47 start_col=5 end_line=47 end_col=5} VarDecl=c:47:12
+// CHECK: {start_line=47 start_col=6 end_line=47 end_col=9} ObjCProtocolRef=SubP:47:12
+// CHECK: {start_line=47 start_col=10 end_line=47 end_col=10} VarDecl=c:47:12
+// CHECK: {start_line=47 start_col=11 end_line=47 end_col=11} FunctionDecl=main:44:5
+// CHECK: {start_line=47 start_col=12 end_line=47 end_col=15} VarDecl=c:47:12
+// CHECK: {start_line=47 start_col=16 end_line=47 end_col=25} ObjCSelectorRef=fooC:8:1
+// CHECK: {start_line=47 start_col=26 end_line=48 end_col=1} FunctionDecl=main:44:5
+// CHECK: {start_line=48 start_col=2 end_line=48 end_col=3} TypedefDecl=id:0:0
+// CHECK: {start_line=48 start_col=4 end_line=48 end_col=4} FunctionDecl=main:44:5
+// CHECK: {start_line=48 start_col=5 end_line=48 end_col=5} VarDecl=d:48:13
+// CHECK: {start_line=48 start_col=6 end_line=48 end_col=10} ObjCProtocolRef=Proto:48:13
+// CHECK: {start_line=48 start_col=11 end_line=48 end_col=11} VarDecl=d:48:13
+// CHECK: {start_line=48 start_col=12 end_line=48 end_col=12} FunctionDecl=main:44:5
+// CHECK: {start_line=48 start_col=13 end_line=48 end_col=13} VarDecl=d:48:13
+// CHECK: {start_line=48 start_col=14 end_line=49 end_col=1} FunctionDecl=main:44:5
+// CHECK: {start_line=49 start_col=2 end_line=49 end_col=2} VarRef=d:48:13
+// CHECK: {start_line=49 start_col=3 end_line=49 end_col=5} FunctionDecl=main:44:5
+// CHECK: {start_line=49 start_col=6 end_line=49 end_col=6} VarRef=c:47:12
+// CHECK: {start_line=49 start_col=7 end_line=50 end_col=1} FunctionDecl=main:44:5
+// CHECK: {start_line=50 start_col=2 end_line=50 end_col=2} ObjCSelectorRef=pMethod:24:1
+// CHECK: {start_line=50 start_col=3 end_line=50 end_col=3} VarRef=d:48:13
+// CHECK: {start_line=50 start_col=4 end_line=50 end_col=12} ObjCSelectorRef=pMethod:24:1
+// CHECK: {start_line=50 start_col=13 end_line=51 end_col=1} FunctionDecl=main:44:5
+// CHECK: {start_line=51 start_col=2 end_line=51 end_col=2} ObjCSelectorRef=catMethodWithFloat::19:1
+// CHECK: {start_line=51 start_col=3 end_line=51 end_col=5} VarRef=bee:45:8
+// CHECK: {start_line=51 start_col=6 end_line=51 end_col=25} ObjCSelectorRef=catMethodWithFloat::19:1
+// CHECK: {start_line=51 start_col=26 end_line=51 end_col=26} ObjCSelectorRef=floatMethod:20:1
+// CHECK: {start_line=51 start_col=27 end_line=51 end_col=29} VarRef=bee:45:8
+// CHECK: {start_line=51 start_col=30 end_line=51 end_col=42} ObjCSelectorRef=floatMethod:20:1
+// CHECK: {start_line=51 start_col=43 end_line=51 end_col=43} ObjCSelectorRef=catMethodWithFloat::19:1
+// CHECK: {start_line=51 start_col=44 end_line=52 end_col=2} FunctionDecl=main:44:5
+// CHECK: {start_line=52 start_col=3 end_line=52 end_col=6} FunctionRef=main:44:5
+// CHECK: {start_line=52 start_col=7 end_line=52 end_col=7} FunctionDecl=main:44:5
+// CHECK: {start_line=52 start_col=8 end_line=52 end_col=15} EnumConstantRef=someEnum:41:3
+// CHECK: {start_line=52 start_col=16 end_line=52 end_col=32} FunctionDecl=main:44:5
+// CHECK: {start_line=52 start_col=33 end_line=52 end_col=35} VarRef=bee:45:8
+// CHECK: {start_line=52 start_col=36 end_line=53 end_col=1} FunctionDecl=main:44:5
+// CHECK: {start_line=53 start_col=2 end_line=160 end_col=1} Invalid Cursor => NoDeclFound
+
diff --git a/test/Index/c-index-pch.c b/test/Index/c-index-pch.c
index aae4eb3669fc0..1ce1085251863 100644
--- a/test/Index/c-index-pch.c
+++ b/test/Index/c-index-pch.c
@@ -1,7 +1,7 @@
-// RUN: clang-cc -emit-pch -x c -o %t.pch %S/c-index-pch.h &&
-// RUN: clang-cc -include-pch %t.pch -x c -emit-pch -o %t.ast %s &&
-// RUN: c-index-test %t.ast all | FileCheck -check-prefix=ALL %s &&
-// RUN: c-index-test %t.ast local | FileCheck -check-prefix=LOCAL %s
+// RUN: clang-cc -emit-pch -x c -o %t.pch %S/Inputs/c-index-pch.h
+// RUN: clang-cc -include-pch %t.pch -x c -emit-pch -o %t.ast %s
+// RUN: c-index-test -test-load-tu %t.ast all | FileCheck -check-prefix=ALL %s
+// RUN: c-index-test -test-load-tu %t.ast local | FileCheck -check-prefix=LOCAL %s
// ALL: FunctionDecl=foo
// ALL: VarDecl=bar
// ALL: FunctionDecl=wibble
diff --git a/test/Index/code-completion.cpp b/test/Index/code-completion.cpp
new file mode 100644
index 0000000000000..44bd9d28932e5
--- /dev/null
+++ b/test/Index/code-completion.cpp
@@ -0,0 +1,53 @@
+// Code-completion through the C interface
+#include "nonexistent_header.h"
+struct X {
+ int member;
+
+ enum E { Val1 };
+};
+
+struct Y {
+ float member;
+ void memfunc(int i = 17);
+};
+
+struct Z : X, Y {
+ double member;
+ operator int() const;
+};
+
+struct Z get_Z();
+
+void test_Z() {
+ // RUN: c-index-test -code-completion-at=%s:23:11 %s | FileCheck -check-prefix=CHECK-MEMBER %s
+ get_Z().member = 17;
+}
+
+
+float& overloaded(int i, long second);
+double& overloaded(float f, int second);
+int& overloaded(Z z, int second);
+
+void test_overloaded() {
+ // RUN: c-index-test -code-completion-at=%s:33:18 %s | FileCheck -check-prefix=CHECK-OVERLOAD %s
+ overloaded(Z(), 0);
+}
+
+// CHECK-MEMBER: EnumDecl:{Informative X::}{TypedText E}
+// CHECK-MEMBER: FieldDecl:{TypedText member}
+// CHECK-MEMBER: FunctionDecl:{Informative Y::}{TypedText memfunc}{LeftParen (}{Optional {Placeholder int i}}{RightParen )}
+// CHECK-MEMBER: EnumConstantDecl:{Informative E::}{TypedText Val1}
+// CHECK-MEMBER: FunctionDecl:{Informative X::}{TypedText ~X}{LeftParen (}{RightParen )}
+// CHECK-MEMBER: FunctionDecl:{TypedText operator int}{LeftParen (}{RightParen )}
+// CHECK-MEMBER: FunctionDecl:{TypedText operator=}{LeftParen (}{Placeholder struct Z const &}{RightParen )}
+// CHECK-MEMBER: StructDecl:{TypedText X}{Text ::}
+// CHECK-MEMBER: StructDecl:{TypedText Y}{Text ::}
+// CHECK-MEMBER: StructDecl:{TypedText Z}{Text ::}
+// CHECK-MEMBER: FieldDecl:{Text X::}{TypedText member}
+// CHECK-MEMBER: FieldDecl:{Text Y::}{TypedText member}
+// CHECK-MEMBER: FunctionDecl:{Text X::}{TypedText operator=}{LeftParen (}{Placeholder struct X const &}{RightParen )}
+// CHECK-MEMBER: FunctionDecl:{Text Y::}{TypedText operator=}{LeftParen (}{Placeholder struct Y const &}{RightParen )}
+
+// CHECK-OVERLOAD: NotImplemented:{Text overloaded}{LeftParen (}{Text struct Z z}{Comma , }{CurrentParameter int second}{RightParen )}
+// CHECK-OVERLOAD: NotImplemented:{Text overloaded}{LeftParen (}{Text int i}{Comma , }{CurrentParameter long second}{RightParen )}
+// CHECK-OVERLOAD: NotImplemented:{Text overloaded}{LeftParen (}{Text float f}{Comma , }{CurrentParameter int second}{RightParen )}
diff --git a/test/Index/comments.c b/test/Index/comments.c
index 689ce88e22138..83bdbf6eed7d0 100644
--- a/test/Index/comments.c
+++ b/test/Index/comments.c
@@ -19,16 +19,16 @@ void g(int);
void h(int); ///< This is a member comment.
-// RUN: clang-cc -emit-pch -o %t.ast %s &&
+// RUN: clang-cc -emit-pch -o %t.ast %s
-// RUN: index-test %t.ast -point-at %s:11:6 > %t &&
-// RUN: grep "starts here" %t &&
-// RUN: grep "block comment" %t &&
+// RUN: index-test %t.ast -point-at %s:11:6 > %t
+// RUN: grep "starts here" %t
+// RUN: grep "block comment" %t
-// RUN: index-test %t.ast -point-at %s:17:6 > %t &&
-// RUN: grep "BCPL" %t &&
-// RUN: grep "But" %t &&
+// RUN: index-test %t.ast -point-at %s:17:6 > %t
+// RUN: grep "BCPL" %t
+// RUN: grep "But" %t
-// RUN: index-test %t.ast -point-at %s:19:6 > %t &&
-// RUN: grep "NOT" %t | count 0 &&
+// RUN: index-test %t.ast -point-at %s:19:6 > %t
+// RUN: grep "NOT" %t | count 0
// RUN: grep "member" %t
diff --git a/test/Index/complete-member-access.m b/test/Index/complete-member-access.m
new file mode 100644
index 0000000000000..9202d0522f4b6
--- /dev/null
+++ b/test/Index/complete-member-access.m
@@ -0,0 +1,30 @@
+/* Note: the RUN lines are near the end of the file, since line/column
+ matter for this test. */
+
+@protocol MyProtocol
+@property float ProtoProp;
+@end
+
+@interface Super {
+ int SuperIVar;
+}
+@end
+@interface Int : Super<MyProtocol>
+{
+ int IVar;
+}
+
+@property int prop1;
+@end
+
+void test_props(Int* ptr) {
+ ptr.prop1 = 0;
+ ptr->IVar = 0;
+}
+
+// RUN: c-index-test -code-completion-at=%s:21:7 %s | FileCheck -check-prefix=CHECK-CC1 %s
+// CHECK-CC1: ObjCPropertyDecl:{TypedText prop1}
+// CHECK-CC1: ObjCPropertyDecl:{TypedText ProtoProp}
+// RUN: c-index-test -code-completion-at=%s:22:8 %s | FileCheck -check-prefix=CHECK-CC2 %s
+// CHECK-CC2: ObjCIvarDecl:{TypedText IVar}
+// CHECK-CC2: ObjCIvarDecl:{TypedText SuperIVar}
diff --git a/test/Index/complete-objc-message.m b/test/Index/complete-objc-message.m
new file mode 100644
index 0000000000000..8f235d39bec2f
--- /dev/null
+++ b/test/Index/complete-objc-message.m
@@ -0,0 +1,107 @@
+// Note: the run lines follow their respective tests, since line/column
+// matter in this test.
+
+@protocol FooTestProtocol
++ protocolClassMethod;
+- protocolInstanceMethod : (int)value;
+@end
+@interface Foo <FooTestProtocol> {
+ void *isa;
+}
++ (int)classMethod1:a withKeyword:(int)b;
++ (void)classMethod2;
++ new;
+- instanceMethod1;
+@end
+
+@interface Foo (FooTestCategory)
++ categoryClassMethod;
+- categoryInstanceMethod;
+@end
+
+void func() {
+ Foo *obj = [Foo new];
+ [obj xx];
+}
+
+@interface MyClass { }
++ (int)MyClassMethod:(id)obj;
+- (int)MyInstMethod:(id)x second:(id)y;
+@end
+
+@interface MySubClass : MyClass { }
++ (int)MySubClassMethod;
+- (int)MySubInstMethod;
+@end
+
+@implementation MyClass
++ (int)MyClassMethod:(id)obj {
+ return 0;
+}
+
++ (int)MyPrivateMethod {
+ return 1;
+}
+
+- (int)MyInstMethod:(id)x second:(id)y {
+ return 2;
+}
+
+- (int)MyPrivateInstMethod {
+ return 3;
+}
+@end
+
+@implementation MySubClass
++ (int)MySubClassMethod {
+ return 2;
+}
+
++ (int)MySubPrivateMethod {
+ return [super MyPrivateMethod];
+}
+
+- (int)MySubInstMethod:(id)obj {
+ return [super MyInstMethod: obj second:obj];
+}
+
+- (int)MyInstMethod:(id)x second:(id)y {
+ return 3;
+}
+@end
+
+void test_super_var(MySubClass *super) {
+ [super MyInstMethod: super second:super];
+}
+
+@protocol FooTestProtocol2
+- (int)secondProtocolInstanceMethod;
+@end
+
+void test_qual_id(id<FooTestProtocol,FooTestProtocol2> ptr) {
+ [ptr protocolInstanceMethod:1];
+}
+
+// RUN: c-index-test -code-completion-at=%s:23:19 %s | FileCheck -check-prefix=CHECK-CC1 %s
+// CHECK-CC1: {TypedText categoryClassMethod}
+// CHECK-CC1: {TypedText classMethod1:}{Placeholder (id)a}{Text withKeyword:}{Placeholder (int)b}
+// CHECK-CC1: {TypedText classMethod2}
+// CHECK-CC1: {TypedText new}
+// CHECK-CC1: {TypedText protocolClassMethod}
+// RUN: c-index-test -code-completion-at=%s:24:8 %s | FileCheck -check-prefix=CHECK-CC2 %s
+// CHECK-CC2: {TypedText categoryInstanceMethod}
+// CHECK-CC2: {TypedText instanceMethod1}
+// CHECK-CC2: {TypedText protocolInstanceMethod:}{Placeholder (int)value}
+// RUN: c-index-test -code-completion-at=%s:61:16 %s | FileCheck -check-prefix=CHECK-CC3 %s
+// CHECK-CC3: ObjCClassMethodDecl:{TypedText MyClassMethod:}{Placeholder (id)obj}
+// CHECK-CC3: ObjCClassMethodDecl:{TypedText MyPrivateMethod}
+// RUN: c-index-test -code-completion-at=%s:65:16 %s | FileCheck -check-prefix=CHECK-CC4 %s
+// CHECK-CC4: ObjCInstanceMethodDecl:{TypedText MyInstMethod:}{Placeholder (id)x}{Text second:}{Placeholder (id)y}
+// CHECK-CC4: ObjCInstanceMethodDecl:{TypedText MyPrivateInstMethod}
+// RUN: c-index-test -code-completion-at=%s:74:9 %s | FileCheck -check-prefix=CHECK-CC5 %s
+// CHECK-CC5: ObjCInstanceMethodDecl:{TypedText MyInstMethod:}{Placeholder (id)x}{Text second:}{Placeholder (id)y}
+// CHECK-CC5: ObjCInstanceMethodDecl:{TypedText MySubInstMethod}
+// RUN: c-index-test -code-completion-at=%s:82:8 %s | FileCheck -check-prefix=CHECK-CC6 %s
+// CHECK-CC6: ObjCInstanceMethodDecl:{TypedText protocolInstanceMethod:}{Placeholder (int)value}
+// CHECK-CC6: ObjCInstanceMethodDecl:{TypedText secondProtocolInstanceMethod}
+
diff --git a/test/Index/complete-protocols.m b/test/Index/complete-protocols.m
new file mode 100644
index 0000000000000..89f61bcf9ac9e
--- /dev/null
+++ b/test/Index/complete-protocols.m
@@ -0,0 +1,25 @@
+/* Note: the RUN lines are near the end of the file, since line/column
+ matter for this test. */
+
+@protocol Protocol1
+@end
+
+@protocol Protocol2;
+
+void f(id<Protocol1,Protocol2>);
+
+@protocol Protocol0;
+@protocol NewProtocol
+{
+}
+@end
+
+// RUN: c-index-test -code-completion-at=%s:9:11 %s | FileCheck -check-prefix=CHECK-CC1 %s
+// CHECK-CC1: ObjCProtocolDecl:{TypedText Protocol1}
+// CHECK-CC1: ObjCProtocolDecl:{TypedText Protocol2}
+// RUN: c-index-test -code-completion-at=%s:9:21 %s | FileCheck -check-prefix=CHECK-CC2 %s
+// CHECK-CC2-NOT: ObjCProtocolDecl:{TypedText Protocol1}
+// CHECK-CC2: ObjCProtocolDecl:{TypedText Protocol2}
+// RUN: c-index-test -code-completion-at=%s:12:11 %s | FileCheck -check-prefix=CHECK-CC3 %s
+// CHECK-CC3: ObjCProtocolDecl:{TypedText Protocol0}
+// CHECK-CC3-NEXT: ObjCProtocolDecl:{TypedText Protocol2}
diff --git a/test/Index/find-decls.c b/test/Index/find-decls.c
index 50a233d75ba5d..99a32428005b1 100644
--- a/test/Index/find-decls.c
+++ b/test/Index/find-decls.c
@@ -1,25 +1,25 @@
-// RUN: clang-cc -fblocks -emit-pch %S/t1.c -o %t1.ast &&
-// RUN: clang-cc -fblocks -emit-pch %S/t2.c -o %t2.ast &&
+// RUN: clang-cc -fblocks -emit-pch %S/Inputs/t1.c -o %t1.ast
+// RUN: clang-cc -fblocks -emit-pch %S/Inputs/t2.c -o %t2.ast
-// RUN: index-test %t1.ast %t2.ast -point-at %S/t1.c:8:7 -print-decls > %t &&
-// RUN: cat %t | count 3 &&
-// RUN: grep 'foo.h:4:6,' %t | count 2 &&
-// RUN: grep 't2.c:5:6,' %t &&
+// RUN: index-test %t1.ast %t2.ast -point-at %S/Inputs/t1.c:8:7 -print-decls > %t
+// RUN: cat %t | count 3
+// RUN: grep 'foo.h:4:6,' %t | count 2
+// RUN: grep 't2.c:5:6,' %t
-// RUN: index-test %t1.ast %t2.ast -point-at %S/t1.c:5:47 -print-decls > %t &&
-// RUN: cat %t | count 1 &&
-// RUN: grep 't1.c:5:12,' %t &&
+// RUN: index-test %t1.ast %t2.ast -point-at %S/Inputs/t1.c:5:47 -print-decls > %t
+// RUN: cat %t | count 1
+// RUN: grep 't1.c:5:12,' %t
-// RUN: index-test %t1.ast %t2.ast -point-at %S/t1.c:6:20 -print-decls > %t &&
-// RUN: cat %t | count 1 &&
-// RUN: grep 't1.c:3:19,' %t &&
+// RUN: index-test %t1.ast %t2.ast -point-at %S/Inputs/t1.c:6:20 -print-decls > %t
+// RUN: cat %t | count 1
+// RUN: grep 't1.c:3:19,' %t
// field test
-// RUN: index-test %t1.ast %t2.ast -point-at %S/t1.c:21:6 -print-decls > %t &&
-// RUN: cat %t | count 1 &&
-// RUN: grep 't1.c:12:7,' %t &&
+// RUN: index-test %t1.ast %t2.ast -point-at %S/Inputs/t1.c:21:6 -print-decls > %t
+// RUN: cat %t | count 1
+// RUN: grep 't1.c:12:7,' %t
-// RUN: index-test %t1.ast %t2.ast -point-at %S/t1.c:22:21 -print-decls > %t &&
-// RUN: cat %t | count 1 &&
+// RUN: index-test %t1.ast %t2.ast -point-at %S/Inputs/t1.c:22:21 -print-decls > %t
+// RUN: cat %t | count 1
// RUN: grep 't1.c:16:7,' %t
diff --git a/test/Index/find-defs.c b/test/Index/find-defs.c
index 0e63ae7600479..fb540727341a2 100644
--- a/test/Index/find-defs.c
+++ b/test/Index/find-defs.c
@@ -1,18 +1,18 @@
-// RUN: clang-cc -fblocks -emit-pch %S/t1.c -o %t1.ast &&
-// RUN: clang-cc -fblocks -emit-pch %S/t2.c -o %t2.ast &&
+// RUN: clang-cc -fblocks -emit-pch %S/Inputs/t1.c -o %t1.ast
+// RUN: clang-cc -fblocks -emit-pch %S/Inputs/t2.c -o %t2.ast
-// RUN: index-test %t1.ast %t2.ast -point-at %S/foo.h:1:14 -print-defs > %t &&
-// RUN: cat %t | count 1 &&
-// RUN: grep 't2.c:3:5,' %t &&
+// RUN: index-test %t1.ast %t2.ast -point-at %S/Inputs/foo.h:1:14 -print-defs > %t
+// RUN: cat %t | count 1
+// RUN: grep 't2.c:3:5,' %t
-// RUN: index-test %t1.ast %t2.ast -point-at %S/foo.h:3:9 -print-defs > %t &&
-// RUN: cat %t | count 1 &&
-// RUN: grep 't1.c:3:6,' %t &&
+// RUN: index-test %t1.ast %t2.ast -point-at %S/Inputs/foo.h:3:9 -print-defs > %t
+// RUN: cat %t | count 1
+// RUN: grep 't1.c:3:6,' %t
-// RUN: index-test %t1.ast %t2.ast -point-at %S/foo.h:4:9 -print-defs > %t &&
-// RUN: cat %t | count 1 &&
-// RUN: grep 't2.c:5:6,' %t &&
+// RUN: index-test %t1.ast %t2.ast -point-at %S/Inputs/foo.h:4:9 -print-defs > %t
+// RUN: cat %t | count 1
+// RUN: grep 't2.c:5:6,' %t
-// RUN: index-test %t1.ast %t2.ast -point-at %S/t1.c:8:7 -print-defs > %t &&
-// RUN: cat %t | count 1 &&
+// RUN: index-test %t1.ast %t2.ast -point-at %S/Inputs/t1.c:8:7 -print-defs > %t
+// RUN: cat %t | count 1
// RUN: grep 't2.c:5:6,' %t
diff --git a/test/Index/find-refs.c b/test/Index/find-refs.c
index 1b58b37527730..5209e141b629d 100644
--- a/test/Index/find-refs.c
+++ b/test/Index/find-refs.c
@@ -1,47 +1,47 @@
-// RUN: clang-cc -fblocks -emit-pch %S/t1.c -o %t1.ast &&
-// RUN: clang-cc -fblocks -emit-pch %S/t2.c -o %t2.ast &&
+// RUN: clang-cc -fblocks -emit-pch %S/Inputs/t1.c -o %t1.ast
+// RUN: clang-cc -fblocks -emit-pch %S/Inputs/t2.c -o %t2.ast
-// RUN: index-test %t1.ast %t2.ast -point-at %S/foo.h:1:14 -print-refs > %t &&
-// RUN: cat %t | count 4 &&
-// RUN: grep 't1.c:4:19,' %t &&
-// RUN: grep 't1.c:28:40,' %t &&
-// RUN: grep 't2.c:6:3,' %t &&
-// RUN: grep 't2.c:7:12,' %t &&
+// RUN: index-test %t1.ast %t2.ast -point-at %S/Inputs/foo.h:1:14 -print-refs > %t
+// RUN: cat %t | count 4
+// RUN: grep 't1.c:4:19,' %t
+// RUN: grep 't1.c:28:40,' %t
+// RUN: grep 't2.c:6:3,' %t
+// RUN: grep 't2.c:7:12,' %t
-// RUN: index-test %t1.ast %t2.ast -point-at %S/foo.h:3:9 -print-refs > %t &&
-// RUN: cat %t | count 1 &&
-// RUN: grep 't2.c:7:3,' %t &&
+// RUN: index-test %t1.ast %t2.ast -point-at %S/Inputs/foo.h:3:9 -print-refs > %t
+// RUN: cat %t | count 1
+// RUN: grep 't2.c:7:3,' %t
-// RUN: index-test %t1.ast %t2.ast -point-at %S/foo.h:4:9 -print-refs > %t &&
-// RUN: cat %t | count 1 &&
-// RUN: grep 't1.c:8:3,' %t &&
+// RUN: index-test %t1.ast %t2.ast -point-at %S/Inputs/foo.h:4:9 -print-refs > %t
+// RUN: cat %t | count 1
+// RUN: grep 't1.c:8:3,' %t
-// RUN: index-test %t1.ast %t2.ast -point-at %S/t1.c:3:22 -print-refs > %t &&
-// RUN: cat %t | count 1 &&
-// RUN: grep 't1.c:6:17,' %t &&
+// RUN: index-test %t1.ast %t2.ast -point-at %S/Inputs/t1.c:3:22 -print-refs > %t
+// RUN: cat %t | count 1
+// RUN: grep 't1.c:6:17,' %t
-// RUN: index-test %t1.ast %t2.ast -point-at %S/t1.c:4:11 -print-refs > %t &&
-// RUN: cat %t | count 1 &&
-// RUN: grep 't1.c:6:5,' %t &&
+// RUN: index-test %t1.ast %t2.ast -point-at %S/Inputs/t1.c:4:11 -print-refs > %t
+// RUN: cat %t | count 1
+// RUN: grep 't1.c:6:5,' %t
-// RUN: index-test %t1.ast %t2.ast -point-at %S/t1.c:5:30 -print-refs > %t &&
-// RUN: cat %t | count 3 &&
-// RUN: grep 't1.c:5:27,' %t &&
-// RUN: grep 't1.c:5:44,' %t &&
-// RUN: grep 't1.c:6:26,' %t &&
+// RUN: index-test %t1.ast %t2.ast -point-at %S/Inputs/t1.c:5:30 -print-refs > %t
+// RUN: cat %t | count 3
+// RUN: grep 't1.c:5:27,' %t
+// RUN: grep 't1.c:5:44,' %t
+// RUN: grep 't1.c:6:26,' %t
// field test
// FIXME: References point at the start of MemberExpr, make them point at the field instead.
-// RUN: index-test %t1.ast %t2.ast -point-at %S/t1.c:12:7 -print-refs > %t &&
-// RUN: cat %t | count 1 &&
-// RUN: grep 't1.c:21:3,' %t &&
+// RUN: index-test %t1.ast %t2.ast -point-at %S/Inputs/t1.c:12:7 -print-refs > %t
+// RUN: cat %t | count 1
+// RUN: grep 't1.c:21:3,' %t
-// RUN: index-test %t1.ast %t2.ast -point-at %S/t1.c:16:7 -print-refs > %t &&
-// RUN: cat %t | count 1 &&
-// RUN: grep 't1.c:22:3,' %t &&
+// RUN: index-test %t1.ast %t2.ast -point-at %S/Inputs/t1.c:16:7 -print-refs > %t
+// RUN: cat %t | count 1
+// RUN: grep 't1.c:22:3,' %t
-// RUN: index-test %t1.ast %t2.ast -point-at %S/foo.h:7:11 -print-refs > %t &&
-// RUN: cat %t | count 2 &&
-// RUN: grep 't1.c:25:3,' %t &&
+// RUN: index-test %t1.ast %t2.ast -point-at %S/Inputs/foo.h:7:11 -print-refs > %t
+// RUN: cat %t | count 2
+// RUN: grep 't1.c:25:3,' %t
// RUN: grep 't2.c:10:3,' %t
diff --git a/test/Index/multiple-redecls.c b/test/Index/multiple-redecls.c
index 6f1f75b02f39a..ea6d00b6a3c4e 100644
--- a/test/Index/multiple-redecls.c
+++ b/test/Index/multiple-redecls.c
@@ -1,5 +1,5 @@
-// RUN: clang-cc -emit-pch %s -o %t.ast &&
-// RUN: index-test %t.ast -point-at %s:8:4 -print-decls | count 2 &&
+// RUN: clang-cc -emit-pch %s -o %t.ast
+// RUN: index-test %t.ast -point-at %s:8:4 -print-decls | count 2
// RUN: index-test %t.ast -point-at %s:8:4 -print-defs | count 1
static void foo(int x);
diff --git a/test/Index/objc-decls.m b/test/Index/objc-decls.m
index 1a8ab4b5577e7..ff396788771df 100644
--- a/test/Index/objc-decls.m
+++ b/test/Index/objc-decls.m
@@ -1,16 +1,16 @@
-// RUN: clang-cc -emit-pch %S/t1.m -o %t1.m.ast &&
-// RUN: clang-cc -emit-pch %S/t2.m -o %t2.m.ast &&
+// RUN: clang-cc -emit-pch %S/Inputs/t1.m -o %t1.m.ast
+// RUN: clang-cc -emit-pch %S/Inputs/t2.m -o %t2.m.ast
-// RUN: index-test %t1.m.ast %t2.m.ast -point-at %S/t1.m:12:12 -print-decls > %t &&
-// RUN: cat %t | count 2 &&
-// RUN: grep 'objc.h:2:9,' %t | count 2 &&
+// RUN: index-test %t1.m.ast %t2.m.ast -point-at %S/Inputs/t1.m:12:12 -print-decls > %t
+// RUN: cat %t | count 2
+// RUN: grep 'objc.h:2:9,' %t | count 2
-// RUN: index-test %t1.m.ast %t2.m.ast -point-at %S/objc.h:5:13 -print-decls > %t &&
-// RUN: cat %t | count 3 &&
-// RUN: grep 'objc.h:5:1,' %t | count 2 &&
-// RUN: grep 't1.m:15:1,' %t | count 1 &&
+// RUN: index-test %t1.m.ast %t2.m.ast -point-at %S/Inputs/objc.h:5:13 -print-decls > %t
+// RUN: cat %t | count 3
+// RUN: grep 'objc.h:5:1,' %t | count 2
+// RUN: grep 't1.m:15:1,' %t | count 1
-// RUN: index-test %t1.m.ast %t2.m.ast -point-at %S/objc.h:10:13 -print-decls > %t &&
-// RUN: cat %t | count 3 &&
-// RUN: grep 'objc.h:10:1,' %t | count 2 &&
+// RUN: index-test %t1.m.ast %t2.m.ast -point-at %S/Inputs/objc.h:10:13 -print-decls > %t
+// RUN: cat %t | count 3
+// RUN: grep 'objc.h:10:1,' %t | count 2
// RUN: grep 't2.m:11:1,' %t | count 1
diff --git a/test/Index/objc-message.m b/test/Index/objc-message.m
index 45ce83876cfeb..de61278af87e8 100644
--- a/test/Index/objc-message.m
+++ b/test/Index/objc-message.m
@@ -1,38 +1,38 @@
-// RUN: clang-cc -emit-pch %S/t1.m -o %t1.m.ast &&
-// RUN: clang-cc -emit-pch %S/t2.m -o %t2.m.ast &&
+// RUN: clang-cc -emit-pch %S/Inputs/t1.m -o %t1.m.ast
+// RUN: clang-cc -emit-pch %S/Inputs/t2.m -o %t2.m.ast
-// RUN: index-test %t1.m.ast %t2.m.ast -point-at %S/objc.h:5:13 -print-refs > %t &&
-// RUN: cat %t | count 1 &&
-// RUN: grep 't1.m:6:3,' %t &&
+// RUN: index-test %t1.m.ast %t2.m.ast -point-at %S/Inputs/objc.h:5:13 -print-refs > %t
+// RUN: cat %t | count 1
+// RUN: grep 't1.m:6:3,' %t
-// RUN: index-test %t1.m.ast %t2.m.ast -point-at %S/objc.h:6:13 -print-refs > %t &&
-// RUN: cat %t | count 2 &&
-// RUN: grep 't1.m:7:3,' %t &&
-// RUN: grep 't2.m:7:3,' %t &&
+// RUN: index-test %t1.m.ast %t2.m.ast -point-at %S/Inputs/objc.h:6:13 -print-refs > %t
+// RUN: cat %t | count 2
+// RUN: grep 't1.m:7:3,' %t
+// RUN: grep 't2.m:7:3,' %t
-// RUN: index-test %t1.m.ast %t2.m.ast -point-at %S/objc.h:10:13 -print-refs > %t &&
-// RUN: cat %t | count 2 &&
-// RUN: grep 't1.m:6:3,' %t &&
-// RUN: grep 't2.m:6:3,' %t &&
+// RUN: index-test %t1.m.ast %t2.m.ast -point-at %S/Inputs/objc.h:10:13 -print-refs > %t
+// RUN: cat %t | count 2
+// RUN: grep 't1.m:6:3,' %t
+// RUN: grep 't2.m:6:3,' %t
-// RUN: index-test %t1.m.ast %t2.m.ast -point-at %S/t1.m:6:15 -print-decls > %t &&
-// RUN: cat %t | count 6 &&
-// RUN: grep 'objc.h:5:1,' %t | count 2 &&
-// RUN: grep 'objc.h:10:1,' %t | count 2 &&
-// RUN: grep 't1.m:15:1,' %t &&
-// RUN: grep 't2.m:11:1,' %t &&
+// RUN: index-test %t1.m.ast %t2.m.ast -point-at %S/Inputs/t1.m:6:15 -print-decls > %t
+// RUN: cat %t | count 6
+// RUN: grep 'objc.h:5:1,' %t | count 2
+// RUN: grep 'objc.h:10:1,' %t | count 2
+// RUN: grep 't1.m:15:1,' %t
+// RUN: grep 't2.m:11:1,' %t
-// RUN: index-test %t1.m.ast %t2.m.ast -point-at %S/t1.m:7:15 -print-decls > %t &&
-// RUN: cat %t | count 3 &&
-// RUN: grep 'objc.h:6:1,' %t | count 2 &&
-// RUN: grep 't1.m:18:1,' %t &&
+// RUN: index-test %t1.m.ast %t2.m.ast -point-at %S/Inputs/t1.m:7:15 -print-decls > %t
+// RUN: cat %t | count 3
+// RUN: grep 'objc.h:6:1,' %t | count 2
+// RUN: grep 't1.m:18:1,' %t
-// RUN: index-test %t2.m.ast %t1.m.ast -point-at %S/t2.m:6:15 -print-decls > %t &&
-// RUN: cat %t | count 3 &&
-// RUN: grep 'objc.h:10:1,' %t | count 2 &&
-// RUN: grep 't2.m:11:1,' %t &&
+// RUN: index-test %t2.m.ast %t1.m.ast -point-at %S/Inputs/t2.m:6:15 -print-decls > %t
+// RUN: cat %t | count 3
+// RUN: grep 'objc.h:10:1,' %t | count 2
+// RUN: grep 't2.m:11:1,' %t
-// RUN: index-test %t2.m.ast %t1.m.ast -point-at %S/t2.m:7:15 -print-decls > %t &&
-// RUN: cat %t | count 3 &&
-// RUN: grep 'objc.h:6:1,' %t | count 2 &&
+// RUN: index-test %t2.m.ast %t1.m.ast -point-at %S/Inputs/t2.m:7:15 -print-decls > %t
+// RUN: cat %t | count 3
+// RUN: grep 'objc.h:6:1,' %t | count 2
// RUN: grep 't1.m:18:1,' %t
diff --git a/test/Index/resolve-loc.c b/test/Index/resolve-loc.c
index cae86f38dd6d4..f4697171ee185 100644
--- a/test/Index/resolve-loc.c
+++ b/test/Index/resolve-loc.c
@@ -16,22 +16,22 @@ struct S {
};
-// RUN: clang-cc -emit-pch %s -o %t.ast &&
-// RUN: index-test %t.ast -point-at %s:3:8 | grep top_var &&
-// RUN: index-test %t.ast -point-at %s:5:15 | grep top_func_decl &&
-// RUN: index-test %t.ast -point-at %s:5:25 | grep param1 &&
-// RUN: index-test %t.ast -point-at %s:7:17 | grep top_func_def &&
-// RUN: index-test %t.ast -point-at %s:7:23 | grep param2 &&
-// RUN: index-test %t.ast -point-at %s:8:10 | grep local_var1 &&
-// RUN: index-test %t.ast -point-at %s:9:15 | grep for_var &&
+// RUN: clang-cc -emit-pch %s -o %t.ast
+// RUN: index-test %t.ast -point-at %s:3:8 | grep top_var
+// RUN: index-test %t.ast -point-at %s:5:15 | grep top_func_decl
+// RUN: index-test %t.ast -point-at %s:5:25 | grep param1
+// RUN: index-test %t.ast -point-at %s:7:17 | grep top_func_def
+// RUN: index-test %t.ast -point-at %s:7:23 | grep param2
+// RUN: index-test %t.ast -point-at %s:8:10 | grep local_var1
+// RUN: index-test %t.ast -point-at %s:9:15 | grep for_var
-// RUN: index-test %t.ast -point-at %s:9:43 > %t &&
-// RUN: grep '++for_var' %t &&
+// RUN: index-test %t.ast -point-at %s:9:43 > %t
+// RUN: grep '++for_var' %t
-// RUN: index-test %t.ast -point-at %s:10:9 | grep local_var2 &&
+// RUN: index-test %t.ast -point-at %s:10:9 | grep local_var2
-// RUN: index-test %t.ast -point-at %s:10:30 > %t &&
-// RUN: grep 'for_var + 1' %t &&
+// RUN: index-test %t.ast -point-at %s:10:30 > %t
+// RUN: grep 'for_var + 1' %t
// fields test.
// RUN: index-test %t.ast -point-at %s:15:10 | grep field_var