[coroutines][PR40978] Emit error for co_yield within catch block

Authored by modocache on Mar 15 2019, 1:25 PM.


[coroutines][PR40978] Emit error for co_yield within catch block

As reported in https://bugs.llvm.org/show_bug.cgi?id=40978, it's an
error to use the co_yield or co_await keywords outside of a valid
"suspension context" as defined by [expr.await]p2 of

Whether or not the current scope was in a function-try-block's
(https://en.cppreference.com/w/cpp/language/function-try-block) handler
could be determined using scope flag Scope::FnTryCatchScope. No
such flag existed for a simple C++ catch statement, so this commit adds

Reviewers: GorNishanov, tks2103, rsmith

Reviewed By: GorNishanov

Subscribers: EricWF, jdoerfert, cfe-commits, lewissbaker

Tags: #clang

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

llvm-svn: 356296