summaryrefslogtreecommitdiffstats
path: root/tools/c-index-test/c-index-test.c
diff options
context:
space:
mode:
Diffstat (limited to 'tools/c-index-test/c-index-test.c')
-rw-r--r--tools/c-index-test/c-index-test.c18
1 files changed, 15 insertions, 3 deletions
diff --git a/tools/c-index-test/c-index-test.c b/tools/c-index-test/c-index-test.c
index 5dd9254631..e774e78086 100644
--- a/tools/c-index-test/c-index-test.c
+++ b/tools/c-index-test/c-index-test.c
@@ -171,7 +171,8 @@ static void PrintRange(CXSourceRange R, const char *str) {
if (!begin_file || !end_file)
return;
- printf(" %s=", str);
+ if (str)
+ printf(" %s=", str);
PrintExtent(stdout, begin_line, begin_column, end_line, end_column);
}
@@ -1449,8 +1450,19 @@ static int inspect_cursor_at(int argc, const char **argv) {
PrintCursorExtent(Cursor);
Spelling = clang_getCursorSpelling(Cursor);
cspell = clang_getCString(Spelling);
- if (cspell && strlen(cspell) != 0)
- printf(" Spelling=%s", cspell);
+ if (cspell && strlen(cspell) != 0) {
+ unsigned pieceIndex;
+ CXSourceRange range, extent;
+ extent = clang_getCursorExtent(Cursor);
+ printf(" Spelling=%s (", cspell);
+ for (pieceIndex = 0; ; ++pieceIndex) {
+ range = clang_Cursor_getSpellingNameRange(Cursor, pieceIndex, 0);
+ if (clang_Range_isNull(range))
+ break;
+ PrintRange(range, 0);
+ }
+ printf(")");
+ }
clang_disposeString(Spelling);
if (completionString != NULL) {
printf("\nCompletion string: ");