From 6b8232ff82f85f40ecda480f2852bf5ec8ccf87c Mon Sep 17 00:00:00 2001 From: Douglas Gregor Date: Tue, 19 Jan 2010 19:34:47 +0000 Subject: 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. llvm-svn: 93893 --- clang/tools/c-index-test/c-index-test.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'clang/tools/c-index-test/c-index-test.c') diff --git a/clang/tools/c-index-test/c-index-test.c b/clang/tools/c-index-test/c-index-test.c index 34332d3e408..391f577bc43 100644 --- a/clang/tools/c-index-test/c-index-test.c +++ b/clang/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, -- cgit v1.2.3