[PATCH] D47554: [analyzer] Check for dead/impossible status checks

George Karpenkov via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed May 30 13:57:31 PDT 2018


george.karpenkov added a comment.

@trixirt I wrote a bunch of comments inline, but then after looking at the test cases,
.... this would not work.

This is a dataflow, all-paths check (the variable can NEVER be a nullptr), yet symbolic execution runs on A given paths.

Currently in the analyzer there's no way to write dataflow checks using the checker API.

HOWEVER, in your case all comparisons to NULL are constants, so this should be just implemented as an AST matcher (a good introduction is https://eli.thegreenplace.net/2014/07/29/ast-matchers-and-clang-refactoring-tools).
The good thing it probably could be expressed in just a few lines of code.


Repository:
  rC Clang

https://reviews.llvm.org/D47554





More information about the cfe-commits mailing list