[cfe-commits] [patch] Add implicit automatic variable dtors for C++ CFG

Zhongxing Xu xuzhongxing at gmail.com
Sun Sep 19 18:19:32 PDT 2010


Hi Marcin,

I'm sorry that I didn't talk with about this piece of work. I really should
let you work on it. The main reason that I did this is because I have the
impression that you might be busy and only have time to work on this at the
week end. I just want to accelerate the progress in this area. No offense.

No handling of other language constructs is because we want to keep the
patches small.

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

> 2010/9/18 Zhongxing Xu <xuzhongxing at gmail.com>
>
> This patch adds automatic variable's dtors to the CFG. It uses LocalScope
>> to
>> record the automatic variables in each scope. When building the CFG,
>> CleanupPoints are inserted at ReturnStmt, CompoundStmt and GotoStmt.
>>
>> After the building process, dtors are inserted into the cleanup points.
>>
>> To hook up the LocalScope when entering a CompoundStmt, now autoCreate a
>> block.
>> This may potentially create redundant blocks. But I think it's easy to
>> remove
>> them.
>>
>> Some code is tricky. It is so to guarantee the correct order the dtors are
>>
>> inserted. I'm not sure they are the best approach.
>>
>> Later we would add an option to control the CFG build option. Currently
>> adding implicit dtors are disabled. If it is enabled, some c++ test cases
>> would
>> fail.
>>
>> Some test cases that this patch can handle are attached. They can be
>> tested by changing
>>
>> if (BuildOpts.AddImplicitDtors) {
>>
>> to
>>
>> if (true) {
>>
>> I don't want to be rude, but I don't like that you've hijacked topic I was
> working on.
> Is this normal practice on this project? If you (or somebody else) thinks
> that
> I shouldn't work on this please contact me before doubling my work.
>
> As for the patch I see no handling of:
> - implicit scopes in if/else/for/while/do/switch,
> - condition variables in if/while/for/switch,
> - temporaries with lifetime extended by binding to const reference.
>
> Marcin
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20100920/5159dfe8/attachment.html>


More information about the cfe-commits mailing list