[cfe-dev] [clang-tidy] Some possible contributions

Firat Kasmis via cfe-dev cfe-dev at lists.llvm.org
Wed Dec 16 12:28:44 PST 2015


I just improved and simplified the code. Now auto, decltype
and initializer_list work too. As you can see in the example, auto is
automatically transformed into its deduced type (there is a way to keep the
auto keyword) and long int will get long. An additional if-statement would
change both behavior if you like.

Now, you only need the DeclarationTransformer: http://pastebin.com/Luu1i9s3
Example before and after: http://pastebin.com/KnrzNWnM ->
http://pastebin.com/rLmPZRxP

There is always a simple solution! :-)

2015-12-16 19:13 GMT+01:00 Richard via cfe-dev <cfe-dev at lists.llvm.org>:

>
> [Please reply *only* to the list and do not include my email directly
> in the To: or Cc: of your reply; otherwise I will not see your reply.
> Thanks.]
>
> In article <56709B81.2020403 at gmail.com>,
>     Piotr Dziwinski via cfe-dev <cfe-dev at lists.llvm.org> writes:
>
> > On 15/12/15 21:10, Richard via cfe-dev wrote:
> > > I remember now that I was looking into this for a check that would
> > > split a multiple variable declaration into multiple single variable
> > > declarations. [...]
> >
> > Well, taking the assumption that all variable declarations are single
> > declarations would simplify my localizing variables checker a great deal
> > and make issue #1 obsolete.
>
> OK, good we're on the same thought track.
>
> > On the other hand, I worry about the decreased usability from the user's
> > point of view.
>
> Agreed.
>
> > He would have to first run the checker that splits multiple
> > declarations, applying its fixes everywhere.
> > Only then, as a second step, he would be able to run the localizing
> > variables checker, and use its fixes.
>
> How would a user feel if the localizing check broke down multiple
> delcarations into single declarations as a by-product?
>
> In other words:
>
> int i, j, k;
> // many lines of code
> i = 10;
>
> becomes
>
> int j;
> int k;
> // many lines of code
> int i = 10;
>
> Would this be unacceptable?
> --
> "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 lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20151216/76db78b6/attachment.html>


More information about the cfe-dev mailing list