objective c - Parse AST from an ObjC header using libClang -



objective c - Parse AST from an ObjC header using libClang -

i'm using libclang lint objective-c codes. stuck in parsing objc header file (.m fine) , can ast standalone ? here's test codes, trying @interfaces , @protocols.

void clangtest(void) { cxindex index = clang_createindex(0, 1); const char *args[] = { // should have 1 ? }; int numargs = sizeof(args) / sizeof(*args); cxtranslationunit tu = clang_parsetranslationunit(index, "/path/to/anobjcclass.h", args, numargs, null, 0, cxtranslationunit_none); clang_visitchildrenwithblock(clang_gettranslationunitcursor(tu), ^(cxcursor cursor, cxcursor parent){ // never reach here if (clang_getcursorkind(cursor) == cxcursor_objcinterfacedecl || clang_getcursorkind(cursor) == cxcursor_objcprotocoldecl) { // neither here, hoped } homecoming cxchildvisit_continue; }); }

objective-c libclang

Comments

Popular posts from this blog

Using Android Volley to post an array to PHP -

python - How to add an model instance to a django queryset? -

angularjs - No 'Access-Control-Allow-Origin' error from local domain to public API -