[cfe-dev] clang-modernize feature (was: Rename cpp11-migrate to be something more general?)

Sean Silva silvas at purdue.edu
Wed Sep 4 20:34:59 PDT 2013


That's a really good conceptually simple refactoring. I think it would make
a great topic for a tutorial (independently of its utility otherwise).

-- Sean Silva


On Tue, Sep 3, 2013 at 5:52 PM, Richard <legalize at xmission.com> wrote:

>
> In article <CAGCO0KgQ5wdA9-8ZZ7kvijTbpBkbLLPmbxCSdNWdaEsZq=
> P6XA at mail.gmail.com>,
>     Chandler Carruth <chandlerc at google.com> writes:
>
> > Awesome. Thanks for everyone replying. I'll plan to do the rename tonight
> > so beware the outstanding patches. =D
>
> I recently did some playing around with libtooling to understand how
> to create an automated refactoring.
>
> I could contribute it to clang-modernize if people think it's
> appropriate.
>
> The tool replaces an argument list of "(void)" with "()".
>
> I have it drilling down into most places, but I am still a little
> sketchy on how to get it to recognize that:
>
>         void some_function_taking_fn_ptrs(
>                 void (*fn_ptr)(void (*fn_void_ptr)(void)));
>
> should become
>
>         void some_function_taking_fn_ptrs(
>                 void (*fn_ptr(void (*fn_void_ptr)()));
>
> This nesting of function pointer types can obviously occur farther and
> farther down into an "inline" type declaration.
>
> My questions for this audience are:
>
> 1) is this considered a "modernizing" transform that is appropriate
>    for clang-modernize?
>
> 2) how do I walk arbitrary type declarations like this without having
>    to re-invent parsing the type expressions?
>
> With knowledge of 2), I think I can make this transformation complete
> across everywhere that fn(void) is acceptable and replace it with
> fn().
> --
> "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>
> _______________________________________________
> 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/20130904/a65a0b32/attachment.html>


More information about the cfe-dev mailing list