[PATCH] Re: Patches to add-override functionality to cpp11-migrate tool

Philip Dunstan phil at philipdunstan.com
Wed Apr 3 19:02:29 PDT 2013


These patches add an 'add-override' feature to the cpp11-migrate tool in
clang/tool/extras. This feature adds the override keyword to virtual
functions where applicable.

These patches were previously send to the list on Feb 13 but there appears
to have been a problem with the sending of my previous email. I've rebased
these patches so svn revision 178680 and added the information of the
add-override feature to the cpp11-migrate tool documentation in the clang
and clang tools extra repositories.

Two patches are attached to this email:
add-override.clang_178680.patch - Adds new AST matchers.
add-override.clang_tools_extra_178680.patch - Adds the feature to the
cpp11-migrate tool.

Thanks.
Phil
--
Philip Dunstan
phil at philipdunstan.com
www.philipdunstan.com


On Wed, Feb 13, 2013 at 11:32 PM, Philip Dunstan <phil at philipdunstan.com>wrote:

> Thanks Dmitri and Manuel
>
> I've attached a new patch to clang/tools/extra with Dmitri's suggestions
> to use isWhitespace() from clang/Basic/CharInfo.h and indent the member
> initializers of AddOverrideFixer.
>
> For completeness, I have also re-attached the patch to the clang
> repository containing the additional matchers. This is unchanged except for
> it now being a diff against svn revision 175100.
>
> I'm happy to add the documentation when there is a somewhere to put it.
>
> Philip Dunstan
> --
> Philip Dunstan
> phil at philipdunstan.com
> www.philipdunstan.com
>
>
> On Wed, Feb 13, 2013 at 1:41 PM, Dmitri Gribenko <gribozavr at gmail.com>wrote:
>
>> On Fri, Feb 8, 2013 at 11:01 PM, Philip Dunstan <phil at philipdunstan.com>
>> wrote:
>> > Hello
>> >
>> > These patches continue some work that I started back in July (before RL
>> > kicked in) to create a C++11 migration tool that would add the override
>> > specifier to suitable member functions where it could. I have reworked
>> the
>> > tool to integrate it into the cpp11-migrate tool in the tool/extra
>> > repository.
>>
>> +static bool isWhitespace(char C) {
>> +  return (C == ' ') || (C == '\t') || (C == '\f') ||
>> +         (C == '\v') || (C == '\n') || (C == '\r');
>> +}
>>
>> You can use isWhitespace() from clang/Basic/CharInfo.h for this.
>>
>> +  AddOverrideFixer(clang::tooling::Replacements &Replace,
>> +                   unsigned &AcceptedChanges) :
>> +  Replace(Replace),
>> +  AcceptedChanges(AcceptedChanges) { }
>>
>> Please indent member initializers.
>>
>> This LGTM, but there's documentation missing -- obviously because
>> there's no place to put it currently.  After the patch to add a
>> documentation page for cpp11-migrate lands, could you write up some
>> user-visible documentation?
>>
>> Dmitri
>>
>> --
>> main(i,j){for(i=2;;i++){for(j=2;j<i;j++){if(!(i%j)){j=0;break;}}if
>> (j){printf("%d\n",i);}}} /*Dmitri Gribenko <gribozavr at gmail.com>*/
>>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20130404/fb2b01be/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: add-override.clang_178680.patch
Type: application/octet-stream
Size: 2996 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20130404/fb2b01be/attachment.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: add-override.clang_tools_extra_178680.patch
Type: application/octet-stream
Size: 19155 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20130404/fb2b01be/attachment-0001.obj>


More information about the cfe-commits mailing list