[PATCH] D82314: [RFC][Coroutines] Optimize the lifespan of temporary co_await object
JunMa via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Tue Jun 23 19:59:37 PDT 2020
junparser added a comment.
In D82314#2109437 <https://reviews.llvm.org/D82314#2109437>, @lxfind wrote:
> In D82314#2107910 <https://reviews.llvm.org/D82314#2107910>, @junparser wrote:
>
> > Rather than doing it here, can we build await_resume call expression with MaterializedTemporaryExpr when expand the coawait expression. That's how gcc does.
>
>
> There doesn't appear to be a way to do that in Clang. It goes from the AST to IR directly, and there needs to be a MaterializedTemporaryExpr to wrap the result of co_await. Could you elaborate on how this might be done in Clang?
For now, we only wrap coawait expression with MaterializedTemporaryExpr when the kind of result is VK_RValue, We can wrap await_resume call instead in such case when build coawait expression. so in emitSuspendExpression, we can directly emit await_call expression with MaterializedTemporaryExpr.
I think this should work, although i'm not so sure.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D82314/new/
https://reviews.llvm.org/D82314
More information about the cfe-commits
mailing list