[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
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@153707 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/tools/c-index-test/c-index-test.c b/tools/c-index-test/c-index-test.c
index 39bb8eb..5dd9254 100644
--- a/tools/c-index-test/c-index-test.c
+++ b/tools/c-index-test/c-index-test.c
@@ -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);