This is an archive of the discontinued LLVM Phabricator instance.

[analyzer] PtrArithChecker: Update to use check::NewAllocator
Changes PlannedPublic

Authored by NoQ on Jan 5 2018, 5:41 PM.

Details

Summary

Make use of the new callback introduced in D41406 for tracking values allocated by operator new() in -analyzer-config c++-allocator-inlining=true mode. Most of the patch actually has no intended functional changes, apart from the StripCasts part, which is similar to D41796 and fixes two tests in ptr-arith.cpp (checkNew() and getArray()).

(@xazax.hun - this is an alpha checker last touched by you, do you still have plans for it?)

Diff Detail

Event Timeline

NoQ created this revision.Jan 5 2018, 5:41 PM

(@xazax.hun - this is an alpha checker last touched by you, do you still have plans for it?)

I think this check could be very useful. Last I checked it was too noisy (e.g.: around 850 hits on LLVM), and I did plan to look into what are the main sources of false positives, but I did not have time to do so yet.

NoQ planned changes to this revision.Jan 9 2018, 7:51 PM

D41250#971888 reverts the change in how casts work, and the checker doesn't really need the casted value, because it only tracks the pointer.

This still leaves us with the problem of PostStmt<CXXNewExpr> being called twice, so i'd keep this revision around so that i didn't forget to fix this; same probably needs to be done for dynamic type checker.