[cfe-dev] Extracting macro information using libclang, the C Interface to Clang
inbox at akiwi.co.uk
Thu Nov 27 10:47:17 PST 2014
I'm new to libclang and using the Clang C-interface (version 3.6.0,
222169) to parse some C header files.
My goal is to extract all the #define constants from the .h files.
For example, for the following #defines:
#define FEE 12
#define FIE 34
#define FOE (FEE+FIE)
#define FUM FIE
I would like to get both the names and the resulting raw values as follows:
FEE = 12
FIE = 34
FOE = 46
FUM = 34
I've got as far as handling /CXCursor_MacroDefinition, /and getting the
macro name from the cursor spelling. But after that, it's not clear to
me how I might obtain further information about the defined macro values
Is this possible using the libclang C interface?
If so, could someone please provide an example, or suggest an approach
that that might work?
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the cfe-dev