This is an archive of the discontinued LLVM Phabricator instance.

[coroutines] Add cleanup for compiler injected objects/allocations in coroutine body
ClosedPublic

Authored by GorNishanov on Mar 29 2017, 7:08 AM.

Diff Detail

Event Timeline

GorNishanov created this revision.Mar 29 2017, 7:08 AM
rnk accepted this revision.Mar 29 2017, 1:41 PM

lgtm

lib/CodeGen/CGCoroutine.cpp
225

This will be called twice: once for a normal exit and once for exceptional exit. In general, double emitting a Stmt* is not safe, since it might contain a VarDecl or a LabelDecl, but this usage is safe because SubStmtBuilder::makeNewAndDeleteExpr() builds two calls that can't declare anything. That is *definitely* worth a comment. :)

This revision is now accepted and ready to land.Mar 29 2017, 1:41 PM
GorNishanov added inline comments.Mar 29 2017, 3:46 PM
lib/CodeGen/CGCoroutine.cpp
225

Thank you very much for the review!
Would switching the type of Deallocate from Stmt* to Expr* address this concern?

rnk added inline comments.Mar 29 2017, 3:47 PM
lib/CodeGen/CGCoroutine.cpp
225

Not really, because gnu statement exprs mean Exprs can contain Decls as well. =(

GorNishanov added inline comments.Mar 29 2017, 4:10 PM
lib/CodeGen/CGCoroutine.cpp
225

Ahh. Okay, comment it is.

This revision was automatically updated to reflect the committed changes.