[PATCH] Enhance CFG to model C++ new more precisely

Jordan Rose jordan_rose at apple.com
Fri Jan 10 18:23:42 PST 2014


  I realized that Ted would probably say at this point that we should guard this by a flag in CFG::BuildOptions, just like AddTemporaryDtors. The flag only has to guard the addition of the CFGNewAllocator node to the graph; everything else will act pretty much the same as before without it. You don't need to hook it up to an analyzer config option yet (like "cfg-temporary-dtors"), but it provides an easy way to turn this behavior off without reverting it if it turns out to break real-world projects.

  Other than that this looks good, and I'm hoping to apply it this weekend or Monday! (Again, though, please drop the whitespace-only changes...)


================
Comment at: lib/StaticAnalyzer/Core/ExprEngineCXX.cpp:332-336
@@ -331,1 +331,7 @@
 
+void ExprEngine::VisitCXXNewAllocatorCall(const CXXNewExpr *CNE,
+                                          ExplodedNode *Pred,
+                                          ExplodedNodeSet &Dst) {
+  //TODO: Handle VisitCXXNewAllocatorExpr
+}
+
----------------
This isn't even called now, so maybe we should just leave it out until the next patch.

================
Comment at: lib/StaticAnalyzer/Core/ExprEngine.cpp:562
@@ +561,3 @@
+  ExplodedNode *N = Bldr.generateNode(PP, Pred->getState(), Pred);
+  Dst.Add(N);
+  Engine.enqueue(Dst, currBldrCtx->getBlock(), currStmtIdx);
----------------
You don't need to do this when using a NodeBuilder: it automatically adds new nodes to the destination set you give it at construction time.


http://llvm-reviews.chandlerc.com/D2423



More information about the cfe-commits mailing list