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

Alexander Zaitsev via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Oct 29 15:17:20 PDT 2018


ZaMaZaN4iK added a comment.

In https://reviews.llvm.org/D33672#1279305, @NoQ wrote:

> Thanks! I like where this is going. Let's land the patch and continue developing it incrementally in trunk.
>
> The next steps for this checker are, in my opinion:
>
> - Do the visitor thingy that i requested in inline-311373 <https://reviews.llvm.org/D33672#inline-311373>. I think it's a necessary thing to do, but don't jump into implementing it right away: i already have some code for this that i want to share.
> - Play nicely with typedefs. For now i believe the checker ignores them because you can't cast `TypedefType` to `EnumType`. Once this is done, it will be worth it to include the name of the enum in the warning message.
> - Optimize the code using `assumeInclusiveRange`. Because `assume` is an expensive operation, i'd like to avoid doing it O(n) times for contiguous enums in which just 2 `assume`s are enough (or, even better, as single `assumeInclusiveRange`).
> - See how this checker performs on real code, fix crashes and false positives if any.


Thank you for the roadmap! Honestly I am not so familiar with Clang AST and Clang Static Analyzer details (all my experience is writing some simple checkers for clang-tidy and watching some videos about Clang/Clang Static Analyzers), so I even don't understand of your words :) So don't rely on quick fixes from my side. But I think I can write something useful after couple of tries (slowly, but I can). Thank you for the help!


https://reviews.llvm.org/D33672





More information about the cfe-commits mailing list