]> granicus.if.org Git - clang/commit
[coroutines] Fix diagnostics depending on the first coroutine statement.
authorEric Fiselier <eric@efcs.ca>
Sat, 11 Mar 2017 02:35:37 +0000 (02:35 +0000)
committerEric Fiselier <eric@efcs.ca>
Sat, 11 Mar 2017 02:35:37 +0000 (02:35 +0000)
commit43671d3c8322d05e28baaeccef3a3477ec1c8897
treee40203f8294dcd8a33e1c6f4d405463857d78063
parent2a9eb8c15bcc95cf9bc956954ae88d59145f9690
[coroutines] Fix diagnostics depending on the first coroutine statement.

Summary:
Some coroutine diagnostics need to point to the location of the first coroutine keyword in the function, like when diagnosing a `return` inside a coroutine. Previously we did this by storing each *valid* coroutine statement in a list and select the first one to use in diagnostics. However if every coroutine statement is invalid we would have no location to point to.

This patch fixes the storage of the first coroutine statement location, ensuring that it gets stored even when the resulting AST node would be invalid.
This patch also removes the `CoroutineStmts` list in `FunctionScopeInfo` because it was unused.

Reviewers: rsmith, GorNishanov, aaron.ballman

Reviewed By: GorNishanov

Subscribers: mehdi_amini, cfe-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@297547 91177308-0d34-0410-b5e6-96231b3b80d8
include/clang/Sema/ScopeInfo.h
lib/Sema/ScopeInfo.cpp
lib/Sema/SemaCoroutine.cpp
lib/Sema/TreeTransform.h
test/SemaCXX/coroutines.cpp