[cfe-dev] CFG temporary objects destructors

Ted Kremenek kremenek at apple.com
Thu Oct 21 10:24:28 PDT 2010


On Oct 21, 2010, at 9:06 AM, Marcin Świderski wrote:

> Basically this assumption doesn't match how we treat binary operators in the CFG.  We should probably fix having the LHS always precessed first.  Any objections?
>  
> C++ standard states that at the end of full expressions temporary objects created should be destroyed in reverse order of the completion of their construction. So when generating destructors we want to process LHS and RHS subexpressions in reverse order of processing them in VisitBinaryOperator. For logical operators order is defined, and for other operators it is undefined (I would have to check if for assignment operator it is undefined as well...). So for logical operators everything should be left as it is IMO, but for other operators we should probably match the compiler.

Understood.  The point I was trying to convey was that for non-logical binary operators it is the case that the RHS appears in the CFG before the LHS, which doesn't match the compiler's behavior.  For logical operators, I think everything is working as expected.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20101021/3200be90/attachment.html>


More information about the cfe-dev mailing list