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

Marcin Świderski marcin.sfider at gmail.com
Sun Sep 19 11:48:49 PDT 2010


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/20100919/70e8c0ab/attachment.html>


More information about the cfe-commits mailing list