[cfe-dev] how to add objectlike macro?

Argyrios Kyrtzidis akyrtzi at gmail.com
Thu Apr 11 11:09:41 PDT 2013


On Apr 10, 2013, at 11:45 PM, huc1985 <huc1985 at 163.com> wrote:

> Hello all.
> I want to add some objectlike macro to Preprocessor.  I'm using libclang, i
> want add macro in code. I just know add simple one.
> e.g.  #define TEST ==>>
>    Preprocessor *pp;
>    IdentifierInfo *Id = pp->getIdentifierInfo("TEST");
>    MacroInfo *MI = pp->AllocateMacroInfo(SourceLocation());
>    MI->setIsBuiltinMacro();
>    pp->setMacroInfo(Id, MI);
> 
> #define MAX 100
> How to do next?
> 

Not sure what you are trying to do, can't you pass a "-D" option to define the macro in the compiler arguments ?

> 
> 
> 
> 
> --
> View this message in context: http://clang-developers.42468.n3.nabble.com/how-to-add-objectlike-macro-tp4031430.html
> Sent from the Clang Developers mailing list archive at Nabble.com.
> _______________________________________________
> cfe-dev mailing list
> cfe-dev at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20130411/24a9b1f1/attachment.html>


More information about the cfe-dev mailing list