[cfe-dev] How to programatically define a symbol?

Matthieu Monrocq matthieu.monrocq at gmail.com
Sat Apr 7 11:42:37 PDT 2012


Le 7 avril 2012 20:17, Yaakov Davis <yaakov.davis at gmail.com> a écrit :

> I want to programatically define a symbol, e.g. FOO, such that the code
> "#if defined(FOO)" will evaluate to true during pre-processing.
> How do I that?
>
> I tried addMacroDef("FOO"), and other methods, but to no avail.
>
> _______________________________________________
> cfe-dev mailing list
> cfe-dev at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev
>
>
Either:

#define FOO

in the code or

-DFOO

on the command line during the compilation (for gcc and clang at least)

-- Matthieu
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20120407/941d21b4/attachment.html>


More information about the cfe-dev mailing list