[PATCH] D45382: [CodeGen] Avoid destructing a struct type that has already been destructed by a delegated constructor

Richard Smith - zygoloid via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Apr 23 13:53:21 PDT 2018


rsmith added a comment.

In https://reviews.llvm.org/D45382#1060452, @ahatanak wrote:

> In https://reviews.llvm.org/D45382#1060163, @rjmccall wrote:
>
> > Hmm.  I'm not actually sure *why* it's not okay to forward callee-cleanup arguments.  Do we just not have the necessary logic to disable the cleanup in the caller?
>
>
> It seems that it would be OK if there was a way to disable the cleanup in the caller when we know that we are delegating to another constructor, possibly by setting the DelegateCXXConstructorCall here too. But maybe there are other reasons for not doing so.
>
> Perhaps Richard (who committed r274049) knows why we can't call the delegated constructor when there are callee-cleanup arguments?


I think the only reason was that we didn't have a good way to handle cleanup emission in the thunk (as @rjmccall points out, we do need parameter cleanups in the thunk, but we need to disable them at the point of the call to the inherited constructor). I cannot think of any correctness reason that prevents using a thunk for the callee-cleanup case.


Repository:
  rC Clang

https://reviews.llvm.org/D45382





More information about the cfe-commits mailing list