[cfe-commits] r153707 - in /cfe/trunk: test/Index/get-cursor.m tools/c-index-test/c-index-test.c
Argyrios Kyrtzidis
akyrtzi at gmail.com
Thu Mar 29 17:19:05 PDT 2012
Author: akirtzidis
Date: Thu Mar 29 19:19:05 2012
New Revision: 153707
URL: http://llvm.org/viewvc/llvm-project?rev=153707&view=rev
Log:
[libclang] Have c-index-test output more information about a cursor with -cursor-at:
-the location of the cursor
-its extent
-its spelling
Part of radar://11113120
Modified:
cfe/trunk/test/Index/get-cursor.m
cfe/trunk/tools/c-index-test/c-index-test.c
Modified: cfe/trunk/test/Index/get-cursor.m
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Index/get-cursor.m?rev=153707&r1=153706&r2=153707&view=diff
==============================================================================
--- cfe/trunk/test/Index/get-cursor.m (original)
+++ cfe/trunk/test/Index/get-cursor.m Thu Mar 29 19:19:05 2012
@@ -31,10 +31,11 @@
@implementation rdar10902015
-struct S {};
+struct S { int x; };
-(void)mm:(struct S*)s {
rdar10902015 *i = 0;
+ s->x = 0;
}
@end
@@ -46,7 +47,10 @@
// CHECK-WITH-WEAK: ObjCClassRef=Foo:8:8
// RUN: c-index-test -cursor-at=%s:20:10 %s | FileCheck -check-prefix=CHECK-METHOD %s
-// CHECK-METHOD: ObjCInstanceMethodDecl=name:20:7
+// CHECK-METHOD: 20:7 ObjCInstanceMethodDecl=name:20:7 Extent=[20:1 - 20:12]
// RUN: c-index-test -cursor-at=%s:37:17 %s | FileCheck -check-prefix=CHECK-IN-IMPL %s
// CHECK-IN-IMPL: VarDecl=i:37:17
+
+// RUN: c-index-test -cursor-at=%s:38:6 -cursor-at=%s:40:11 %s | FileCheck -check-prefix=CHECK-MEMBERREF %s
+// CHECK-MEMBERREF: 38:6 MemberRefExpr=x:34:16 SingleRefName=[38:6 - 38:7] RefName=[38:6 - 38:7] Extent=[38:3 - 38:7]
Modified: cfe/trunk/tools/c-index-test/c-index-test.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/tools/c-index-test/c-index-test.c?rev=153707&r1=153706&r2=153707&view=diff
==============================================================================
--- cfe/trunk/tools/c-index-test/c-index-test.c (original)
+++ cfe/trunk/tools/c-index-test/c-index-test.c Thu Mar 29 19:19:05 2012
@@ -1439,7 +1439,19 @@
if (I + 1 == Repeats) {
CXCompletionString completionString = clang_getCursorCompletionString(
Cursor);
+ CXSourceLocation CursorLoc = clang_getCursorLocation(Cursor);
+ CXString Spelling;
+ const char *cspell;
+ unsigned line, column;
+ clang_getSpellingLocation(CursorLoc, 0, &line, &column, 0);
+ printf("%d:%d ", line, column);
PrintCursor(Cursor);
+ PrintCursorExtent(Cursor);
+ Spelling = clang_getCursorSpelling(Cursor);
+ cspell = clang_getCString(Spelling);
+ if (cspell && strlen(cspell) != 0)
+ printf(" Spelling=%s", cspell);
+ clang_disposeString(Spelling);
if (completionString != NULL) {
printf("\nCompletion string: ");
print_completion_string(completionString, stdout);
More information about the cfe-commits
mailing list