[cfe-dev] Modifying clang AST using a plugin

Nico Weber via cfe-dev cfe-dev at lists.llvm.org
Mon Jan 13 11:57:56 PST 2020


This is generally explicitly not supported:
https://clang.llvm.org/docs/InternalsManual.html#immutability

In some cases you can hack around that:
https://www.youtube.com/watch?v=_rUwW8Awc5s

On Mon, Jan 13, 2020 at 1:16 PM Blaise Tine via cfe-dev <
cfe-dev at lists.llvm.org> wrote:

> Hi all,
>
> I would like to modify the clang AST using a plugin.
> I have following the suggestions of using clang Rewriter object.
> I use compiler.createDefaultOutputFile() to obtain the output stream to
> write the changed file into.
> the compilation works fine but the generated object file is broken.
> I get the following linker error: "Wrong file format".
>
> Question:
> - Is it actually possible to update the AST using a clang plugin?
> - What am I doing wrong with my solution?
> - Can someone point me to an example program that does that?
>
> Thanks,
> -Blaise
>
>
> _______________________________________________
> cfe-dev mailing list
> cfe-dev at lists.llvm.org
> https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20200113/907840dc/attachment.html>


More information about the cfe-dev mailing list