Changeset View
Changeset View
Standalone View
Standalone View
clang/lib/Sema/SemaCoroutine.cpp
Show First 20 Lines • Show All 871 Lines • ▼ Show 20 Lines | ExprResult Sema::BuildResolvedCoawaitExpr(SourceLocation Loc, Expr *E, | ||||
if (E->getType()->isDependentType()) { | if (E->getType()->isDependentType()) { | ||||
Expr *Res = new (Context) | Expr *Res = new (Context) | ||||
CoawaitExpr(Loc, Context.DependentTy, E, IsImplicit); | CoawaitExpr(Loc, Context.DependentTy, E, IsImplicit); | ||||
return Res; | return Res; | ||||
} | } | ||||
// If the expression is a temporary, materialize it as an lvalue so that we | // If the expression is a temporary, materialize it as an lvalue so that we | ||||
// can use it multiple times. | // can use it multiple times. | ||||
if (E->getValueKind() == VK_PRValue) | if (E->isPRValue()) | ||||
E = CreateMaterializeTemporaryExpr(E->getType(), E, true); | E = CreateMaterializeTemporaryExpr(E->getType(), E, true); | ||||
// The location of the `co_await` token cannot be used when constructing | // The location of the `co_await` token cannot be used when constructing | ||||
// the member call expressions since it's before the location of `Expr`, which | // the member call expressions since it's before the location of `Expr`, which | ||||
// is used as the start of the member call expression. | // is used as the start of the member call expression. | ||||
SourceLocation CallLoc = E->getExprLoc(); | SourceLocation CallLoc = E->getExprLoc(); | ||||
// Build the await_ready, await_suspend, await_resume calls. | // Build the await_ready, await_suspend, await_resume calls. | ||||
▲ Show 20 Lines • Show All 43 Lines • ▼ Show 20 Lines | ExprResult Sema::BuildCoyieldExpr(SourceLocation Loc, Expr *E) { | ||||
if (E->getType()->isDependentType()) { | if (E->getType()->isDependentType()) { | ||||
Expr *Res = new (Context) CoyieldExpr(Loc, Context.DependentTy, E); | Expr *Res = new (Context) CoyieldExpr(Loc, Context.DependentTy, E); | ||||
return Res; | return Res; | ||||
} | } | ||||
// If the expression is a temporary, materialize it as an lvalue so that we | // If the expression is a temporary, materialize it as an lvalue so that we | ||||
// can use it multiple times. | // can use it multiple times. | ||||
if (E->getValueKind() == VK_PRValue) | if (E->isPRValue()) | ||||
E = CreateMaterializeTemporaryExpr(E->getType(), E, true); | E = CreateMaterializeTemporaryExpr(E->getType(), E, true); | ||||
// Build the await_ready, await_suspend, await_resume calls. | // Build the await_ready, await_suspend, await_resume calls. | ||||
ReadySuspendResumeResult RSS = buildCoawaitCalls( | ReadySuspendResumeResult RSS = buildCoawaitCalls( | ||||
*this, Coroutine->CoroutinePromise, Loc, E); | *this, Coroutine->CoroutinePromise, Loc, E); | ||||
if (RSS.IsInvalid) | if (RSS.IsInvalid) | ||||
return ExprError(); | return ExprError(); | ||||
▲ Show 20 Lines • Show All 739 Lines • Show Last 20 Lines |