- Use pushCleanup to emit freeing coroutine memory on normal and EH exits.
- Surround emitted code with CodeGenFunction::RunCleanupsScope.
Details
- Reviewers
EricWF rnk rsmith - Commits
- rG63b6df4f05f0: [coroutines] Add cleanup for compiler injected objects/allocations in coroutine…
rC299281: [coroutines] Add cleanup for compiler injected objects/allocations in coroutine…
rL299281: [coroutines] Add cleanup for compiler injected objects/allocations in coroutine…
Diff Detail
Event Timeline
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. :) |
lib/CodeGen/CGCoroutine.cpp | ||
---|---|---|
225 | Thank you very much for the review! |
lib/CodeGen/CGCoroutine.cpp | ||
---|---|---|
225 | Not really, because gnu statement exprs mean Exprs can contain Decls as well. =( |
lib/CodeGen/CGCoroutine.cpp | ||
---|---|---|
225 | Ahh. Okay, comment it is. |
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. :)