python - How to get the literal place of variable definition with clang -


i have following scenario.

some_header.h

#define some_vars \   int first_var; \   char other_var; 

source_file.c

#include "some_header.h"  some_vars 

now clang can dump ast , see knows variables literally defined:

clang -xclang -ast-dump -fsyntax-only source_file.c  translationunitdecl 0x8007f4c0 <<invalid sloc>> |-typedefdecl 0x8007f790 <<invalid sloc>> __builtin_va_list 'char *' |-vardecl 0x8007f7d0 <./some_header.h:2:3, col:7> first_var 'int'                       -------------------------- part i'm looking `-vardecl 0x8007f810 <line:3:3, col:8> other_var 'char'                      ----------------- , 

i'm trying information using libclang , python far have been unsuccessful.

where need information? inforamiton available in c interface maybe not yet ported python?


Comments

Popular posts from this blog

c++ - Difference between pre and post decrement in recursive function argument -

php - Nothing but 'run(); ' when browsing to my local project, how do I fix this? -

php - How can I echo out this array? -