[cfe-dev] AST Writer

Matthieu Brucher via cfe-dev cfe-dev at lists.llvm.org
Tue Jul 10 14:11:18 PDT 2018


It's odd though, because generating code on the fly would be easier on the
AST than on the IR tree, if the goal is JIT and also saving the code at the
same time.
It's probably also easier also to generate properly formatted code?

Regards,

Matthieu

Le mar. 10 juil. 2018 à 16:21, David Blaikie via cfe-dev <
cfe-dev at lists.llvm.org> a écrit :

> It's generally considered that the AST invariants are too subtle/complex
> to use AST modification and AST->source conversion reliably.
> Refactoring/source code modification is generally encouraged to be done via
> textual edits generated from source location information in the AST.
>
> On Mon, Jul 9, 2018 at 8:36 PM 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
>>
> _______________________________________________
> cfe-dev mailing list
> cfe-dev at lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev
>


-- 
Quantitative analyst, Ph.D.
Blog: http://blog.audio-tk.com/
LinkedIn: http://www.linkedin.com/in/matthieubrucher
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20180710/7b2028fc/attachment.html>


More information about the cfe-dev mailing list