[clang] [Clang] Propagate elide safe context through [[clang::coro_must_await]] (PR #108474)
Yuxuan Chen via cfe-commits
cfe-commits at lists.llvm.org
Mon Sep 16 11:03:39 PDT 2024
================
@@ -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:
> So after this patch, we could actually check await_transform and also operator co_await and thereby get rid of the CurFnAwaitElidable check?
No, not yet. I am just saying that we can potentially check the entire expression built here including the `CallerType::await_transform` and `CalleeType::operator co_await` part. Right now we are just checking the immediate operand before any transformation customization points.
https://github.com/llvm/llvm-project/pull/108474
More information about the cfe-commits
mailing list