summaryrefslogtreecommitdiffstats
path: root/clang/tools/c-index-test/c-index-test.c
diff options
context:
space:
mode:
authorSteve Naroff <snaroff@apple.com>2009-08-31 00:59:03 +0000
committerSteve Naroff <snaroff@apple.com>2009-08-31 00:59:03 +0000
commit1054e603341f967d2ca6a351a0a6417766b1ec91 (patch)
tree98f8ffcb55b2958b2becdfe89ad06274b30fcf09 /clang/tools/c-index-test/c-index-test.c
parentb1c3df239d51d77438dc0154c0435987305feb3d (diff)
downloadbcm5719-llvm-1054e603341f967d2ca6a351a0a6417766b1ec91.tar.gz
bcm5719-llvm-1054e603341f967d2ca6a351a0a6417766b1ec91.zip
More fleshing out the C-based indexing API (under construction).
llvm-svn: 80529
Diffstat (limited to 'clang/tools/c-index-test/c-index-test.c')
-rw-r--r--clang/tools/c-index-test/c-index-test.c9
1 files changed, 8 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 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 <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;
}
OpenPOWER on IntegriCloud