More fleshing out the C-based indexing API (under construction).


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@80529 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/tools/c-index-test/c-index-test.c b/tools/c-index-test/c-index-test.c
index 71bdcc5..3126b31 100644
--- a/tools/c-index-test/c-index-test.c
+++ b/tools/c-index-test/c-index-test.c
@@ -1,5 +1,12 @@
 
 #include "clang-c/Index.h"
+#include <stdio.h>
+
+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;
 }