[PATCH] D18457: [clang-tidy] Add a new checker to detect missing comma in initializer list.
Etienne Bergeron via cfe-commits
cfe-commits at lists.llvm.org
Thu Mar 24 12:13:39 PDT 2016
etienneb created this revision.
etienneb added a reviewer: alexfh.
etienneb added a subscriber: cfe-commits.
This checker is able to detect missing comma in
an array of string literals.
```
const char* A[] = {
"abc",
"def" // missing comma (no compiler warnings)
"ghi",
};
```
The ratio of false-positive is reduced by restricting the
size of the array considered and the ratio of missing
comma.
To validate the quantity of false positive, the checker
was tried over LLVM and chromium code and detected these
cases:
[[ http://reviews.llvm.org/D18454 | http://reviews.llvm.org/D18454 ]]
[[https://codereview.chromium.org/1807753002/ | https://codereview.chromium.org/1807753002/]]
[[https://codereview.chromium.org/1826193002/ | https://codereview.chromium.org/1826193002/]]
[[https://codereview.chromium.org/1805713002/ | https://codereview.chromium.org/1805713002/]]
http://reviews.llvm.org/D18457
Files:
clang-tidy/misc/CMakeLists.txt
clang-tidy/misc/MiscTidyModule.cpp
clang-tidy/misc/SuspiciousMissingCommaCheck.cpp
clang-tidy/misc/SuspiciousMissingCommaCheck.h
docs/clang-tidy/checks/list.rst
docs/clang-tidy/checks/misc-suspicious-missing-comma.rst
test/clang-tidy/misc-suspicious-missing-comma.cpp
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D18457.51581.patch
Type: text/x-patch
Size: 8065 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20160324/2bfe7da7/attachment.bin>
More information about the cfe-commits
mailing list