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

2018-04-26 Thread Akira Hatanaka via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes. Closed by commit rC331016: [CodeGen] Avoid destructing a callee-destructued struct type in a (authored by ahatanak, committed by ). Repository: rC Clang https://reviews.llvm.org/D45382 Files: lib/CodeGen/CGCall.cpp

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

2018-04-26 Thread John McCall via Phabricator via cfe-commits
rjmccall accepted this revision. rjmccall added a comment. This revision is now accepted and ready to land. Thanks, LGTM. Repository: rC Clang https://reviews.llvm.org/D45382 ___ cfe-commits mailing list cfe-commits@lists.llvm.org

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

2018-04-26 Thread Akira Hatanaka via Phabricator via cfe-commits
ahatanak updated this revision to Diff 144231. ahatanak marked an inline comment as done. ahatanak added a comment. Rename variable to something OldCleanupScopeDepth. Repository: rC Clang https://reviews.llvm.org/D45382 Files: lib/CodeGen/CGCall.cpp lib/CodeGen/CGCleanup.cpp

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

2018-04-23 Thread John McCall via Phabricator via cfe-commits
rjmccall added inline comments. Comment at: lib/CodeGen/CGCall.cpp:3069 + if (hasAggregateEvaluationKind(type) && + getContext().isParamDestroyedInCallee(type)) { +EHScopeStack::stable_iterator cleanup = ahatanak wrote: > rjmccall wrote: > > I wonder

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

2018-04-23 Thread Akira Hatanaka via Phabricator via cfe-commits
ahatanak added a comment. x. Comment at: lib/CodeGen/CGCall.cpp:3069 + if (hasAggregateEvaluationKind(type) && + getContext().isParamDestroyedInCallee(type)) { +EHScopeStack::stable_iterator cleanup = rjmccall wrote: > I wonder if this is something

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

2018-04-23 Thread Richard Smith - zygoloid via Phabricator via cfe-commits
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

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

2018-04-23 Thread John McCall via Phabricator via cfe-commits
rjmccall added inline comments. Comment at: lib/CodeGen/CGCall.cpp:3069 + if (hasAggregateEvaluationKind(type) && + getContext().isParamDestroyedInCallee(type)) { +EHScopeStack::stable_iterator cleanup = I wonder if this is something we should be

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

2018-04-23 Thread Akira Hatanaka via Phabricator via cfe-commits
ahatanak updated this revision to Diff 143624. ahatanak marked 2 inline comments as done. ahatanak added a comment. Address review comments. Repository: rC Clang https://reviews.llvm.org/D45382 Files: lib/CodeGen/CGCall.cpp lib/CodeGen/CGCleanup.cpp lib/CodeGen/CGDecl.cpp

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

2018-04-21 Thread John McCall via Phabricator via cfe-commits
rjmccall added inline comments. Herald added a reviewer: javed.absar. Comment at: lib/CodeGen/CodeGenFunction.h:847 +CurrentCleanupStackDepth = C; + } + You don't need (or want) these accessors, I think; this is just private state of the CGF object, and

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

2018-04-17 Thread Akira Hatanaka via Phabricator via cfe-commits
ahatanak updated this revision to Diff 142792. ahatanak added a comment. Deactivate the cleanups for callee-destructed parameters that are being forwarded to a delegated constructor. I also added a new member (CurrentCleanupStackDepth) to CodeGenFunction that tracks the stack depth of the most

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

2018-04-06 Thread John McCall via Phabricator via cfe-commits
rjmccall added a comment. If that's the problem, then I think the right design is for CallArg to include an optional cleanup reference for a cleanup that can be deactivated at the instant of the call (we should assert that this exists for parameters that are destroyed in the callee), and then

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

2018-04-06 Thread Akira Hatanaka via Phabricator via cfe-commits
ahatanak added a comment. 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

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

2018-04-06 Thread John McCall via Phabricator via cfe-commits
rjmccall added a comment. 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? Repository: rC Clang https://reviews.llvm.org/D45382

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

2018-04-06 Thread Akira Hatanaka via Phabricator via cfe-commits
ahatanak created this revision. ahatanak added reviewers: rjmccall, rsmith. Herald added a subscriber: kristof.beyls. This patch fixes a bug where a struct with an ObjC `__weak` field gets destructed after it has already been destructed. This bug was introduced in r328731, which made changes to