================
@@ -129,7 +130,14 @@ static SmallString<32> buildSuspendPrefixStr(CGCoroData 
&Coro, AwaitKind Kind) {
   return Prefix;
 }
 
-static bool memberCallExpressionCanThrow(const Expr *E) {
+static bool ResumeExprCanThrow(const CoroutineSuspendExpr &S) {
+  const Expr *E = S.getResumeExpr();
+
+  // If the return type of await_resume is not void, get the CXXMemberCallExpr
+  // from its subexpr.
+  if (const auto *BindTempExpr = dyn_cast<CXXBindTemporaryExpr>(E)) {
+    E = BindTempExpr->getSubExpr();
+  }
----------------
yuxuanchen1997 wrote:

I find this a little overkill for what we need. The old code here didn't intend 
to handle more cases either because it just expected the AST to be in a 
specific shape (`CXXMemberCallExpr`). This fix is merely just to amend its 
functionality to work on a temporary expression as well should there be a 
return value to be discarded. It should be clear intent here that we don't care 
about anything else. (Ideally, I want an assertion here that it's either of the 
two `Expr` types)

https://github.com/llvm/llvm-project/pull/73160
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to