How to expand macros with python and libclang

41 Views Asked by At

Say I have the following C code.

#define A 0x1800
#define MACRO_FUNC(in) (A | (in))
#define B 6
#define MY_MACRO MACRO_FUNC(B) 

How would I use libclang python bindings to expand MY_MACRO to (0x1800 | (6)) or preferably to 0x1806

0

There are 0 best solutions below