[cfe-commits] [patch] Bug 5077

Dimitri Tcaciuc dtcaciuc at gmail.com
Thu Oct 8 23:54:59 PDT 2009


The attached is the proposed fix and test case for 5077.

I've discussed it for some time on IRC and it seems this is not a
perfect solution, however at this point I'm a bit stumped to find an
alternative and I figured I would get more results with mail list
discussions. The train of thought is the following:

 * Member initializers can accept one or more expressions which can
emit temporaries that need to be cleaned up.
   * Assuming expressions are correctly generated and use
EmitCXXExprWithTemporaries, can we assume that there can only be one
leftover temporary per argument?
 * The temporary needs to persist until after member constructor call.
 * CXXBaseOrMemberInitializer is not an Expr and cannot be wrapped
with EmitCXXExprWithTemporaries
 * (?) There should be no meaningful temporaries left after member
initializer completes.

Thus, we can do the same thing as in EmitCXXExprWithTemporaries , that
is perform a check right after member constructor completes and any
new live temporaries still kicking around are safe to dispose of.

Started nibbling on clang only a relatively short time ago, so
comments and guidance are much appreciated!

Cheers,


Dimitri.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 5077.0.patch
Type: application/octet-stream
Size: 2010 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20091008/642e6e38/attachment.obj>


More information about the cfe-commits mailing list