================ @@ -880,14 +898,12 @@ ExprResult Sema::BuildUnresolvedCoawaitExpr(SourceLocation Loc, Expr *Operand, } auto *RD = Promise->getType()->getAsCXXRecordDecl(); - bool AwaitElidable = - isCoroAwaitElidableCall(Operand) && - isAttributedCoroAwaitElidable( - getCurFunctionDecl(/*AllowLambda=*/true)->getReturnType()); - - if (AwaitElidable) - if (auto *Call = dyn_cast<CallExpr>(Operand->IgnoreImplicit())) - Call->setCoroElideSafe(); + + bool CurFnAwaitElidable = isAttributedCoroAwaitElidable( + getCurFunctionDecl(/*AllowLambda=*/true)->getReturnType()); ---------------- yuxuanchen1997 wrote:
This is not the piece of code that performs this check. See `applySafeElideContext`. But what you said is potentially a good point, we actually skipped checking two things: `operator co_await` on the callee return object, and the `await_transform`. As these operations may not be safe. The original intention was to make this a user's liability to ensure early caller destruction cannot happen in both customization points. It's not as granular as I'd like. With this patch, we are actually making it possible. `await_transform` and `operator co_await` here are just function calls whose arguments can be attributed with `[[clang::coro_must_await]]`. https://github.com/llvm/llvm-project/pull/108474 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits