summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEric Fiselier <eric@efcs.ca>2017-04-17 23:28:02 +0000
committerEric Fiselier <eric@efcs.ca>2017-04-17 23:28:02 +0000
commita9b3d0975af225794fbfb9349d271d67670a8d19 (patch)
treefe337c66aab1b096777ee60fc0d2a8a3494dc488
parent1781d6f732684fa4c1539082cd8f59c44720a377 (diff)
downloadbcm5719-llvm-a9b3d0975af225794fbfb9349d271d67670a8d19.tar.gz
bcm5719-llvm-a9b3d0975af225794fbfb9349d271d67670a8d19.zip
Rename coroutine warning when unhandled_exception() is missing
llvm-svn: 300513
-rw-r--r--clang/include/clang/Basic/DiagnosticGroups.td4
-rw-r--r--clang/include/clang/Basic/DiagnosticSemaKinds.td2
-rw-r--r--clang/test/CodeGenCoroutines/coro-alloc.cpp6
-rw-r--r--clang/test/SemaCXX/coroutine-unhandled_exception-warning.cpp15
4 files changed, 22 insertions, 5 deletions
diff --git a/clang/include/clang/Basic/DiagnosticGroups.td b/clang/include/clang/Basic/DiagnosticGroups.td
index 9f5f9888a81..4bcf3be0a8e 100644
--- a/clang/include/clang/Basic/DiagnosticGroups.td
+++ b/clang/include/clang/Basic/DiagnosticGroups.td
@@ -36,7 +36,9 @@ def GNUCompoundLiteralInitializer : DiagGroup<"gnu-compound-literal-initializer"
def BitFieldConstantConversion : DiagGroup<"bitfield-constant-conversion">;
def BitFieldEnumConversion : DiagGroup<"bitfield-enum-conversion">;
def BitFieldWidth : DiagGroup<"bitfield-width">;
-def Coroutine : DiagGroup<"coroutine">;
+def CoroutineMissingUnhandledException :
+ DiagGroup<"coroutine-missing-unhandled-exception">;
+def Coroutine : DiagGroup<"coroutine", [CoroutineMissingUnhandledException]>;
def ConstantConversion :
DiagGroup<"constant-conversion", [ BitFieldConstantConversion ] >;
def LiteralConversion : DiagGroup<"literal-conversion">;
diff --git a/clang/include/clang/Basic/DiagnosticSemaKinds.td b/clang/include/clang/Basic/DiagnosticSemaKinds.td
index 9b2cfe495ce..ab10a050ddc 100644
--- a/clang/include/clang/Basic/DiagnosticSemaKinds.td
+++ b/clang/include/clang/Basic/DiagnosticSemaKinds.td
@@ -8880,7 +8880,7 @@ def err_coroutine_promise_unhandled_exception_required : Error<
"%0 is required to declare the member 'unhandled_exception()'">;
def warn_coroutine_promise_unhandled_exception_required_with_exceptions : Warning<
"%0 is required to declare the member 'unhandled_exception()' when exceptions are enabled">,
- InGroup<Coroutine>;
+ InGroup<CoroutineMissingUnhandledException>;
def err_coroutine_promise_get_return_object_on_allocation_failure : Error<
"%0: 'get_return_object_on_allocation_failure()' must be a static member function">;
}
diff --git a/clang/test/CodeGenCoroutines/coro-alloc.cpp b/clang/test/CodeGenCoroutines/coro-alloc.cpp
index f0a600eabe9..7ff57faeafb 100644
--- a/clang/test/CodeGenCoroutines/coro-alloc.cpp
+++ b/clang/test/CodeGenCoroutines/coro-alloc.cpp
@@ -1,4 +1,6 @@
-// RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu -fcoroutines-ts -std=c++14 -emit-llvm %s -o - -disable-llvm-passes | FileCheck %s
+// RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu -fcoroutines-ts -std=c++14 \
+// RUN: -Wno-coroutine-missing-unhandled-exception -emit-llvm %s -o - -disable-llvm-passes \
+// RUN: | FileCheck %s
namespace std {
namespace experimental {
@@ -133,7 +135,7 @@ struct promise_on_alloc_failure_tag {};
template<>
struct std::experimental::coroutine_traits<int, promise_on_alloc_failure_tag> {
struct promise_type {
- int get_return_object() {}
+ int get_return_object() { return 0; }
suspend_always initial_suspend() { return {}; }
suspend_always final_suspend() { return {}; }
void return_void() {}
diff --git a/clang/test/SemaCXX/coroutine-unhandled_exception-warning.cpp b/clang/test/SemaCXX/coroutine-unhandled_exception-warning.cpp
index f98e00d1a70..d7f6066109a 100644
--- a/clang/test/SemaCXX/coroutine-unhandled_exception-warning.cpp
+++ b/clang/test/SemaCXX/coroutine-unhandled_exception-warning.cpp
@@ -1,4 +1,11 @@
-// RUN: %clang_cc1 -triple x86_64-apple-darwin9 %s -std=c++14 -fcoroutines-ts -fsyntax-only -Wignored-qualifiers -Wno-error=return-type -verify -fblocks -Wno-unreachable-code -Wno-unused-value
+// RUN: %clang_cc1 -triple x86_64-apple-darwin9 %s -std=c++14 -fcoroutines-ts \
+// RUN: -fsyntax-only -Wignored-qualifiers -Wno-error=return-type -verify \
+// RUN: -fblocks -Wno-unreachable-code -Wno-unused-value
+
+// RUN: %clang_cc1 -triple x86_64-apple-darwin9 %s -std=c++14 -fcoroutines-ts \
+// RUN: -fsyntax-only -Wignored-qualifiers -Wno-error=return-type -verify \
+// RUN: -fblocks -Wno-unreachable-code -Wno-unused-value \
+// RUN: -DDISABLE_WARNING -Wno-coroutine-missing-unhandled-exception
#if __has_feature(cxx_exceptions)
#error This test requires exceptions be disabled
@@ -19,6 +26,12 @@ struct promise_void {
template <typename... T>
struct std::experimental::coroutine_traits<void, T...> { using promise_type = promise_void; };
+#ifndef DISABLE_WARNING
void test0() { // expected-warning {{'promise_void' is required to declare the member 'unhandled_exception()' when exceptions are enabled}}
co_return;
}
+#else
+void test0() { // expected-no-diagnostics
+ co_return;
+}
+#endif
OpenPOWER on IntegriCloud