[cfe-dev] [clang-tidy] multiple declaration statement check contribution

Firat Kasmis via cfe-dev cfe-dev at lists.llvm.org
Fri Oct 21 08:06:47 PDT 2016


Hi,

I would like to know if there is any need for a readability check that
checks for multiple declarations in one statement (init-declarator list).
Things like this:

long int lint1, *lintptr1, lintaray10[10];
long int lint2 = 3, *lintptr2,
        lintaray2[2] = { 1, 2 };
int int3 = f(), intarray[] = { 1, 2, 3, 4 };
const int cint3 = 4, cintarray[] = { 1, 2, 3, 4 };

may be transformed into:

long lint1;
long *lintptr1;
long lintaray10[10];

long lint2 = 3;
long *lintptr2;
long lintaray2[2] = { 1, 2 };

int int3 = f();
int intarray[4] = { 1, 2, 3, 4 };

const int cint3 = 4;
const int cintarray[4] = { 1, 2, 3, 4 };

Here is the full example with before (http://pastebin.com/raw/KnrzNWnM) and
after (http://pastebin.com/raw/rLmPZRxP).

I haven't worked for a long time on the code and like to continue,
especially implement these suggested features (
http://lists.llvm.org/pipermail/cfe-dev/2015-December/046556.html).

I am open for any hints or additional features.

Best,
Firat
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20161021/22eb7e8a/attachment.html>


More information about the cfe-dev mailing list