<div dir="ltr">This is generally explicitly not supported: <a href="https://clang.llvm.org/docs/InternalsManual.html#immutability">https://clang.llvm.org/docs/InternalsManual.html#immutability</a><div><br></div><div>In some cases you can hack around that: <a href="https://www.youtube.com/watch?v=_rUwW8Awc5s">https://www.youtube.com/watch?v=_rUwW8Awc5s</a></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Mon, Jan 13, 2020 at 1:16 PM Blaise Tine via cfe-dev <<a href="mailto:cfe-dev@lists.llvm.org">cfe-dev@lists.llvm.org</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div><div style="font-family:"times new roman","new york",times,serif;font-size:13px"><div></div>
        <div dir="ltr">Hi all,</div><div dir="ltr"><br></div><div dir="ltr">I would like to modify the clang AST using a plugin.</div><div dir="ltr">I have following the suggestions of using clang Rewriter object.</div><div dir="ltr">I use compiler.createDefaultOutputFile() to obtain the output stream to write the changed file into.</div><div dir="ltr">the compilation works fine but the generated object file is broken. </div><div dir="ltr">I get the following linker error: "Wrong file format".</div><div dir="ltr"><br></div><div dir="ltr">Question:</div><div dir="ltr">- Is it actually possible to update the AST using a clang plugin?</div><div dir="ltr">- What am I doing wrong with my solution?</div><div dir="ltr">- Can someone point me to an example program that does that?</div><div dir="ltr"><br></div><div dir="ltr">Thanks,</div><div dir="ltr">-Blaise</div><div dir="ltr"><br></div><div dir="ltr"> </div></div></div>_______________________________________________<br>
cfe-dev mailing list<br>
<a href="mailto:cfe-dev@lists.llvm.org" target="_blank">cfe-dev@lists.llvm.org</a><br>
<a href="https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev" rel="noreferrer" target="_blank">https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev</a><br>
</blockquote></div>