diff options
| author | Roman Divacky <rdivacky@FreeBSD.org> | 2010-07-13 17:21:42 +0000 |
|---|---|---|
| committer | Roman Divacky <rdivacky@FreeBSD.org> | 2010-07-13 17:21:42 +0000 |
| commit | 4ba675006b5a8edfc48b6a9bd3dcf54a70cc08f2 (patch) | |
| tree | 48b44512b5db8ced345df4a1a56b5065cf2a14d9 /test/Index | |
| parent | d7279c4c177bca357ef96ff1379fd9bc420bfe83 (diff) | |
Notes
Diffstat (limited to 'test/Index')
| -rw-r--r-- | test/Index/blocks.c | 29 | ||||
| -rw-r--r-- | test/Index/code-complete-errors.c | 2 | ||||
| -rw-r--r-- | test/Index/code-completion.cpp | 13 | ||||
| -rw-r--r-- | test/Index/complete-at-directives.m | 9 | ||||
| -rw-r--r-- | test/Index/complete-exprs.c | 36 | ||||
| -rw-r--r-- | test/Index/complete-macros.c | 15 | ||||
| -rw-r--r-- | test/Index/complete-method-decls.m | 31 | ||||
| -rw-r--r-- | test/Index/complete-objc-message.m | 14 | ||||
| -rw-r--r-- | test/Index/complete-recovery.m | 8 | ||||
| -rw-r--r-- | test/Index/complete-type-factors.m | 107 | ||||
| -rw-r--r-- | test/Index/print-typekind.c | 2 | ||||
| -rw-r--r-- | test/Index/print-typekind.m | 10 | ||||
| -rw-r--r-- | test/Index/usrs.m | 14 |
13 files changed, 258 insertions, 32 deletions
diff --git a/test/Index/blocks.c b/test/Index/blocks.c new file mode 100644 index 0000000000000..08241cbcd196d --- /dev/null +++ b/test/Index/blocks.c @@ -0,0 +1,29 @@ +// RUN: c-index-test -test-load-source local -fblocks %s | FileCheck %s + +typedef int int_t; +struct foo { long x; }; + +void test() { + static struct foo _foo; + ^ int_t(struct foo *foo) { return (int_t) foo->x; }(&_foo); +} + +// TODO: expose the BlockExpr, CastExpr, and UnaryOperatorExpr here + +// CHECK: blocks.c:3:13: TypedefDecl=int_t:3:13 (Definition) Extent=[3:13 - 3:18] +// CHECK: blocks.c:4:8: StructDecl=foo:4:8 (Definition) Extent=[4:1 - 4:23] +// CHECK: blocks.c:4:19: FieldDecl=x:4:19 (Definition) Extent=[4:19 - 4:20] +// CHECK: blocks.c:6:6: FunctionDecl=test:6:6 (Definition) Extent=[6:6 - 9:2] +// CHECK: blocks.c:7:21: VarDecl=_foo:7:21 (Definition) Extent=[7:17 - 7:25] +// CHECK: blocks.c:7:17: TypeRef=struct foo:4:8 Extent=[7:17 - 7:20] +// CHECK: blocks.c:8:3: CallExpr= Extent=[8:3 - 8:61] +// CHECK: blocks.c:8:3: UnexposedExpr= Extent=[8:3 - 8:54] +// CHECK: blocks.c:8:5: TypeRef=int_t:3:13 Extent=[8:5 - 8:10] +// CHECK: blocks.c:8:23: ParmDecl=foo:8:23 (Definition) Extent=[8:18 - 8:26] +// CHECK: blocks.c:8:18: TypeRef=struct foo:4:8 Extent=[8:18 - 8:21] +// CHECK: blocks.c:8:37: UnexposedExpr=x:4:19 Extent=[8:37 - 8:51] +// CHECK: blocks.c:8:38: TypeRef=int_t:3:13 Extent=[8:38 - 8:43] +// CHECK: blocks.c:8:50: MemberRefExpr=x:4:19 Extent=[8:45 - 8:51] +// CHECK: blocks.c:8:45: DeclRefExpr=foo:8:23 Extent=[8:45 - 8:48] +// CHECK: blocks.c:8:55: UnexposedExpr= Extent=[8:55 - 8:60] +// CHECK: blocks.c:8:56: DeclRefExpr=_foo:7:21 Extent=[8:56 - 8:60] diff --git a/test/Index/code-complete-errors.c b/test/Index/code-complete-errors.c index 29c2a86198693..01c298c01d992 100644 --- a/test/Index/code-complete-errors.c +++ b/test/Index/code-complete-errors.c @@ -1,7 +1,7 @@ _Complex cd; // CHECK: code-complete-errors.c:1:1: warning: plain '_Complex' requires a type specifier; assuming '_Complex double' // CHECK: FIX-IT: Insert " double" at 1:9 struct s { - int x, y;; // CHECK: code-complete-errors.c:4:12: warning: extra ';' inside a struct or union + int x, y;; // CHECK: code-complete-errors.c:4:12: warning: extra ';' inside a struct }; // CHECK: FIX-IT: Remove [4:12 - 4:13] struct s s0 = { y: 5 }; // CHECK: code-complete-errors.c:7:20: warning: use of GNU old-style field designator extension diff --git a/test/Index/code-completion.cpp b/test/Index/code-completion.cpp index 670b13f6344b5..1d50fd3469a19 100644 --- a/test/Index/code-completion.cpp +++ b/test/Index/code-completion.cpp @@ -33,6 +33,10 @@ void test_overloaded() { overloaded(Z(), 0); } +Z::operator int() const { + return 0; +} + // CHECK-MEMBER: FieldDecl:{ResultType double}{TypedText member} // CHECK-MEMBER: FieldDecl:{ResultType int}{Text X::}{TypedText member} // CHECK-MEMBER: FieldDecl:{ResultType float}{Text Y::}{TypedText member} @@ -52,3 +56,12 @@ void test_overloaded() { // CHECK-OVERLOAD: NotImplemented:{ResultType int &}{Text overloaded}{LeftParen (}{Text Z z}{Comma , }{CurrentParameter int second}{RightParen )} // CHECK-OVERLOAD: NotImplemented:{ResultType float &}{Text overloaded}{LeftParen (}{Text int i}{Comma , }{CurrentParameter long second}{RightParen )} // CHECK-OVERLOAD: NotImplemented:{ResultType double &}{Text overloaded}{LeftParen (}{Text float f}{Comma , }{CurrentParameter int second}{RightParen )} + +// RUN: c-index-test -code-completion-at=%s:37:10 %s | FileCheck -check-prefix=CHECK-EXPR %s +// CHECK-EXPR: NotImplemented:{TypedText int} (40) +// CHECK-EXPR: NotImplemented:{TypedText long} (40) +// CHECK-EXPR: FieldDecl:{ResultType double}{TypedText member} (10) +// CHECK-EXPR: FieldDecl:{ResultType int}{Text X::}{TypedText member} (5) +// CHECK-EXPR: FieldDecl:{ResultType float}{Text Y::}{TypedText member} (11) +// CHECK-EXPR: FunctionDecl:{ResultType void}{TypedText memfunc}{LeftParen (}{Optional {Placeholder int i}}{RightParen )} (22) + diff --git a/test/Index/complete-at-directives.m b/test/Index/complete-at-directives.m index a278ce883666b..219d434ea4dac 100644 --- a/test/Index/complete-at-directives.m +++ b/test/Index/complete-at-directives.m @@ -6,7 +6,7 @@ @end // RUN: c-index-test -code-completion-at=%s:2:2 -Xclang -code-completion-patterns %s | FileCheck -check-prefix=CHECK-CC1 %s -// CHECK-CC1: {TypedText class}{HorizontalSpace }{Placeholder identifier} +// CHECK-CC1: {TypedText class}{HorizontalSpace }{Placeholder name} // CHECK-CC1: {TypedText compatibility_alias}{HorizontalSpace }{Placeholder alias}{HorizontalSpace }{Placeholder class} // CHECK-CC1: {TypedText implementation}{HorizontalSpace }{Placeholder class} // CHECK-CC1: {TypedText interface}{HorizontalSpace }{Placeholder class} @@ -24,7 +24,7 @@ // CHECK-CC3: {TypedText synthesize}{HorizontalSpace }{Placeholder property} // RUN: c-index-test -code-completion-at=%s:2:1 -Xclang -code-completion-patterns %s | FileCheck -check-prefix=CHECK-CC4 %s -// CHECK-CC4: NotImplemented:{TypedText @class}{HorizontalSpace }{Placeholder identifier} +// CHECK-CC4: NotImplemented:{TypedText @class}{HorizontalSpace }{Placeholder name} // CHECK-CC4: NotImplemented:{TypedText @compatibility_alias}{HorizontalSpace }{Placeholder alias}{HorizontalSpace }{Placeholder class} // CHECK-CC4: NotImplemented:{TypedText @implementation}{HorizontalSpace }{Placeholder class} // CHECK-CC4: NotImplemented:{TypedText @interface}{HorizontalSpace }{Placeholder class} @@ -39,11 +39,6 @@ // CHECK-CC5: {TypedText @optional} // CHECK-CC5: {TypedText @property} // CHECK-CC5: {TypedText @required} -// CHECK-CC5: NotImplemented:{TypedText _Bool} -// CHECK-CC5: TypedefDecl:{TypedText Class} -// CHECK-CC5: TypedefDecl:{TypedText id} -// CHECK-CC5: ObjCInterfaceDecl:{TypedText MyClass} -// CHECK-CC5: TypedefDecl:{TypedText SEL} // RUN: c-index-test -code-completion-at=%s:2:23 -Xclang -code-completion-patterns %s | FileCheck -check-prefix=CHECK-CC6 %s // CHECK-CC6: NotImplemented:{TypedText package} diff --git a/test/Index/complete-exprs.c b/test/Index/complete-exprs.c index 65af2419213ab..b7bed8c5fde80 100644 --- a/test/Index/complete-exprs.c +++ b/test/Index/complete-exprs.c @@ -7,12 +7,36 @@ int test(int i, int j, int k, int l) { return i | j | k & l; } +struct X f1 = { 17 }; +void f2() { f1(17); } + +const char *str = "Hello, \nWorld"; + // RUN: c-index-test -code-completion-at=%s:7:9 -Xclang -code-completion-patterns %s | FileCheck -check-prefix=CHECK-CC1 %s // CHECK-CC1: macro definition:{TypedText __VERSION__} (70) -// CHECK-CC1: FunctionDecl:{ResultType int}{TypedText f}{LeftParen (}{Placeholder int}{RightParen )} (50) -// CHECK-CC1: NotImplemented:{TypedText float} (40) -// CHECK-CC1: ParmDecl:{ResultType int}{TypedText j} (8) +// CHECK-CC1: FunctionDecl:{ResultType int}{TypedText f}{LeftParen (}{Placeholder int}{RightParen )} (12) +// CHECK-CC1-NOT: NotImplemented:{TypedText float} (40) +// CHECK-CC1: ParmDecl:{ResultType int}{TypedText j} (2) // CHECK-CC1: NotImplemented:{TypedText sizeof}{LeftParen (}{Placeholder expression-or-type}{RightParen )} (30) -// RUN: c-index-test -code-completion-at=%s:7:14 -Xclang -code-completion-patterns %s | FileCheck -check-prefix=CHECK-CC1 %s -// RUN: c-index-test -code-completion-at=%s:7:18 -Xclang -code-completion-patterns %s | FileCheck -check-prefix=CHECK-CC1 %s -// RUN: c-index-test -code-completion-at=%s:7:22 -Xclang -code-completion-patterns %s | FileCheck -check-prefix=CHECK-CC1 %s +// RUN: c-index-test -code-completion-at=%s:7:14 -Xclang -code-completion-patterns %s | FileCheck -check-prefix=CHECK-CC3 %s +// CHECK-CC3: macro definition:{TypedText __VERSION__} (70) +// CHECK-CC3: FunctionDecl:{ResultType int}{TypedText f}{LeftParen (}{Placeholder int}{RightParen )} (50) +// CHECK-CC3-NOT: NotImplemented:{TypedText float} (40) +// CHECK-CC3: ParmDecl:{ResultType int}{TypedText j} (8) +// CHECK-CC3: NotImplemented:{TypedText sizeof}{LeftParen (}{Placeholder expressio + +// RUN: c-index-test -code-completion-at=%s:7:18 -Xclang -code-completion-patterns %s | FileCheck -check-prefix=CHECK-CC3 %s +// RUN: c-index-test -code-completion-at=%s:7:22 -Xclang -code-completion-patterns %s | FileCheck -check-prefix=CHECK-CC3 %s +// RUN: c-index-test -code-completion-at=%s:7:2 -Xclang -code-completion-patterns %s | FileCheck -check-prefix=CHECK-CC2 %s +// CHECK-CC2: macro definition:{TypedText __VERSION__} (70) +// CHECK-CC2: FunctionDecl:{ResultType int}{TypedText f}{LeftParen (}{Placeholder int}{RightParen )} (50) +// CHECK-CC2: NotImplemented:{TypedText float} (40) +// CHECK-CC2: ParmDecl:{ResultType int}{TypedText j} (8) +// CHECK-CC2: NotImplemented:{TypedText sizeof}{LeftParen (}{Placeholder expression-or-type}{RightParen )} (30) +// RUN: c-index-test -code-completion-at=%s:11:16 -Xclang -code-completion-patterns %s | FileCheck -check-prefix=CHECK-CC4 %s +// CHECK-CC4: FunctionDecl:{ResultType int}{TypedText f}{LeftParen (}{Placeholder int}{RightParen )} (50) +// CHECK-CC4: VarDecl:{ResultType struct X}{TypedText f1} (50) + +// RUN: c-index-test -code-completion-at=%s:13:28 -Xclang -code-completion-patterns %s | FileCheck -check-prefix=CHECK-CC5 %s +// CHECK-CC5: NotImplemented:{TypedText void} (40) +// CHECK-CC5: NotImplemented:{TypedText volatile} (40) diff --git a/test/Index/complete-macros.c b/test/Index/complete-macros.c index c33d8c02e13b8..9a898e152a7fe 100644 --- a/test/Index/complete-macros.c +++ b/test/Index/complete-macros.c @@ -2,10 +2,23 @@ // matter in this test. #define FOO(Arg1,Arg2) foobar - +#define nil 0 void f() { } +void g(int); + +void f2() { + int *ip = nil; + ip = nil; + g(nil); +} + // RUN: c-index-test -code-completion-at=%s:7:1 %s | FileCheck -check-prefix=CHECK-CC1 %s // CHECK-CC1: macro definition:{TypedText FOO}{LeftParen (}{Placeholder Arg1}{Comma , }{Placeholder Arg2}{RightParen )} +// RUN: c-index-test -code-completion-at=%s:13:13 %s | FileCheck -check-prefix=CHECK-CC2 %s +// RUN: c-index-test -code-completion-at=%s:14:8 %s | FileCheck -check-prefix=CHECK-CC2 %s +// CHECK-CC2: macro definition:{TypedText nil} (30) +// RUN: c-index-test -code-completion-at=%s:15:5 %s | FileCheck -check-prefix=CHECK-CC3 %s +// CHECK-CC3: macro definition:{TypedText nil} (60) diff --git a/test/Index/complete-method-decls.m b/test/Index/complete-method-decls.m index c18994ec20a91..a30874b8a28e2 100644 --- a/test/Index/complete-method-decls.m +++ b/test/Index/complete-method-decls.m @@ -42,6 +42,16 @@ - (id)categoryFunction:(int)x { return self; } @end +@interface C +- (int)first:(int)x second:(float)y third:(double)z; +- (id)first:(int)xx second2:(float)y2 third:(double)z; +- (void*)first:(int)xxx second3:(float)y3 third:(double)z; +@end + +@interface D +- (int)first:(int)x second2:(float)y third:(double)z; +@end + // RUN: c-index-test -code-completion-at=%s:17:3 %s | FileCheck -check-prefix=CHECK-CC1 %s // CHECK-CC1: NotImplemented:{LeftParen (}{Text id}{RightParen )}{TypedText abc} // CHECK-CC1: NotImplemented:{LeftParen (}{Text int}{RightParen )}{TypedText getInt} @@ -59,24 +69,35 @@ // CHECK-CC3: NotImplemented:{TypedText init} // CHECK-CC3: NotImplemented:{TypedText initWithInt}{Colon :}{LeftParen (}{Text int}{RightParen )}{Text x} // CHECK-CC3: NotImplemented:{TypedText initWithTwoInts}{Colon :}{LeftParen (}{Text int}{RightParen )}{Text x}{HorizontalSpace }{Text second}{Colon :}{LeftParen (}{Text int}{RightParen )}{Text y} -// RUN: c-index-test -code-completion-at=%s:33:3 %s | FileCheck -check-prefix=CHECK-CC4 %s -// CHECK-CC4: NotImplemented:{LeftParen (}{Text id}{RightParen )}{TypedText abc}{HorizontalSpace }{LeftBrace {}{VerticalSpace +// RUN: c-index-test -code-completion-at=%s:33:3 -Xclang -code-completion-patterns %s | FileCheck -check-prefix=CHECK-CC4 %s +// CHECK-CC4: NotImplemented:{LeftParen (}{Text id}{RightParen )}{TypedText abc} // CHECK-CC4: NotImplemented:{LeftParen (}{Text int}{RightParen )}{TypedText getInt}{HorizontalSpace }{LeftBrace {}{VerticalSpace // CHECK-CC4: NotImplemented:{LeftParen (}{Text int}{RightParen )}{TypedText getSecondValue}{HorizontalSpace }{LeftBrace {}{VerticalSpace // CHECK-CC4: NotImplemented:{LeftParen (}{Text id}{RightParen )}{TypedText getSelf}{HorizontalSpace }{LeftBrace {}{VerticalSpace // CHECK-CC4: NotImplemented:{LeftParen (}{Text id}{RightParen )}{TypedText initWithInt}{Colon :}{LeftParen (}{Text int}{RightParen )}{Text x}{HorizontalSpace }{LeftBrace {}{VerticalSpace // CHECK-CC4: NotImplemented:{LeftParen (}{Text id}{RightParen )}{TypedText initWithTwoInts}{Colon :}{LeftParen (}{Text int}{RightParen )}{Text x}{HorizontalSpace }{Text second}{Colon :}{LeftParen (}{Text int}{RightParen )}{Text y}{HorizontalSpace }{LeftBrace {}{VerticalSpace // CHECK-CC4: NotImplemented:{LeftParen (}{Text int}{RightParen )}{TypedText setValue}{Colon :}{LeftParen (}{Text int}{RightParen )}{Text x}{HorizontalSpace }{LeftBrace {}{VerticalSpace -// RUN: c-index-test -code-completion-at=%s:33:8 %s | FileCheck -check-prefix=CHECK-CC5 %s +// RUN: c-index-test -code-completion-at=%s:33:8 -Xclang -code-completion-patterns %s | FileCheck -check-prefix=CHECK-CC5 %s // CHECK-CC5: NotImplemented:{TypedText getInt}{HorizontalSpace }{LeftBrace {}{VerticalSpace // CHECK-CC5: NotImplemented:{TypedText getSecondValue}{HorizontalSpace }{LeftBrace {}{VerticalSpace // CHECK-CC5-NOT: {TypedText getSelf}{HorizontalSpace }{LeftBrace {}{VerticalSpace // CHECK-CC5: NotImplemented:{TypedText setValue}{Colon :}{LeftParen (}{Text int}{RightParen )}{Text x}{HorizontalSpace }{LeftBrace {}{VerticalSpace -// RUN: c-index-test -code-completion-at=%s:37:7 %s | FileCheck -check-prefix=CHECK-CC6 %s +// RUN: c-index-test -code-completion-at=%s:37:7 -Xclang -code-completion-patterns %s | FileCheck -check-prefix=CHECK-CC6 %s // CHECK-CC6: NotImplemented:{TypedText abc}{HorizontalSpace }{LeftBrace {}{VerticalSpace // CHECK-CC6-NOT: getSelf // CHECK-CC6: NotImplemented:{TypedText initWithInt}{Colon :}{LeftParen (}{Text int}{RightParen )}{Text x}{HorizontalSpace }{LeftBrace {}{VerticalSpace // CHECK-CC6: NotImplemented:{TypedText initWithTwoInts}{Colon :}{LeftParen (}{Text int}{RightParen )}{Text x}{HorizontalSpace }{Text second}{Colon :}{LeftParen (}{Text int}{RightParen )}{Text y}{HorizontalSpace }{LeftBrace {}{VerticalSpace -// RUN: c-index-test -code-completion-at=%s:42:3 %s | FileCheck -check-prefix=CHECK-CC7 %s +// RUN: c-index-test -code-completion-at=%s:42:3 -Xclang -code-completion-patterns %s | FileCheck -check-prefix=CHECK-CC7 %s // CHECK-CC7: NotImplemented:{LeftParen (}{Text id}{RightParen )}{TypedText categoryFunction}{Colon :}{LeftParen (}{Text int}{RightParen )}{Text x}{HorizontalSpace }{LeftBrace {}{VerticalSpace +// RUN: c-index-test -code-completion-at=%s:52:21 -Xclang -code-completion-patterns %s | FileCheck -check-prefix=CHECK-CC8 %s +// CHECK-CC8: ObjCInstanceMethodDecl:{ResultType id}{Informative first:}{TypedText second2:}{Text (float)y2}{HorizontalSpace }{Text third:}{Text (double)z} (20) +// CHECK-CC8: ObjCInstanceMethodDecl:{ResultType void *}{Informative first:}{TypedText second3:}{Text (float)y3}{HorizontalSpace }{Text third:}{Text (double)z} (20) +// CHECK-CC8: ObjCInstanceMethodDecl:{ResultType int}{Informative first:}{TypedText second:}{Text (float)y}{HorizontalSpace }{Text third:}{Text (double)z} (5) +// RUN: c-index-test -code-completion-at=%s:52:19 -Xclang -code-completion-patterns %s | FileCheck -check-prefix=CHECK-CC9 %s +// CHECK-CC9: NotImplemented:{TypedText x} (30) +// CHECK-CC9: NotImplemented:{TypedText xx} (30) +// CHECK-CC9: NotImplemented:{TypedText xxx} (30) +// RUN: c-index-test -code-completion-at=%s:52:36 -Xclang -code-completion-patterns %s | FileCheck -check-prefix=CHECK-CCA %s +// CHECK-CCA: NotImplemented:{TypedText y2} (30) + diff --git a/test/Index/complete-objc-message.m b/test/Index/complete-objc-message.m index e65a056e36c33..321d75f3fe170 100644 --- a/test/Index/complete-objc-message.m +++ b/test/Index/complete-objc-message.m @@ -51,7 +51,7 @@ void func() { return 3; } @end - +MyClass *getMyClass(); @implementation MySubClass + (int)MySubClassMethod { return 2; @@ -160,14 +160,13 @@ void msg_id(id x) { // CHECK-CC9: ObjCInstanceMethodDecl:{ResultType int}{Informative Method:}{Informative Arg1:}{TypedText Arg2:}{Placeholder (int)i2} // CHECK-CC9: ObjCInstanceMethodDecl:{ResultType int}{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: {ResultType SEL}{TypedText _cmd} // CHECK-CCA: TypedefDecl:{TypedText Class} -// CHECK-CCA: ObjCInterfaceDecl:{TypedText Foo} -// CHECK-CCA: FunctionDecl:{ResultType void}{TypedText func}{LeftParen (}{RightParen )} +// CHECK-CCA-NEXT: ObjCInterfaceDecl:{TypedText Foo} +// CHECK-CCA-NOT: FunctionDecl:{ResultType void}{TypedText func}{LeftParen (}{RightParen )} +// CHECK-CCA:FunctionDecl:{ResultType MyClass *}{TypedText getMyClass}{LeftParen (}{RightParen )} // CHECK-CCA: TypedefDecl:{TypedText id} // CHECK-CCA: ObjCInterfaceDecl:{TypedText MyClass} // CHECK-CCA: ObjCInterfaceDecl:{TypedText MySubClass} -// CHECK-CCA: TypedefDecl:{TypedText SEL} // CHECK-CCA: {ResultType Class}{TypedText self} // CHECK-CCA: {TypedText super} // RUN: c-index-test -code-completion-at=%s:103:6 %s | FileCheck -check-prefix=CHECK-CCB %s @@ -188,14 +187,12 @@ void msg_id(id x) { // CHECK-CCE: ObjCClassMethodDecl:{ResultType int}{Informative Method:}{Informative Arg1:}{TypedText Arg2:}{Placeholder (int)i2} // CHECK-CCE: ObjCClassMethodDecl:{ResultType int}{Informative Method:}{Informative Arg1:}{TypedText OtherArg:}{Placeholder (id)obj} // RUN: c-index-test -code-completion-at=%s:61:11 %s | FileCheck -check-prefix=CHECK-CCF %s -// CHECK-CCF: {ResultType SEL}{TypedText _cmd} // CHECK-CCF: TypedefDecl:{TypedText Class} // CHECK-CCF: ObjCInterfaceDecl:{TypedText Foo} -// CHECK-CCF: FunctionDecl:{ResultType void}{TypedText func}{LeftParen (}{RightParen )} +// CHECK-CCF-NOT: FunctionDecl:{ResultType void}{TypedText func}{LeftParen (}{RightParen )} // CHECK-CCF: TypedefDecl:{TypedText id} // CHECK-CCF: ObjCInterfaceDecl:{TypedText MyClass} // CHECK-CCF: ObjCInterfaceDecl:{TypedText MySubClass} -// CHECK-CCF: TypedefDecl:{TypedText SEL} // CHECK-CCF: {ResultType Class}{TypedText self} // CHECK-CCF: {TypedText super} // RUN: c-index-test -code-completion-at=%s:120:6 %s | FileCheck -check-prefix=CHECK-CCG %s @@ -230,4 +227,3 @@ void msg_id(id x) { // CHECK-CCH: ObjCClassMethodDecl:{ResultType id}{TypedText new} // CHECK-CCH: ObjCClassMethodDecl:{ResultType int}{TypedText OtherMethod:}{Placeholder (float)f}{HorizontalSpace }{Text Arg1:}{Placeholder (int)i1}{HorizontalSpace }{Text Arg2:}{Placeholder (int)i2} // CHECK-CCH: ObjCClassMethodDecl:{ResultType id}{TypedText protocolClassMethod} - diff --git a/test/Index/complete-recovery.m b/test/Index/complete-recovery.m index c28438da66f8d..e03834ee15b74 100644 --- a/test/Index/complete-recovery.m +++ b/test/Index/complete-recovery.m @@ -14,8 +14,12 @@ // RUN: c-index-test -code-completion-at=%s:9:20 -Xclang -code-completion-patterns %s 2>%t | FileCheck -check-prefix=CHECK-CC1 %s // RUN: not grep error %t // CHECK-CC1: NotImplemented:{TypedText @encode}{LeftParen (}{Placeholder type-name}{RightParen )} -// CHECK-CC1: NotImplemented:{TypedText _Bool} +// CHECK-CC1-NOT: NotImplemented:{TypedText _Bool} // CHECK-CC1: VarDecl:{ResultType A *}{TypedText a} // CHECK-CC1: NotImplemented:{TypedText sizeof}{LeftParen (}{Placeholder expression-or-type}{RightParen )} -// RUN: c-index-test -code-completion-at=%s:10:24 -Xclang -code-completion-patterns %s 2>%t | FileCheck -check-prefix=CHECK-CC1 %s +// RUN: c-index-test -code-completion-at=%s:10:24 -Xclang -code-completion-patterns %s 2>%t | FileCheck -check-prefix=CHECK-CC2 %s +// CHECK-CC2: NotImplemented:{TypedText @encode}{LeftParen (}{Placeholder type-name}{RightParen )} +// CHECK-CC2: NotImplemented:{TypedText _Bool} +// CHECK-CC2: VarDecl:{ResultType A *}{TypedText a} +// CHECK-CC2: NotImplemented:{TypedText sizeof}{LeftParen (}{Placeholder expression-or-type}{RightParen )} diff --git a/test/Index/complete-type-factors.m b/test/Index/complete-type-factors.m new file mode 100644 index 0000000000000..2048cd35233ae --- /dev/null +++ b/test/Index/complete-type-factors.m @@ -0,0 +1,107 @@ +/* Run lines are at the end, since line/column matter in this test. */ + +enum Color { + Red, Green, Blue +}; + +enum Priority { + Low, + High +}; + +int func1(enum Color); +enum Priority func2(int); +void func3(float); +enum Priority test1(enum Priority priority, enum Color color, int integer) { + int i = integer; + enum Color c = color; + return priority; + func1(c); + void (^block)(enum Color, int); + block(c, 17); + c = color; +} + +// FIXME: It would be great for message sends to have the same +// benefits as function calls, but we don't quite have the +// infrastructure yet. + +// RUN: c-index-test -code-completion-at=%s:16:11 -Xclang -code-completion-patterns %s | FileCheck -check-prefix=CHECK-CC1 %s +// CHECK-CC1: EnumConstantDecl:{ResultType enum Color}{TypedText Blue} (30) +// CHECK-CC1: ParmDecl:{ResultType enum Color}{TypedText color} (4) +// CHECK-CC1: FunctionDecl:{ResultType int}{TypedText func1}{LeftParen (}{Placeholder enum Color}{RightParen )} (12) +// CHECK-CC1: FunctionDecl:{ResultType enum Priority}{TypedText func2}{LeftParen (}{Placeholder int}{RightParen )} (25) +// CHECK-CC1: EnumConstantDecl:{ResultType enum Color}{TypedText Green} (30) +// CHECK-CC1: EnumConstantDecl:{ResultType enum Priority}{TypedText High} (30) +// CHECK-CC1: VarDecl:{ResultType int}{TypedText i} (2) +// CHECK-CC1: ParmDecl:{ResultType int}{TypedText integer} (2) +// CHECK-CC1: EnumConstantDecl:{ResultType enum Priority}{TypedText Low} (30) +// CHECK-CC1: ParmDecl:{ResultType enum Priority}{TypedText priority} (4) +// CHECK-CC1: EnumConstantDecl:{ResultType enum Color}{TypedText Red} (30) +// CHECK-CC1: NotImplemented:{TypedText sizeof}{LeftParen (}{Placeholder expression-or-type}{RightParen )} (30) +// CHECK-CC1: FunctionDecl:{ResultType enum Priority}{TypedText test1}{LeftParen (}{Placeholder enum Priority priority}{Comma , }{Placeholder enum Color color}{Comma , }{Placeholder int integer}{RightParen )} (25) +// RUN: c-index-test -code-completion-at=%s:17:18 -Xclang -code-completion-patterns %s | FileCheck -check-prefix=CHECK-CC2 %s +// CHECK-CC2: EnumConstantDecl:{ResultType enum Color}{TypedText Blue} (15) +// CHECK-CC2: VarDecl:{ResultType enum Color}{TypedText c} (2) +// CHECK-CC2: ParmDecl:{ResultType enum Color}{TypedText color} (2) +// CHECK-CC2: FunctionDecl:{ResultType int}{TypedText func1}{LeftParen (}{Placeholder enum Color}{RightParen )} (25) +// CHECK-CC2: FunctionDecl:{ResultType enum Priority}{TypedText func2}{LeftParen (}{Placeholder int}{RightParen )} (50) +// CHECK-CC2: EnumConstantDecl:{ResultType enum Color}{TypedText Green} (15) +// CHECK-CC2: EnumConstantDecl:{ResultType enum Priority}{TypedText High} (60) +// CHECK-CC2: VarDecl:{ResultType int}{TypedText i} (4) +// CHECK-CC2: ParmDecl:{ResultType int}{TypedText integer} (4) +// CHECK-CC2: EnumConstantDecl:{ResultType enum Priority}{TypedText Low} (60) +// CHECK-CC2: ParmDecl:{ResultType enum Priority}{TypedText priority} (8) +// CHECK-CC2: EnumConstantDecl:{ResultType enum Color}{TypedText Red} (15) +// CHECK-CC2: NotImplemented:{TypedText sizeof}{LeftParen (}{Placeholder expression-or-type}{RightParen )} (30) +// CHECK-CC2: FunctionDecl:{ResultType enum Priority}{TypedText test1}{LeftParen (}{Placeholder enum Priority priority}{Comma , }{Placeholder enum Color color}{Comma , }{Placeholder int integer}{RightParen )} (50) +// RUN: c-index-test -code-completion-at=%s:18:10 -Xclang -code-completion-patterns %s | FileCheck -check-prefix=CHECK-CC3 %s +// CHECK-CC3: EnumConstantDecl:{ResultType enum Color}{TypedText Blue} (60) +// CHECK-CC3: VarDecl:{ResultType enum Color}{TypedText c} (8) +// CHECK-CC3: ParmDecl:{ResultType enum Color}{TypedText color} (8) +// CHECK-CC3: FunctionDecl:{ResultType int}{TypedText func1}{LeftParen (}{Placeholder enum Color}{RightParen )} (25) +// CHECK-CC3: FunctionDecl:{ResultType enum Priority}{TypedText func2}{LeftParen (}{Placeholder int}{RightParen )} (12) +// CHECK-CC3: FunctionDecl:{ResultType void}{TypedText func3}{LeftParen (}{Placeholder float}{RightParen )} (50) +// CHECK-CC3: EnumConstantDecl:{ResultType enum Color}{TypedText Green} (60) +// CHECK-CC3: EnumConstantDecl:{ResultType enum Priority}{TypedText High} (15) +// CHECK-CC3: VarDecl:{ResultType int}{TypedText i} (4) +// CHECK-CC3: ParmDecl:{ResultType int}{TypedText integer} (4) +// CHECK-CC3: EnumConstantDecl:{ResultType enum Priority}{TypedText Low} (15) +// CHECK-CC3: ParmDecl:{ResultType enum Priority}{TypedText priority} (2) +// CHECK-CC3: EnumConstantDecl:{ResultType enum Color}{TypedText Red} (60) +// CHECK-CC3: NotImplemented:{TypedText sizeof}{LeftParen (}{Placeholder expression-or-type}{RightParen )} (30) +// CHECK-CC3: FunctionDecl:{ResultType enum Priority}{TypedText test1}{LeftParen (}{Placeholder enum Priority priority}{Comma , }{Placeholder enum Color color}{Comma , }{Placeholder int integer}{RightParen )} (12) +// RUN: c-index-test -code-completion-at=%s:19:9 -Xclang -code-completion-patterns %s | FileCheck -check-prefix=CHECK-CC4 %s +// CHECK-CC4: EnumConstantDecl:{ResultType enum Color}{TypedText Blue} (15) +// CHECK-CC4: VarDecl:{ResultType enum Color}{TypedText c} (2) +// CHECK-CC4: ParmDecl:{ResultType enum Color}{TypedText color} (2) +// CHECK-CC4: FunctionDecl:{ResultType int}{TypedText func1}{LeftParen (}{Placeholder enum Color}{RightParen )} (25) +// CHECK-CC4: FunctionDecl:{ResultType enum Priority}{TypedText func2}{LeftParen (}{Placeholder int}{RightParen )} (50) +// CHECK-CC4: FunctionDecl:{ResultType void}{TypedText func3}{LeftParen (}{Placeholder float}{RightParen )} (50) +// CHECK-CC4: EnumConstantDecl:{ResultType enum Color}{TypedText Green} (15) +// CHECK-CC4: EnumConstantDecl:{ResultType enum Priority}{TypedText High} (60) +// CHECK-CC4: VarDecl:{ResultType int}{TypedText i} (4) +// CHECK-CC4: ParmDecl:{ResultType int}{TypedText integer} (4) +// CHECK-CC4: EnumConstantDecl:{ResultType enum Priority}{TypedText Low} (60) +// CHECK-CC4: ParmDecl:{ResultType enum Priority}{TypedText priority} (8) +// CHECK-CC4: EnumConstantDecl:{ResultType enum Color}{TypedText Red} (15) +// CHECK-CC4: NotImplemented:{TypedText sizeof}{LeftParen (}{Placeholder expression-or-type}{RightParen )} (30) +// CHECK-CC4: FunctionDecl:{ResultType enum Priority}{TypedText test1}{LeftParen (}{Placeholder enum Priority priority}{Comma , }{Placeholder enum Color color}{Comma , }{Placeholder int integer}{RightParen )} (50) +// RUN: c-index-test -code-completion-at=%s:21:9 -Xclang -code-completion-patterns %s | FileCheck -check-prefix=CHECK-CC4 %s +// RUN: c-index-test -code-completion-at=%s:22:7 -Xclang -code-completion-patterns %s | FileCheck -check-prefix=CHECK-CC6 %s +// CHECK-CC6: VarDecl:{ResultType void (^)(enum Color, int)}{TypedText block} (8) +// CHECK-CC6: EnumConstantDecl:{ResultType enum Color}{TypedText Blue} (15) +// CHECK-CC6: VarDecl:{ResultType enum Color}{TypedText c} (2) +// CHECK-CC6: ParmDecl:{ResultType enum Color}{TypedText color} (2) +// CHECK-CC6: FunctionDecl:{ResultType int}{TypedText func1}{LeftParen (}{Placeholder enum Color}{RightParen )} (25) +// CHECK-CC6: FunctionDecl:{ResultType enum Priority}{TypedText func2}{LeftParen (}{Placeholder int}{RightParen )} (50) +// CHECK-CC6: FunctionDecl:{ResultType void}{TypedText func3}{LeftParen (}{Placeholder float}{RightParen )} (50) +// CHECK-CC6: EnumConstantDecl:{ResultType enum Color}{TypedText Green} (15) +// CHECK-CC6: EnumConstantDecl:{ResultType enum Priority}{TypedText High} (60) +// CHECK-CC6: VarDecl:{ResultType int}{TypedText i} (4) +// CHECK-CC6: ParmDecl:{ResultType int}{TypedText integer} (4) +// CHECK-CC6: EnumConstantDecl:{ResultType enum Priority}{TypedText Low} (60) +// CHECK-CC6: ParmDecl:{ResultType enum Priority}{TypedText priority} (8) +// CHECK-CC6: EnumConstantDecl:{ResultType enum Color}{TypedText Red} (15) +// CHECK-CC6: NotImplemented:{TypedText sizeof}{LeftParen (}{Placeholder expression-or-type}{RightParen )} (30) +// CHECK-CC6: FunctionDecl:{ResultType enum Priority}{TypedText test1}{LeftParen (}{Placeholder enum Priority priority}{Comma , }{Placeholder enum Color color}{Comma , }{Placeholder int integer}{RightParen )} (50) diff --git a/test/Index/print-typekind.c b/test/Index/print-typekind.c index 79a9965d4d85c..13b41198f1278 100644 --- a/test/Index/print-typekind.c +++ b/test/Index/print-typekind.c @@ -8,7 +8,7 @@ int *f(int *p, char *x, FooType z) { // RUN: c-index-test -test-print-typekind %s | FileCheck %s // CHECK: TypedefDecl=FooType:1:13 (Definition) typekind=Typedef [canonical=Int] // CHECK: VarDecl=p:2:6 typekind=Pointer -// CHECK: FunctionDecl=f:3:6 (Definition) typekind=Unexposed [canonical=Unexposed] +// CHECK: FunctionDecl=f:3:6 (Definition) typekind=FunctionProto [canonical=FunctionProto] [result=Pointer] // CHECK: ParmDecl=p:3:13 (Definition) typekind=Pointer // CHECK: ParmDecl=x:3:22 (Definition) typekind=Pointer // CHECK: ParmDecl=z:3:33 (Definition) typekind=Typedef [canonical=Int] diff --git a/test/Index/print-typekind.m b/test/Index/print-typekind.m new file mode 100644 index 0000000000000..68827fb7ca6e9 --- /dev/null +++ b/test/Index/print-typekind.m @@ -0,0 +1,10 @@ +@interface Foo +@property (readonly) id x; +-(int) mymethod; +@end + +// RUN: c-index-test -test-print-typekind %s | FileCheck %s +// CHECK: ObjCPropertyDecl=x:2:25 typekind=Typedef [canonical=ObjCObjectPointer] +// CHECK: ObjCInstanceMethodDecl=mymethod:3:1 typekind=Invalid [result=Int] + + diff --git a/test/Index/usrs.m b/test/Index/usrs.m index bffd0ee4bbc75..0b56cca1ef645 100644 --- a/test/Index/usrs.m +++ b/test/Index/usrs.m @@ -48,6 +48,15 @@ int z; static int local_func(int x) { return x; } +@interface CWithExt +@end +@interface CWithExt () +@end +@interface CWithExt () +@end +@implementation CWithExt +@end + // CHECK: usrs.m c:usrs.m@3:19@F@my_helper Extent=[3:19 - 3:60] // CHECK: usrs.m c:usrs.m@3:29@F@my_helper@x Extent=[3:29 - 3:34] // CHECK: usrs.m c:usrs.m@3:36@F@my_helper@y Extent=[3:36 - 3:41] @@ -84,4 +93,9 @@ static int local_func(int x) { return x; } // CHECK: usrs.m c:@z Extent=[47:1 - 47:6] // CHECK: usrs.m c:usrs.m@49:12@F@local_func Extent=[49:12 - 49:43] // CHECK: usrs.m c:usrs.m@49:23@F@local_func@x Extent=[49:23 - 49:28] +// CHECK: usrs.m c:objc(cs)CWithExt Extent=[51:1 - 52:5] +// CHECK: usrs.m c:objc(cy)CWithExt@ Extent=[53:1 - 54:5] +// CHECK: usrs.m c:objc(cy)CWithExt@ Extent=[55:1 - 56:5] +// CHECK: usrs.m c:objc(cs)CWithExt Extent=[57:1 - 58:2] + |
