blob: 3126b319efdad17c9a44484bb6cb346cfb9f1eec [file] [log] [blame]
Steve Naroff50398192009-08-28 15:28:48 +00001
2#include "clang-c/Index.h"
Steve Naroff89922f82009-08-31 00:59:03 +00003#include <stdio.h>
4
5static void PrintDecls(CXTranslationUnit Unit, CXCursor Cursor) {
6 if (clang_isDeclaration(Cursor.kind))
7 printf("%s => %s\n", clang_getKindSpelling(Cursor.kind),
8 clang_getDeclSpelling(Cursor.decl));
9}
Steve Naroff50398192009-08-28 15:28:48 +000010
11/*
12 * First sign of life:-)
13 */
14int main(int argc, char **argv) {
15 CXIndex Idx = clang_createIndex();
16 CXTranslationUnit TU = clang_createTranslationUnit(Idx, argv[1]);
Steve Naroff89922f82009-08-31 00:59:03 +000017 clang_loadTranslationUnit(TU, PrintDecls);
Steve Naroff50398192009-08-28 15:28:48 +000018 return 1;
19}