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

Matthew Plant mplant at google.com
Fri Aug 1 13:32:31 PDT 2014


>
> not to be argumentative, but in what ways is Clang's parser not ad-hoc and
> homegrown?   How many C++ parsers aren't in that category?


I think the intended distinction is that ad-hoc parsers try to discard as
much information that is unrelated to the task at hand as possible.
For example, one could imagine an ad-hoc parser intended for indenting that
simply determined how many unmatched curly braces there are.

As far as I can tell, ad-hoc, when applied to parses, is synonymous with
"bad"


On Fri, Aug 1, 2014 at 1:22 PM, Gabriel Dos Reis <
gdr at integrable-solutions.net> wrote:

>
>
>
> On Wed, Jul 30, 2014 at 9:42 AM, Richard <legalize at xmission.com> wrote:
>
>> 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.
>
>
> not to be argumentative, but in what ways is Clang's parser not ad-hoc and
> homegrown?   How many C++ parsers aren't in that category?
>
>
>>  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.
>>
>>
> JetBeans has been promising:
> http://www.jetbrains.com/resharper/features/cpp.html
> It would be interesting to see the two of you sort it out on that kind of
> field :-)
>
> -- Gaby
>
> _______________________________________________
> cfe-dev mailing list
> cfe-dev at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20140801/3fcb30c8/attachment.html>


More information about the cfe-dev mailing list