[cfe-dev] add-override-specifier example tool

Manuel Klimek klimek at google.com
Sun Jul 1 22:55:24 PDT 2012


On Mon, Jul 2, 2012 at 2:19 AM, Philip Dunstan <phil at philipdunstan.com>wrote:

> Again, with a few bug fixes...
>
> Phil
> --
> Philip Dunstan
> phil at philipdunstan.com
> www.philipdunstan.com
>
>
> On Sun, Jul 1, 2012 at 11:31 PM, Philip Dunstan <phil at philipdunstan.com>wrote:
>
>> Hi everyone,
>>
>> I'd like to submit my refactoring tool that adds the override specifier
>> to appropriate virtual functions to the clang tooling branch. Given the
>> recent discussion on this list about creating a larger refactoring tool
>> with many different C++11 refactoring options  I thought I would submit it
>> here for discussion before submitting it to cfe-commit list.
>>
>
Cool stuff :) Feel free to check this into the tooling branch. Before it
goes anywhere else it would obviously need tests...


> Regardless of the discussion on the larger tool, I think that the
>> add-override-specifier example is still a useful example of the work that
>> has been done in the tooling branch. It includes writing a custom
>> ASTMatcher to identify virtual functions which are candidates for the
>> override keyword. It also demonstrates a different problem than the
>> rename-method example and remove-cstr-calls tool on which it is based.  If
>> there isn't any opposition to this, I will submit it to cfe-commit.
>>
>
We'll need to figure out a place where to put those tools. At the moment
the AST matchers are not in mainline yet.


> I am still not entirely happy with the technique used to identify where
>> the override keyword should be inserted and would welcome discussion on
>> this problem.
>>
>
I think currently the best way to do this is to re-lex those parts (cc'ed
djasper, who has more hands on experience with that).

A different question is how much information we want to store in the AST to
make it easier for tools to figure out the answers to questions like "where
is the right place to put attributes for this function declaration?".

Cheers,
/Manuel
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20120702/a2a6973f/attachment.html>


More information about the cfe-dev mailing list