This is an archive of the discontinued LLVM Phabricator instance.

[analyzer] ObjCContainers: Track index values.
ClosedPublic

Authored by NoQ on Dec 7 2018, 1:46 PM.

Details

Summary

This is a checker for CF (well, not really ObjC) arrays that checks array bounds. As such, it's a good place to experiment with array bound checking.

Use trackExpressionValue() (previously known as trackNullOrUndefValue()) to track index value, so that the user knew what Static Analyzer thinks the index is.

Hopefully this will make warnings more understandable. Other ideas for better warnings include adding index and length values to the message and explaining how constraints over index and length evolve along the path.

Additionally, add printState() to help debugging the checker later.

Diff Detail

Repository
rC Clang

Event Timeline

NoQ created this revision.Dec 7 2018, 1:46 PM
NoQ marked 2 inline comments as done.Dec 7 2018, 1:47 PM
NoQ added inline comments.
test/Analysis/CFContainers.mm
178–180

This is a new note.

240

This is a new note.

NoQ added a comment.Dec 14 2018, 6:04 PM

These are boring, i guess i just commit.

This revision was not accepted when it landed; it landed in state Needs Review.Dec 14 2018, 6:09 PM
This revision was automatically updated to reflect the committed changes.