[PATCH] [analyzer] Add very limited support for temporary destructors

Pavel Labath labath at google.com
Tue Jul 16 02:06:38 PDT 2013



================
Comment at: lib/StaticAnalyzer/Core/ExprEngine.cpp:596
@@ +595,3 @@
+
+  ProgramStateRef State = Pred->getState();
+
----------------
Jordan Rose wrote:
> Unused?
apparently yes. removed.

================
Comment at: lib/StaticAnalyzer/Core/ExprEngine.cpp:598-600
@@ +597,5 @@
+
+  const MemRegion *Region =
+      getSValBuilder().getRegionManager().getCXXTempObjectRegion(
+          D.getBindTemporaryExpr(), Pred->getLocationContext());
+
----------------
Jordan Rose wrote:
> Hm. This doesn't actually refer to the object being bound -- the temp region is created for the MaterializeTemporaryExpr, not the CXXBindTemporaryExpr. Moreover, it's currently not consistent -- if the value being materialized is already represented as a temporary region in the analyzer, we're not going to copy it.
> 
> (Actually, I'm not sure this happens anymore. I've tightened up our handling of glvalues vs. prvalues since writing that code.)
> 
> The best thing to do might be to just use UnknownVal as the "this" value for now (i.e. until you're/we're ready to tackle this problem for real). I think this should just work if you pass NULL to VisitCXXDestructor (which will trickle down to a NULL value in CXXDestructorCall), but there might be some fallout cleanup work.
Done. Passing NULL seems to work just fine.

================
Comment at: lib/StaticAnalyzer/Core/ExprEngineCallAndReturn.cpp:809
@@ +808,3 @@
+  // inline them.
+  // FIME: Remove this once temp destructors are working.
+  if ((*currBldrCtx->getBlock())[currStmtIdx].getAs<CFGTemporaryDtor>())
----------------
Jordan Rose wrote:
> Typo: "FIME"
Done.


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



More information about the cfe-commits mailing list