[cfe-dev] Source to source transformations questions in branches/tooling
Stephen Kelly
steveire at gmail.com
Mon Jun 25 02:51:16 PDT 2012
Philip Dunstan wrote:
> Hi,
>
> I've been trying some source to source transformations using the
> matcher/callback framework in the tooling branch. They are mostly working
> but I have a couple of questions and would like some feedback on whether I
> am doing everything as intended. Will you please help me?
Hi Philip,
I'm in the same position as you, having used the tooling API and had some
feedback:
http://thread.gmane.org/gmane.comp.compilers.clang.devel/21996
I also just published a follow up blog post:
http://www.kdab.com/assessing-the-automatic-qt-4-to-5-porting-tool/
> There are two transformations I am trying to make: adding the override
> keyword to virtual functions where we can and replacing shared_ptr by
> value function parameters with const references. I have attached the two
> cpp files to this post. They are also available from
> https://bitbucket.org/phildunstan/clang_tools/src/5d63a291d377/add-
override-specifier
> https://bitbucket.org/phildunstan/clang_tools/src/5d63a291d377/replace-
shared_ptr-parameters
>
At least the override one seems to be generally useful. It's starting to
look more likely that a repo for things like this (and some of the generic
parts of my work such as method renaming) should be in a shared location in
the clang tree (possibly just in an example).
> I'd like to run these tools over our complete code base where the changes
> will affect both header and source files. What is the recommended way to
> limit changes to only my files and not system header files? I expect I can
> limit them to the main file specified by the source manager, however I
> assume that this would prevent changes to my header files.
The approach I took was to specify the top of the source tree manually as a
command line argument and then try to verify that I only change files in the
correct paths.
Thanks,
Steve.
More information about the cfe-dev
mailing list