[PATCH] D37025: [analyzer] Support more pointer arithmetic in bugreporter::getDerefExpr().

Artem Dergachev via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Aug 22 14:08:56 PDT 2017


NoQ created this revision.
Herald added a subscriber: eraman.

This patch adds support for a few more pointer arithmetic cases. For instance, when `p` is a null pointer, it would be possible to track that expressions like `*(++p) = 5` and `*(p + 2) = 5` are null pointer dereferences that are based on pointer `p`. The analyzer would later be able to display additional diagnostics to track where `p` has become null and why. I noticed these cases accidentally when i was working on https://reviews.llvm.org/D37023.


https://reviews.llvm.org/D37025

Files:
  lib/StaticAnalyzer/Core/BugReporterVisitors.cpp
  test/Analysis/inlining/inline-defensive-checks.c
  test/Analysis/nullptr.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D37025.112221.patch
Type: text/x-patch
Size: 7815 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20170822/f740c6e7/attachment-0001.bin>


More information about the cfe-commits mailing list