diff options
author | Douglas Gregor <dgregor@apple.com> | 2010-01-19 19:34:47 +0000 |
---|---|---|
committer | Douglas Gregor <dgregor@apple.com> | 2010-01-19 19:34:47 +0000 |
commit | b699866820102a69d83d6ac6941985c5ef4e8c40 (patch) | |
tree | b8e905190ac4c390edfb8ba3d419c9d72b548fb3 /tools/c-index-test/c-index-test.c | |
parent | 2e8f00c8d632b6cd7c73f9103ea74c4d90c7bf23 (diff) |
Eliminate cursor kinds used to express definitions. Instead, provide
CIndex functions that (1) map from a reference or declaration to the
corresponding definition, if available, and (2) determine whether a
given declaration cursor is also a definition. This eliminates a lot
of duplication in the cursor kinds, and maps more closely to the Clang
ASTs.
This is another API + ABI breaker with no deprecation. Yay, progress.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@93893 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 | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/tools/c-index-test/c-index-test.c b/tools/c-index-test/c-index-test.c index 34332d3e40..391f577bc4 100644 --- a/tools/c-index-test/c-index-test.c +++ b/tools/c-index-test/c-index-test.c @@ -59,6 +59,9 @@ static void PrintCursor(CXCursor Cursor) { CXSourceLocation Loc = clang_getCursorLocation(Referenced); printf(":%d:%d", Loc.line, Loc.column); } + + if (clang_isCursorDefinition(Cursor)) + printf(" (Definition)"); } } @@ -125,7 +128,8 @@ static void FunctionScanVisitor(CXTranslationUnit Unit, CXCursor Cursor, unsigned startLine, startColumn, endLine, endColumn, curLine, curColumn; CXCursor Ref; - if (Cursor.kind != CXCursor_FunctionDefn) + if (Cursor.kind != CXCursor_FunctionDecl || + !clang_isCursorDefinition(Cursor)) return; clang_getDefinitionSpellingAndExtent(Cursor, &startBuf, &endBuf, |