[cfe-dev] CFG temporary objects destructors

Ted Kremenek kremenek at apple.com
Wed Oct 20 21:29:32 PDT 2010


On Oct 17, 2010, at 3:06 PM, Marcin Świderski wrote:

> I'm currently working on modeling destructors of temporary objects in CFG. I've attached patch with prototype implementation and some tests.
> 

Hi Marcin,

Aside from your other comment (which I will get to later), I had a question about the following:

+CFGBlock *CFGBuilder::VisitBinaryOperatorForTemporaryDtors(BinaryOperator *E) {
+  if (E->isLogicalOp()) {
+    // Destructors for temporaries in LHS expression should be called after
+    // those for RHS expression. Even if this will unnecessarily create a block,
+    // this block will be used at least by the full expression.

In the CFG, where we must represent control-flow between the LHS and RHS subexpressions, we actually have the RHS appear first in the CFG.  I believe, however, that the compiler chooses the reverse direction.  Should we reverse it to match?  I think your logic here assumes that the LHS temporaries are created first.

Ted



More information about the cfe-dev mailing list