[PATCH] D33672: [analyzer] INT50-CPP. Do not cast to an out-of-range enumeration checker

Aaron Ballman via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Aug 24 06:56:10 PDT 2017


aaron.ballman added inline comments.


================
Comment at: lib/StaticAnalyzer/Checkers/EnumCastOutOfRangeChecker.cpp:19
+//   of casting an integer value that is out of range
+//===----------------------------------------------------------------------===//
+
----------------
If this check is intended to conform to CERT's INT50-CPP rule, you should put a link to the wiki entry for it here as well.


================
Comment at: lib/StaticAnalyzer/Checkers/EnumCastOutOfRangeChecker.cpp:72
+      std::distance(ED->enumerator_begin(), ED->enumerator_end()));
+  std::transform(ED->enumerator_begin(), ED->enumerator_end(),
+                 DeclValues.begin(),
----------------
You can use `llvm::transform(ED->enumerators(), ...)` instead -- the semantics are identical to `std::transform()`, but it takes a range instead of a pair of iterators.


https://reviews.llvm.org/D33672





More information about the cfe-commits mailing list