This is an archive of the discontinued LLVM Phabricator instance.

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

Authored by NoQ on Aug 22 2017, 2:08 PM.

Details

Summary

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 D37023.

Diff Detail

Repository
rL LLVM

Event Timeline

NoQ created this revision.Aug 22 2017, 2:08 PM
NoQ added inline comments.
test/Analysis/nullptr.cpp
54 ↗(On Diff #112221)

This note has been added by the patch. Other newly displayed notes in the old tests here have always been there, but just now got displayed.

This revision is now accepted and ready to land.Aug 28 2017, 3:48 AM
This revision was automatically updated to reflect the committed changes.