aboutsummaryrefslogtreecommitdiff
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.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/tools/c-index-test/c-index-test.c b/tools/c-index-test/c-index-test.c
index f1f9372a18..aa93a7ed4f 100644
--- a/tools/c-index-test/c-index-test.c
+++ b/tools/c-index-test/c-index-test.c
@@ -9,9 +9,16 @@ extern char *basename(const char *);
static void PrintCursor(CXCursor Cursor) {
if (clang_isInvalid(Cursor.kind))
printf("Invalid Cursor => %s\n", clang_getCursorKindSpelling(Cursor.kind));
- else
+ else {
printf("%s=%s", clang_getCursorKindSpelling(Cursor.kind),
clang_getCursorSpelling(Cursor));
+ if (Cursor.stmt) {
+ CXDecl DeclReferenced = clang_getCursorDecl(Cursor);
+ if (DeclReferenced)
+ printf(":%d:%d", clang_getDeclLine(DeclReferenced),
+ clang_getDeclColumn(DeclReferenced));
+ }
+ }
}
static void DeclVisitor(CXDecl Dcl, CXCursor Cursor, CXClientData Filter)