|
@@ -234,6 +234,13 @@ RValue CodeGenFunction::EmitCoyieldExpr(const CoyieldExpr &E,
|
|
|
|
|
|
void CodeGenFunction::EmitCoreturnStmt(CoreturnStmt const &S) {
|
|
void CodeGenFunction::EmitCoreturnStmt(CoreturnStmt const &S) {
|
|
++CurCoro.Data->CoreturnCount;
|
|
++CurCoro.Data->CoreturnCount;
|
|
|
|
+ const Expr *RV = S.getOperand();
|
|
|
|
+ if (RV && RV->getType()->isVoidType()) {
|
|
|
|
+ // Make sure to evaluate the expression of a co_return with a void
|
|
|
|
+ // expression for side effects.
|
|
|
|
+ RunCleanupsScope cleanupScope(*this);
|
|
|
|
+ EmitIgnoredExpr(RV);
|
|
|
|
+ }
|
|
EmitStmt(S.getPromiseCall());
|
|
EmitStmt(S.getPromiseCall());
|
|
EmitBranchThroughCleanup(CurCoro.Data->FinalJD);
|
|
EmitBranchThroughCleanup(CurCoro.Data->FinalJD);
|
|
}
|
|
}
|