diff options
Diffstat (limited to 'test/Index')
-rw-r--r-- | test/Index/annotate-tokens-pp.c | 14 | ||||
-rw-r--r-- | test/Index/annotate-tokens.cpp | 8 | ||||
-rw-r--r-- | test/Index/annotate-tokens.m | 28 | ||||
-rw-r--r-- | test/Index/arc-annotate.m | 38 | ||||
-rw-r--r-- | test/Index/arc-complete.m | 16 | ||||
-rw-r--r-- | test/Index/c-index-api-loadTU-test.m | 11 | ||||
-rw-r--r-- | test/Index/c-index-getCursor-pp.c | 8 | ||||
-rw-r--r-- | test/Index/c-index-getCursor-test.m | 2 | ||||
-rw-r--r-- | test/Index/code-completion.cpp | 20 | ||||
-rw-r--r-- | test/Index/complete-exprs.m | 9 | ||||
-rw-r--r-- | test/Index/complete-natural.m | 5 | ||||
-rw-r--r-- | test/Index/complete-property-flags.m | 2 | ||||
-rw-r--r-- | test/Index/get-cursor.cpp | 7 | ||||
-rw-r--r-- | test/Index/nested-macro-instantiations.cpp | 10 | ||||
-rw-r--r-- | test/Index/werror.c | 15 |
15 files changed, 162 insertions, 31 deletions
diff --git a/test/Index/annotate-tokens-pp.c b/test/Index/annotate-tokens-pp.c index 01a615f..e6bb086 100644 --- a/test/Index/annotate-tokens-pp.c +++ b/test/Index/annotate-tokens-pp.c @@ -53,14 +53,14 @@ void test() { // CHECK: Identifier: "X" [4:22 - 4:23] macro definition=WIBBLE // CHECK: Punctuation: "##" [4:23 - 4:25] macro definition=WIBBLE // CHECK: Identifier: "Y" [4:25 - 4:26] macro definition=WIBBLE -// CHECK: Identifier: "NOTHING" [5:1 - 5:8] macro instantiation=NOTHING:1:9 +// CHECK: Identifier: "NOTHING" [5:1 - 5:8] macro expansion=NOTHING:1:9 // CHECK: Punctuation: "(" [5:8 - 5:9] // CHECK: Identifier: "more" [5:9 - 5:13] // CHECK: Punctuation: "," [5:13 - 5:14] // CHECK: Identifier: "junk" [5:14 - 5:18] // CHECK: Punctuation: ")" [5:18 - 5:19] // CHECK: Keyword: "float" [5:20 - 5:25] -// CHECK: Identifier: "WIBBLE" [5:26 - 5:32] macro instantiation=WIBBLE:4:9 +// CHECK: Identifier: "WIBBLE" [5:26 - 5:32] macro expansion=WIBBLE:4:9 // CHECK: Punctuation: "(" [5:32 - 5:33] // CHECK: Keyword: "int" [5:33 - 5:36] // CHECK: Punctuation: "," [5:36 - 5:37] @@ -68,8 +68,8 @@ void test() { // CHECK: Punctuation: ")" [5:43 - 5:44] // CHECK: Punctuation: ";" [5:44 - 5:45] // CHECK: Keyword: "int" [6:1 - 6:4] -// CHECK: Identifier: "BAR" [6:5 - 6:8] macro instantiation=BAR:3:9 -// CHECK: Identifier: "STILL_NOTHING" [6:9 - 6:22] macro instantiation=STILL_NOTHING:2:9 +// CHECK: Identifier: "BAR" [6:5 - 6:8] macro expansion=BAR:3:9 +// CHECK: Identifier: "STILL_NOTHING" [6:9 - 6:22] macro expansion=STILL_NOTHING:2:9 // CHECK: Punctuation: ";" [6:22 - 6:23] // CHECK: Punctuation: "#" [7:1 - 7:2] inclusion directive=foo.h // CHECK: Identifier: "include" [7:2 - 7:9] inclusion directive=foo.h @@ -115,7 +115,7 @@ void test() { // CHECK: Keyword: "int" [16:3 - 16:6] VarDecl=k:16:7 (Definition) // CHECK: Identifier: "k" [16:7 - 16:8] VarDecl=k:16:7 (Definition) // CHECK: Punctuation: "=" [16:9 - 16:10] VarDecl=k:16:7 (Definition) -// CHECK: Identifier: "REVERSE_MACRO" [16:11 - 16:24] macro instantiation=REVERSE_MACRO:10:9 +// CHECK: Identifier: "REVERSE_MACRO" [16:11 - 16:24] macro expansion=REVERSE_MACRO:10:9 // CHECK: Punctuation: "(" [16:24 - 16:25] UnexposedStmt= // CHECK: Identifier: "t" [16:25 - 16:26] DeclRefExpr=t:15:7 // CHECK: Punctuation: "," [16:26 - 16:27] UnexposedStmt= @@ -125,7 +125,7 @@ void test() { // CHECK: Keyword: "int" [17:3 - 17:6] VarDecl=j:17:7 (Definition) // CHECK: Identifier: "j" [17:7 - 17:8] VarDecl=j:17:7 (Definition) // CHECK: Punctuation: "=" [17:9 - 17:10] VarDecl=j:17:7 (Definition) -// CHECK: Identifier: "TWICE_MACRO" [17:11 - 17:22] macro instantiation=TWICE_MACRO:11:9 +// CHECK: Identifier: "TWICE_MACRO" [17:11 - 17:22] macro expansion=TWICE_MACRO:11:9 // CHECK: Punctuation: "(" [17:22 - 17:23] UnexposedStmt= // CHECK: Identifier: "k" [17:23 - 17:24] DeclRefExpr=k:16:7 // CHECK: Punctuation: "+" [17:25 - 17:26] UnexposedStmt= @@ -170,7 +170,7 @@ void test() { // CHECK: Punctuation: "=" [24:9 - 24:10] VarDecl=x:24:7 (Definition) // CHECK: Literal: "10" [24:11 - 24:13] UnexposedExpr= // CHECK: Punctuation: ";" [24:13 - 24:14] UnexposedStmt= -// CHECK: Identifier: "fun_with_macro_bodies" [25:3 - 25:24] macro instantiation=fun_with_macro_bodies:21:9 +// CHECK: Identifier: "fun_with_macro_bodies" [25:3 - 25:24] macro expansion=fun_with_macro_bodies:21:9 // CHECK: Punctuation: "(" [25:24 - 25:25] UnexposedStmt= // CHECK: Identifier: "x" [25:25 - 25:26] DeclRefExpr=x:24:7 // CHECK: Punctuation: "," [25:26 - 25:27] UnexposedStmt= diff --git a/test/Index/annotate-tokens.cpp b/test/Index/annotate-tokens.cpp index ccc9e96..165420a 100644 --- a/test/Index/annotate-tokens.cpp +++ b/test/Index/annotate-tokens.cpp @@ -17,9 +17,10 @@ struct S1 { void f(); }; struct S2 { S1 *operator->(); }; void test3(S2 s2) { s2->f(); + X foo; } -// RUN: c-index-test -test-annotate-tokens=%s:1:1:20:1 %s | FileCheck %s +// RUN: c-index-test -test-annotate-tokens=%s:1:1:21:1 %s | FileCheck %s // CHECK: Keyword: "struct" [1:1 - 1:7] StructDecl=bonk:1:8 (Definition) // CHECK: Identifier: "bonk" [1:8 - 1:12] StructDecl=bonk:1:8 (Definition) // CHECK: Punctuation: "{" [1:13 - 1:14] StructDecl=bonk:1:8 (Definition) @@ -115,4 +116,7 @@ void test3(S2 s2) { // CHECK: Punctuation: "(" [19:8 - 19:9] CallExpr=f:16:18 // CHECK: Punctuation: ")" [19:9 - 19:10] CallExpr=f:16:18 // CHECK: Punctuation: ";" [19:10 - 19:11] UnexposedStmt= -// CHECK: Punctuation: "}" [20:1 - 20:2] UnexposedStmt= +// CHECK: Identifier: "X" [20:3 - 20:4] TypeRef=struct X:7:8 +// CHECK: Identifier: "foo" [20:5 - 20:8] VarDecl=foo:20:5 (Definition) +// CHECK: Punctuation: ";" [20:8 - 20:9] UnexposedStmt= +// CHECK: Punctuation: "}" [21:1 - 21:2] UnexposedStmt= diff --git a/test/Index/annotate-tokens.m b/test/Index/annotate-tokens.m index 1eb7794..1dc7621 100644 --- a/test/Index/annotate-tokens.m +++ b/test/Index/annotate-tokens.m @@ -134,6 +134,7 @@ static Rdar8595462_A * Rdar8595462_staticVar; @interface Rdar8062781 + (Foo*)getB; @property (readonly, nonatomic) Foo *blah; +@property (readonly, atomic) Foo *abah; @end // RUN: c-index-test -test-annotate-tokens=%s:1:1:118:1 %s -DIBOutlet='__attribute__((iboutlet))' -DIBAction='void)__attribute__((ibaction)' | FileCheck %s @@ -226,7 +227,7 @@ static Rdar8595462_A * Rdar8595462_staticVar; // CHECK: Identifier: "IBActionTests" [32:12 - 32:25] ObjCInterfaceDecl=IBActionTests:32:12 // CHECK: Punctuation: "-" [33:1 - 33:2] ObjCInstanceMethodDecl=actionMethod::33:1 // CHECK: Punctuation: "(" [33:3 - 33:4] ObjCInstanceMethodDecl=actionMethod::33:1 -// CHECK: Identifier: "IBAction" [33:4 - 33:12] macro instantiation=IBAction +// CHECK: Identifier: "IBAction" [33:4 - 33:12] macro expansion=IBAction // CHECK: Punctuation: ")" [33:12 - 33:13] ObjCInstanceMethodDecl=actionMethod::33:1 // CHECK: Identifier: "actionMethod" [33:14 - 33:26] ObjCInstanceMethodDecl=actionMethod::33:1 // CHECK: Punctuation: ":" [33:26 - 33:27] ObjCInstanceMethodDecl=actionMethod::33:1 @@ -261,7 +262,7 @@ static Rdar8595462_A * Rdar8595462_staticVar; // CHECK: Identifier: "IBActionTests" [37:17 - 37:30] ObjCImplementationDecl=IBActionTests:37:1 (Definition) // CHECK: Punctuation: "-" [38:1 - 38:2] ObjCInstanceMethodDecl=actionMethod::38:1 (Definition) // CHECK: Punctuation: "(" [38:3 - 38:4] ObjCInstanceMethodDecl=actionMethod::38:1 (Definition) -// CHECK: Identifier: "IBAction" [38:4 - 38:12] macro instantiation=IBAction +// CHECK: Identifier: "IBAction" [38:4 - 38:12] macro expansion=IBAction // CHECK: Punctuation: ")" [38:12 - 38:13] ObjCInstanceMethodDecl=actionMethod::38:1 (Definition) // CHECK: Identifier: "actionMethod" [38:14 - 38:26] ObjCInstanceMethodDecl=actionMethod::38:1 (Definition) // CHECK: Punctuation: ":" [38:26 - 38:27] ObjCInstanceMethodDecl=actionMethod::38:1 (Definition) @@ -305,7 +306,7 @@ static Rdar8595462_A * Rdar8595462_staticVar; // CHECK: Keyword: "interface" [51:2 - 51:11] ObjCInterfaceDecl=IBOutletTests:51:12 // CHECK: Identifier: "IBOutletTests" [51:12 - 51:25] ObjCInterfaceDecl=IBOutletTests:51:12 // CHECK: Punctuation: "{" [52:1 - 52:2] ObjCInterfaceDecl=IBOutletTests:51:12 -// CHECK: Identifier: "IBOutlet" [53:5 - 53:13] macro instantiation=IBOutlet +// CHECK: Identifier: "IBOutlet" [53:5 - 53:13] macro expansion=IBOutlet // CHECK: Keyword: "char" [53:14 - 53:18] ObjCIvarDecl=anOutlet:53:21 (Definition) // CHECK: Punctuation: "*" [53:19 - 53:20] ObjCIvarDecl=anOutlet:53:21 (Definition) // CHECK: Identifier: "anOutlet" [53:21 - 53:29] ObjCIvarDecl=anOutlet:53:21 (Definition) @@ -313,7 +314,7 @@ static Rdar8595462_A * Rdar8595462_staticVar; // CHECK: Punctuation: "}" [54:1 - 54:2] ObjCInterfaceDecl=IBOutletTests:51:12 // CHECK: Punctuation: "-" [55:1 - 55:2] ObjCInstanceMethodDecl=actionMethod::55:1 // CHECK: Punctuation: "(" [55:3 - 55:4] ObjCInstanceMethodDecl=actionMethod::55:1 -// CHECK: Identifier: "IBAction" [55:4 - 55:12] macro instantiation=IBAction +// CHECK: Identifier: "IBAction" [55:4 - 55:12] macro expansion=IBAction // CHECK: Punctuation: ")" [55:12 - 55:13] ObjCInstanceMethodDecl=actionMethod::55:1 // CHECK: Identifier: "actionMethod" [55:14 - 55:26] ObjCInstanceMethodDecl=actionMethod::55:1 // CHECK: Punctuation: ":" [55:26 - 55:27] ObjCInstanceMethodDecl=actionMethod::55:1 @@ -324,7 +325,7 @@ static Rdar8595462_A * Rdar8595462_staticVar; // CHECK: Punctuation: ";" [55:34 - 55:35] ObjCInstanceMethodDecl=actionMethod::55:1 // CHECK: Punctuation: "@" [56:1 - 56:2] ObjCPropertyDecl=aPropOutlet:56:26 // CHECK: Keyword: "property" [56:2 - 56:10] ObjCPropertyDecl=aPropOutlet:56:26 -// CHECK: Identifier: "IBOutlet" [56:11 - 56:19] macro instantiation=IBOutlet +// CHECK: Identifier: "IBOutlet" [56:11 - 56:19] macro expansion=IBOutlet // CHECK: Keyword: "int" [56:20 - 56:23] ObjCPropertyDecl=aPropOutlet:56:26 // CHECK: Punctuation: "*" [56:24 - 56:25] ObjCPropertyDecl=aPropOutlet:56:26 // CHECK: Identifier: "aPropOutlet" [56:26 - 56:37] ObjCPropertyDecl=aPropOutlet:56:26 @@ -388,7 +389,7 @@ static Rdar8595462_A * Rdar8595462_staticVar; // CHECK: Identifier: "self" [76:18 - 76:22] DeclRefExpr=self:0:0 // CHECK: Identifier: "foo" [76:23 - 76:26] ObjCMessageExpr=foo::66:1 // CHECK: Punctuation: ":" [76:26 - 76:27] ObjCMessageExpr=foo::66:1 -// CHECK: Identifier: "VAL" [76:27 - 76:30] macro instantiation=VAL:63:9 +// CHECK: Identifier: "VAL" [76:27 - 76:30] macro expansion=VAL:63:9 // CHECK: Punctuation: "]" [76:30 - 76:31] ObjCMessageExpr=foo::66:1 // CHECK: Punctuation: ";" [76:31 - 76:32] UnexposedStmt= // CHECK: Keyword: "int" [77:5 - 77:8] VarDecl=second:77:9 (Definition) @@ -526,7 +527,7 @@ static Rdar8595462_A * Rdar8595462_staticVar; // CHECK-INSIDE_BLOCK: Punctuation: "=" [128:20 - 128:21] VarDecl=a:128:18 (Definition) // CHECK-INSIDE_BLOCK: Identifier: "self" [128:22 - 128:26] DeclRefExpr=self:0:0 -// RUN: c-index-test -test-annotate-tokens=%s:134:1:137:1 %s -DIBOutlet='__attribute__((iboutlet))' -DIBAction='void)__attribute__((ibaction)' | FileCheck -check-prefix=CHECK-PROP-AFTER-METHOD %s +// RUN: c-index-test -test-annotate-tokens=%s:134:1:138:1 %s -DIBOutlet='__attribute__((iboutlet))' -DIBAction='void)__attribute__((ibaction)' | FileCheck -check-prefix=CHECK-PROP-AFTER-METHOD %s // CHECK-PROP-AFTER-METHOD: Punctuation: "@" [134:1 - 134:2] ObjCInterfaceDecl=Rdar8062781:134:12 // CHECK-PROP-AFTER-METHOD: Keyword: "interface" [134:2 - 134:11] ObjCInterfaceDecl=Rdar8062781:134:12 // CHECK-PROP-AFTER-METHOD: Identifier: "Rdar8062781" [134:12 - 134:23] ObjCInterfaceDecl=Rdar8062781:134:12 @@ -548,4 +549,15 @@ static Rdar8595462_A * Rdar8595462_staticVar; // CHECK-PROP-AFTER-METHOD: Punctuation: "*" [136:37 - 136:38] ObjCPropertyDecl=blah:136:38 // CHECK-PROP-AFTER-METHOD: Identifier: "blah" [136:38 - 136:42] ObjCPropertyDecl=blah:136:38 // CHECK-PROP-AFTER-METHOD: Punctuation: ";" [136:42 - 136:43] ObjCInterfaceDecl=Rdar8062781:134:12 -// CHECK-PROP-AFTER-METHOD: Punctuation: "@" [137:1 - 137:2] ObjCInterfaceDecl=Rdar8062781:134:12 +// CHECK-PROP-AFTER-METHOD: Punctuation: "@" [137:1 - 137:2] ObjCPropertyDecl=abah:137:35 +// CHECK-PROP-AFTER-METHOD: Keyword: "property" [137:2 - 137:10] ObjCPropertyDecl=abah:137:35 +// CHECK-PROP-AFTER-METHOD: Punctuation: "(" [137:11 - 137:12] ObjCPropertyDecl=abah:137:35 +// CHECK-PROP-AFTER-METHOD: Keyword: "readonly" [137:12 - 137:20] ObjCPropertyDecl=abah:137:35 +// CHECK-PROP-AFTER-METHOD: Punctuation: "," [137:20 - 137:21] ObjCPropertyDecl=abah:137:35 +// CHECK-PROP-AFTER-METHOD: Keyword: "atomic" [137:22 - 137:28] ObjCPropertyDecl=abah:137:35 +// CHECK-PROP-AFTER-METHOD: Punctuation: ")" [137:28 - 137:29] ObjCPropertyDecl=abah:137:35 +// CHECK-PROP-AFTER-METHOD: Identifier: "Foo" [137:30 - 137:33] ObjCClassRef=Foo:1:12 +// CHECK-PROP-AFTER-METHOD: Punctuation: "*" [137:34 - 137:35] ObjCPropertyDecl=abah:137:35 +// CHECK-PROP-AFTER-METHOD: Identifier: "abah" [137:35 - 137:39] ObjCPropertyDecl=abah:137:35 +// CHECK-PROP-AFTER-METHOD: Punctuation: ";" [137:39 - 137:40] ObjCInterfaceDecl=Rdar8062781:134:12 +// CHECK-PROP-AFTER-METHOD: Punctuation: "@" [138:1 - 138:2] ObjCInterfaceDecl=Rdar8062781:134:12 diff --git a/test/Index/arc-annotate.m b/test/Index/arc-annotate.m new file mode 100644 index 0000000..b836bc8 --- /dev/null +++ b/test/Index/arc-annotate.m @@ -0,0 +1,38 @@ +@interface A +@property (strong, nonatomic) id property; +@property (nonatomic, weak) id second_property; +@property (unsafe_unretained, nonatomic) id third_property; +@end + +// RUN: c-index-test -test-annotate-tokens=%s:1:1:5:1 %s -fobjc-arc -fobjc-nonfragile-abi | FileCheck %s +// CHECK: Punctuation: "@" [1:1 - 1:2] ObjCInterfaceDecl=A:1:12 +// CHECK: Keyword: "interface" [1:2 - 1:11] ObjCInterfaceDecl=A:1:12 +// CHECK: Identifier: "A" [1:12 - 1:13] ObjCInterfaceDecl=A:1:12 +// CHECK: Punctuation: "@" [2:1 - 2:2] ObjCPropertyDecl=property:2:34 +// CHECK: Keyword: "property" [2:2 - 2:10] ObjCPropertyDecl=property:2:34 +// CHECK: Punctuation: "(" [2:11 - 2:12] ObjCPropertyDecl=property:2:34 +// CHECK: Keyword: "strong" [2:12 - 2:18] ObjCPropertyDecl=property:2:34 +// CHECK: Punctuation: "," [2:18 - 2:19] ObjCPropertyDecl=property:2:34 +// CHECK: Keyword: "nonatomic" [2:20 - 2:29] ObjCPropertyDecl=property:2:34 +// CHECK: Punctuation: ")" [2:29 - 2:30] ObjCPropertyDecl=property:2:34 +// CHECK: Identifier: "id" [2:31 - 2:33] TypeRef=id:0:0 +// CHECK: Identifier: "property" [2:34 - 2:42] ObjCPropertyDecl=property:2:34 +// CHECK: Punctuation: ";" [2:42 - 2:43] ObjCInterfaceDecl=A:1:12 +// CHECK: Punctuation: "@" [3:1 - 3:2] ObjCPropertyDecl=second_property:3:32 +// CHECK: Keyword: "property" [3:2 - 3:10] ObjCPropertyDecl=second_property:3:32 +// CHECK: Punctuation: "(" [3:11 - 3:12] ObjCPropertyDecl=second_property:3:32 +// CHECK: Keyword: "nonatomic" [3:12 - 3:21] ObjCPropertyDecl=second_property:3:32 +// CHECK: Punctuation: "," [3:21 - 3:22] ObjCPropertyDecl=second_property:3:32 +// CHECK: Keyword: "weak" [3:23 - 3:27] ObjCPropertyDecl=second_property:3:32 +// CHECK: Punctuation: ")" [3:27 - 3:28] ObjCPropertyDecl=second_property:3:32 +// CHECK: Identifier: "id" [3:29 - 3:31] TypeRef=id:0:0 +// CHECK: Identifier: "second_property" [3:32 - 3:47] ObjCPropertyDecl=second_property:3:32 +// CHECK: Punctuation: "@" [4:1 - 4:2] ObjCPropertyDecl=third_property:4:45 +// CHECK: Keyword: "property" [4:2 - 4:10] ObjCPropertyDecl=third_property:4:45 +// CHECK: Punctuation: "(" [4:11 - 4:12] ObjCPropertyDecl=third_property:4:45 +// CHECK: Keyword: "unsafe_unretained" [4:12 - 4:29] ObjCPropertyDecl=third_property:4:45 +// CHECK: Punctuation: "," [4:29 - 4:30] ObjCPropertyDecl=third_property:4:45 +// CHECK: Keyword: "nonatomic" [4:31 - 4:40] ObjCPropertyDecl=third_property:4:45 +// CHECK: Punctuation: ")" [4:40 - 4:41] ObjCPropertyDecl=third_property:4:45 +// CHECK: Identifier: "id" [4:42 - 4:44] TypeRef=id:0:0 +// CHECK: Identifier: "third_property" [4:45 - 4:59] ObjCPropertyDecl=third_property:4:45 diff --git a/test/Index/arc-complete.m b/test/Index/arc-complete.m new file mode 100644 index 0000000..328983c --- /dev/null +++ b/test/Index/arc-complete.m @@ -0,0 +1,16 @@ +typedef const void *CFTypeRef; + +void test(id x) { + (__bridge CFTypeRef)x; +} + + + +// RUN: c-index-test -code-completion-at=%s:4:4 %s -fobjc-arc -fobjc-nonfragile-abi | FileCheck -check-prefix=CHECK-CC1 %s +// CHECK-CC1: macro definition:{TypedText __autoreleasing} (70) +// CHECK-CC1: NotImplemented:{TypedText __bridge}{HorizontalSpace }{Placeholder type}{RightParen )}{Placeholder expression} (40) +// CHECK-CC1: NotImplemented:{TypedText __bridge_retained}{HorizontalSpace }{Placeholder CF type}{RightParen )}{Placeholder expression} (40) +// CHECK-CC1: NotImplemented:{TypedText __bridge_transfer}{HorizontalSpace }{Placeholder Objective-C type}{RightParen )}{Placeholder expression} (40) +// CHECK-CC1: macro definition:{TypedText __strong} (70) +// CHECK-CC1: macro definition:{TypedText __unsafe_unretained} (70) +// CHECK-CC1: macro definition:{TypedText __weak} (70) diff --git a/test/Index/c-index-api-loadTU-test.m b/test/Index/c-index-api-loadTU-test.m index 98a41d8..ab5f9a9 100644 --- a/test/Index/c-index-api-loadTU-test.m +++ b/test/Index/c-index-api-loadTU-test.m @@ -70,6 +70,11 @@ typedef struct X0 X1; struct X0; struct X0 {}; +@interface TestAttributes() +// <rdar://problem/9561076> +@property (retain) IBOutlet id anotherOutlet; +@end + // CHECK: c-index-api-loadTU-test.m:4:12: ObjCInterfaceDecl=Foo:4:12 Extent=[4:1 - 12:5] // CHECK: c-index-api-loadTU-test.m:6:32: ObjCIvarDecl=myoutlet:6:32 (Definition) Extent=[6:3 - 6:40] // CHECK: <invalid loc>:0:0: attribute(iboutlet)= @@ -150,3 +155,9 @@ struct X0 {}; // CHECK: c-index-api-loadTU-test.m:70:8: StructDecl=X0:70:8 Extent=[70:1 - 70:10] // CHECK: c-index-api-loadTU-test.m:71:8: StructDecl=X0:71:8 (Definition) Extent=[71:1 - 71:14] +// CHECK: <invalid loc>:0:0: attribute(iboutlet)= +// CHECK: c-index-api-loadTU-test.m:75:29: TypeRef=id:0:0 Extent=[75:29 - 75:31] +// CHECK: c-index-api-loadTU-test.m:75:32: ObjCInstanceMethodDecl=anotherOutlet:75:32 Extent=[75:32 - 75:45] +// CHECK: c-index-api-loadTU-test.m:75:32: ObjCInstanceMethodDecl=setAnotherOutlet::75:32 Extent=[75:32 - 75:45] +// CHECK: c-index-api-loadTU-test.m:75:32: ParmDecl=anotherOutlet:75:32 (Definition) Extent=[75:32 - 75:45] + diff --git a/test/Index/c-index-getCursor-pp.c b/test/Index/c-index-getCursor-pp.c index 8f98691..df61ec0 100644 --- a/test/Index/c-index-getCursor-pp.c +++ b/test/Index/c-index-getCursor-pp.c @@ -18,15 +18,15 @@ B(int x); // RUN: c-index-test -cursor-at=%s:2:14 -I%S/Inputs %s | FileCheck -check-prefix=CHECK-2 %s // CHECK-2: macro definition=DECORATION // RUN: c-index-test -cursor-at=%s:5:7 -I%S/Inputs %s | FileCheck -check-prefix=CHECK-3 %s -// CHECK-3: macro instantiation=OBSCURE:1:9 +// CHECK-3: macro expansion=OBSCURE:1:9 // RUN: c-index-test -cursor-at=%s:6:6 -I%S/Inputs %s | FileCheck -check-prefix=CHECK-4 %s -// CHECK-4: macro instantiation=OBSCURE:1:9 +// CHECK-4: macro expansion=OBSCURE:1:9 // RUN: c-index-test -cursor-at=%s:6:19 -I%S/Inputs %s | FileCheck -check-prefix=CHECK-5 %s -// CHECK-5: macro instantiation=DECORATION:2:9 +// CHECK-5: macro expansion=DECORATION:2:9 // RUN: c-index-test -cursor-at=%s:9:10 -I%S/Inputs %s | FileCheck -check-prefix=CHECK-6 %s // CHECK-6: inclusion directive=a.h // RUN: c-index-test -cursor-at=%s:14:1 -I%S/Inputs %s | FileCheck -check-prefix=CHECK-7 %s -// CHECK-7: macro instantiation=B:12:9 +// CHECK-7: macro expansion=B:12:9 // Same tests, but with "editing" optimizations // RUN: env CINDEXTEST_EDITING=1 c-index-test -cursor-at=%s:1:11 -I%S/Inputs %s | FileCheck -check-prefix=CHECK-1 %s diff --git a/test/Index/c-index-getCursor-test.m b/test/Index/c-index-getCursor-test.m index c2ff696..6df8c1a 100644 --- a/test/Index/c-index-getCursor-test.m +++ b/test/Index/c-index-getCursor-test.m @@ -165,4 +165,4 @@ void f() { // CHECK: [55:9 - 55:26] macro definition=CONCAT // CHECK: [57:1 - 57:10] FunctionDecl=f:57:6 (Definition) // CHECK: [58:4 - 58:8] VarDecl=my_var:58:8 (Definition) -// CHECK: [58:8 - 58:14] macro instantiation=CONCAT:55:9 +// CHECK: [58:8 - 58:14] macro expansion=CONCAT:55:9 diff --git a/test/Index/code-completion.cpp b/test/Index/code-completion.cpp index 62b9e4d..f75d61f 100644 --- a/test/Index/code-completion.cpp +++ b/test/Index/code-completion.cpp @@ -52,10 +52,21 @@ Z::operator int() const { // CHECK-MEMBER: CXXDestructor:{ResultType void}{Informative X::}{TypedText ~X}{LeftParen (}{RightParen )} // CHECK-MEMBER: CXXDestructor:{ResultType void}{Informative Y::}{TypedText ~Y}{LeftParen (}{RightParen )} // CHECK-MEMBER: CXXDestructor:{ResultType void}{TypedText ~Z}{LeftParen (}{RightParen )} +// CHECK-MEMBER: Completion contexts: +// CHECK-MEMBER-NEXT: Dot member access // 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 )} +// CHECK-OVERLOAD: Completion contexts: +// CHECK-OVERLOAD-NEXT: Any type +// CHECK-OVERLOAD-NEXT: Any value +// CHECK-OVERLOAD-NEXT: Enum tag +// CHECK-OVERLOAD-NEXT: Union tag +// CHECK-OVERLOAD-NEXT: Struct tag +// CHECK-OVERLOAD-NEXT: Class name +// CHECK-OVERLOAD-NEXT: Nested name specifier +// CHECK-OVERLOAD-NEXT: Objective-C interface // RUN: c-index-test -code-completion-at=%s:37:10 %s | FileCheck -check-prefix=CHECK-EXPR %s // CHECK-EXPR: NotImplemented:{TypedText int} (50) @@ -65,3 +76,12 @@ Z::operator int() const { // CHECK-EXPR: FieldDecl:{ResultType float}{Text Y::}{TypedText member} (18) // CHECK-EXPR: CXXMethod:{ResultType void}{TypedText memfunc}{LeftParen (}{Optional {Placeholder int i}}{RightParen )} (37) // CHECK-EXPR: Namespace:{TypedText N}{Text ::} (75) +// CHECK-EXPR: Completion contexts: +// CHECK-EXPR-NEXT: Any type +// CHECK-EXPR-NEXT: Any value +// CHECK-EXPR-NEXT: Enum tag +// CHECK-EXPR-NEXT: Union tag +// CHECK-EXPR-NEXT: Struct tag +// CHECK-EXPR-NEXT: Class name +// CHECK-EXPR-NEXT: Nested name specifier +// CHECK-EXPR-NEXT: Objective-C interface diff --git a/test/Index/complete-exprs.m b/test/Index/complete-exprs.m index 0446dcd..dfa114d 100644 --- a/test/Index/complete-exprs.m +++ b/test/Index/complete-exprs.m @@ -7,10 +7,10 @@ typedef signed char BOOL; @property int prop1; @end - +__strong id global; @implementation A - (int)method:(id)param1 { - + void foo(id (^block)(id x, A* y)); for(BOOL B = YES; ; ) { } } @end @@ -27,3 +27,8 @@ typedef signed char BOOL; // CHECK-CC2: TypedefDecl:{TypedText BOOL} (50) // CHECK-CC2: NotImplemented:{TypedText char} (50) // CHECK-CC2: NotImplemented:{TypedText sizeof}{LeftParen (}{Placeholder expression-or-type}{RightParen )} (40) +// RUN: c-index-test -code-completion-at=%s:15:1 -fobjc-arc -fobjc-nonfragile-abi %s | FileCheck -check-prefix=CHECK-CC3 %s +// RUN: env CINDEXTEST_EDITING=1 CINDEXTEST_COMPLETION_CACHING=1 c-index-test -code-completion-at=%s:15:1 -fobjc-arc -fobjc-nonfragile-abi %s | FileCheck -check-prefix=CHECK-CC3 %s +// CHECK-CC3: FunctionDecl:{ResultType void}{TypedText foo}{LeftParen (}{Placeholder ^id(id x, A *y)block}{RightParen )} (34) +// CHECK-CC3: VarDecl:{ResultType id}{TypedText global} (50) +// CHECK-CC3: ParmDecl:{ResultType id}{TypedText param1} (34) diff --git a/test/Index/complete-natural.m b/test/Index/complete-natural.m index e1aba39..326b8a7 100644 --- a/test/Index/complete-natural.m +++ b/test/Index/complete-natural.m @@ -11,8 +11,9 @@ char in_char = 'a'; // RUN: c-index-test -code-completion-at=%s:4:32 %s > %t // RUN: echo "DONE" >> %t // RUN: FileCheck -check-prefix=CHECK-CC1 %s < %t -// CHECK-CC1-NOT: : -// CHECK-CC1: DONE +// CHECK-CC1: Completion contexts: +// CHECK-CC1-NEXT: Natural language +// CHECK-CC1-NEXT: DONE // RUN: c-index-test -code-completion-at=%s:5:18 %s > %t // RUN: echo "DONE" >> %t // RUN: FileCheck -check-prefix=CHECK-CC1 %s < %t diff --git a/test/Index/complete-property-flags.m b/test/Index/complete-property-flags.m index af9e214..f2e08c3 100644 --- a/test/Index/complete-property-flags.m +++ b/test/Index/complete-property-flags.m @@ -16,6 +16,8 @@ // CHECK-CC1-NEXT: {TypedText readwrite} // CHECK-CC1-NEXT: {TypedText retain} // CHECK-CC1-NEXT: {TypedText setter}{Text = }{Placeholder method} +// CHECK-CC1-NEXT: {TypedText strong} +// CHECK-CC1-NEXT: {TypedText unsafe_unretained} // RUN: c-index-test -code-completion-at=%s:8:18 %s | FileCheck -check-prefix=CHECK-CC2 %s // CHECK-CC2: {TypedText getter}{Text = }{Placeholder method} // CHECK-CC2-NEXT: {TypedText nonatomic} diff --git a/test/Index/get-cursor.cpp b/test/Index/get-cursor.cpp index f26d982..2aa76c4 100644 --- a/test/Index/get-cursor.cpp +++ b/test/Index/get-cursor.cpp @@ -31,6 +31,10 @@ struct YDerived : Y { X getAnotherX() { return member; } }; +void test() { + X foo; +} + // RUN: c-index-test -cursor-at=%s:12:20 %s | FileCheck -check-prefix=CHECK-VALUE-REF %s // RUN: c-index-test -cursor-at=%s:13:21 %s | FileCheck -check-prefix=CHECK-VALUE-REF %s // RUN: c-index-test -cursor-at=%s:13:28 %s | FileCheck -check-prefix=CHECK-VALUE-REF %s @@ -61,3 +65,6 @@ struct YDerived : Y { // RUN: c-index-test -cursor-at=%s:27:10 %s | FileCheck -check-prefix=CHECK-IMPLICIT-MEMREF %s // RUN: c-index-test -cursor-at=%s:31:28 %s | FileCheck -check-prefix=CHECK-IMPLICIT-MEMREF %s // CHECK-IMPLICIT-MEMREF: MemberRefExpr=member:21:7 + +// RUN: c-index-test -cursor-at=%s:35:5 %s | FileCheck -check-prefix=CHECK-DECL %s +// CHECK-DECL: VarDecl=foo:35:5 diff --git a/test/Index/nested-macro-instantiations.cpp b/test/Index/nested-macro-instantiations.cpp index d0c9bbb1..9d0c052 100644 --- a/test/Index/nested-macro-instantiations.cpp +++ b/test/Index/nested-macro-instantiations.cpp @@ -7,14 +7,14 @@ WIBBLE(int x); // RUN: env CINDEXTEST_NESTED_MACROS=1 c-index-test -test-load-source all %s | FileCheck -check-prefix CHECK-WITH-NESTED %s // RUN: env CINDEXTEST_EDITING=1 CINDEXTEST_NESTED_MACROS=1 c-index-test -test-load-source all %s | FileCheck -check-prefix CHECK-WITH-NESTED %s // RUN: env CINDEXTEST_EDITING=1 CINDEXTEST_NESTED_MACROS=1 c-index-test -test-load-source-reparse 5 all %s | FileCheck -check-prefix CHECK-WITH-NESTED %s -// CHECK-WITH-NESTED: nested-macro-instantiations.cpp:5:1: macro instantiation=WIBBLE:3:9 Extent=[5:1 - 5:7] -// CHECK-WITH-NESTED: nested-macro-instantiations.cpp:3:19: macro instantiation=BAR:2:9 Extent=[3:19 - 5:14] -// CHECK-WITH-NESTED: nested-macro-instantiations.cpp:2:16: macro instantiation=FOO:1:9 Extent=[2:16 - 5:14] +// CHECK-WITH-NESTED: nested-macro-instantiations.cpp:5:1: macro expansion=WIBBLE:3:9 Extent=[5:1 - 5:7] +// CHECK-WITH-NESTED: nested-macro-instantiations.cpp:3:19: macro expansion=BAR:2:9 Extent=[3:19 - 5:14] +// CHECK-WITH-NESTED: nested-macro-instantiations.cpp:2:16: macro expansion=FOO:1:9 Extent=[2:16 - 5:14] // CHECK-WITH-NESTED: nested-macro-instantiations.cpp:5:1: VarDecl=x:5:1 (Definition) Extent=[5:1 - 5:14] // RUN: c-index-test -test-load-source all %s | FileCheck -check-prefix CHECK-WITHOUT-NESTED %s // RUN: env CINDEXTEST_EDITING=1 c-index-test -test-load-source all %s | FileCheck -check-prefix CHECK-WITHOUT-NESTED %s // RUN: env CINDEXTEST_EDITING=1 c-index-test -test-load-source-reparse 5 all %s | FileCheck -check-prefix CHECK-WITHOUT-NESTED %s -// CHECK-WITHOUT-NESTED: nested-macro-instantiations.cpp:5:1: macro instantiation=WIBBLE:3:9 Extent=[5:1 - 5:7] -// CHECK-WITHOUT-NESTED-NOT: nested-macro-instantiations.cpp:3:19: macro instantiation=BAR:2:9 Extent=[3:19 - 5:14] +// CHECK-WITHOUT-NESTED: nested-macro-instantiations.cpp:5:1: macro expansion=WIBBLE:3:9 Extent=[5:1 - 5:7] +// CHECK-WITHOUT-NESTED-NOT: nested-macro-instantiations.cpp:3:19: macro expansion=BAR:2:9 Extent=[3:19 - 5:14] // CHECK-WITHOUT-NESTED: nested-macro-instantiations.cpp:5:1: VarDecl=x:5:1 (Definition) Extent=[5:1 - 5:14] diff --git a/test/Index/werror.c b/test/Index/werror.c new file mode 100644 index 0000000..150095d --- /dev/null +++ b/test/Index/werror.c @@ -0,0 +1,15 @@ +inline int *get_int_ptr(float *fp) { + return fp; +} + +#ifdef FATAL +void fatal(int); +void fatal(float); +#endif + +// CHECK-FATAL: translation errors + +// RUN: c-index-test -write-pch %t.pch -Werror %s +// RUN: not c-index-test -write-pch %t.pch -DFATAL -Werror %s 2>%t.err +// RUN: FileCheck -check-prefix=CHECK-FATAL %s < %t.err + |