From 1054e603341f967d2ca6a351a0a6417766b1ec91 Mon Sep 17 00:00:00 2001 From: Steve Naroff Date: Mon, 31 Aug 2009 00:59:03 +0000 Subject: More fleshing out the C-based indexing API (under construction). llvm-svn: 80529 --- clang/tools/c-index-test/c-index-test.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'clang/tools/c-index-test') diff --git a/clang/tools/c-index-test/c-index-test.c b/clang/tools/c-index-test/c-index-test.c index 71bdcc5c64d..3126b319efd 100644 --- a/clang/tools/c-index-test/c-index-test.c +++ b/clang/tools/c-index-test/c-index-test.c @@ -1,5 +1,12 @@ #include "clang-c/Index.h" +#include + +static void PrintDecls(CXTranslationUnit Unit, CXCursor Cursor) { + if (clang_isDeclaration(Cursor.kind)) + printf("%s => %s\n", clang_getKindSpelling(Cursor.kind), + clang_getDeclSpelling(Cursor.decl)); +} /* * First sign of life:-) @@ -7,6 +14,6 @@ int main(int argc, char **argv) { CXIndex Idx = clang_createIndex(); CXTranslationUnit TU = clang_createTranslationUnit(Idx, argv[1]); - clang_loadTranslationUnit(TU, 0); + clang_loadTranslationUnit(TU, PrintDecls); return 1; } -- cgit v1.2.3