[cfe-commits] r118158 - in /cfe/trunk: include/clang/Analysis/CFG.h lib/Analysis/CFG.cpp test/Analysis/temp-obj-dtors-cfg-output.cpp

Marcin Świderski marcin.sfider at gmail.com
Wed Nov 3 00:31:26 PDT 2010


2010/11/3 Zhongxing Xu <xuzhongxing at gmail.com>

>
>
> On Wed, Nov 3, 2010 at 2:19 PM, Marcin Swiderski <marcin.sfider at gmail.com>wrote:
>
>> Author: sfider
>> Date: Wed Nov  3 01:19:35 2010
>> New Revision: 118158
>>
>> URL: http://llvm.org/viewvc/llvm-project?rev=118158&view=rev
>> Log:
>> Added generating destructors for temporary objects. Two cases I know of,
>> that are not handled properly:
>> 1. For statement: const C& c = C(0) ?: C(1) destructors generated for
>> condition will not differ from those generated for case without prolonged
>> lifetime of temporary,
>> 2. There will be no destructor for constant reference member bound to
>> temporary at the exit from constructor.
>>
>>
> Hi Marcin,
>
> Could you please provide two examples for these cases?
>

Examples in attachment.

In test_impl_cond() you can see that when assigning expression result to
regular variable both temporaries are destroyed and this is correct. But
when assiging to constant reference, temporary in condition should be
destroyed only when false branch is taken.

In TestConstRefMember constructor temporary is created and should be
destroyed at the exit from constructor (after "int b").
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20101103/d37fa8ed/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: example.cpp
Type: application/octet-stream
Size: 316 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20101103/d37fa8ed/attachment.obj>


More information about the cfe-commits mailing list