[PATCH] D33481: [coroutines] Improved diagnostics when unhandled_exception is missing in the promise_type

Gor Nishanov via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed May 24 07:34:31 PDT 2017


This revision was automatically updated to reflect the committed changes.
Closed by commit rL303752: [coroutines] Improved diagnostics when unhandled_exception is missing in theā€¦ (authored by GorNishanov).

Changed prior to commit:
  https://reviews.llvm.org/D33481?vs=100037&id=100086#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D33481

Files:
  cfe/trunk/lib/Sema/SemaCoroutine.cpp
  cfe/trunk/test/SemaCXX/coroutine-unhandled_exception-warning.cpp
  cfe/trunk/test/SemaCXX/coroutines.cpp


Index: cfe/trunk/test/SemaCXX/coroutines.cpp
===================================================================
--- cfe/trunk/test/SemaCXX/coroutines.cpp
+++ cfe/trunk/test/SemaCXX/coroutines.cpp
@@ -540,7 +540,7 @@
 }
 template coro<bad_promise_6> bad_implicit_return_dependent(bad_promise_6); // expected-note {{in instantiation}}
 
-struct bad_promise_7 {
+struct bad_promise_7 { // expected-note 2 {{defined here}}
   coro<bad_promise_7> get_return_object();
   suspend_always initial_suspend();
   suspend_always final_suspend();
Index: cfe/trunk/test/SemaCXX/coroutine-unhandled_exception-warning.cpp
===================================================================
--- cfe/trunk/test/SemaCXX/coroutine-unhandled_exception-warning.cpp
+++ cfe/trunk/test/SemaCXX/coroutine-unhandled_exception-warning.cpp
@@ -16,7 +16,11 @@
 using std::experimental::suspend_always;
 using std::experimental::suspend_never;
 
+#ifndef DISABLE_WARNING
+struct promise_void { // expected-note {{defined here}}
+#else
 struct promise_void {
+#endif
   void get_return_object();
   suspend_always initial_suspend();
   suspend_always final_suspend();
Index: cfe/trunk/lib/Sema/SemaCoroutine.cpp
===================================================================
--- cfe/trunk/lib/Sema/SemaCoroutine.cpp
+++ cfe/trunk/lib/Sema/SemaCoroutine.cpp
@@ -120,8 +120,7 @@
   return PromiseType;
 }
 
-/// Look up the std::coroutine_traits<...>::promise_type for the given
-/// function type.
+/// Look up the std::experimental::coroutine_handle<PromiseType>.
 static QualType lookupCoroutineHandleType(Sema &S, QualType PromiseType,
                                           SourceLocation Loc) {
   if (PromiseType.isNull())
@@ -729,8 +728,7 @@
   }
 
   if (isa<CoroutineBodyStmt>(Body)) {
-    // FIXME(EricWF): Nothing todo. the body is already a transformed coroutine
-    // body statement.
+    // Nothing todo. the body is already a transformed coroutine body statement.
     return;
   }
 
@@ -1030,6 +1028,8 @@
             : diag::
                   warn_coroutine_promise_unhandled_exception_required_with_exceptions;
     S.Diag(Loc, DiagID) << PromiseRecordDecl;
+    S.Diag(PromiseRecordDecl->getLocation(), diag::note_defined_here)
+        << PromiseRecordDecl;
     return !RequireUnhandledException;
   }
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D33481.100086.patch
Type: text/x-patch
Size: 2309 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20170524/adb31501/attachment-0001.bin>


More information about the cfe-commits mailing list