summaryrefslogtreecommitdiffstats
path: root/test/Index
diff options
context:
space:
mode:
Diffstat (limited to 'test/Index')
-rw-r--r--test/Index/Inputs/remap-complete-to.c1
-rw-r--r--test/Index/TestClassDecl.m2
-rw-r--r--test/Index/TestClassForwardDecl.m2
-rw-r--r--test/Index/c-index-api-fn-scan.m2
-rw-r--r--test/Index/c-index-api-loadTU-test.m2
-rw-r--r--test/Index/c-index-getCursor-test.m2
-rw-r--r--test/Index/cindex-from-source.m9
-rw-r--r--test/Index/cindex-on-invalid.m8
-rw-r--r--test/Index/code-completion.cpp7
-rw-r--r--test/Index/complete-at-directives.m24
-rw-r--r--test/Index/complete-at-exprstmt.m23
-rw-r--r--test/Index/complete-objc-message.m11
-rw-r--r--test/Index/objc-decls.m4
-rw-r--r--test/Index/objc-message.m4
-rw-r--r--test/Index/remap-complete.c5
15 files changed, 93 insertions, 13 deletions
diff --git a/test/Index/Inputs/remap-complete-to.c b/test/Index/Inputs/remap-complete-to.c
new file mode 100644
index 0000000..9f8be2c
--- /dev/null
+++ b/test/Index/Inputs/remap-complete-to.c
@@ -0,0 +1 @@
+void f0() { }
diff --git a/test/Index/TestClassDecl.m b/test/Index/TestClassDecl.m
index 9009f78..12ae4f4 100644
--- a/test/Index/TestClassDecl.m
+++ b/test/Index/TestClassDecl.m
@@ -1,4 +1,4 @@
-// RUN: clang-cc -triple x86_64-apple-darwin10 -fobjc-nonfragile-abi -fblocks -emit-pch -x objective-c %s -o %t.ast
+// RUN: clang -cc1 -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
diff --git a/test/Index/TestClassForwardDecl.m b/test/Index/TestClassForwardDecl.m
index 31b7c6c..db9a1eb 100644
--- a/test/Index/TestClassForwardDecl.m
+++ b/test/Index/TestClassForwardDecl.m
@@ -1,4 +1,4 @@
-// RUN: clang-cc -triple x86_64-apple-darwin10 -fobjc-nonfragile-abi -fblocks -emit-pch -x objective-c %s -o %t.ast
+// RUN: clang -cc1 -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
diff --git a/test/Index/c-index-api-fn-scan.m b/test/Index/c-index-api-fn-scan.m
index 3e2c9c2..0350d87 100644
--- a/test/Index/c-index-api-fn-scan.m
+++ b/test/Index/c-index-api-fn-scan.m
@@ -1,4 +1,4 @@
-// RUN: clang-cc -triple x86_64-apple-darwin10 -fobjc-nonfragile-abi -fblocks -emit-pch -x objective-c %s -o %t.ast
+// RUN: clang -cc1 -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 scan-function | FileCheck %s
diff --git a/test/Index/c-index-api-loadTU-test.m b/test/Index/c-index-api-loadTU-test.m
index 1d5a9a8..446f588 100644
--- a/test/Index/c-index-api-loadTU-test.m
+++ b/test/Index/c-index-api-loadTU-test.m
@@ -1,4 +1,4 @@
-// RUN: clang-cc -triple x86_64-apple-darwin10 -fobjc-nonfragile-abi -fblocks -emit-pch -x objective-c %s -o %t.ast
+// RUN: clang -cc1 -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
diff --git a/test/Index/c-index-getCursor-test.m b/test/Index/c-index-getCursor-test.m
index 3653a9c..d6081bc 100644
--- a/test/Index/c-index-getCursor-test.m
+++ b/test/Index/c-index-getCursor-test.m
@@ -1,4 +1,4 @@
-// RUN: clang-cc -triple x86_64-apple-darwin10 -fobjc-nonfragile-abi -fblocks -emit-pch -x objective-c %s -o %t.ast
+// RUN: clang -cc1 -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
{
diff --git a/test/Index/cindex-from-source.m b/test/Index/cindex-from-source.m
new file mode 100644
index 0000000..8d6a1de
--- /dev/null
+++ b/test/Index/cindex-from-source.m
@@ -0,0 +1,9 @@
+// RUN: echo 'typedef int t0;' > %t.pfx.h
+// RUN: clang -x objective-c-header %t.pfx.h -o %t.pfx.h.gch
+// RUN: c-index-test -test-load-source local %s -include %t.pfx.h > %t
+// RUN: FileCheck %s < %t
+// CHECK: cindex-from-source.m:{{.*}}:{{.*}}: StructDecl=s0:{{.*}}:{{.*}} [Context=cindex-from-source.m]
+// CHECK: cindex-from-source.m:{{.*}}:{{.*}}: VarDecl=g0:{{.*}}:{{.*}} [Context=cindex-from-source.m]
+
+struct s0 {};
+t0 g0;
diff --git a/test/Index/cindex-on-invalid.m b/test/Index/cindex-on-invalid.m
new file mode 100644
index 0000000..651c40a
--- /dev/null
+++ b/test/Index/cindex-on-invalid.m
@@ -0,0 +1,8 @@
+// RUN: not c-index-test -test-load-source local %s > %t 2> %t.err
+// RUN: FileCheck %s < %t.err
+
+// CHECK: error: expected identifier or '('
+// CHECK: Unable to load translation unit!
+
+int foo;
+int
diff --git a/test/Index/code-completion.cpp b/test/Index/code-completion.cpp
index 44bd9d2..c286c82 100644
--- a/test/Index/code-completion.cpp
+++ b/test/Index/code-completion.cpp
@@ -33,20 +33,19 @@ void test_overloaded() {
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-MEMBER: StructDecl:{TypedText X}{Text ::}
+// CHECK-MEMBER: StructDecl:{TypedText Y}{Text ::}
+// CHECK-MEMBER: StructDecl:{TypedText Z}{Text ::}
// 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 )}
diff --git a/test/Index/complete-at-directives.m b/test/Index/complete-at-directives.m
new file mode 100644
index 0000000..68d1ef4
--- /dev/null
+++ b/test/Index/complete-at-directives.m
@@ -0,0 +1,24 @@
+/* Run lines are at the end, since line/column matter in this test. */
+@interface MyClass { }
+@end
+
+@implementation MyClass
+@end
+
+// RUN: c-index-test -code-completion-at=%s:2:2 %s | FileCheck -check-prefix=CHECK-CC1 %s
+// CHECK-CC1: {TypedText class}{Text }{Placeholder identifier}{Text ;}
+// CHECK-CC1: {TypedText compatibility_alias}{Text }{Placeholder alias}{Text }{Placeholder class}
+// CHECK-CC1: {TypedText implementation}{Text }{Placeholder class}
+// CHECK-CC1: {TypedText interface}{Text }{Placeholder class}
+// CHECK-CC1: {TypedText protocol}{Text }{Placeholder protocol}
+
+// RUN: c-index-test -code-completion-at=%s:3:2 %s | FileCheck -check-prefix=CHECK-CC2 %s
+// CHECK-CC2: {TypedText end}
+// CHECK-CC2: {TypedText optional}
+// CHECK-CC2: {TypedText property}
+// CHECK-CC2: {TypedText required}
+
+// RUN: c-index-test -code-completion-at=%s:6:2 %s | FileCheck -check-prefix=CHECK-CC3 %s
+// CHECK-CC3: {TypedText dynamic}{Text }{Placeholder property}
+// CHECK-CC3: {TypedText end}
+// CHECK-CC3: {TypedText synthesize}{Text }{Placeholder property}
diff --git a/test/Index/complete-at-exprstmt.m b/test/Index/complete-at-exprstmt.m
new file mode 100644
index 0000000..82c3983
--- /dev/null
+++ b/test/Index/complete-at-exprstmt.m
@@ -0,0 +1,23 @@
+/* The run lines are below, because this test is line- and
+ column-number sensitive. */
+@interface MyClass { }
+- (int)myMethod:(int)arg;
+@end
+
+@implementation MyClass
+- (int)myMethod:(int)arg {
+ @synchronized (@encode(MyClass)) { }
+}
+@end
+// RUN: c-index-test -code-completion-at=%s:9:4 %s | FileCheck -check-prefix=CHECK-CC1 %s
+// CHECK-CC1: {TypedText encode}{LeftParen (}{Placeholder type-name}{RightParen )}
+// CHECK-CC1: {TypedText protocol}{LeftParen (}{Placeholder protocol-name}{RightParen )}
+// CHECK-CC1: {TypedText selector}{LeftParen (}{Placeholder selector}{RightParen )}
+// CHECK-CC1: {TypedText synchronized}{Text }{LeftParen (}{Placeholder expression}{RightParen )}{LeftBrace {}{Placeholder statements}{RightBrace }}
+// CHECK-CC1: {TypedText throw}{Text }{Placeholder expression}{Text ;}
+// CHECK-CC1: {TypedText try}{LeftBrace {}{Placeholder statements}{RightBrace }}{Text @catch}{LeftParen (}{Placeholder parameter}{RightParen )}{LeftBrace {}{Placeholder statements}{RightBrace }}{Text @finally}{LeftBrace {}{Placeholder statements}{RightBrace }}
+// RUN: c-index-test -code-completion-at=%s:9:19 %s | FileCheck -check-prefix=CHECK-CC2 %s
+// CHECK-CC2: {TypedText encode}{LeftParen (}{Placeholder type-name}{RightParen )}
+// CHECK-CC2: {TypedText protocol}{LeftParen (}{Placeholder protocol-name}{RightParen )}
+// CHECK-CC2: {TypedText selector}{LeftParen (}{Placeholder selector}{RightParen )}
+
diff --git a/test/Index/complete-objc-message.m b/test/Index/complete-objc-message.m
index b692986c..1c03095 100644
--- a/test/Index/complete-objc-message.m
+++ b/test/Index/complete-objc-message.m
@@ -132,3 +132,14 @@ void test_overload(Overload *ovl) {
// RUN: c-index-test -code-completion-at=%s:95:24 %s | FileCheck -check-prefix=CHECK-CC9 %s
// CHECK-CC9: ObjCInstanceMethodDecl:{Informative Method:}{Informative Arg1:}{TypedText Arg2:}{Placeholder (int)i2}
// CHECK-CC9: ObjCInstanceMethodDecl:{Informative Method:}{Informative Arg1:}{TypedText OtherArg:}{Placeholder (id)obj}
+// RUN: c-index-test -code-completion-at=%s:61:11 %s | FileCheck -check-prefix=CHECK-CCA %s
+// CHECK-CCA: {TypedText _cmd}
+// CHECK-CCA: {TypedText self}
+// CHECK-CCA: TypedefDecl:{TypedText Class}
+// CHECK-CCA: ObjCInterfaceDecl:{TypedText Foo}
+// CHECK-CCA: FunctionDecl:{TypedText func}{LeftParen (}{RightParen )}
+// CHECK-CCA: TypedefDecl:{TypedText id}
+// CHECK-CCA: ObjCInterfaceDecl:{TypedText MyClass}
+// CHECK-CCA: ObjCInterfaceDecl:{TypedText MySubClass}
+// CHECK-CCA: TypedefDecl:{TypedText SEL}
+// CHECK-CCA: {TypedText super}
diff --git a/test/Index/objc-decls.m b/test/Index/objc-decls.m
index ff39678..62a43da 100644
--- a/test/Index/objc-decls.m
+++ b/test/Index/objc-decls.m
@@ -1,5 +1,5 @@
-// 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: clang -cc1 -emit-pch %S/Inputs/t1.m -o %t1.m.ast
+// RUN: clang -cc1 -emit-pch %S/Inputs/t2.m -o %t2.m.ast
// 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
diff --git a/test/Index/objc-message.m b/test/Index/objc-message.m
index de61278..568ca94 100644
--- a/test/Index/objc-message.m
+++ b/test/Index/objc-message.m
@@ -1,5 +1,5 @@
-// 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: clang -cc1 -emit-pch %S/Inputs/t1.m -o %t1.m.ast
+// RUN: clang -cc1 -emit-pch %S/Inputs/t2.m -o %t2.m.ast
// 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
diff --git a/test/Index/remap-complete.c b/test/Index/remap-complete.c
new file mode 100644
index 0000000..cfafd30
--- /dev/null
+++ b/test/Index/remap-complete.c
@@ -0,0 +1,5 @@
+// RUN: c-index-test -code-completion-at=%s:1:12 -remap-file="%s;%S/Inputs/remap-complete-to.c" %s | FileCheck %s
+// XFAIL: win32
+
+// CHECK: FunctionDecl:{TypedText f0}{LeftParen (}{RightParen )}
+void f() { }
OpenPOWER on IntegriCloud