[cfe-dev] Macro expansion

Nagaraju Mekala via cfe-dev cfe-dev at lists.llvm.org
Sun May 31 03:13:26 PDT 2020


Hello All,

I have a situation to expand a macro and I have succeeded by
extracting a constant value using clang::MacroInfo
getReplacementToken(0)
But if a user gives a expression then how can we evaluate the macro value?

ex:
#define S 16
#define O 4
#define C S/O

In the above example I need the evaluate S/O expression and use the
value for my processing.
Can someone point how can we do this?

Thanks in advance.

-Nagaraju


More information about the cfe-dev mailing list