diff options
Diffstat (limited to 'clang/lib/Sema/SemaCoroutine.cpp')
-rw-r--r-- | clang/lib/Sema/SemaCoroutine.cpp | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/clang/lib/Sema/SemaCoroutine.cpp b/clang/lib/Sema/SemaCoroutine.cpp index e4cb4cf059f..95758baff4a 100644 --- a/clang/lib/Sema/SemaCoroutine.cpp +++ b/clang/lib/Sema/SemaCoroutine.cpp @@ -708,9 +708,14 @@ ExprResult Sema::BuildResolvedCoawaitExpr(SourceLocation Loc, Expr *E, if (E->getValueKind() == VK_RValue) E = CreateMaterializeTemporaryExpr(E->getType(), E, true); + // 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 + // is used as the start of the member call expression. + SourceLocation CallLoc = E->getExprLoc(); + // Build the await_ready, await_suspend, await_resume calls. ReadySuspendResumeResult RSS = - buildCoawaitCalls(*this, Coroutine->CoroutinePromise, Loc, E); + buildCoawaitCalls(*this, Coroutine->CoroutinePromise, CallLoc, E); if (RSS.IsInvalid) return ExprError(); |