[clang] [Clang] CGCoroutines skip emitting try block for value returning `noexcept` init `await_resume` calls (PR #73160)
Chuanqi Xu via cfe-commits
cfe-commits at lists.llvm.org
Mon Nov 27 18:16:00 PST 2023
================
@@ -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();
+ }
----------------
ChuanqiXu9 wrote:
Maybe it is not a such big task as you imaged, you can take a look at `Sema::checkFinalSuspendNoThrow` and we should be able to make a simpler change than that.
The reason why I don't like the current pattern is that, every time I wrote:
```
if (auto *WantedExpressionType = isa<AExpreType>(E))
E = WantedExpressionType->subExpr();
...
```
I found I always missed some situations.
https://github.com/llvm/llvm-project/pull/73160
More information about the cfe-commits
mailing list