[PATCH] D40737: [clang-tidy] Resubmit hicpp-multiway-paths-covered without breaking test

Aaron Ballman via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Mar 20 09:26:04 PDT 2018


aaron.ballman added inline comments.


================
Comment at: clang-tidy/hicpp/MultiwayPathsCoveredCheck.cpp:68
+}
+/// This function calculate 2 ** Bits and returns
+/// numeric_limits<std::size_t>::max() if an overflow occured.
----------------
Add some vertical whitespace before the comments.


================
Comment at: clang-tidy/hicpp/MultiwayPathsCoveredCheck.cpp:75
+}
+/// Get the number of possible values that can be switched on for the type T.
+///
----------------
Same here.


================
Comment at: clang-tidy/hicpp/MultiwayPathsCoveredCheck.cpp:79
+///         - numeric_limits<std::size_t>::max() when overflow appeared due to
+///           more then 64 bits type size.
+static std::size_t getNumberOfPossibleValues(QualType T,
----------------
s/then/than


================
Comment at: clang-tidy/hicpp/MultiwayPathsCoveredCheck.cpp:119
+  if (!SwitchHasDefault && SwitchCaseCount == 0) {
+    diag(Switch->getLocStart(), "degenerated switch without labels");
+    return;
----------------
I think a better way to phrase this one is: "switch statement without labels has no effect" and perhaps have a fix-it to replace the entire switch construct with its predicate?


================
Comment at: docs/clang-tidy/checks/hicpp-multiway-paths-covered.rst:95
+
+  Activates warning for missing``else`` branches. Default is `0`.
----------------
Missing whitespace after "missing". May want to clarify that that this is a Boolean option.


Repository:
  rCTE Clang Tools Extra

https://reviews.llvm.org/D40737





More information about the cfe-commits mailing list