[PATCH] D18457: [clang-tidy] Add a new checker to detect missing comma in initializer list.

Alexander Kornienko via cfe-commits cfe-commits at lists.llvm.org
Wed Mar 30 08:56:07 PDT 2016


alexfh accepted this revision.
alexfh added a comment.
This revision is now accepted and ready to land.

Looks good with a few comments. Further functionality improvements can be done in a follow up, I think.

Please update docs/ReleaseNotes.rst.


================
Comment at: clang-tidy/misc/SuspiciousMissingCommaCheck.cpp:72
@@ +71,3 @@
+  // The current threshold is set to less than 1/5 of the string literals.
+  if ((RatioThreshold * Count) / Size > 1) return;
+
----------------
I'd prefer this to be `double(Count) / Size > RatioThreshold` and `RatioThreshold` to be a double.

================
Comment at: clang-tidy/misc/SuspiciousMissingCommaCheck.cpp:75
@@ +74,3 @@
+  diag(ConcatenatedLiteral->getLocStart(),
+       "suspicious string literal, probably missing a comma");
+}
----------------
We need to add a recommendation on how to silence this warning (use parentheses, for example). Fine for a follow up.


http://reviews.llvm.org/D18457





More information about the cfe-commits mailing list