diff options
-rw-r--r-- | clang/test/Index/TestClassDecl.m | 2 | ||||
-rw-r--r-- | clang/test/Index/TestClassForwardDecl.m | 2 | ||||
-rw-r--r-- | clang/test/Index/c-index-api-loadTU-test.m | 10 | ||||
-rw-r--r-- | clang/test/Index/c-index-getCursor-test.m | 26 | ||||
-rw-r--r-- | clang/test/Index/load-stmts.cpp | 24 | ||||
-rw-r--r-- | clang/tools/CIndex/CIndex.cpp | 5 |
6 files changed, 36 insertions, 33 deletions
diff --git a/clang/test/Index/TestClassDecl.m b/clang/test/Index/TestClassDecl.m index f9627123a0d..ab70f7731e1 100644 --- a/clang/test/Index/TestClassDecl.m +++ b/clang/test/Index/TestClassDecl.m @@ -25,7 +25,7 @@ void function(Foo * arg) // 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=function +// CHECK-scan: {start_line=14 start_col=1 end_line=16 end_col=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] diff --git a/clang/test/Index/TestClassForwardDecl.m b/clang/test/Index/TestClassForwardDecl.m index c53453b0ba8..c96fb5a0206 100644 --- a/clang/test/Index/TestClassForwardDecl.m +++ b/clang/test/Index/TestClassForwardDecl.m @@ -20,7 +20,7 @@ void function(Foo * arg) // 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=function +// CHECK-scan: {start_line=11 start_col=1 end_line=13 end_col=1} UnexposedStmt= diff --git a/clang/test/Index/c-index-api-loadTU-test.m b/clang/test/Index/c-index-api-loadTU-test.m index 891e18b67d5..eea407e5c15 100644 --- a/clang/test/Index/c-index-api-loadTU-test.m +++ b/clang/test/Index/c-index-api-loadTU-test.m @@ -94,22 +94,22 @@ int main (int argc, const char * argv[]) { // 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=main [Extent=45:42:54:1] -// CHECK: c-index-api-loadTU-test.m:45:5: UnexposedStmt=main [Extent=46:2:46:11] +// 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=bee [Extent=47:2:47:18] +// 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=a [Extent=48:2:48:26] +// 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=c [Extent=49:2:49:14] +// 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] diff --git a/clang/test/Index/c-index-getCursor-test.m b/clang/test/Index/c-index-getCursor-test.m index 8fb7ffc5ff9..51828878843 100644 --- a/clang/test/Index/c-index-getCursor-test.m +++ b/clang/test/Index/c-index-getCursor-test.m @@ -102,39 +102,39 @@ int main (int argc, const char * argv[]) { // 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=main +// 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=main -// CHECK: {start_line=45 start_col=12 end_line=46 end_col=1} UnexposedStmt=main +// 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=main -// CHECK: {start_line=46 start_col=19 end_line=47 end_col=1} UnexposedStmt=main +// 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=main -// CHECK: {start_line=47 start_col=27 end_line=48 end_col=1} UnexposedStmt=main +// 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=main -// CHECK: {start_line=48 start_col=15 end_line=49 end_col=1} UnexposedStmt=main +// 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=main +// 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=main +// 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 @@ -142,7 +142,7 @@ int main (int argc, const char * argv[]) { // 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=main +// 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 @@ -150,4 +150,4 @@ int main (int argc, const char * argv[]) { // 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=main +// CHECK: {start_line=52 start_col=37 end_line=53 end_col=1} UnexposedStmt= diff --git a/clang/test/Index/load-stmts.cpp b/clang/test/Index/load-stmts.cpp index ed9ad0c3381..86d4b62e9ac 100644 --- a/clang/test/Index/load-stmts.cpp +++ b/clang/test/Index/load-stmts.cpp @@ -11,9 +11,9 @@ void f(int x) { } // RUN: c-index-test -test-load-source all %s | FileCheck %s -// CHECK: load-stmts.cpp:3:6: UnexposedStmt=f [Extent=3:15:11:1] -// CHECK: load-stmts.cpp:3:6: UnexposedStmt=f [Extent=4:3:5:3] -// CHECK: load-stmts.cpp:3:6: UnexposedStmt=f [Extent=4:8:4:15] +// CHECK: load-stmts.cpp:3:6: UnexposedStmt= [Extent=3:15:11:1] +// 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] @@ -24,29 +24,29 @@ void f(int x) { // 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=z [Extent=4:31:5:3] -// CHECK: load-stmts.cpp:4:19: UnexposedStmt=z [Extent=6:3:6:21] +// 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=z2 [Extent=6:19:6:21] -// CHECK: load-stmts.cpp:6:10: UnexposedStmt=z2 [Extent=7:3:7:24] +// 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=z3 [Extent=7:22:7:24] -// CHECK: load-stmts.cpp:7:13: UnexposedStmt=z3 [Extent=8:3:10:3] +// 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=z4 [Extent=8:21:10:3] -// CHECK: load-stmts.cpp:8:13: UnexposedStmt=z4 [Extent=9:3:9:16] -// CHECK: load-stmts.cpp:8:13: UnexposedStmt=z4 [Extent=9:12:9:16] +// 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/clang/tools/CIndex/CIndex.cpp b/clang/tools/CIndex/CIndex.cpp index eb40b7fe994..26c92730c3f 100644 --- a/clang/tools/CIndex/CIndex.cpp +++ b/clang/tools/CIndex/CIndex.cpp @@ -1349,7 +1349,10 @@ CXString clang_getCursorSpelling(CXCursor C) { return CIndexer::createCXString(""); } - return getDeclSpelling(getCursorDecl(C)); + if (clang_isDeclaration(C.kind)) + return getDeclSpelling(getCursorDecl(C)); + + return CIndexer::createCXString(""); } const char *clang_getCursorKindSpelling(enum CXCursorKind Kind) { |