[PATCH] D37808: [clang-tidy] Add new hicpp-multiway-paths-covered check for missing branches

Aaron Ballman via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Sat Nov 18 11:40:38 PST 2017


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

Aside from some minor commenting nits, LGTM



================
Comment at: clang-tidy/hicpp/MultiwayPathsCoveredCheck.cpp:41
+          switchStmt(hasCondition(allOf(
+              // Match on switch statements that have either bitfield or integer
+              // condition.
----------------
aaron.ballman wrote:
> either bitfield or integer condition -> either a bit-field or an integer condition
bitfield -> bit-field


================
Comment at: clang-tidy/hicpp/MultiwayPathsCoveredCheck.cpp:91-92
+  // Context.getTypeSize(T) returns the number of bits T uses.
+  // Calculates the number of discrete values that are representable by this
+  // type.
+  return T->isIntegralType(Context) ? twoPow(Context.getTypeSize(T))
----------------
JonasToth wrote:
> aaron.ballman wrote:
> > I don't think this comment adds value.
> i dropped all of it. The function doc should be clear enough, is it?
Yes, I think so.


================
Comment at: clang-tidy/hicpp/MultiwayPathsCoveredCheck.cpp:168
+      return twoPow(BitfieldDecl->getBitWidthValue(*Result.Context));
+    llvm_unreachable("either bitfield or non-enum must be condition");
+  }();
----------------
bitfield -> bit-field


https://reviews.llvm.org/D37808





More information about the cfe-commits mailing list