[PATCH] D27621: [clang-tidy] check to find declarations declaring more than one name
Firat Kasmis via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Mon Dec 19 09:07:55 PST 2016
firolino updated this revision to Diff 81964.
firolino added a comment.
Added support for new test cases:
int S::*mdpa1[2] = {&S::a, &S::a}, var1 = 0;
// CHECK-MESSAGES: :[[@LINE-1]]:9: warning: declaration statement can be split
// CHECK-FIXES: {{^ }}int S::*mdpa1[2] = {&S::a, &S::a};
// CHECK-FIXES: {{^ }}int var1 = 0;
int S :: * * mdpa2[2] = {&p, &pp2}, var2 = 0;
// CHECK-MESSAGES: :[[@LINE-1]]:9: warning: declaration statement can be split
// CHECK-FIXES: {{^ }}int S :: * * mdpa2[2] = {&p, &pp2};
// CHECK-FIXES: {{^ }}int var2 = 0;
void (S::*mdfp1)() = &S::f, (S::*mdfp2)() = &S::f;
// CHECK-MESSAGES: :[[@LINE-1]]:9: warning: declaration statement can be split
// CHECK-FIXES: {{^ }}void (S::*mdfp1)() = &S::f;
// CHECK-FIXES: {{^ }}void (S::*mdfp2)() = &S::f;
void (S::*mdfpa1[2])() = {&S::f, &S::f}, (S::*mdfpa2)() = &S::f;
// CHECK-MESSAGES: :[[@LINE-1]]:9: warning: declaration statement can be split
// CHECK-FIXES: {{^ }}void (S::*mdfpa1[2])() = {&S::f, &S::f};
// CHECK-FIXES: {{^ }}void (S::*mdfpa2)() = &S::f;
void (S::**mdfpa3[2])() = {&mdfpa1[0], &mdfpa1[1]}, (S::*mdfpa4)() = &S::f;
// CHECK-MESSAGES: :[[@LINE-1]]:9: warning: declaration statement can be split
// CHECK-FIXES: {{^ }}void (S::**mdfpa3[2])() = {&mdfpa1[0], &mdfpa1[1]};
// CHECK-FIXES: {{^ }}void (S::*mdfpa4)() = &S::f;
https://reviews.llvm.org/D27621
Files:
clang-tidy/readability/CMakeLists.txt
clang-tidy/readability/OneNamePerDeclarationCheck.cpp
clang-tidy/readability/OneNamePerDeclarationCheck.h
clang-tidy/readability/ReadabilityTidyModule.cpp
clang-tidy/utils/LexerUtils.cpp
clang-tidy/utils/LexerUtils.h
docs/ReleaseNotes.rst
docs/clang-tidy/checks/list.rst
docs/clang-tidy/checks/readability-one-name-per-declaration.rst
test/clang-tidy/readability-one-name-per-declaration-complex.cpp
test/clang-tidy/readability-one-name-per-declaration-modern.cpp
test/clang-tidy/readability-one-name-per-declaration-simple.cpp
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D27621.81964.patch
Type: text/x-patch
Size: 38506 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20161219/2d8e1e2d/attachment-0001.bin>
More information about the cfe-commits
mailing list