This is an archive of the discontinued LLVM Phabricator instance.

[analyzer] Fix CXXNewExpr callback order.
ClosedPublic

Authored by NoQ on Jan 10 2018, 6:27 PM.

Details

Summary

Even if we later change how these callbacks work (as in http://lists.llvm.org/pipermail/cfe-dev/2017-December/056314.html), i wanted to clean up the current mess so that it at least worked in any reasonable manner.

  1. Make the PreStmt<CXXNewExpr> callback actually work. It is called on CXXNewExpr pre-visit in ExprEngine.
  2. In -analyzer-config c++-allocator-inlining, don't call the PostStmt<CXXNewExpr> callback twice when the allocator is inlined.

Diff Detail

Event Timeline

NoQ created this revision.Jan 10 2018, 6:27 PM
NoQ added inline comments.Jan 10 2018, 6:28 PM
test/Analysis/cxxnewexpr-callback-inline.cpp
31–32

This ensures that there are no other callbacks after PostStmt<CXXNewExpr>, in particular that there's no another PostStmt<CXXNewExpr>.

dcoughlin accepted this revision.Jan 12 2018, 5:04 PM

Looks great. It is nice to have this fixed and cleaned up!

lib/StaticAnalyzer/Checkers/AnalysisOrderChecker.cpp
95

Style nit: use auto for the casts.

This revision is now accepted and ready to land.Jan 12 2018, 5:04 PM
This revision was automatically updated to reflect the committed changes.