[PATCH] Proposal on how to fix temporary dtors.

Jordan Rose jordan_rose at apple.com
Mon Jul 7 09:48:16 PDT 2014


Can you add an assertion at the end of a block that there are no outstanding temporary destructors in the current stack frame? That seems useful.

================
Comment at: lib/Analysis/CFG.cpp:3583
@@ -3512,4 +3582,3 @@
     if (Stmt *Child = *I)
-      if (CFGBlock *R = VisitForTemporaryDtors(Child))
-        B = R;
+      if (CFGBlock *R = VisitForTemporaryDtors(Child, false, Context)) B = R;
   }
----------------
Lost a newline here.

================
Comment at: lib/StaticAnalyzer/Core/ExprEngine.cpp:681-686
@@ -663,1 +680,8 @@
   QualType varType = D.getBindTemporaryExpr()->getSubExpr()->getType();
+  for (ExplodedNode *Node : CleanDtorState) {
+    // FIXME: Inlining of temporary destructors is not supported yet anyway, so
+    // we just put a NULL region for now. This will need to be changed later.
+    VisitCXXDestructor(varType, nullptr, D.getBindTemporaryExpr(),
+                       /*IsBase=*/false, Node, Dst);
+  }
+}
----------------
I'm not sure you're supposed to reuse `Dst` with multiple builders. However, you know there's only one node in `CleanDtorState`, so you should be able to just skip the loop.

http://reviews.llvm.org/D3627






More information about the cfe-commits mailing list