From: Daniel Dunbar Date: Sun, 14 Feb 2010 08:32:51 +0000 (+0000) Subject: c-index-test: Unify and always print half-open extents. X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=8f0bf81c0f3ab31881cc7db7914e6978bb2a19af;p=clang c-index-test: Unify and always print half-open extents. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@96160 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/test/Index/TestClassDecl.m b/test/Index/TestClassDecl.m index 32d4d4c668..b55c8623a5 100644 --- a/test/Index/TestClassDecl.m +++ b/test/Index/TestClassDecl.m @@ -15,19 +15,19 @@ void function(Foo * arg) // nothing here. } -// CHECK-scan: [1:1 - 7:1] Invalid Cursor => NoDeclFound -// CHECK-scan: [8:1 - 8:7] UnexposedDecl=:8:1 -// CHECK-scan: [8:8 - 8:10] ObjCClassRef=Foo:10:12 -// CHECK-scan: [8:11 - 9:1] Invalid Cursor => NoDeclFound -// CHECK-scan: [10:1 - 11:4] ObjCInterfaceDecl=Foo:10:12 -// CHECK-scan: [11:5 - 13:5] Invalid Cursor => NoDeclFound -// CHECK-scan: [13:6 - 13:14] FunctionDecl=function:13:6 (Definition) -// CHECK-scan: [13:15 - 13:17] ObjCClassRef=Foo:10:12 -// CHECK-scan: [13:18 - 13:23] ParmDecl=arg:13:21 (Definition) -// CHECK-scan: [13:24 - 13:25] FunctionDecl=function:13:6 (Definition) -// CHECK-scan: [14:1 - 16:1] UnexposedStmt= +// CHECK-scan: [1:1 - 8:1] Invalid Cursor => NoDeclFound +// CHECK-scan: [8:1 - 8:8] UnexposedDecl=:8:1 +// CHECK-scan: [8:8 - 8:11] ObjCClassRef=Foo:10:12 +// CHECK-scan: [8:11 - 10:1] Invalid Cursor => NoDeclFound +// CHECK-scan: [10:1 - 11:5] ObjCInterfaceDecl=Foo:10:12 +// CHECK-scan: [11:5 - 13:6] Invalid Cursor => NoDeclFound +// CHECK-scan: [13:6 - 13:15] FunctionDecl=function:13:6 (Definition) +// CHECK-scan: [13:15 - 13:18] ObjCClassRef=Foo:10:12 +// CHECK-scan: [13:18 - 13:24] ParmDecl=arg:13:21 (Definition) +// CHECK-scan: [13:24 - 14:1] FunctionDecl=function:13:6 (Definition) +// CHECK-scan: [14:1 - 16:2] UnexposedStmt= -// CHECK-load: TestClassDecl.m:10:12: ObjCInterfaceDecl=Foo:10:12 Extent=[10:1 - 11:4] -// CHECK-load: TestClassDecl.m:13:6: FunctionDecl=function:13:6 (Definition) Extent=[13:6 - 16:1] -// CHECK-load: TestClassDecl.m:13:21: ParmDecl=arg:13:21 (Definition) Extent=[13:15 - 13:23] +// CHECK-load: TestClassDecl.m:10:12: ObjCInterfaceDecl=Foo:10:12 Extent=[10:1 - 11:5] +// CHECK-load: TestClassDecl.m:13:6: FunctionDecl=function:13:6 (Definition) Extent=[13:6 - 16:2] +// CHECK-load: TestClassDecl.m:13:21: ParmDecl=arg:13:21 (Definition) Extent=[13:15 - 13:24] diff --git a/test/Index/TestClassForwardDecl.m b/test/Index/TestClassForwardDecl.m index 2943c67c6c..325a4236a5 100644 --- a/test/Index/TestClassForwardDecl.m +++ b/test/Index/TestClassForwardDecl.m @@ -12,15 +12,15 @@ void function(Foo * arg) // nothing here. } -// CHECK-scan: [1:1 - 7:1] Invalid Cursor => NoDeclFound -// CHECK-scan: [8:1 - 8:7] UnexposedDecl=:8:1 -// CHECK-scan: [8:8 - 8:10] ObjCClassRef=Foo:8:8 -// CHECK-scan: [8:11 - 10:5] Invalid Cursor => NoDeclFound -// CHECK-scan: [10:6 - 10:14] FunctionDecl=function:10:6 (Definition) -// CHECK-scan: [10:15 - 10:17] ObjCClassRef=Foo:8:8 -// CHECK-scan: [10:18 - 10:23] ParmDecl=arg:10:21 (Definition) -// CHECK-scan: [10:24 - 10:25] FunctionDecl=function:10:6 (Definition) -// CHECK-scan: [11:1 - 13:1] UnexposedStmt= +// CHECK-scan: [1:1 - 8:1] Invalid Cursor => NoDeclFound +// CHECK-scan: [8:1 - 8:8] UnexposedDecl=:8:1 +// CHECK-scan: [8:8 - 8:11] ObjCClassRef=Foo:8:8 +// CHECK-scan: [8:11 - 10:6] Invalid Cursor => NoDeclFound +// CHECK-scan: [10:6 - 10:15] FunctionDecl=function:10:6 (Definition) +// CHECK-scan: [10:15 - 10:18] ObjCClassRef=Foo:8:8 +// CHECK-scan: [10:18 - 10:24] ParmDecl=arg:10:21 (Definition) +// CHECK-scan: [10:24 - 11:1] FunctionDecl=function:10:6 (Definition) +// CHECK-scan: [11:1 - 13:2] UnexposedStmt= diff --git a/test/Index/annotate-tokens.c b/test/Index/annotate-tokens.c index b1af2ff14e..ef0069c887 100644 --- a/test/Index/annotate-tokens.c +++ b/test/Index/annotate-tokens.c @@ -10,54 +10,55 @@ void f(void *ptr) { } // RUN: c-index-test -test-annotate-tokens=%s:4:1:9:32 %s | FileCheck %s -// CHECK: Identifier: "T" [4:3 - 4:3] TypeRef=T:1:13 -// CHECK: Punctuation: "*" [4:4 - 4:4] -// CHECK: Identifier: "t_ptr" [4:6 - 4:10] VarDecl=t_ptr:4:6 (Definition) -// CHECK: Punctuation: "=" [4:12 - 4:12] -// CHECK: Punctuation: "(" [4:14 - 4:14] -// CHECK: Identifier: "T" [4:15 - 4:15] TypeRef=T:1:13 -// CHECK: Punctuation: "*" [4:17 - 4:17] -// CHECK: Punctuation: ")" [4:18 - 4:18] -// CHECK: Identifier: "ptr" [4:19 - 4:21] DeclRefExpr=ptr:3:14 -// CHECK: Punctuation: ";" [4:22 - 4:22] -// CHECK: Punctuation: "(" [5:3 - 5:3] -// CHECK: Keyword: "void" [5:4 - 5:7] -// CHECK: Punctuation: ")" [5:8 - 5:8] -// CHECK: Keyword: "sizeof" [5:9 - 5:14] -// CHECK: Punctuation: "(" [5:15 - 5:15] -// CHECK: Identifier: "T" [5:16 - 5:16] TypeRef=T:1:13 -// CHECK: Punctuation: ")" [5:17 - 5:17] -// CHECK: Punctuation: ";" [5:18 - 5:18] -// CHECK: Comment: "/* A comment */" [6:3 - 6:17] -// CHECK: Keyword: "struct" [7:3 - 7:8] -// CHECK: Identifier: "X" [7:10 - 7:10] TypeRef=struct X:2:8 -// CHECK: Identifier: "x" [7:12 - 7:12] VarDecl=x:7:12 (Definition) -// CHECK: Punctuation: "=" [7:14 - 7:14] -// CHECK: Punctuation: "(" [7:16 - 7:16] -// CHECK: Keyword: "struct" [7:17 - 7:22] -// CHECK: Identifier: "X" [7:24 - 7:24] TypeRef=struct X:2:8 -// CHECK: Punctuation: ")" [7:25 - 7:25] -// CHECK: Punctuation: "{" [7:26 - 7:26] -// CHECK: Literal: "1" [7:27 - 7:27] -// CHECK: Punctuation: "," [7:28 - 7:28] -// CHECK: Literal: "2" [7:30 - 7:30] -// CHECK: Punctuation: "}" [7:31 - 7:31] -// CHECK: Punctuation: ";" [7:32 - 7:32] -// CHECK: Keyword: "void" [8:3 - 8:6] -// CHECK: Punctuation: "*" [8:8 - 8:8] -// CHECK: Identifier: "xx" [8:9 - 8:10] VarDecl=xx:8:9 (Definition) -// CHECK: Punctuation: "=" [8:12 - 8:12] -// CHECK: Identifier: "ptr" [8:14 - 8:16] DeclRefExpr=ptr:3:14 -// CHECK: Punctuation: "?" [8:18 - 8:18] -// CHECK: Punctuation: ":" [8:20 - 8:20] -// CHECK: Punctuation: "&" [8:22 - 8:22] -// CHECK: Identifier: "x" [8:23 - 8:23] DeclRefExpr=x:7:12 -// CHECK: Punctuation: ";" [8:24 - 8:24] -// CHECK: Keyword: "const" [9:3 - 9:7] -// CHECK: Keyword: "char" [9:9 - 9:12] -// CHECK: Punctuation: "*" [9:14 - 9:14] -// CHECK: Identifier: "hello" [9:16 - 9:20] VarDecl=hello:9:16 (Definition) -// CHECK: Punctuation: "=" [9:22 - 9:22] -// CHECK: Literal: ""Hello"" [9:24 - 9:30] -// CHECK: Punctuation: ";" [9:31 - 9:31] -// CHECK: Punctuation: "}" [10:1 - 10:1] +// CHECK: Identifier: "T" [4:3 - 4:4] TypeRef=T:1:13 +// CHECK: Punctuation: "*" [4:4 - 4:5] +// CHECK: Identifier: "t_ptr" [4:6 - 4:11] VarDecl=t_ptr:4:6 (Definition) +// CHECK: Punctuation: "=" [4:12 - 4:13] +// CHECK: Punctuation: "(" [4:14 - 4:15] +// CHECK: Identifier: "T" [4:15 - 4:16] TypeRef=T:1:13 +// CHECK: Punctuation: "*" [4:17 - 4:18] +// CHECK: Punctuation: ")" [4:18 - 4:19] +// CHECK: Identifier: "ptr" [4:19 - 4:22] DeclRefExpr=ptr:3:14 +// CHECK: Punctuation: ";" [4:22 - 4:23] +// CHECK: Punctuation: "(" [5:3 - 5:4] +// CHECK: Keyword: "void" [5:4 - 5:8] +// CHECK: Punctuation: ")" [5:8 - 5:9] +// CHECK: Keyword: "sizeof" [5:9 - 5:15] +// CHECK: Punctuation: "(" [5:15 - 5:16] +// CHECK: Identifier: "T" [5:16 - 5:17] TypeRef=T:1:13 +// CHECK: Punctuation: ")" [5:17 - 5:18] +// CHECK: Punctuation: ";" [5:18 - 5:19] +// CHECK: Comment: "/* A comment */" [6:3 - 6:18] +// CHECK: Keyword: "struct" [7:3 - 7:9] +// CHECK: Identifier: "X" [7:10 - 7:11] TypeRef=struct X:2:8 +// CHECK: Identifier: "x" [7:12 - 7:13] VarDecl=x:7:12 (Definition) +// CHECK: Punctuation: "=" [7:14 - 7:15] +// CHECK: Punctuation: "(" [7:16 - 7:17] +// CHECK: Keyword: "struct" [7:17 - 7:23] +// CHECK: Identifier: "X" [7:24 - 7:25] TypeRef=struct X:2:8 +// CHECK: Punctuation: ")" [7:25 - 7:26] +// CHECK: Punctuation: "{" [7:26 - 7:27] +// CHECK: Literal: "1" [7:27 - 7:28] +// CHECK: Punctuation: "," [7:28 - 7:29] +// CHECK: Literal: "2" [7:30 - 7:31] +// CHECK: Punctuation: "}" [7:31 - 7:32] +// CHECK: Punctuation: ";" [7:32 - 7:33] +// CHECK: Keyword: "void" [8:3 - 8:7] +// CHECK: Punctuation: "*" [8:8 - 8:9] +// CHECK: Identifier: "xx" [8:9 - 8:11] VarDecl=xx:8:9 (Definition) +// CHECK: Punctuation: "=" [8:12 - 8:13] +// CHECK: Identifier: "ptr" [8:14 - 8:17] DeclRefExpr=ptr:3:14 +// CHECK: Punctuation: "?" [8:18 - 8:19] +// CHECK: Punctuation: ":" [8:20 - 8:21] +// CHECK: Punctuation: "&" [8:22 - 8:23] +// CHECK: Identifier: "x" [8:23 - 8:24] DeclRefExpr=x:7:12 +// CHECK: Punctuation: ";" [8:24 - 8:25] +// CHECK: Keyword: "const" [9:3 - 9:8] +// CHECK: Keyword: "char" [9:9 - 9:13] +// CHECK: Punctuation: "*" [9:14 - 9:15] +// CHECK: Identifier: "hello" [9:16 - 9:21] VarDecl=hello:9:16 (Definition) +// CHECK: Punctuation: "=" [9:22 - 9:23] +// CHECK: Literal: ""Hello"" [9:24 - 9:31] +// CHECK: Punctuation: ";" [9:31 - 9:32] +// CHECK: Punctuation: "}" [10:1 - 10:2] + diff --git a/test/Index/c-index-api-loadTU-test.m b/test/Index/c-index-api-loadTU-test.m index f07528a8f8..cd0c8687aa 100644 --- a/test/Index/c-index-api-loadTU-test.m +++ b/test/Index/c-index-api-loadTU-test.m @@ -69,63 +69,63 @@ int main (int argc, const char * argv[]) { // CHECK: :87:159: TypedefDecl=__builtin_va_list:87:159 (Definition) // CHECK: :87:145: TypeRef=__va_list_tag:87:123 // CHECK: :87:177: UnexposedExpr= -// CHECK: c-index-api-loadTU-test.m:4:12: ObjCInterfaceDecl=Foo:4:12 Extent=[4:1 - 11:4] -// CHECK: c-index-api-loadTU-test.m:8:1: ObjCInstanceMethodDecl=foo:8:1 Extent=[8:1 - 8:6] -// CHECK: c-index-api-loadTU-test.m:9:1: ObjCClassMethodDecl=fooC:9:1 Extent=[9:1 - 9:7] -// CHECK: c-index-api-loadTU-test.m:13:12: ObjCInterfaceDecl=Bar:13:12 Extent=[13:1 - 17:4] -// CHECK: c-index-api-loadTU-test.m:13:18: ObjCSuperClassRef=Foo:4:12 Extent=[13:18 - 13:20] -// CHECK: c-index-api-loadTU-test.m:19:12: ObjCCategoryDecl=FooCat:19:12 Extent=[19:1 - 22:4] -// CHECK: c-index-api-loadTU-test.m:19:12: ObjCClassRef=Foo:4:12 Extent=[19:12 - 19:14] -// CHECK: c-index-api-loadTU-test.m:20:1: ObjCInstanceMethodDecl=catMethodWithFloat::20:1 Extent=[20:1 - 20:40] -// CHECK: c-index-api-loadTU-test.m:20:36: ParmDecl=fArg:20:36 (Definition) Extent=[20:29 - 20:39] -// CHECK: c-index-api-loadTU-test.m:21:1: ObjCInstanceMethodDecl=floatMethod:21:1 Extent=[21:1 - 21:22] -// CHECK: c-index-api-loadTU-test.m:24:1: ObjCProtocolDecl=Proto:24:1 (Definition) Extent=[24:1 - 26:4] -// CHECK: c-index-api-loadTU-test.m:25:1: ObjCInstanceMethodDecl=pMethod:25:1 Extent=[25:1 - 25:10] -// CHECK: c-index-api-loadTU-test.m:28:1: ObjCProtocolDecl=SubP:28:1 (Definition) Extent=[28:1 - 30:4] -// CHECK: c-index-api-loadTU-test.m:28:17: ObjCProtocolRef=Proto:24:1 Extent=[28:17 - 28:21] -// CHECK: c-index-api-loadTU-test.m:29:1: ObjCInstanceMethodDecl=spMethod:29:1 Extent=[29:1 - 29:11] -// CHECK: c-index-api-loadTU-test.m:32:12: ObjCInterfaceDecl=Baz:32:12 Extent=[32:1 - 39:4] -// CHECK: c-index-api-loadTU-test.m:32:18: ObjCSuperClassRef=Bar:13:12 Extent=[32:18 - 32:20] -// CHECK: c-index-api-loadTU-test.m:32:23: ObjCProtocolRef=SubP:28:1 Extent=[32:23 - 32:26] -// CHECK: c-index-api-loadTU-test.m:34:9: ObjCIvarDecl=_anIVar:34:9 (Definition) Extent=[34:9 - 34:15] -// CHECK: c-index-api-loadTU-test.m:37:1: ObjCInstanceMethodDecl=bazMethod:37:1 Extent=[37:1 - 37:20] -// CHECK: c-index-api-loadTU-test.m:41:1: EnumDecl=:41:1 (Definition) Extent=[41:1 - 43:1] -// CHECK: c-index-api-loadTU-test.m:42:3: EnumConstantDecl=someEnum:42:3 (Definition) Extent=[42:3 - 42:10] -// CHECK: c-index-api-loadTU-test.m:45:5: FunctionDecl=main:45:5 (Definition) Extent=[45:5 - 54:1] -// CHECK: c-index-api-loadTU-test.m:45:15: ParmDecl=argc:45:15 (Definition) Extent=[45:11 - 45:18] -// CHECK: c-index-api-loadTU-test.m:45:34: ParmDecl=argv:45:34 (Definition) Extent=[45:27 - 45:37] -// CHECK: c-index-api-loadTU-test.m:45:5: UnexposedStmt= Extent=[45:42 - 54:1] -// CHECK: c-index-api-loadTU-test.m:45:5: UnexposedStmt= Extent=[46:2 - 46:11] -// CHECK: c-index-api-loadTU-test.m:46:8: VarDecl=bee:46:8 (Definition) Extent=[46:2 - 46:10] -// CHECK: c-index-api-loadTU-test.m:46:2: ObjCClassRef=Baz:32:12 Extent=[46:2 - 46:4] -// CHECK: c-index-api-loadTU-test.m:46:8: UnexposedStmt= Extent=[47:2 - 47:18] -// CHECK: c-index-api-loadTU-test.m:47:5: VarDecl=a:47:5 (Definition) Extent=[47:2 - 47:17] -// CHECK: c-index-api-loadTU-test.m:47:2: TypeRef=id:0:0 Extent=[47:2 - 47:3] -// CHECK: c-index-api-loadTU-test.m:47:9: ObjCMessageExpr=foo:8:1 Extent=[47:9 - 47:17] -// CHECK: c-index-api-loadTU-test.m:47:10: DeclRefExpr=bee:46:8 Extent=[47:10 - 47:12] -// CHECK: c-index-api-loadTU-test.m:47:5: UnexposedStmt= Extent=[48:2 - 48:26] -// CHECK: c-index-api-loadTU-test.m:48:12: VarDecl=c:48:12 (Definition) Extent=[48:2 - 48:25] -// CHECK: c-index-api-loadTU-test.m:48:2: TypeRef=id:0:0 Extent=[48:2 - 48:3] -// CHECK: c-index-api-loadTU-test.m:48:6: ObjCProtocolRef=SubP:28:1 Extent=[48:6 - 48:9] -// CHECK: c-index-api-loadTU-test.m:48:16: UnexposedExpr=fooC:9:1 Extent=[48:16 - 48:25] -// CHECK: c-index-api-loadTU-test.m:48:16: ObjCMessageExpr=fooC:9:1 Extent=[48:16 - 48:25] -// CHECK: c-index-api-loadTU-test.m:48:12: UnexposedStmt= Extent=[49:2 - 49:14] -// CHECK: c-index-api-loadTU-test.m:49:13: VarDecl=d:49:13 (Definition) Extent=[49:2 - 49:13] -// CHECK: c-index-api-loadTU-test.m:49:2: TypeRef=id:0:0 Extent=[49:2 - 49:3] -// CHECK: c-index-api-loadTU-test.m:49:6: ObjCProtocolRef=Proto:24:1 Extent=[49:6 - 49:10] -// CHECK: c-index-api-loadTU-test.m:50:2: UnexposedExpr= Extent=[50:2 - 50:6] -// CHECK: c-index-api-loadTU-test.m:50:2: DeclRefExpr=d:49:13 Extent=[50:2 - 50:2] -// CHECK: c-index-api-loadTU-test.m:50:6: UnexposedExpr=c:48:12 Extent=[50:6 - 50:6] -// CHECK: c-index-api-loadTU-test.m:50:6: DeclRefExpr=c:48:12 Extent=[50:6 - 50:6] -// CHECK: c-index-api-loadTU-test.m:51:2: ObjCMessageExpr=pMethod:25:1 Extent=[51:2 - 51:12] -// CHECK: c-index-api-loadTU-test.m:51:3: DeclRefExpr=d:49:13 Extent=[51:3 - 51:3] -// CHECK: c-index-api-loadTU-test.m:52:2: ObjCMessageExpr=catMethodWithFloat::20:1 Extent=[52:2 - 52:43] -// CHECK: c-index-api-loadTU-test.m:52:3: DeclRefExpr=bee:46:8 Extent=[52:3 - 52:5] -// CHECK: c-index-api-loadTU-test.m:52:26: ObjCMessageExpr=floatMethod:21:1 Extent=[52:26 - 52:42] -// CHECK: c-index-api-loadTU-test.m:52:27: DeclRefExpr=bee:46:8 Extent=[52:27 - 52:29] -// CHECK: c-index-api-loadTU-test.m:53:3: CallExpr=main:45:5 Extent=[53:3 - 53:36] -// CHECK: c-index-api-loadTU-test.m:53:3: UnexposedExpr=main:45:5 Extent=[53:3 - 53:6] -// CHECK: c-index-api-loadTU-test.m:53:3: DeclRefExpr=main:45:5 Extent=[53:3 - 53:6] -// CHECK: c-index-api-loadTU-test.m:53:8: DeclRefExpr=someEnum:42:3 Extent=[53:8 - 53:15] -// CHECK: c-index-api-loadTU-test.m:53:18: UnexposedExpr=bee:46:8 Extent=[53:18 - 53:35] -// CHECK: c-index-api-loadTU-test.m:53:33: DeclRefExpr=bee:46:8 Extent=[53:33 - 53:35] +// CHECK: c-index-api-loadTU-test.m:4:12: ObjCInterfaceDecl=Foo:4:12 Extent=[4:1 - 11:5] +// CHECK: c-index-api-loadTU-test.m:8:1: ObjCInstanceMethodDecl=foo:8:1 Extent=[8:1 - 8:7] +// CHECK: c-index-api-loadTU-test.m:9:1: ObjCClassMethodDecl=fooC:9:1 Extent=[9:1 - 9:8] +// CHECK: c-index-api-loadTU-test.m:13:12: ObjCInterfaceDecl=Bar:13:12 Extent=[13:1 - 17:5] +// CHECK: c-index-api-loadTU-test.m:13:18: ObjCSuperClassRef=Foo:4:12 Extent=[13:18 - 13:21] +// CHECK: c-index-api-loadTU-test.m:19:12: ObjCCategoryDecl=FooCat:19:12 Extent=[19:1 - 22:5] +// CHECK: c-index-api-loadTU-test.m:19:12: ObjCClassRef=Foo:4:12 Extent=[19:12 - 19:15] +// CHECK: c-index-api-loadTU-test.m:20:1: ObjCInstanceMethodDecl=catMethodWithFloat::20:1 Extent=[20:1 - 20:41] +// CHECK: c-index-api-loadTU-test.m:20:36: ParmDecl=fArg:20:36 (Definition) Extent=[20:29 - 20:40] +// CHECK: c-index-api-loadTU-test.m:21:1: ObjCInstanceMethodDecl=floatMethod:21:1 Extent=[21:1 - 21:23] +// CHECK: c-index-api-loadTU-test.m:24:1: ObjCProtocolDecl=Proto:24:1 (Definition) Extent=[24:1 - 26:5] +// CHECK: c-index-api-loadTU-test.m:25:1: ObjCInstanceMethodDecl=pMethod:25:1 Extent=[25:1 - 25:11] +// CHECK: c-index-api-loadTU-test.m:28:1: ObjCProtocolDecl=SubP:28:1 (Definition) Extent=[28:1 - 30:5] +// CHECK: c-index-api-loadTU-test.m:28:17: ObjCProtocolRef=Proto:24:1 Extent=[28:17 - 28:22] +// CHECK: c-index-api-loadTU-test.m:29:1: ObjCInstanceMethodDecl=spMethod:29:1 Extent=[29:1 - 29:12] +// CHECK: c-index-api-loadTU-test.m:32:12: ObjCInterfaceDecl=Baz:32:12 Extent=[32:1 - 39:5] +// CHECK: c-index-api-loadTU-test.m:32:18: ObjCSuperClassRef=Bar:13:12 Extent=[32:18 - 32:21] +// CHECK: c-index-api-loadTU-test.m:32:23: ObjCProtocolRef=SubP:28:1 Extent=[32:23 - 32:27] +// CHECK: c-index-api-loadTU-test.m:34:9: ObjCIvarDecl=_anIVar:34:9 (Definition) Extent=[34:9 - 34:16] +// CHECK: c-index-api-loadTU-test.m:37:1: ObjCInstanceMethodDecl=bazMethod:37:1 Extent=[37:1 - 37:21] +// CHECK: c-index-api-loadTU-test.m:41:1: EnumDecl=:41:1 (Definition) Extent=[41:1 - 43:2] +// CHECK: c-index-api-loadTU-test.m:42:3: EnumConstantDecl=someEnum:42:3 (Definition) Extent=[42:3 - 42:11] +// CHECK: c-index-api-loadTU-test.m:45:5: FunctionDecl=main:45:5 (Definition) Extent=[45:5 - 54:2] +// CHECK: c-index-api-loadTU-test.m:45:15: ParmDecl=argc:45:15 (Definition) Extent=[45:11 - 45:19] +// CHECK: c-index-api-loadTU-test.m:45:34: ParmDecl=argv:45:34 (Definition) Extent=[45:27 - 45:38] +// CHECK: c-index-api-loadTU-test.m:45:5: UnexposedStmt= Extent=[45:42 - 54:2] +// CHECK: c-index-api-loadTU-test.m:45:5: UnexposedStmt= Extent=[46:2 - 46:12] +// CHECK: c-index-api-loadTU-test.m:46:8: VarDecl=bee:46:8 (Definition) Extent=[46:2 - 46:11] +// CHECK: c-index-api-loadTU-test.m:46:2: ObjCClassRef=Baz:32:12 Extent=[46:2 - 46:5] +// CHECK: c-index-api-loadTU-test.m:46:8: UnexposedStmt= Extent=[47:2 - 47:19] +// CHECK: c-index-api-loadTU-test.m:47:5: VarDecl=a:47:5 (Definition) Extent=[47:2 - 47:18] +// CHECK: c-index-api-loadTU-test.m:47:2: TypeRef=id:0:0 Extent=[47:2 - 47:4] +// CHECK: c-index-api-loadTU-test.m:47:9: ObjCMessageExpr=foo:8:1 Extent=[47:9 - 47:18] +// CHECK: c-index-api-loadTU-test.m:47:10: DeclRefExpr=bee:46:8 Extent=[47:10 - 47:13] +// CHECK: c-index-api-loadTU-test.m:47:5: UnexposedStmt= Extent=[48:2 - 48:27] +// CHECK: c-index-api-loadTU-test.m:48:12: VarDecl=c:48:12 (Definition) Extent=[48:2 - 48:26] +// CHECK: c-index-api-loadTU-test.m:48:2: TypeRef=id:0:0 Extent=[48:2 - 48:4] +// CHECK: c-index-api-loadTU-test.m:48:6: ObjCProtocolRef=SubP:28:1 Extent=[48:6 - 48:10] +// CHECK: c-index-api-loadTU-test.m:48:16: UnexposedExpr=fooC:9:1 Extent=[48:16 - 48:26] +// CHECK: c-index-api-loadTU-test.m:48:16: ObjCMessageExpr=fooC:9:1 Extent=[48:16 - 48:26] +// CHECK: c-index-api-loadTU-test.m:48:12: UnexposedStmt= Extent=[49:2 - 49:15] +// CHECK: c-index-api-loadTU-test.m:49:13: VarDecl=d:49:13 (Definition) Extent=[49:2 - 49:14] +// CHECK: c-index-api-loadTU-test.m:49:2: TypeRef=id:0:0 Extent=[49:2 - 49:4] +// CHECK: c-index-api-loadTU-test.m:49:6: ObjCProtocolRef=Proto:24:1 Extent=[49:6 - 49:11] +// CHECK: c-index-api-loadTU-test.m:50:2: UnexposedExpr= Extent=[50:2 - 50:7] +// CHECK: c-index-api-loadTU-test.m:50:2: DeclRefExpr=d:49:13 Extent=[50:2 - 50:3] +// CHECK: c-index-api-loadTU-test.m:50:6: UnexposedExpr=c:48:12 Extent=[50:6 - 50:7] +// CHECK: c-index-api-loadTU-test.m:50:6: DeclRefExpr=c:48:12 Extent=[50:6 - 50:7] +// CHECK: c-index-api-loadTU-test.m:51:2: ObjCMessageExpr=pMethod:25:1 Extent=[51:2 - 51:13] +// CHECK: c-index-api-loadTU-test.m:51:3: DeclRefExpr=d:49:13 Extent=[51:3 - 51:4] +// CHECK: c-index-api-loadTU-test.m:52:2: ObjCMessageExpr=catMethodWithFloat::20:1 Extent=[52:2 - 52:44] +// CHECK: c-index-api-loadTU-test.m:52:3: DeclRefExpr=bee:46:8 Extent=[52:3 - 52:6] +// CHECK: c-index-api-loadTU-test.m:52:26: ObjCMessageExpr=floatMethod:21:1 Extent=[52:26 - 52:43] +// CHECK: c-index-api-loadTU-test.m:52:27: DeclRefExpr=bee:46:8 Extent=[52:27 - 52:30] +// CHECK: c-index-api-loadTU-test.m:53:3: CallExpr=main:45:5 Extent=[53:3 - 53:37] +// CHECK: c-index-api-loadTU-test.m:53:3: UnexposedExpr=main:45:5 Extent=[53:3 - 53:7] +// CHECK: c-index-api-loadTU-test.m:53:3: DeclRefExpr=main:45:5 Extent=[53:3 - 53:7] +// CHECK: c-index-api-loadTU-test.m:53:8: DeclRefExpr=someEnum:42:3 Extent=[53:8 - 53:16] +// CHECK: c-index-api-loadTU-test.m:53:18: UnexposedExpr=bee:46:8 Extent=[53:18 - 53:36] +// CHECK: c-index-api-loadTU-test.m:53:33: DeclRefExpr=bee:46:8 Extent=[53:33 - 53:36] diff --git a/test/Index/c-index-getCursor-test.m b/test/Index/c-index-getCursor-test.m index ca0895e656..6a17e1c841 100644 --- a/test/Index/c-index-getCursor-test.m +++ b/test/Index/c-index-getCursor-test.m @@ -52,102 +52,102 @@ int main (int argc, const char * argv[]) { main(someEnum, (const char **)bee); } -// CHECK: [1:1 - 2:62] Invalid Cursor => NoDeclFound -// CHECK: [3:1 - 6:1] ObjCInterfaceDecl=Foo:3:12 -// CHECK: [7:1 - 7:6] ObjCInstanceMethodDecl=foo:7:1 -// CHECK: [7:7 - 7:7] ObjCInterfaceDecl=Foo:3:12 -// CHECK: [8:1 - 8:7] ObjCClassMethodDecl=fooC:8:1 -// CHECK: [8:8 - 10:4] ObjCInterfaceDecl=Foo:3:12 -// CHECK: [10:5 - 11:1] Invalid Cursor => NoDeclFound -// CHECK: [12:1 - 12:17] ObjCInterfaceDecl=Bar:12:12 -// CHECK: [12:18 - 12:20] ObjCSuperClassRef=Foo:3:12 -// CHECK: [12:21 - 16:4] ObjCInterfaceDecl=Bar:12:12 -// CHECK: [16:5 - 17:1] Invalid Cursor => NoDeclFound -// CHECK: [18:1 - 18:11] ObjCCategoryDecl=FooCat:18:12 -// CHECK: [18:12 - 18:14] ObjCClassRef=Foo:3:12 -// CHECK: [18:15 - 18:24] ObjCCategoryDecl=FooCat:18:12 -// CHECK: [19:1 - 19:28] ObjCInstanceMethodDecl=catMethodWithFloat::19:1 -// CHECK: [19:29 - 19:39] ParmDecl=fArg:19:36 (Definition) -// CHECK: [19:40 - 19:40] ObjCInstanceMethodDecl=catMethodWithFloat::19:1 -// CHECK: [19:41 - 19:41] ObjCCategoryDecl=FooCat:18:12 -// CHECK: [20:1 - 20:22] ObjCInstanceMethodDecl=floatMethod:20:1 -// CHECK: [20:23 - 21:4] ObjCCategoryDecl=FooCat:18:12 -// CHECK: [21:5 - 22:1] Invalid Cursor => NoDeclFound -// CHECK: [23:1 - 23:16] ObjCProtocolDecl=Proto:23:1 (Definition) -// CHECK: [24:1 - 24:10] ObjCInstanceMethodDecl=pMethod:24:1 -// CHECK: [24:11 - 25:4] ObjCProtocolDecl=Proto:23:1 (Definition) -// CHECK: [25:5 - 26:1] Invalid Cursor => NoDeclFound -// CHECK: [27:1 - 27:16] ObjCProtocolDecl=SubP:27:1 (Definition) -// CHECK: [27:17 - 27:21] ObjCProtocolRef=Proto:23:1 -// CHECK: [27:22 - 27:23] ObjCProtocolDecl=SubP:27:1 (Definition) -// CHECK: [28:1 - 28:11] ObjCInstanceMethodDecl=spMethod:28:1 -// CHECK: [28:12 - 29:4] ObjCProtocolDecl=SubP:27:1 (Definition) -// CHECK: [29:5 - 30:1] Invalid Cursor => NoDeclFound -// CHECK: [31:1 - 31:17] ObjCInterfaceDecl=Baz:31:12 -// CHECK: [31:18 - 31:20] ObjCSuperClassRef=Bar:12:12 -// CHECK: [31:21 - 31:22] ObjCInterfaceDecl=Baz:31:12 -// CHECK: [31:23 - 31:26] ObjCProtocolRef=SubP:27:1 -// CHECK: [31:27 - 33:8] ObjCInterfaceDecl=Baz:31:12 -// CHECK: [33:9 - 33:15] ObjCIvarDecl=_anIVar:33:9 (Definition) -// CHECK: [33:16 - 35:1] ObjCInterfaceDecl=Baz:31:12 -// CHECK: [36:1 - 36:20] ObjCInstanceMethodDecl=bazMethod:36:1 -// CHECK: [36:21 - 38:4] ObjCInterfaceDecl=Baz:31:12 -// CHECK: [38:5 - 39:1] Invalid Cursor => NoDeclFound -// CHECK: [40:1 - 41:2] EnumDecl=:40:1 (Definition) -// CHECK: [41:3 - 41:10] EnumConstantDecl=someEnum:41:3 (Definition) -// CHECK: [41:11 - 42:1] EnumDecl=:40:1 (Definition) -// CHECK: [42:2 - 44:4] Invalid Cursor => NoDeclFound -// CHECK: [44:5 - 44:10] FunctionDecl=main:44:5 (Definition) -// CHECK: [44:11 - 44:18] ParmDecl=argc:44:15 (Definition) -// CHECK: [44:19 - 44:26] FunctionDecl=main:44:5 (Definition) -// CHECK: [44:27 - 44:37] ParmDecl=argv:44:34 (Definition) -// CHECK: [44:38 - 44:41] FunctionDecl=main:44:5 (Definition) -// CHECK: [44:42 - 45:1] UnexposedStmt= -// CHECK: [45:2 - 45:4] ObjCClassRef=Baz:31:12 -// CHECK: [45:5 - 45:10] VarDecl=bee:45:8 (Definition) -// CHECK: [45:11 - 45:11] UnexposedStmt= -// CHECK: [45:12 - 46:1] UnexposedStmt= -// CHECK: [46:2 - 46:3] TypeRef=id:0:0 -// CHECK: [46:4 - 46:8] VarDecl=a:46:5 (Definition) -// CHECK: [46:9 - 46:9] ObjCMessageExpr=foo:7:1 -// CHECK: [46:10 - 46:12] DeclRefExpr=bee:45:8 -// CHECK: [46:13 - 46:17] ObjCMessageExpr=foo:7:1 -// CHECK: [46:18 - 46:18] UnexposedStmt= -// CHECK: [46:19 - 47:1] UnexposedStmt= -// CHECK: [47:2 - 47:3] TypeRef=id:0:0 -// CHECK: [47:4 - 47:5] VarDecl=c:47:12 (Definition) -// CHECK: [47:6 - 47:9] ObjCProtocolRef=SubP:27:1 -// CHECK: [47:10 - 47:15] VarDecl=c:47:12 (Definition) -// CHECK: [47:16 - 47:25] ObjCMessageExpr=fooC:8:1 -// CHECK: [47:26 - 47:26] UnexposedStmt= -// CHECK: [47:27 - 48:1] UnexposedStmt= -// CHECK: [48:2 - 48:3] TypeRef=id:0:0 -// CHECK: [48:4 - 48:5] VarDecl=d:48:13 (Definition) -// CHECK: [48:6 - 48:10] ObjCProtocolRef=Proto:23:1 -// CHECK: [48:11 - 48:13] VarDecl=d:48:13 (Definition) -// CHECK: [48:14 - 48:14] UnexposedStmt= -// CHECK: [48:15 - 49:1] UnexposedStmt= -// CHECK: [49:2 - 49:2] DeclRefExpr=d:48:13 -// CHECK: [49:3 - 49:5] UnexposedExpr= -// CHECK: [49:6 - 49:6] DeclRefExpr=c:47:12 -// CHECK: [49:7 - 50:1] UnexposedStmt= -// CHECK: [50:2 - 50:2] ObjCMessageExpr=pMethod:24:1 -// CHECK: [50:3 - 50:3] DeclRefExpr=d:48:13 -// CHECK: [50:4 - 50:12] ObjCMessageExpr=pMethod:24:1 -// CHECK: [50:13 - 51:1] UnexposedStmt= -// CHECK: [51:2 - 51:2] ObjCMessageExpr=catMethodWithFloat::19:1 -// CHECK: [51:3 - 51:5] DeclRefExpr=bee:45:8 -// CHECK: [51:6 - 51:25] ObjCMessageExpr=catMethodWithFloat::19:1 -// CHECK: [51:26 - 51:26] ObjCMessageExpr=floatMethod:20:1 -// CHECK: [51:27 - 51:29] DeclRefExpr=bee:45:8 -// CHECK: [51:30 - 51:42] ObjCMessageExpr=floatMethod:20:1 -// CHECK: [51:43 - 51:43] ObjCMessageExpr=catMethodWithFloat::19:1 -// CHECK: [51:44 - 52:2] UnexposedStmt= -// CHECK: [52:3 - 52:6] DeclRefExpr=main:44:5 -// CHECK: [52:7 - 52:7] CallExpr=main:44:5 -// CHECK: [52:8 - 52:15] DeclRefExpr=someEnum:41:3 -// CHECK: [52:16 - 52:17] CallExpr=main:44:5 -// CHECK: [52:18 - 52:32] UnexposedExpr=bee:45:8 -// CHECK: [52:33 - 52:35] DeclRefExpr=bee:45:8 -// CHECK: [52:36 - 52:36] CallExpr=main:44:5 -// CHECK: [52:37 - 53:1] UnexposedStmt= +// CHECK: [1:1 - 3:1] Invalid Cursor => NoDeclFound +// CHECK: [3:1 - 7:1] ObjCInterfaceDecl=Foo:3:12 +// CHECK: [7:1 - 7:7] ObjCInstanceMethodDecl=foo:7:1 +// CHECK: [7:7 - 8:1] ObjCInterfaceDecl=Foo:3:12 +// CHECK: [8:1 - 8:8] ObjCClassMethodDecl=fooC:8:1 +// CHECK: [8:8 - 10:5] ObjCInterfaceDecl=Foo:3:12 +// CHECK: [10:5 - 12:1] Invalid Cursor => NoDeclFound +// CHECK: [12:1 - 12:18] ObjCInterfaceDecl=Bar:12:12 +// CHECK: [12:18 - 12:21] ObjCSuperClassRef=Foo:3:12 +// CHECK: [12:21 - 16:5] ObjCInterfaceDecl=Bar:12:12 +// CHECK: [16:5 - 18:1] Invalid Cursor => NoDeclFound +// CHECK: [18:1 - 18:12] ObjCCategoryDecl=FooCat:18:12 +// CHECK: [18:12 - 18:15] ObjCClassRef=Foo:3:12 +// CHECK: [18:15 - 19:1] ObjCCategoryDecl=FooCat:18:12 +// CHECK: [19:1 - 19:29] ObjCInstanceMethodDecl=catMethodWithFloat::19:1 +// CHECK: [19:29 - 19:40] ParmDecl=fArg:19:36 (Definition) +// CHECK: [19:40 - 19:41] ObjCInstanceMethodDecl=catMethodWithFloat::19:1 +// CHECK: [19:41 - 20:1] ObjCCategoryDecl=FooCat:18:12 +// CHECK: [20:1 - 20:23] ObjCInstanceMethodDecl=floatMethod:20:1 +// CHECK: [20:23 - 21:5] ObjCCategoryDecl=FooCat:18:12 +// CHECK: [21:5 - 23:1] Invalid Cursor => NoDeclFound +// CHECK: [23:1 - 24:1] ObjCProtocolDecl=Proto:23:1 (Definition) +// CHECK: [24:1 - 24:11] ObjCInstanceMethodDecl=pMethod:24:1 +// CHECK: [24:11 - 25:5] ObjCProtocolDecl=Proto:23:1 (Definition) +// CHECK: [25:5 - 27:1] Invalid Cursor => NoDeclFound +// CHECK: [27:1 - 27:17] ObjCProtocolDecl=SubP:27:1 (Definition) +// CHECK: [27:17 - 27:22] ObjCProtocolRef=Proto:23:1 +// CHECK: [27:22 - 28:1] ObjCProtocolDecl=SubP:27:1 (Definition) +// CHECK: [28:1 - 28:12] ObjCInstanceMethodDecl=spMethod:28:1 +// CHECK: [28:12 - 29:5] ObjCProtocolDecl=SubP:27:1 (Definition) +// CHECK: [29:5 - 31:1] Invalid Cursor => NoDeclFound +// CHECK: [31:1 - 31:18] ObjCInterfaceDecl=Baz:31:12 +// CHECK: [31:18 - 31:21] ObjCSuperClassRef=Bar:12:12 +// CHECK: [31:21 - 31:23] ObjCInterfaceDecl=Baz:31:12 +// CHECK: [31:23 - 31:27] ObjCProtocolRef=SubP:27:1 +// CHECK: [31:27 - 33:9] ObjCInterfaceDecl=Baz:31:12 +// CHECK: [33:9 - 33:16] ObjCIvarDecl=_anIVar:33:9 (Definition) +// CHECK: [33:16 - 36:1] ObjCInterfaceDecl=Baz:31:12 +// CHECK: [36:1 - 36:21] ObjCInstanceMethodDecl=bazMethod:36:1 +// CHECK: [36:21 - 38:5] ObjCInterfaceDecl=Baz:31:12 +// CHECK: [38:5 - 40:1] Invalid Cursor => NoDeclFound +// CHECK: [40:1 - 41:3] EnumDecl=:40:1 (Definition) +// CHECK: [41:3 - 41:11] EnumConstantDecl=someEnum:41:3 (Definition) +// CHECK: [41:11 - 42:2] EnumDecl=:40:1 (Definition) +// CHECK: [42:2 - 44:5] Invalid Cursor => NoDeclFound +// CHECK: [44:5 - 44:11] FunctionDecl=main:44:5 (Definition) +// CHECK: [44:11 - 44:19] ParmDecl=argc:44:15 (Definition) +// CHECK: [44:19 - 44:27] FunctionDecl=main:44:5 (Definition) +// CHECK: [44:27 - 44:38] ParmDecl=argv:44:34 (Definition) +// CHECK: [44:38 - 44:42] FunctionDecl=main:44:5 (Definition) +// CHECK: [44:42 - 45:2] UnexposedStmt= +// CHECK: [45:2 - 45:5] ObjCClassRef=Baz:31:12 +// CHECK: [45:5 - 45:11] VarDecl=bee:45:8 (Definition) +// CHECK: [45:11 - 45:12] UnexposedStmt= +// CHECK: [45:12 - 46:2] UnexposedStmt= +// CHECK: [46:2 - 46:4] TypeRef=id:0:0 +// CHECK: [46:4 - 46:9] VarDecl=a:46:5 (Definition) +// CHECK: [46:9 - 46:10] ObjCMessageExpr=foo:7:1 +// CHECK: [46:10 - 46:13] DeclRefExpr=bee:45:8 +// CHECK: [46:13 - 46:18] ObjCMessageExpr=foo:7:1 +// CHECK: [46:18 - 46:19] UnexposedStmt= +// CHECK: [46:19 - 47:2] UnexposedStmt= +// CHECK: [47:2 - 47:4] TypeRef=id:0:0 +// CHECK: [47:4 - 47:6] VarDecl=c:47:12 (Definition) +// CHECK: [47:6 - 47:10] ObjCProtocolRef=SubP:27:1 +// CHECK: [47:10 - 47:16] VarDecl=c:47:12 (Definition) +// CHECK: [47:16 - 47:26] ObjCMessageExpr=fooC:8:1 +// CHECK: [47:26 - 47:27] UnexposedStmt= +// CHECK: [47:27 - 48:2] UnexposedStmt= +// CHECK: [48:2 - 48:4] TypeRef=id:0:0 +// CHECK: [48:4 - 48:6] VarDecl=d:48:13 (Definition) +// CHECK: [48:6 - 48:11] ObjCProtocolRef=Proto:23:1 +// CHECK: [48:11 - 48:14] VarDecl=d:48:13 (Definition) +// CHECK: [48:14 - 48:15] UnexposedStmt= +// CHECK: [48:15 - 49:2] UnexposedStmt= +// CHECK: [49:2 - 49:3] DeclRefExpr=d:48:13 +// CHECK: [49:3 - 49:6] UnexposedExpr= +// CHECK: [49:6 - 49:7] DeclRefExpr=c:47:12 +// CHECK: [49:7 - 50:2] UnexposedStmt= +// CHECK: [50:2 - 50:3] ObjCMessageExpr=pMethod:24:1 +// CHECK: [50:3 - 50:4] DeclRefExpr=d:48:13 +// CHECK: [50:4 - 50:13] ObjCMessageExpr=pMethod:24:1 +// CHECK: [50:13 - 51:2] UnexposedStmt= +// CHECK: [51:2 - 51:3] ObjCMessageExpr=catMethodWithFloat::19:1 +// CHECK: [51:3 - 51:6] DeclRefExpr=bee:45:8 +// CHECK: [51:6 - 51:26] ObjCMessageExpr=catMethodWithFloat::19:1 +// CHECK: [51:26 - 51:27] ObjCMessageExpr=floatMethod:20:1 +// CHECK: [51:27 - 51:30] DeclRefExpr=bee:45:8 +// CHECK: [51:30 - 51:43] ObjCMessageExpr=floatMethod:20:1 +// CHECK: [51:43 - 51:44] ObjCMessageExpr=catMethodWithFloat::19:1 +// CHECK: [51:44 - 52:3] UnexposedStmt= +// CHECK: [52:3 - 52:7] DeclRefExpr=main:44:5 +// CHECK: [52:7 - 52:8] CallExpr=main:44:5 +// CHECK: [52:8 - 52:16] DeclRefExpr=someEnum:41:3 +// CHECK: [52:16 - 52:18] CallExpr=main:44:5 +// CHECK: [52:18 - 52:33] UnexposedExpr=bee:45:8 +// CHECK: [52:33 - 52:36] DeclRefExpr=bee:45:8 +// CHECK: [52:36 - 52:37] CallExpr=main:44:5 +// CHECK: [52:37 - 53:2] UnexposedStmt= diff --git a/test/Index/cindex-from-source.m b/test/Index/cindex-from-source.m index 676ffb0b24..6c5d936e20 100644 --- a/test/Index/cindex-from-source.m +++ b/test/Index/cindex-from-source.m @@ -4,6 +4,6 @@ // RUN: FileCheck %s < %t // CHECK: cindex-from-source.m:{{.*}}:{{.*}}: StructDecl=s0:{{.*}}:{{.*}} // CHECK: cindex-from-source.m:{{.*}}:{{.*}}: VarDecl=g0:{{.*}}:{{.*}} -// CHECK: cindex-from-source.m:9:1: TypeRef=t0:1:13 Extent=[9:1 - 9:2] +// CHECK: cindex-from-source.m:9:1: TypeRef=t0:1:13 Extent=[9:1 - 9:3] struct s0 {}; t0 g0; diff --git a/test/Index/load-exprs.c b/test/Index/load-exprs.c index 263702d292..f72f1046c2 100644 --- a/test/Index/load-exprs.c +++ b/test/Index/load-exprs.c @@ -9,10 +9,10 @@ void f(void *ptr) { // RUN: c-index-test -test-load-source all %s | FileCheck %s -// CHECK: load-exprs.c:4:15: TypeRef=T:1:13 Extent=[4:15 - 4:15] -// CHECK: load-exprs.c:5:16: TypeRef=T:1:13 Extent=[5:16 - 5:16] -// CHECK: load-exprs.c:6:10: TypeRef=struct X:2:8 Extent=[6:10 - 6:10] -// CHECK: load-exprs.c:6:24: TypeRef=struct X:2:8 Extent=[6:24 - 6:24] -// CHECK: load-exprs.c:7:9: VarDecl=xx:7:9 (Definition) Extent=[7:3 - 7:23] -// CHECK: load-exprs.c:7:14: DeclRefExpr=ptr:3:14 Extent=[7:14 - 7:16] -// CHECK: load-exprs.c:7:23: DeclRefExpr=x:6:12 Extent=[7:23 - 7:23] +// CHECK: load-exprs.c:4:15: TypeRef=T:1:13 Extent=[4:15 - 4:16] +// CHECK: load-exprs.c:5:16: TypeRef=T:1:13 Extent=[5:16 - 5:17] +// CHECK: load-exprs.c:6:10: TypeRef=struct X:2:8 Extent=[6:10 - 6:11] +// CHECK: load-exprs.c:6:24: TypeRef=struct X:2:8 Extent=[6:24 - 6:25] +// CHECK: load-exprs.c:7:9: VarDecl=xx:7:9 (Definition) Extent=[7:3 - 7:24] +// CHECK: load-exprs.c:7:14: DeclRefExpr=ptr:3:14 Extent=[7:14 - 7:17] +// CHECK: load-exprs.c:7:23: DeclRefExpr=x:6:12 Extent=[7:23 - 7:24] diff --git a/test/Index/load-stmts.cpp b/test/Index/load-stmts.cpp index 78ed7ee8cc..fdfedfb16e 100644 --- a/test/Index/load-stmts.cpp +++ b/test/Index/load-stmts.cpp @@ -11,41 +11,41 @@ void f(int x) { } // RUN: c-index-test -test-load-source all %s | FileCheck %s -// CHECK: load-stmts.cpp:3:6: UnexposedStmt= Extent=[4:3 - 5:3] -// CHECK: load-stmts.cpp:3:6: UnexposedStmt= Extent=[4:8 - 4:15] -// CHECK: load-stmts.cpp:4:10: VarDecl=y:4:10 (Definition) Extent=[4:8 - 4:14] -// CHECK: load-stmts.cpp:4:8: TypeRef=T:1:13 Extent=[4:8 - 4:8] -// CHECK: load-stmts.cpp:4:14: DeclRefExpr=x:3:12 Extent=[4:14 - 4:14] -// CHECK: load-stmts.cpp:4:19: VarDecl=z:4:19 (Definition) Extent=[4:17 - 4:23] -// CHECK: load-stmts.cpp:4:17: TypeRef=T:1:13 Extent=[4:17 - 4:17] -// CHECK: load-stmts.cpp:4:23: DeclRefExpr=x:3:12 Extent=[4:23 - 4:23] -// CHECK: load-stmts.cpp:4:19: UnexposedExpr=z:4:19 Extent=[4:19 - 4:19] -// CHECK: load-stmts.cpp:4:19: DeclRefExpr=z:4:19 Extent=[4:19 - 4:19] -// CHECK: load-stmts.cpp:4:26: UnexposedExpr= Extent=[4:26 - 4:28] -// CHECK: load-stmts.cpp:4:28: DeclRefExpr=x:3:12 Extent=[4:28 - 4:28] -// CHECK: load-stmts.cpp:4:19: UnexposedStmt= Extent=[4:31 - 5:3] -// CHECK: load-stmts.cpp:4:19: UnexposedStmt= Extent=[6:3 - 6:21] -// CHECK: load-stmts.cpp:6:10: VarDecl=z2:6:10 (Definition) Extent=[6:7 - 6:16] -// CHECK: load-stmts.cpp:6:7: TypeRef=T:1:13 Extent=[6:7 - 6:7] -// CHECK: load-stmts.cpp:6:15: UnexposedExpr= Extent=[6:15 - 6:16] -// CHECK: load-stmts.cpp:6:16: DeclRefExpr=x:3:12 Extent=[6:16 - 6:16] -// CHECK: load-stmts.cpp:6:10: UnexposedExpr=z2:6:10 Extent=[6:10 - 6:11] -// CHECK: load-stmts.cpp:6:10: DeclRefExpr=z2:6:10 Extent=[6:10 - 6:11] -// CHECK: load-stmts.cpp:6:10: UnexposedStmt= Extent=[6:19 - 6:21] -// CHECK: load-stmts.cpp:6:10: UnexposedStmt= Extent=[7:3 - 7:24] -// CHECK: load-stmts.cpp:7:13: VarDecl=z3:7:13 (Definition) Extent=[7:10 - 7:19] -// CHECK: load-stmts.cpp:7:10: TypeRef=T:1:13 Extent=[7:10 - 7:10] -// CHECK: load-stmts.cpp:7:18: UnexposedExpr= Extent=[7:18 - 7:19] -// CHECK: load-stmts.cpp:7:19: DeclRefExpr=x:3:12 Extent=[7:19 - 7:19] -// CHECK: load-stmts.cpp:7:13: UnexposedExpr=z3:7:13 Extent=[7:13 - 7:14] -// CHECK: load-stmts.cpp:7:13: DeclRefExpr=z3:7:13 Extent=[7:13 - 7:14] -// CHECK: load-stmts.cpp:7:13: UnexposedStmt= Extent=[7:22 - 7:24] -// CHECK: load-stmts.cpp:7:13: UnexposedStmt= Extent=[8:3 - 10:3] -// CHECK: load-stmts.cpp:8:13: VarDecl=z4:8:13 (Definition) Extent=[8:11 - 8:18] -// CHECK: load-stmts.cpp:8:11: TypeRef=T:1:13 Extent=[8:11 - 8:11] -// CHECK: load-stmts.cpp:8:18: DeclRefExpr=x:3:12 Extent=[8:18 - 8:18] -// CHECK: load-stmts.cpp:8:13: DeclRefExpr=z4:8:13 Extent=[8:13 - 8:14] -// CHECK: load-stmts.cpp:8:13: UnexposedStmt= Extent=[8:21 - 10:3] -// CHECK: load-stmts.cpp:8:13: UnexposedStmt= Extent=[9:3 - 9:16] -// CHECK: load-stmts.cpp:8:13: UnexposedStmt= Extent=[9:12 - 9:16] -// CHECK: load-stmts.cpp:9:8: UnexposedExpr= Extent=[9:8 - 9:9] +// CHECK: load-stmts.cpp:3:6: UnexposedStmt= Extent=[4:3 - 5:4] +// CHECK: load-stmts.cpp:3:6: UnexposedStmt= Extent=[4:8 - 4:16] +// CHECK: load-stmts.cpp:4:10: VarDecl=y:4:10 (Definition) Extent=[4:8 - 4:15] +// CHECK: load-stmts.cpp:4:8: TypeRef=T:1:13 Extent=[4:8 - 4:9] +// CHECK: load-stmts.cpp:4:14: DeclRefExpr=x:3:12 Extent=[4:14 - 4:15] +// CHECK: load-stmts.cpp:4:19: VarDecl=z:4:19 (Definition) Extent=[4:17 - 4:24] +// CHECK: load-stmts.cpp:4:17: TypeRef=T:1:13 Extent=[4:17 - 4:18] +// CHECK: load-stmts.cpp:4:23: DeclRefExpr=x:3:12 Extent=[4:23 - 4:24] +// CHECK: load-stmts.cpp:4:19: UnexposedExpr=z:4:19 Extent=[4:19 - 4:20] +// CHECK: load-stmts.cpp:4:19: DeclRefExpr=z:4:19 Extent=[4:19 - 4:20] +// CHECK: load-stmts.cpp:4:26: UnexposedExpr= Extent=[4:26 - 4:29] +// CHECK: load-stmts.cpp:4:28: DeclRefExpr=x:3:12 Extent=[4:28 - 4:29] +// CHECK: load-stmts.cpp:4:19: UnexposedStmt= Extent=[4:31 - 5:4] +// CHECK: load-stmts.cpp:4:19: UnexposedStmt= Extent=[6:3 - 6:22] +// CHECK: load-stmts.cpp:6:10: VarDecl=z2:6:10 (Definition) Extent=[6:7 - 6:17] +// CHECK: load-stmts.cpp:6:7: TypeRef=T:1:13 Extent=[6:7 - 6:8] +// CHECK: load-stmts.cpp:6:15: UnexposedExpr= Extent=[6:15 - 6:17] +// CHECK: load-stmts.cpp:6:16: DeclRefExpr=x:3:12 Extent=[6:16 - 6:17] +// CHECK: load-stmts.cpp:6:10: UnexposedExpr=z2:6:10 Extent=[6:10 - 6:12] +// CHECK: load-stmts.cpp:6:10: DeclRefExpr=z2:6:10 Extent=[6:10 - 6:12] +// CHECK: load-stmts.cpp:6:10: UnexposedStmt= Extent=[6:19 - 6:22] +// CHECK: load-stmts.cpp:6:10: UnexposedStmt= Extent=[7:3 - 7:25] +// CHECK: load-stmts.cpp:7:13: VarDecl=z3:7:13 (Definition) Extent=[7:10 - 7:20] +// CHECK: load-stmts.cpp:7:10: TypeRef=T:1:13 Extent=[7:10 - 7:11] +// CHECK: load-stmts.cpp:7:18: UnexposedExpr= Extent=[7:18 - 7:20] +// CHECK: load-stmts.cpp:7:19: DeclRefExpr=x:3:12 Extent=[7:19 - 7:20] +// CHECK: load-stmts.cpp:7:13: UnexposedExpr=z3:7:13 Extent=[7:13 - 7:15] +// CHECK: load-stmts.cpp:7:13: DeclRefExpr=z3:7:13 Extent=[7:13 - 7:15] +// CHECK: load-stmts.cpp:7:13: UnexposedStmt= Extent=[7:22 - 7:25] +// CHECK: load-stmts.cpp:7:13: UnexposedStmt= Extent=[8:3 - 10:4] +// CHECK: load-stmts.cpp:8:13: VarDecl=z4:8:13 (Definition) Extent=[8:11 - 8:19] +// CHECK: load-stmts.cpp:8:11: TypeRef=T:1:13 Extent=[8:11 - 8:12] +// CHECK: load-stmts.cpp:8:18: DeclRefExpr=x:3:12 Extent=[8:18 - 8:19] +// CHECK: load-stmts.cpp:8:13: DeclRefExpr=z4:8:13 Extent=[8:13 - 8:15] +// CHECK: load-stmts.cpp:8:13: UnexposedStmt= Extent=[8:21 - 10:4] +// CHECK: load-stmts.cpp:8:13: UnexposedStmt= Extent=[9:3 - 9:17] +// CHECK: load-stmts.cpp:8:13: UnexposedStmt= Extent=[9:12 - 9:17] +// CHECK: load-stmts.cpp:9:8: UnexposedExpr= Extent=[9:8 - 9:10] diff --git a/test/Index/remap-load.c b/test/Index/remap-load.c index aae5434c5a..b8415e6a17 100644 --- a/test/Index/remap-load.c +++ b/test/Index/remap-load.c @@ -2,13 +2,13 @@ // RUN: env CINDEXTEST_USE_EXTERNAL_AST_GENERATION=1 c-index-test -test-load-source all -remap-file="%s;%S/Inputs/remap-load-to.c" %s | FileCheck -check-prefix=CHECK %s // XFAIL: win32 -// CHECK: remap-load.c:1:5: FunctionDecl=foo:1:5 (Definition) Extent=[1:5 - 3:1] -// CHECK: remap-load.c:1:13: ParmDecl=parm1:1:13 (Definition) Extent=[1:9 - 1:17] -// CHECK: remap-load.c:1:26: ParmDecl=parm2:1:26 (Definition) Extent=[1:20 - 1:30] -// CHECK: remap-load.c:1:5: UnexposedStmt= Extent=[1:33 - 3:1] -// CHECK: remap-load.c:1:5: UnexposedStmt= Extent=[2:3 - 2:22] -// CHECK: remap-load.c:2:10: UnexposedExpr= Extent=[2:10 - 2:22] -// CHECK: remap-load.c:2:10: UnexposedExpr= Extent=[2:10 - 2:22] -// CHECK: remap-load.c:2:10: UnexposedExpr=parm1:1:13 Extent=[2:10 - 2:14] -// CHECK: remap-load.c:2:10: DeclRefExpr=parm1:1:13 Extent=[2:10 - 2:14] -// CHECK: remap-load.c:2:18: DeclRefExpr=parm2:1:26 Extent=[2:18 - 2:22] +// CHECK: remap-load.c:1:5: FunctionDecl=foo:1:5 (Definition) Extent=[1:5 - 3:2] +// CHECK: remap-load.c:1:13: ParmDecl=parm1:1:13 (Definition) Extent=[1:9 - 1:18] +// CHECK: remap-load.c:1:26: ParmDecl=parm2:1:26 (Definition) Extent=[1:20 - 1:31] +// CHECK: remap-load.c:1:5: UnexposedStmt= Extent=[1:33 - 3:2] +// CHECK: remap-load.c:1:5: UnexposedStmt= Extent=[2:3 - 2:23] +// CHECK: remap-load.c:2:10: UnexposedExpr= Extent=[2:10 - 2:23] +// CHECK: remap-load.c:2:10: UnexposedExpr= Extent=[2:10 - 2:23] +// CHECK: remap-load.c:2:10: UnexposedExpr=parm1:1:13 Extent=[2:10 - 2:15] +// CHECK: remap-load.c:2:10: DeclRefExpr=parm1:1:13 Extent=[2:10 - 2:15] +// CHECK: remap-load.c:2:18: DeclRefExpr=parm2:1:26 Extent=[2:18 - 2:23] diff --git a/tools/c-index-test/c-index-test.c b/tools/c-index-test/c-index-test.c index b7ea47e675..1619616bb7 100644 --- a/tools/c-index-test/c-index-test.c +++ b/tools/c-index-test/c-index-test.c @@ -34,8 +34,9 @@ static void PrintDiagnosticCallback(CXDiagnostic Diagnostic, static void PrintExtent(FILE *out, unsigned begin_line, unsigned begin_column, unsigned end_line, unsigned end_column) { + /* FIXME: Remove this + 1. */ fprintf(out, "[%d:%d - %d:%d]", begin_line, begin_column, - end_line, end_column); + end_line, end_column + 1); } static unsigned CreateTranslationUnit(CXIndex Idx, const char *file, @@ -222,7 +223,7 @@ static void PrintDiagnosticCallback(CXDiagnostic Diagnostic, if (start_file != end_file || start_file != file) continue; - PrintExtent(out, start_line, start_column, end_line, end_column+1); + PrintExtent(out, start_line, start_column, end_line, end_column); printed_any_ranges = 1; } if (printed_any_ranges) @@ -277,7 +278,7 @@ static void PrintDiagnosticCallback(CXDiagnostic Diagnostic, &end_file, &end_line, &end_column, 0); if (start_file == file && end_file == file) { fprintf(out, "FIX-IT: Remove "); - PrintExtent(out, start_line, start_column, end_line, end_column+1); + PrintExtent(out, start_line, start_column, end_line, end_column); fprintf(out, "\n"); } break; @@ -295,7 +296,7 @@ static void PrintDiagnosticCallback(CXDiagnostic Diagnostic, &end_file, &end_line, &end_column, 0); if (start_file == end_file) { fprintf(out, "FIX-IT: Replace "); - PrintExtent(out, start_line, start_column, end_line, end_column+1); + PrintExtent(out, start_line, start_column, end_line, end_column); fprintf(out, " with \"%s\"\n", clang_getCString(text)); } clang_disposeString(text); @@ -582,7 +583,7 @@ static int perform_file_scan(const char *ast_file, const char *source_file, CXCursor prevCursor = clang_getNullCursor(); CXFile file; unsigned line = 1, col = 1; - unsigned start_line = 1, start_col = 1, prev_line = 0, prev_col = 0; + unsigned start_line = 1, start_col = 1; if (!(Idx = clang_createIndex(/* excludeDeclsFromPCH */ 1))) { fprintf(stderr, "Could not create Index\n"); @@ -615,7 +616,7 @@ static int perform_file_scan(const char *ast_file, const char *source_file, if ((c == EOF || !clang_equalCursors(cursor, prevCursor)) && prevCursor.kind != CXCursor_InvalidFile) { print_cursor_file_scan(prevCursor, start_line, start_col, - prev_line, prev_col, prefix); + line, col - 1, prefix); start_line = line; start_col = col; } @@ -623,8 +624,6 @@ static int perform_file_scan(const char *ast_file, const char *source_file, break; prevCursor = cursor; - prev_line = line; - prev_col = col; } fclose(fp);