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

Artem Dergachev via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Jun 13 15:10:10 PDT 2018


NoQ added a comment.

For now the tests that i proposed may in fact accidentally work because as far as i understand you're updating the "variable contains a value returned by operator new" flag when you encounter assignment operators. The real problems will arise when the order of the assignments in the AST doesn't correspond to the order of assignments during program execution.

So one more test i'd like to have is:

  int *m = new int;
  while (true) {
    if (m == nullptr) { ... } // no-warning
    m = nullptr;
  }


Repository:
  rC Clang

https://reviews.llvm.org/D47554





More information about the cfe-commits mailing list