[PATCH] D31460: [coroutines] Add cleanup for compiler injected objects/allocations in coroutine body

Gor Nishanov via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Mar 29 16:10:18 PDT 2017


GorNishanov added inline comments.


================
Comment at: lib/CodeGen/CGCoroutine.cpp:225
+  void Emit(CodeGenFunction &CGF, Flags) override {
+    CGF.EmitStmt(Deallocate);
+  }
----------------
rnk wrote:
> GorNishanov wrote:
> > rnk wrote:
> > > 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. :)
> > Thank you very much for the review!
> > Would switching the type of Deallocate from Stmt* to Expr* address this concern? 
> Not really, because gnu statement exprs mean Exprs can contain Decls as well. =(
Ahh. Okay, comment it is.


https://reviews.llvm.org/D31460





More information about the cfe-commits mailing list