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

Jordan Rose jordan_rose at apple.com
Wed Jan 8 18:54:39 PST 2014


  This doesn't actually pass the regression tests for me; it crashes in CoreEngine::enqueueStmtNode. I'm pretty sure when this happened for destructors, the solution was to generate a new node that had the same state as the old node, but a PostImplicitCall location. That probably means you're going to have to provide a location for the implicit call, but that's just the location of the CXXNewExpr.

  (Also, please watch the 80 column limit, and try not to commit whitespace-only changes.)

  If that's not enough to get you going I'll try to come back with something more clear tomorrow.


================
Comment at: include/clang/Analysis/CFG.h:151
@@ +150,3 @@
+  explicit CFGNewAllocator(const CXXNewExpr *S)
+             : CFGElement(NewAllocator, S) {}
+
----------------
This should be indented twice from the beginning of the line (i.e. from "explicit"), not from the name of the constructor.

================
Comment at: include/clang/Analysis/CFG.h:148
@@ -143,1 +147,3 @@
 
+class CFGNewAllocator : public CFGElement {
+public:
----------------
Doxygen comment?

================
Comment at: include/clang/Analysis/CFG.h:601-604
@@ -578,1 +600,6 @@
 
+  void appendNewAllocator(CXXNewExpr *NE,
+                          BumpVectorContext &C) {
+    Elements.push_back(CFGNewAllocator(NE), C);
+  }
+
----------------
Gosh, we should really template this at some point, huh. Not in this patch, though.


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



More information about the cfe-commits mailing list