diff options
author | Douglas Gregor <dgregor@apple.com> | 2010-01-19 01:20:04 +0000 |
---|---|---|
committer | Douglas Gregor <dgregor@apple.com> | 2010-01-19 01:20:04 +0000 |
commit | c5d1e9375d71e66d22456e7cc52cc7c0a5c65c3f (patch) | |
tree | e168ea625a2ae5045476af907d914a4e3dde434e /tools/c-index-test/c-index-test.c | |
parent | a7bde20f8c6334ccc3a7ef4dd77243d0921a8497 (diff) |
Introduce clang_getCursorReferenced, to get a cursor pointing at the
entity that a particular cursor references.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@93830 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'tools/c-index-test/c-index-test.c')
-rw-r--r-- | tools/c-index-test/c-index-test.c | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/tools/c-index-test/c-index-test.c b/tools/c-index-test/c-index-test.c index 2f113cfada..34332d3e40 100644 --- a/tools/c-index-test/c-index-test.c +++ b/tools/c-index-test/c-index-test.c @@ -47,16 +47,18 @@ static void PrintCursor(CXCursor Cursor) { if (clang_isInvalid(Cursor.kind)) printf("Invalid Cursor => %s", clang_getCursorKindSpelling(Cursor.kind)); else { - CXDecl DeclReferenced; CXString string; + CXCursor Referenced; string = clang_getCursorSpelling(Cursor); printf("%s=%s", clang_getCursorKindSpelling(Cursor.kind), clang_getCString(string)); clang_disposeString(string); - DeclReferenced = clang_getCursorDecl(Cursor); - if (DeclReferenced) - printf(":%d:%d", clang_getDeclLine(DeclReferenced), - clang_getDeclColumn(DeclReferenced)); + + Referenced = clang_getCursorReferenced(Cursor); + if (!clang_equalCursors(Referenced, clang_getNullCursor())) { + CXSourceLocation Loc = clang_getCursorLocation(Referenced); + printf(":%d:%d", Loc.line, Loc.column); + } } } |