[clang] [llvm] [Clang] C++20 Coroutines: Introduce Frontend Attribute [[clang::coro_await_elidable]] (PR #99282)
Chuanqi Xu via llvm-commits
llvm-commits at lists.llvm.org
Tue Aug 6 23:58:41 PDT 2024
================
@@ -848,7 +862,21 @@ ExprResult Sema::BuildUnresolvedCoawaitExpr(SourceLocation Loc, Expr *Operand,
}
auto *RD = Promise->getType()->getAsCXXRecordDecl();
- auto *Transformed = Operand;
+ bool InplaceCall =
+ isCoroInplaceCall(Operand) &&
+ isAttributedCoroInplaceTask(
+ getCurFunctionDecl(/*AllowLambda=*/true)->getReturnType());
+
+ if (InplaceCall) {
+ if (auto *Temporary = dyn_cast<CXXBindTemporaryExpr>(Operand)) {
----------------
ChuanqiXu9 wrote:
This is not correct at least it didn't handle `MaterializeTemporaryExpr` and I believe there are other patterns. I always don't like such pattern matches in AST.
The ideal solution in my mind is to handle this in parser. But that may be a too big change.
Maybe what we can do here is:
```
if (auto *Call = dyn_cast<CallExpr>(Operand->IgnoreImplicit()))
Call->setCoroMustElide();
```
https://github.com/llvm/llvm-project/pull/99282
More information about the llvm-commits
mailing list