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 with clang I can dump the AST and see that it knows where those variables are 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'
-------------------------- this is the part i'm looking for
`-VarDecl 0x8007f810 <line:3:3, col:8> other_var 'char'
----------------- and this
I'm trying to get this information using libclang and python but so far I have been unsuccessful.
Where do I need to look for this information? Is this inforamiton available in the C interface but maybe not yet ported to Python?