[cfe-dev] RFC: Adding a rename refactoring tool to clang

Richard legalize at xmission.com
Wed Jul 30 09:42:06 PDT 2014


In article <CAMfx8+eLTwdAbHw64L-O71hChrsKJKBOsgB-cuYaXN4xU7Qp5Q at mail.gmail.com>,
    Matthew Plant <mplant at google.com> writes:

> The code does not need to be compile-able, but it does need to be at least
> some-what parseable.

In this regard, clang's rename won't be any worse than any other
language's rename.

For instance, refactoring tools are pretty mature in .NET/Java, but
none of them successfully rename an identifier whose type can't be parsed.
You're fundamentally missing the semantic information needed to decide
where else this identifier needs to be changed.

As far as C++ refactoring tools goes, *anything* based on clang's
parser is going to be light years ahead of other tools that are based
on ad-hoc homegrown parsers.  I've been kicking the tires of C++
refactoring tools since roughly 2007 when I started refactoring a crusty
old code base.  Obviously the older tools use their own parser.  Just
having a parser that gets the job done correctly is difficult, never
mind keeping that parser up to date with the C++11 and C++14
standards.

This is where clang-based refactoring tools are really going to shine.
Leveraging the *production quality* parser and resulting lossless AST
just puts you miles ahead in the game.
-- 
"The Direct3D Graphics Pipeline" free book <http://tinyurl.com/d3d-pipeline>
     The Computer Graphics Museum <http://ComputerGraphicsMuseum.org>
         The Terminals Wiki <http://terminals.classiccmp.org>
  Legalize Adulthood! (my blog) <http://LegalizeAdulthood.wordpress.com>



More information about the cfe-dev mailing list