@@ -141,7 +141,7 @@ static bool FunctionCanThrow(const FunctionDecl *D) {
141
141
Proto->canThrow () != CT_Cannot;
142
142
}
143
143
144
- static bool ResumeStmtCanThrow (const Stmt *S) {
144
+ static bool StmtCanThrow (const Stmt *S) {
145
145
if (const auto *CE = dyn_cast<CallExpr>(S)) {
146
146
const auto *Callee = CE->getDirectCallee ();
147
147
if (!Callee)
@@ -167,16 +167,12 @@ static bool ResumeStmtCanThrow(const Stmt *S) {
167
167
}
168
168
169
169
for (const auto *child : S->children ())
170
- if (ResumeStmtCanThrow (child))
170
+ if (StmtCanThrow (child))
171
171
return true ;
172
172
173
173
return false ;
174
174
}
175
175
176
- static bool AwaitSuspendStmtCanThrow (const Stmt *S) {
177
- return ResumeStmtCanThrow (S);
178
- }
179
-
180
176
// Emit suspend expression which roughly looks like:
181
177
//
182
178
// auto && x = CommonExpr();
@@ -282,8 +278,7 @@ static LValueOrRValue emitSuspendExpression(CodeGenFunction &CGF, CGCoroData &Co
282
278
283
279
llvm::Function *AwaitSuspendIntrinsic = CGF.CGM .getIntrinsic (AwaitSuspendIID);
284
280
285
- const auto AwaitSuspendCanThrow =
286
- AwaitSuspendStmtCanThrow (S.getSuspendExpr ());
281
+ const auto AwaitSuspendCanThrow = StmtCanThrow (S.getSuspendExpr ());
287
282
288
283
llvm::CallBase *SuspendRet = nullptr ;
289
284
// FIXME: add call attributes?
@@ -343,7 +338,7 @@ static LValueOrRValue emitSuspendExpression(CodeGenFunction &CGF, CGCoroData &Co
343
338
// is marked as 'noexcept', we avoid generating this additional IR.
344
339
CXXTryStmt *TryStmt = nullptr ;
345
340
if (Coro.ExceptionHandler && Kind == AwaitKind::Init &&
346
- ResumeStmtCanThrow (S.getResumeExpr ())) {
341
+ StmtCanThrow (S.getResumeExpr ())) {
347
342
Coro.ResumeEHVar =
348
343
CGF.CreateTempAlloca (Builder.getInt1Ty (), Prefix + Twine (" resume.eh" ));
349
344
Builder.CreateFlagStore (true , Coro.ResumeEHVar );
0 commit comments