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

Firat Kasmis via cfe-dev cfe-dev at lists.llvm.org
Thu Dec 17 04:22:37 PST 2015

Great! Thanks for the test cases. I am going to implement the rest and keep
you guys updated. Btw, where is your repository so I can contribute
directly into your repository instead of doing this here in the mailing

[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.

In article <CAC8rT1_WHgg4wE0Tn2s-GqWSZ_tA5UJYF=
sSpBh0c+QoGu93zw at mail.gmail.com>,
    Firat Kasmis via cfe-dev <cfe-dev at lists.llvm.org> writes:

> 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
> 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:
> Example before and after: http://pastebin.com/KnrzNWnM ->
> http://pastebin.com/rLmPZRxP
> There is always a simple solution! :-)


A couple other things to try:

- C++11 brace initialization

    std::vector<std::string> s{"foo"s, "bar"s}, t{"foo"s}, u;
    std::vector<std::string> s{"foo"s, "bar"s};
    std::vector<std::string> t{"foo"s};
    std::vector<std::string> u;

- function declarations

    void f(int), g(int, float);
    void f(int);
    void g(int, float);

- pointers to functions

    void gg(int, float);
    void (*f)(int), (*g)(int, float) = gg;
    void gg(int, float);
    void (*f)(int);
    void (*g)(int, float) = gg;

- pointers to member data

    struct S { int a; const int b; };
        int S::*p = &S::a, S::* const q = &S::a;
        const int S::*r = &S::b, S::*t;
    struct S { int a; const int b; };
        int S::*p = &S::a;
        int S::* const q = &S::a;
        const int S::*r = &S::b;
        const int S::*t;

- pointers to member functions

    struct S { int f(); };
        int (S::*p)() = &S::f, (S::*q)();
    struct S { int f(); };
        int (S::*p)() = &S::f;
        int (S::*q)();

I haven't looked at your implementation to specifically see if any of
these are a problem, but in my experience these more "exotic" types
are often a weak spot in refactoring tools.  clang tooling
infrastructure tends to do a little better here because it's a real
"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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20151217/623a50ab/attachment.html>

More information about the cfe-dev mailing list