Add clang_getDeclLine and clang_getDeclColumn
Fix clang_getCursorDecl to do the right thing for expr refs
Fixup test file to accommodate new output (which includes the line/column for the referenced decl)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@82798 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 f1f9372..aa93a7e 100644
--- a/tools/c-index-test/c-index-test.c
+++ b/tools/c-index-test/c-index-test.c
@@ -9,9 +9,16 @@
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)