[coroutines] Diagnose invalid result types for `await_resume` and `await_suspend...
authorEric Fiselier <eric@efcs.ca>
Sun, 28 May 2017 18:21:12 +0000 (18:21 +0000)
committerEric Fiselier <eric@efcs.ca>
Sun, 28 May 2017 18:21:12 +0000 (18:21 +0000)
commitd978e53c6d70822e3a668623bb2a3630d5a51cc2
treea3c3f30bf5d17316b8785bc9c5d7e9684ca9a0b0
parent5a4ec2146154276f9497936cd82b620c47e1c739
[coroutines] Diagnose invalid result  types for `await_resume` and `await_suspend` and add missing conversions.

Summary:
The expression `await_ready` is required to be contextually convertible to bool and `await_suspend` must be a prvalue of either `void` or `bool`.
This patch adds diagnostics for when those requirements are violated.

It also correctly performs the contextual conversion to bool on the result of `await_ready`

Reviewers: GorNishanov, rsmith

Reviewed By: GorNishanov

Subscribers: cfe-commits

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

llvm-svn: 304094
clang/include/clang/Basic/DiagnosticSemaKinds.td
clang/lib/Sema/SemaCoroutine.cpp
clang/test/SemaCXX/coroutines.cpp