[coroutines] Fix invalid source range in co_await call expressions.
authorEric Fiselier <eric@efcs.ca>
Tue, 27 Mar 2018 03:15:46 +0000 (03:15 +0000)
committerEric Fiselier <eric@efcs.ca>
Tue, 27 Mar 2018 03:15:46 +0000 (03:15 +0000)
commitd2e30d34b943470025ebcf0fe18f8925c2aac012
tree37655517eb4396449d0aa13e0ae4e304f194851c
parentbc0d3b4e0fe5081b54751c4561f388cb857d5a72
[coroutines] Fix invalid source range in co_await call expressions.

Summary:
Currently an invalid source range is generated for the member call expressions of `co_await`. The end location of the call expression is the `co_await` token loc, while the start is the location of the operand. This causes crashes when the source range is used to produce diagnostics.

This patch fixes the issues by using the expression location instead of the token location when building the member calls.

Reviewers: GorNishanov, rsmith, vsk, aaron.ballman

Reviewed By: vsk

Subscribers: cfe-commits, modocache

Differential Revision: https://reviews.llvm.org/D44915

llvm-svn: 328606
clang/lib/Sema/SemaCoroutine.cpp
clang/test/SemaCXX/coroutine-source-location-crash.cpp [new file with mode: 0644]