[cfe-dev] How to add a function to an AST?

Manuel Klimek klimek at google.com
Sun Sep 8 05:10:38 PDT 2013


On Sat, Sep 7, 2013 at 2:57 PM, maxs <xtxwy.ustc at gmail.com> wrote:

> Hi, everyone :
>      I want to add a function or a statement to an AST? Is there simple
> way to do this? Using Sema or call the FunctionDecl's create method? Thanks.
>

Generally speaking, the easy way is to add it in the code and let clang
parse the code (seriously, that's what works best, and has a couple of
other upsides - you can also do that programatically).

Or to turn it around, the other question would be: why do you want to add a
function to the AST instead of adding it to the code? :)

Cheers,
/Manuel


>
> xtxwy
> ______________________________**_________________
> cfe-dev mailing list
> cfe-dev at cs.uiuc.edu
> http://lists.cs.uiuc.edu/**mailman/listinfo/cfe-dev<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/20130908/d061873b/attachment.html>


More information about the cfe-dev mailing list