Patches to add-override functionality to cpp11-migrate tool

Philip Dunstan phil at philipdunstan.com
Wed Feb 13 15:32:07 PST 2013


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/20130214/64a17bca/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: add-override.clang_tools_extra_175100.patch
Type: application/octet-stream
Size: 16569 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20130214/64a17bca/attachment.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: add-override.clang_175100.patch
Type: application/octet-stream
Size: 2369 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20130214/64a17bca/attachment-0001.obj>


More information about the cfe-commits mailing list