[cfe-dev] AST Writer

Ridwan Shariffdeen via cfe-dev cfe-dev at lists.llvm.org
Mon Jul 9 20:58:25 PDT 2018

Hi Madhur,

Thank you for the reply.
I am currently working on AST mutation and need this feature to insert
custom nodes. If I have to use IR I will have to translate the AST
mutations into IR level code and redo. Or is there a tool which I can use
to translate AST diff into IR instructions?


On Tue, Jul 10, 2018 at 11:51 AM Madhur Amilkanthwar <madhur13490 at gmail.com>

> That's interesting but is it not possible for you to work on IR?
> The IRBuilder has better support for arbitrary instruction insertion.
> On Tue, Jul 10, 2018 at 9:06 AM Ridwan Shariffdeen via cfe-dev <
> cfe-dev at lists.llvm.org> wrote:
>> Hi,
>> I am trying to build a tool which can insert new AST nodes to a AST tree
>> obtained from a source code and generate the modified source code. For
>> example add an if condition to a given location.
>> I have seen examples on ReWriter which can insert text, but I want to
>> insert a proper AST node and generate the source code from the modified
>> AST.
>> For this purpose, I think I should be using ASTWriter and not ReWriter.
>> Is there any documentation I can refer on how to implement this?
>> Any help in this regard is highly appreciated.
>> Thanks!
>> Ridwan
>> _______________________________________________
>> cfe-dev mailing list
>> cfe-dev at lists.llvm.org
>> http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev
> --
> *Disclaimer: Views, concerns, thoughts, questions, ideas expressed in this
> mail are of my own and my employer has no take in it. *
> Thank You.
> Madhur D. Amilkanthwar
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20180710/8a8c82d4/attachment.html>

More information about the cfe-dev mailing list