[cfe-dev] CFG initializers and destructors patch

Zhongxing Xu xuzhongxing at gmail.com
Tue Sep 14 22:14:03 PDT 2010


Hi Marcin,

I suggest we fix the CFGElement part of design in the first patches, and
leave the CFG building processes later. Attached is my patch based on your
proposal. The differences are:

- I made two pointers explicit in the CFGElement since they are simpler and
as I calculated before they won't take too much memory, and we can optimize
them any time later.

- I added dtors for temporaries. This is truly needed as we don't want to
reason about it every time we need it.

What do you think?

2010/9/3 Marcin Świderski <marcin.sfider at gmail.com>

> Hi
>
> I'm sending a patch with implementation of C++
> - initializers from constructor initialization list,
> - implicit destructors for objects with automatic storage duration.
>
> For destructors I've taken care of:
> - block local scopes,
> - if/switch/for/while/do local scopes (in case there's no block),
> - if/switch/for/while condition variables,
> - catch exception variable,
> - temporaries bound to const reference.
>
> Is there something that I've missed?
>
> As it have been suggested I've created hierarchy of CFGElements. Currently
> there're two unused types for implicit destructor calls in destructor. I've
> did not revert ability of CFGElement to cast/dyn_cast to Stmt, because it
> would lead to situation when cast<Stmt>(SomeCFGElement) would return null. I
> did however add method for downcasting CFGElement object to object of its
> implemntation class (returned by value, not pointer) with returning invalid
> object on invalid cast.
>
> I did not add CFGElement for destructors of temporary objects. After giving
> it some thought I came to a conclusion that it shouldn't be covered by CFG,
> because it clearly needs path-sensitiveness.
>
> Cheers
> Marcin
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20100915/439a93ab/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: cfg.patch
Type: text/x-patch
Size: 19909 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20100915/439a93ab/attachment.bin>


More information about the cfe-dev mailing list