<div dir="ltr"><div><div><div><div><div>With this sort of thing, "the devil is in the detail". Yes, clang has tools to do things to source-code, and there are other tools to do things with the intermediate form in llvm.<br><br></div>But without fully understanding more in detail what changes you are wanting to do, and how those are meant to interact with the overall source code, it's hard to say exactly what is the best approach.<br><br></div>(I'm far from sure I can give any appropriate advice, but I know enough about the subject to know that there can be difficulties, and the exact details is what makes the difference between "approach A is good", "approach B" is good and "it's impossible no matter what".)<br><br>--<br></div><div>Mats<br></div></div></div></div><div class="gmail_extra"><br><div class="gmail_quote">On 19 March 2017 at 13:07, Rachel HaCohen (rahacohe) via cfe-dev <span dir="ltr"><<a href="mailto:cfe-dev@lists.llvm.org" target="_blank">cfe-dev@lists.llvm.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">





<div link="#0563C1" vlink="#954F72" lang="EN-US">
<div class="m_-580217317241430006WordSection1">
<p class="MsoNormal">Hello all,<u></u><u></u></p>
<p class="MsoNormal"><span style="font-size:10.5pt;font-family:"Segoe UI",sans-serif;color:#24292e;background:white">In a project we’re working on, we wish to build a tool that automatically manipulates c code.<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:10.5pt;font-family:"Segoe UI",sans-serif;color:#24292e;background:white">We</span><span style="font-size:10.5pt;font-family:"Segoe UI",sans-serif;color:#24292e"> wish to be able to track the control flow of the program
 and manipulate it (flattening</span><span style="font-size:10.5pt;font-family:"Segoe UI",sans-serif;color:#002060">, adding blocks</span><span style="font-size:10.5pt;font-family:"Segoe UI",sans-serif;color:#24292e">
</span><span style="font-size:10.5pt;font-family:"Segoe UI",sans-serif;color:#002060">of code
</span><span style="font-size:10.5pt;font-family:"Segoe UI",sans-serif;color:#24292e">etc.).</span><b><i><span style="font-size:10.5pt;font-family:"Segoe UI",sans-serif;color:#002060"><u></u><u></u></span></i></b></p>
<p class="MsoNormal"><span style="font-size:10.5pt;font-family:"Segoe UI",sans-serif;color:#24292e;background:white">We want the tool to be very general and automatic an</span><span style="font-size:10.5pt;font-family:"Segoe UI",sans-serif;color:#002060;background:white">d</span><span style="font-size:10.5pt;font-family:"Segoe UI",sans-serif;color:#24292e;background:white">
 be able to work properly for every c file</span><i><span style="font-size:10.5pt;font-family:"Segoe UI",sans-serif;color:#002060;background:white">
</span></i><span style="font-size:10.5pt;font-family:"Segoe UI",sans-serif;color:#002060;background:white">and generate compilable code</span><span style="font-size:10.5pt;font-family:"Segoe UI",sans-serif;color:#24292e;background:white">.<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:10.5pt;font-family:"Segoe UI",sans-serif;color:#24292e;background:white"><u></u> <u></u></span></p>
<p class="MsoNormal"><span style="font-size:10.5pt;font-family:"Segoe UI",sans-serif;color:#24292e;background:white">Do you think this is achievable using clang? Do you have any tips for implementing this tool?<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:10.5pt;font-family:"Segoe UI",sans-serif;color:#24292e;background:white">Many thanks,<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:10.5pt;font-family:"Segoe UI",sans-serif;color:#24292e;background:white">Rachel.<u></u><u></u></span></p>
</div>
</div>

<br>______________________________<wbr>_________________<br>
cfe-dev mailing list<br>
<a href="mailto:cfe-dev@lists.llvm.org">cfe-dev@lists.llvm.org</a><br>
<a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev" rel="noreferrer" target="_blank">http://lists.llvm.org/cgi-bin/<wbr>mailman/listinfo/cfe-dev</a><br>
<br></blockquote></div><br></div>