From 7aa274fff389ba3dba30c7ee908ce40fb94fe2a5 Mon Sep 17 00:00:00 2001 From: Argyrios Kyrtzidis Date: Fri, 30 Mar 2012 00:19:05 +0000 Subject: [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 llvm-svn: 153707 --- clang/tools/c-index-test/c-index-test.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'clang/tools/c-index-test/c-index-test.c') diff --git a/clang/tools/c-index-test/c-index-test.c b/clang/tools/c-index-test/c-index-test.c index 39bb8ebed06..5dd92546313 100644 --- a/clang/tools/c-index-test/c-index-test.c +++ b/clang/tools/c-index-test/c-index-test.c @@ -1439,7 +1439,19 @@ static int inspect_cursor_at(int argc, const char **argv) { 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); -- cgit v1.2.3