================
@@ -59,10 +63,31 @@ class ConditionalEvaluationFinder
return true;
}
- // Don't cross evaluation-context boundaries.
- bool TraverseLambdaExpr(LambdaExpr *) { return true; }
+ // Don't cross evaluation-context boundaries. Only the initializers of a
+ // lambda's captures are part of the enclosing full-expression.
+ bool TraverseLambdaExpr(LambdaExpr *e) {
+ for (Expr *init : e->capture_inits())
+ if (init && !TraverseStmt(init))
+ return false;
+ return true;
+ }
bool TraverseBlockExpr(BlockExpr *) { return true; }
bool TraverseStmtExpr(StmtExpr *) { return true; }
+
+ // Skip over the implicit call to await_resume(). This requires cleanup
+ // scopes for await full-expressions which don't exist yet.
+ bool TraverseCoawaitExpr(CoawaitExpr *e) {
+ assert(!cir::MissingFeatures::coroAwaitFullExprCleanups());
+ return TraverseStmt(e->getOperand());
+ }
+ bool TraverseDependentCoawaitExpr(DependentCoawaitExpr *e) {
+ assert(!cir::MissingFeatures::coroAwaitFullExprCleanups());
----------------
mmha wrote:
Basically the missing thing is creating the cleanups for temporaries in default
arguments (like `void await_resume(T x = T{})`) in the right place, which we
don't do yet. We need to create an EH-only scope around the `await_resume` call
and defer pushing the cleanups until after the `cir.await` using
`CapturedCleanups` (which doesn't handle the conditional ones yet).
And then there's also conditional cleanups which need to have their cleanup
scope opened after `cir.await` instead of inside the `resume` region.
https://github.com/llvm/llvm-project/pull/229829
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits