diff options
author | Steve Naroff <snaroff@apple.com> | 2009-08-31 00:59:03 +0000 |
---|---|---|
committer | Steve Naroff <snaroff@apple.com> | 2009-08-31 00:59:03 +0000 |
commit | 89922f86f4e7da383af2a62ef04ad8b93b941220 (patch) | |
tree | 5dc260ad76be4746a95a21fe57d91968ed9c82b7 /tools/c-index-test/c-index-test.c | |
parent | a31d5f70e02d89631d07be162796a2d6bd74e561 (diff) |
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
Diffstat (limited to 'tools/c-index-test/c-index-test.c')
-rw-r--r-- | tools/c-index-test/c-index-test.c | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/tools/c-index-test/c-index-test.c b/tools/c-index-test/c-index-test.c index 71bdcc5c64..3126b319ef 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; } |