[cfe-dev] Macro expansion
Nathan James via cfe-dev
cfe-dev at lists.llvm.org
Sun May 31 03:58:41 PDT 2020
Unfortunately the pre processor amounts to not much more than text
manipulation and as such it won't evaluate expressions. In your example
`C` will hold the value `16/4`. If you want to have more than that,
then you will likely need to add a pre-build step to your build
process, Similar(but very different) to TableGen.
On Sun, 2020-05-31 at 15:43 +0530, Nagaraju Mekala via cfe-dev wrote:
> Hello All,
> I have a situation to expand a macro and I have succeeded by
> extracting a constant value using clang::MacroInfo
> But if a user gives a expression then how can we evaluate the macro
> #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.
> cfe-dev mailing list
> cfe-dev at lists.llvm.org
More information about the cfe-dev