[clang] [Clang] Coroutines: Properly Check if `await_suspend` return type is a `std::coroutine_handle` (PR #85684)

Chuanqi Xu via cfe-commits cfe-commits at lists.llvm.org
Fri Mar 22 17:26:09 PDT 2024


================
@@ -358,6 +364,30 @@ static Expr *maybeTailCall(Sema &S, QualType RetType, Expr *E,
   return S.MaybeCreateExprWithCleanups(JustAddress);
 }
 
+static bool isSpecializationOfCoroutineHandle(Sema &S, QualType Ty,
+                                              SourceLocation Loc) {
+  auto *CoroutineHandleClassTemplateDecl =
+      lookupCoroutineHandleTemplate(S, Loc);
----------------
ChuanqiXu9 wrote:

Maybe it can be better to cache the coroutine handle declaration to avoid redundant looking up. But it may be fine for the number of `await_suspend` in practical.

We can send another patch for this if we want.

https://github.com/llvm/llvm-project/pull/85684


More information about the cfe-commits mailing list