[analyzer] Fix CXXNewExpr callback order.
ClosedPublic

Authored by NoQ on Wed, Jan 10, 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

Repository
rC Clang
NoQ created this revision.Wed, Jan 10, 6:27 PM
NoQ added inline comments.Wed, Jan 10, 6:28 PM
test/Analysis/cxxnewexpr-callback-inline.cpp
32–33

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

dcoughlin accepted this revision.Fri, Jan 12, 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.Fri, Jan 12, 5:04 PM
This revision was automatically updated to reflect the committed changes.