[PATCH] D33672: [analyzer] INT50-CPP. Do not cast to an out-of-range enumeration checker
Umann Kristóf via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Mon Oct 29 01:31:37 PDT 2018
Szelethus added a comment.
I think is good to go! Please wait on @xazax.hun or @NoQ to have the final say (it's been a while since this revision was accepted by them), but for a work-in-progress alpha checker, I like what I'm seeing.
================
Comment at: lib/StaticAnalyzer/Checkers/EnumCastOutOfRangeChecker.cpp:19
+// of casting an integer value that is out of range
+//===----------------------------------------------------------------------===//
+
----------------
ZaMaZaN4iK wrote:
> aaron.ballman wrote:
> > 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.
> Which wiki entry do you mean?
Maybe this one? https://wiki.sei.cmu.edu/confluence/display/cplusplus/INT50-CPP.+Do+not+cast+to+an+out-of-range+enumeration+value
================
Comment at: lib/StaticAnalyzer/Checkers/EnumCastOutOfRangeChecker.cpp:36
+ const ProgramStateRef PS;
+ SValBuilder &SVB;
+
----------------
You can acquire `SValBuilder` from `ProgramState`:
`PS->getStateManager()->getSvalBuilder()`
================
Comment at: lib/StaticAnalyzer/Checkers/EnumCastOutOfRangeChecker.cpp:66
+
+typedef typename llvm::SmallVector<llvm::APSInt, 6> EnumValueVector;
+
----------------
Prefer `using`.
https://reviews.llvm.org/D33672
More information about the cfe-commits
mailing list