[cfe-dev] Clang as a scripted refactoring tool

Joseph Garvin joseph.h.garvin at gmail.com
Tue Aug 31 09:56:49 PDT 2010


The mozilla folks have two complementary tools, Dehydra/Treehydra,
that let them add new static checking features to C++ via javascript.
They write how an annotation should work in javascript and then the
tools enforce it. I'd like to see an extended version of that idea --
using a high level language like javascript or python to be able to
describe refactorings specific to the task at hand. Beyond simple
class renaming I'd like to be able to say, refactor classes that use a
visitor pattern to use signals, or write a simple script to find
classes that have virtual functions and update them to have a virtual
destructor if they don't already. I asked the mozilla guys about this
on IRC and they suggested Clang is already part way there. What's the
state of using Clang for refactoring and what parts of the code base
should I be looking at if I'm interested in trying to build something
like this?



More information about the cfe-dev mailing list