From: Daniel Dunbar Date: Sun, 14 Feb 2010 08:32:24 +0000 (+0000) Subject: c-index-test: Unify syntax for printing extents. Yes, there were 4. X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=51b058cb1e726c49fe0fae29404a4ca4308a6a12;p=clang c-index-test: Unify syntax for printing extents. Yes, there were 4. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@96158 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/test/Index/TestClassDecl.m b/test/Index/TestClassDecl.m index ab70f7731e..32d4d4c668 100644 --- a/test/Index/TestClassDecl.m +++ b/test/Index/TestClassDecl.m @@ -15,19 +15,19 @@ void function(Foo * arg) // nothing here. } -// CHECK-scan: {start_line=1 start_col=1 end_line=7 end_col=1} Invalid Cursor => NoDeclFound -// CHECK-scan: {start_line=8 start_col=1 end_line=8 end_col=7} UnexposedDecl=:8:1 -// CHECK-scan: {start_line=8 start_col=8 end_line=8 end_col=10} ObjCClassRef=Foo:10:12 -// CHECK-scan: {start_line=8 start_col=11 end_line=9 end_col=1} Invalid Cursor => NoDeclFound -// CHECK-scan: {start_line=10 start_col=1 end_line=11 end_col=4} ObjCInterfaceDecl=Foo:10:12 -// CHECK-scan: {start_line=11 start_col=5 end_line=13 end_col=5} Invalid Cursor => NoDeclFound -// CHECK-scan: {start_line=13 start_col=6 end_line=13 end_col=14} FunctionDecl=function:13:6 (Definition) -// CHECK-scan: {start_line=13 start_col=15 end_line=13 end_col=17} ObjCClassRef=Foo:10:12 -// CHECK-scan: {start_line=13 start_col=18 end_line=13 end_col=23} ParmDecl=arg:13:21 (Definition) -// CHECK-scan: {start_line=13 start_col=24 end_line=13 end_col=25} FunctionDecl=function:13:6 (Definition) -// CHECK-scan: {start_line=14 start_col=1 end_line=16 end_col=1} UnexposedStmt= +// 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-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: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] diff --git a/test/Index/TestClassForwardDecl.m b/test/Index/TestClassForwardDecl.m index c96fb5a020..2943c67c6c 100644 --- a/test/Index/TestClassForwardDecl.m +++ b/test/Index/TestClassForwardDecl.m @@ -12,15 +12,15 @@ void function(Foo * arg) // nothing here. } -// CHECK-scan: {start_line=1 start_col=1 end_line=7 end_col=1} Invalid Cursor => NoDeclFound -// CHECK-scan: {start_line=8 start_col=1 end_line=8 end_col=7} UnexposedDecl=:8:1 -// CHECK-scan: {start_line=8 start_col=8 end_line=8 end_col=10} ObjCClassRef=Foo:8:8 -// CHECK-scan: {start_line=8 start_col=11 end_line=10 end_col=5} Invalid Cursor => NoDeclFound -// CHECK-scan: {start_line=10 start_col=6 end_line=10 end_col=14} FunctionDecl=function:10:6 (Definition) -// CHECK-scan: {start_line=10 start_col=15 end_line=10 end_col=17} ObjCClassRef=Foo:8:8 -// CHECK-scan: {start_line=10 start_col=18 end_line=10 end_col=23} ParmDecl=arg:10:21 (Definition) -// CHECK-scan: {start_line=10 start_col=24 end_line=10 end_col=25} FunctionDecl=function:10:6 (Definition) -// CHECK-scan: {start_line=11 start_col=1 end_line=13 end_col=1} UnexposedStmt= +// 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= diff --git a/test/Index/c-index-api-loadTU-test.m b/test/Index/c-index-api-loadTU-test.m index eea407e5c1..f07528a8f8 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: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] diff --git a/test/Index/c-index-getCursor-test.m b/test/Index/c-index-getCursor-test.m index 5182887884..ca0895e656 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: {start_line=1 start_col=1 end_line=2 end_col=62} Invalid Cursor => NoDeclFound -// CHECK: {start_line=3 start_col=1 end_line=6 end_col=1} ObjCInterfaceDecl=Foo:3:12 -// CHECK: {start_line=7 start_col=1 end_line=7 end_col=6} ObjCInstanceMethodDecl=foo:7:1 -// CHECK: {start_line=7 start_col=7 end_line=7 end_col=7} ObjCInterfaceDecl=Foo:3:12 -// CHECK: {start_line=8 start_col=1 end_line=8 end_col=7} ObjCClassMethodDecl=fooC:8:1 -// CHECK: {start_line=8 start_col=8 end_line=10 end_col=4} ObjCInterfaceDecl=Foo:3:12 -// CHECK: {start_line=10 start_col=5 end_line=11 end_col=1} Invalid Cursor => NoDeclFound -// CHECK: {start_line=12 start_col=1 end_line=12 end_col=17} ObjCInterfaceDecl=Bar:12:12 -// CHECK: {start_line=12 start_col=18 end_line=12 end_col=20} ObjCSuperClassRef=Foo:3:12 -// CHECK: {start_line=12 start_col=21 end_line=16 end_col=4} ObjCInterfaceDecl=Bar:12:12 -// CHECK: {start_line=16 start_col=5 end_line=17 end_col=1} Invalid Cursor => NoDeclFound -// CHECK: {start_line=18 start_col=1 end_line=18 end_col=11} ObjCCategoryDecl=FooCat:18:12 -// CHECK: {start_line=18 start_col=12 end_line=18 end_col=14} ObjCClassRef=Foo:3:12 -// CHECK: {start_line=18 start_col=15 end_line=18 end_col=24} ObjCCategoryDecl=FooCat:18:12 -// CHECK: {start_line=19 start_col=1 end_line=19 end_col=28} ObjCInstanceMethodDecl=catMethodWithFloat::19:1 -// CHECK: {start_line=19 start_col=29 end_line=19 end_col=39} ParmDecl=fArg:19:36 (Definition) -// CHECK: {start_line=19 start_col=40 end_line=19 end_col=40} ObjCInstanceMethodDecl=catMethodWithFloat::19:1 -// CHECK: {start_line=19 start_col=41 end_line=19 end_col=41} ObjCCategoryDecl=FooCat:18:12 -// CHECK: {start_line=20 start_col=1 end_line=20 end_col=22} ObjCInstanceMethodDecl=floatMethod:20:1 -// CHECK: {start_line=20 start_col=23 end_line=21 end_col=4} ObjCCategoryDecl=FooCat:18:12 -// CHECK: {start_line=21 start_col=5 end_line=22 end_col=1} Invalid Cursor => NoDeclFound -// CHECK: {start_line=23 start_col=1 end_line=23 end_col=16} ObjCProtocolDecl=Proto:23:1 (Definition) -// CHECK: {start_line=24 start_col=1 end_line=24 end_col=10} ObjCInstanceMethodDecl=pMethod:24:1 -// CHECK: {start_line=24 start_col=11 end_line=25 end_col=4} ObjCProtocolDecl=Proto:23:1 (Definition) -// CHECK: {start_line=25 start_col=5 end_line=26 end_col=1} Invalid Cursor => NoDeclFound -// CHECK: {start_line=27 start_col=1 end_line=27 end_col=16} ObjCProtocolDecl=SubP:27:1 (Definition) -// CHECK: {start_line=27 start_col=17 end_line=27 end_col=21} ObjCProtocolRef=Proto:23:1 -// CHECK: {start_line=27 start_col=22 end_line=27 end_col=23} ObjCProtocolDecl=SubP:27:1 (Definition) -// CHECK: {start_line=28 start_col=1 end_line=28 end_col=11} ObjCInstanceMethodDecl=spMethod:28:1 -// CHECK: {start_line=28 start_col=12 end_line=29 end_col=4} ObjCProtocolDecl=SubP:27:1 (Definition) -// CHECK: {start_line=29 start_col=5 end_line=30 end_col=1} Invalid Cursor => NoDeclFound -// CHECK: {start_line=31 start_col=1 end_line=31 end_col=17} ObjCInterfaceDecl=Baz:31:12 -// CHECK: {start_line=31 start_col=18 end_line=31 end_col=20} ObjCSuperClassRef=Bar:12:12 -// CHECK: {start_line=31 start_col=21 end_line=31 end_col=22} ObjCInterfaceDecl=Baz:31:12 -// CHECK: {start_line=31 start_col=23 end_line=31 end_col=26} ObjCProtocolRef=SubP:27:1 -// CHECK: {start_line=31 start_col=27 end_line=33 end_col=8} ObjCInterfaceDecl=Baz:31:12 -// CHECK: {start_line=33 start_col=9 end_line=33 end_col=15} ObjCIvarDecl=_anIVar:33:9 (Definition) -// CHECK: {start_line=33 start_col=16 end_line=35 end_col=1} ObjCInterfaceDecl=Baz:31:12 -// CHECK: {start_line=36 start_col=1 end_line=36 end_col=20} ObjCInstanceMethodDecl=bazMethod:36:1 -// CHECK: {start_line=36 start_col=21 end_line=38 end_col=4} ObjCInterfaceDecl=Baz:31:12 -// CHECK: {start_line=38 start_col=5 end_line=39 end_col=1} Invalid Cursor => NoDeclFound -// CHECK: {start_line=40 start_col=1 end_line=41 end_col=2} EnumDecl=:40:1 (Definition) -// CHECK: {start_line=41 start_col=3 end_line=41 end_col=10} EnumConstantDecl=someEnum:41:3 (Definition) -// CHECK: {start_line=41 start_col=11 end_line=42 end_col=1} EnumDecl=:40:1 (Definition) -// CHECK: {start_line=42 start_col=2 end_line=44 end_col=4} Invalid Cursor => NoDeclFound -// CHECK: {start_line=44 start_col=5 end_line=44 end_col=10} FunctionDecl=main:44:5 (Definition) -// CHECK: {start_line=44 start_col=11 end_line=44 end_col=18} ParmDecl=argc:44:15 (Definition) -// CHECK: {start_line=44 start_col=19 end_line=44 end_col=26} FunctionDecl=main:44:5 (Definition) -// CHECK: {start_line=44 start_col=27 end_line=44 end_col=37} ParmDecl=argv:44:34 (Definition) -// CHECK: {start_line=44 start_col=38 end_line=44 end_col=41} FunctionDecl=main:44:5 (Definition) -// CHECK: {start_line=44 start_col=42 end_line=45 end_col=1} UnexposedStmt= -// CHECK: {start_line=45 start_col=2 end_line=45 end_col=4} ObjCClassRef=Baz:31:12 -// CHECK: {start_line=45 start_col=5 end_line=45 end_col=10} VarDecl=bee:45:8 (Definition) -// CHECK: {start_line=45 start_col=11 end_line=45 end_col=11} UnexposedStmt= -// CHECK: {start_line=45 start_col=12 end_line=46 end_col=1} UnexposedStmt= -// CHECK: {start_line=46 start_col=2 end_line=46 end_col=3} TypeRef=id:0:0 -// CHECK: {start_line=46 start_col=4 end_line=46 end_col=8} VarDecl=a:46:5 (Definition) -// CHECK: {start_line=46 start_col=9 end_line=46 end_col=9} ObjCMessageExpr=foo:7:1 -// CHECK: {start_line=46 start_col=10 end_line=46 end_col=12} DeclRefExpr=bee:45:8 -// CHECK: {start_line=46 start_col=13 end_line=46 end_col=17} ObjCMessageExpr=foo:7:1 -// CHECK: {start_line=46 start_col=18 end_line=46 end_col=18} UnexposedStmt= -// CHECK: {start_line=46 start_col=19 end_line=47 end_col=1} UnexposedStmt= -// CHECK: {start_line=47 start_col=2 end_line=47 end_col=3} TypeRef=id:0:0 -// CHECK: {start_line=47 start_col=4 end_line=47 end_col=5} VarDecl=c:47:12 (Definition) -// CHECK: {start_line=47 start_col=6 end_line=47 end_col=9} ObjCProtocolRef=SubP:27:1 -// CHECK: {start_line=47 start_col=10 end_line=47 end_col=15} VarDecl=c:47:12 (Definition) -// CHECK: {start_line=47 start_col=16 end_line=47 end_col=25} ObjCMessageExpr=fooC:8:1 -// CHECK: {start_line=47 start_col=26 end_line=47 end_col=26} UnexposedStmt= -// CHECK: {start_line=47 start_col=27 end_line=48 end_col=1} UnexposedStmt= -// CHECK: {start_line=48 start_col=2 end_line=48 end_col=3} TypeRef=id:0:0 -// CHECK: {start_line=48 start_col=4 end_line=48 end_col=5} VarDecl=d:48:13 (Definition) -// CHECK: {start_line=48 start_col=6 end_line=48 end_col=10} ObjCProtocolRef=Proto:23:1 -// CHECK: {start_line=48 start_col=11 end_line=48 end_col=13} VarDecl=d:48:13 (Definition) -// CHECK: {start_line=48 start_col=14 end_line=48 end_col=14} UnexposedStmt= -// CHECK: {start_line=48 start_col=15 end_line=49 end_col=1} UnexposedStmt= -// CHECK: {start_line=49 start_col=2 end_line=49 end_col=2} DeclRefExpr=d:48:13 -// CHECK: {start_line=49 start_col=3 end_line=49 end_col=5} UnexposedExpr= -// CHECK: {start_line=49 start_col=6 end_line=49 end_col=6} DeclRefExpr=c:47:12 -// CHECK: {start_line=49 start_col=7 end_line=50 end_col=1} UnexposedStmt= -// CHECK: {start_line=50 start_col=2 end_line=50 end_col=2} ObjCMessageExpr=pMethod:24:1 -// CHECK: {start_line=50 start_col=3 end_line=50 end_col=3} DeclRefExpr=d:48:13 -// CHECK: {start_line=50 start_col=4 end_line=50 end_col=12} ObjCMessageExpr=pMethod:24:1 -// CHECK: {start_line=50 start_col=13 end_line=51 end_col=1} UnexposedStmt= -// CHECK: {start_line=51 start_col=2 end_line=51 end_col=2} ObjCMessageExpr=catMethodWithFloat::19:1 -// CHECK: {start_line=51 start_col=3 end_line=51 end_col=5} DeclRefExpr=bee:45:8 -// CHECK: {start_line=51 start_col=6 end_line=51 end_col=25} ObjCMessageExpr=catMethodWithFloat::19:1 -// CHECK: {start_line=51 start_col=26 end_line=51 end_col=26} ObjCMessageExpr=floatMethod:20:1 -// CHECK: {start_line=51 start_col=27 end_line=51 end_col=29} DeclRefExpr=bee:45:8 -// CHECK: {start_line=51 start_col=30 end_line=51 end_col=42} ObjCMessageExpr=floatMethod:20:1 -// CHECK: {start_line=51 start_col=43 end_line=51 end_col=43} ObjCMessageExpr=catMethodWithFloat::19:1 -// CHECK: {start_line=51 start_col=44 end_line=52 end_col=2} UnexposedStmt= -// CHECK: {start_line=52 start_col=3 end_line=52 end_col=6} DeclRefExpr=main:44:5 -// CHECK: {start_line=52 start_col=7 end_line=52 end_col=7} CallExpr=main:44:5 -// CHECK: {start_line=52 start_col=8 end_line=52 end_col=15} DeclRefExpr=someEnum:41:3 -// CHECK: {start_line=52 start_col=16 end_line=52 end_col=17} CallExpr=main:44:5 -// CHECK: {start_line=52 start_col=18 end_line=52 end_col=32} UnexposedExpr=bee:45:8 -// CHECK: {start_line=52 start_col=33 end_line=52 end_col=35} DeclRefExpr=bee:45:8 -// CHECK: {start_line=52 start_col=36 end_line=52 end_col=36} CallExpr=main:44:5 -// CHECK: {start_line=52 start_col=37 end_line=53 end_col=1} UnexposedStmt= +// 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= diff --git a/test/Index/cindex-from-source.m b/test/Index/cindex-from-source.m index 8f79304cb6..676ffb0b24 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:2] struct s0 {}; t0 g0; diff --git a/test/Index/code-complete-errors.c b/test/Index/code-complete-errors.c index ecd56aa40f..520a8c87df 100644 --- a/test/Index/code-complete-errors.c +++ b/test/Index/code-complete-errors.c @@ -2,12 +2,12 @@ _Complex cd; // CHECK: code-complete-errors.c:1:1: warning: plain '_Complex' req // 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 -}; // CHECK: FIX-IT: Remove 4:12-4:13 +}; // 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 -// CHECK: FIX-IT: Replace 7:17-7:19 with ".y = " +// CHECK: FIX-IT: Replace [7:17 - 7:19] with ".y = " int f(int *ptr1, float *ptr2) { - return ptr1 != ptr2; // CHECK: code-complete-errors.c:10:15:{10:10-10:14}{10:18-10:22}: warning: comparison of distinct pointer types ('int *' and 'float *') + return ptr1 != ptr2; // CHECK: code-complete-errors.c:10:15:[10:10 - 10:14][10:18 - 10:22]: warning: comparison of distinct pointer types ('int *' and 'float *') } void g() { } diff --git a/test/Index/load-exprs.c b/test/Index/load-exprs.c index cafb32e14d..263702d292 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: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] diff --git a/test/Index/load-stmts.cpp b/test/Index/load-stmts.cpp index 65f4857ba9..78ed7ee8cc 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: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] diff --git a/test/Index/remap-load.c b/test/Index/remap-load.c index ae1d6b03c6..aae5434c5a 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: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] diff --git a/tools/c-index-test/c-index-test.c b/tools/c-index-test/c-index-test.c index b33b0f4aa7..4f56efe157 100644 --- a/tools/c-index-test/c-index-test.c +++ b/tools/c-index-test/c-index-test.c @@ -31,6 +31,13 @@ extern char *basename(const char *); static void PrintDiagnosticCallback(CXDiagnostic Diagnostic, CXClientData ClientData); + +static void PrintExtent(FILE *out, unsigned begin_line, unsigned begin_column, + unsigned end_line, unsigned end_column) { + fprintf(out, "[%d:%d - %d:%d]", begin_line, begin_column, + end_line, end_column); +} + static unsigned CreateTranslationUnit(CXIndex Idx, const char *file, CXTranslationUnit *TU) { @@ -214,9 +221,8 @@ static void PrintDiagnosticCallback(CXDiagnostic Diagnostic, if (start_file != end_file || start_file != file) continue; - - fprintf(out, "{%d:%d-%d:%d}", start_line, start_column, end_line, - end_column+1); + + PrintExtent(out, start_line, start_column, end_line, end_column+1); printed_any_ranges = 1; } if (printed_any_ranges) @@ -269,9 +275,11 @@ static void PrintDiagnosticCallback(CXDiagnostic Diagnostic, 0); clang_getInstantiationLocation(clang_getRangeEnd(remove_range), &end_file, &end_line, &end_column, 0); - if (start_file == file && end_file == file) - fprintf(out, "FIX-IT: Remove %d:%d-%d:%d\n", - start_line, start_column, end_line, end_column+1); + if (start_file == file && end_file == file) { + fprintf(out, "FIX-IT: Remove "); + PrintExtent(out, start_line, start_column, end_line, end_column+1); + fprintf(out, "\n"); + } break; } @@ -285,10 +293,11 @@ static void PrintDiagnosticCallback(CXDiagnostic Diagnostic, 0); clang_getInstantiationLocation(clang_getRangeEnd(remove_range), &end_file, &end_line, &end_column, 0); - if (start_file == end_file) - fprintf(out, "FIX-IT: Replace %d:%d-%d:%d with \"%s\"\n", - start_line, start_column, end_line, end_column+1, - clang_getCString(text)); + if (start_file == end_file) { + fprintf(out, "FIX-IT: Replace "); + PrintExtent(out, start_line, start_column, end_line, end_column+1); + fprintf(out, " with \"%s\"\n", clang_getCString(text)); + } clang_disposeString(text); break; } @@ -315,8 +324,8 @@ static void PrintCursorExtent(CXCursor C) { if (!begin_file || !end_file) return; - printf(" [Extent=%d:%d:%d:%d]", begin_line, begin_column, - end_line, end_column); + printf(" Extent="); + PrintExtent(stdout, begin_line, begin_column, end_line, end_column); } /* Data used by all of the visitors. */ @@ -559,8 +568,8 @@ static void print_cursor_file_scan(CXCursor cursor, printf("// %s: ", FileCheckPrefix); if (prefix) printf("-%s", prefix); - printf("{start_line=%d start_col=%d end_line=%d end_col=%d} ", - start_line, start_col, end_line, end_col); + PrintExtent(stdout, start_line, start_col, end_line, end_col); + printf(" "); PrintCursor(cursor); printf("\n"); } @@ -968,8 +977,8 @@ int perform_token_annotation(int argc, const char **argv) { 0, &start_line, &start_column, 0); clang_getInstantiationLocation(clang_getRangeEnd(extent), 0, &end_line, &end_column, 0); - printf("%s: \"%s\" [%d:%d - %d:%d]", kind, clang_getCString(spelling), - start_line, start_column, end_line, end_column); + printf("%s: \"%s\" ", kind, clang_getCString(spelling)); + PrintExtent(stdout, start_line, start_column, end_line, end_column); if (!clang_isInvalid(cursors[i].kind)) { printf(" "); PrintCursor(cursors[i]);