[cfe-dev] Getting final value of macros that is included in the IR
arnamoy at ualberta.ca
Tue Jan 28 05:11:01 PST 2014
I want to write a Clang pass that let me do the following:
1. I have a list of names of macros of interest.
2. I want to get the final value of the macro that is included in the
IR after preprocessing. For example:
#if CLASS == 'A'
#define TOTAL_KEYS_LOG_2 23
#if CLASS == 'B'
#define TOTAL_KEYS_LOG_2 25
If in the above example, I compile using definition of CLASS as B, I
want to collect the value 25 for TOTAL_KEYS_LOG_2. Of course,
beforehand I know the name of the macro I am interested in
I have fairly used LLVM middle end but very new to the front end.
Thus any pointer will be greatly appreciated.
Thanks a lot;
Scalable Parallel Computing Laboratory
CAB E66, Department of Computing Science, ETH Zurich
8092, Zurich, Switzerland
More information about the cfe-dev