<p dir="ltr"><br>
On Jan 13, 2013 12:27 PM, "Sean Silva" <<a href="mailto:silvas@purdue.edu">silvas@purdue.edu</a>> wrote:<br>
><br>
> Hi Tooling folks, I have a quick question about making changes to<br>
> headers with a clang tool.<br>
><br>
> Suppose the following basic setup:<br>
><br>
> - I have a compile_commands.json for a project.<br>
> - I have a tool that renames class Foo to Bar.<br>
><br>
> So if Foo appears in headers, how do occurrences of Foo in headers get renamed?</p>
<p dir="ltr">I believe the approach for some current tools is to compute all the edits over the entire codebase, considering all the contents in each TU. Then take all those edits and deduplicate them (as well as detecting conflicts) before applying them.</p>
<p dir="ltr">><br>
> To my understanding, the compile_commands.json only tracks the ".cpp"<br>
> files that are compiled, rather than each source file in the project.<br>
> This makes me wonder:<br>
><br>
> - How will a tool will ensure that Foo only gets renamed once if it is<br>
> in a header that is included multiple times?<br>
><br>
> - Once Foo gets renamed in a header, how will the other files that<br>
> have yet to be processed still see the old name (the new name would<br>
> cause a compilation failure since the references in the other ".cpp"<br>
> file will not have yet been renamed).<br>
><br>
> Is there a "standard" way to deal with this?<br>
><br>
> -- Sean Silva<br>
> _______________________________________________<br>
> cfe-dev mailing list<br>
> <a href="mailto:cfe-dev@cs.uiuc.edu">cfe-dev@cs.uiuc.edu</a><br>
> <a href="http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev">http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev</a></p>
<p dir="ltr">On Jan 13, 2013 12:27 PM, "Sean Silva" <<a href="mailto:silvas@purdue.edu">silvas@purdue.edu</a>> wrote:<br>
><br>
> Hi Tooling folks, I have a quick question about making changes to<br>
> headers with a clang tool.<br>
><br>
> Suppose the following basic setup:<br>
><br>
> - I have a compile_commands.json for a project.<br>
> - I have a tool that renames class Foo to Bar.<br>
><br>
> So if Foo appears in headers, how do occurrences of Foo in headers get renamed?<br>
><br>
> To my understanding, the compile_commands.json only tracks the ".cpp"<br>
> files that are compiled, rather than each source file in the project.<br>
> This makes me wonder:<br>
><br>
> - How will a tool will ensure that Foo only gets renamed once if it is<br>
> in a header that is included multiple times?<br>
><br>
> - Once Foo gets renamed in a header, how will the other files that<br>
> have yet to be processed still see the old name (the new name would<br>
> cause a compilation failure since the references in the other ".cpp"<br>
> file will not have yet been renamed).<br>
><br>
> Is there a "standard" way to deal with this?<br>
><br>
> -- Sean Silva<br>
> _______________________________________________<br>
> cfe-dev mailing list<br>
> <a href="mailto:cfe-dev@cs.uiuc.edu">cfe-dev@cs.uiuc.edu</a><br>
> <a href="http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev">http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev</a><br>
</p>