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 19:34:47 +0000
committerDouglas Gregor <dgregor@apple.com>2010-01-19 19:34:47 +0000
commit6b8232ff82f85f40ecda480f2852bf5ec8ccf87c (patch)
tree99054a55818529e0fefe24816e065d920273de81 /clang/tools/c-index-test/c-index-test.c
parentfefcb1531c43e792e1fc5a3b8fab9282f0f85625 (diff)
downloadbcm5719-llvm-6b8232ff82f85f40ecda480f2852bf5ec8ccf87c.tar.gz
bcm5719-llvm-6b8232ff82f85f40ecda480f2852bf5ec8ccf87c.zip
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
Diffstat (limited to 'clang/tools/c-index-test/c-index-test.c')
-rw-r--r--clang/tools/c-index-test/c-index-test.c6
1 files changed, 5 insertions, 1 deletions
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,
OpenPOWER on IntegriCloud