[PATCH] D19769: [clang-tidy] Add explicitly given array size heuristic to misc-suspicious-missing-comma check.
Dominik Szabó via cfe-commits
cfe-commits at lists.llvm.org
Mon May 2 03:57:33 PDT 2016
szdominik added inline comments.
================
Comment at: clang-tidy/misc/SuspiciousMissingCommaCheck.cpp:94
@@ -93,3 +93,3 @@
Finder->addMatcher(StringsInitializerList.bind("list"), this);
}
----------------
etienneb wrote:
> If it's working as-is,... this is neat :)
Well, the array filler has a problematic limitation.
I forget that I used the explicit given size for reduce false positives in my checker.
e.g.
```
struct MusicIntervalArray {
int n;
const char* list[5];
} intervals[2] = {
{5, {"second", "third", "fourth", "fifth" "sixth"}},
{5, {"ninth", "tenth", "eleventh", "twelfth", "thir" "teenth"}},
};
```
The first is simple: has array filler, so warn because of size.
But the second one is a good initialization, it has 5 elements, which is the explicit size. But your implementation warns us, that there is a missing comma. If I work with the length (from declaration or type), I can filter these cases.
http://reviews.llvm.org/D19769
More information about the cfe-commits
mailing list