[cfe-dev] Clang as a scripted refactoring tool

Sebastian Redl sebastian.redl at getdesigned.at
Tue Aug 31 10:09:49 PDT 2010


On Aug 31, 2010, at 9:56 AM, Joseph Garvin wrote:
> 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?

Hi,

Clang is designed to be usable as the basis for a refactoring tool. Your best bet is to look at the Rewriter component. It allows you to create edits of the source code, based on location information stored in the AST. For an example, look at the Obj-C rewriter, a tool that rewrites Obj-C into pure C.

Sebastian



More information about the cfe-dev mailing list