summaryrefslogtreecommitdiffstats
path: root/clang/tools/c-index-test/c-index-test.c
diff options
context:
space:
mode:
authorDouglas Gregor <dgregor@apple.com>2010-01-19 01:20:04 +0000
committerDouglas Gregor <dgregor@apple.com>2010-01-19 01:20:04 +0000
commitad27e8b777726ed63f8c8dfbdee1cc40121ead23 (patch)
tree45f273294306d63f49e55bed170631a56b406bec /clang/tools/c-index-test/c-index-test.c
parent6c0fb92c03cdd0398362b6d4be1b3c368b822f09 (diff)
downloadbcm5719-llvm-ad27e8b777726ed63f8c8dfbdee1cc40121ead23.tar.gz
bcm5719-llvm-ad27e8b777726ed63f8c8dfbdee1cc40121ead23.zip
Introduce clang_getCursorReferenced, to get a cursor pointing at the
entity that a particular cursor references. llvm-svn: 93830
Diffstat (limited to 'clang/tools/c-index-test/c-index-test.c')
-rw-r--r--clang/tools/c-index-test/c-index-test.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/clang/tools/c-index-test/c-index-test.c b/clang/tools/c-index-test/c-index-test.c
index 2f113cfadaa..34332d3e408 100644
--- a/clang/tools/c-index-test/c-index-test.c
+++ b/clang/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);
+ }
}
}
OpenPOWER on IntegriCloud