ChuanqiXu updated this revision to Diff 489665.
ChuanqiXu added a comment.

Address comments and refine the wording from "use `-std=c++20`" to "use 
`-std=c++20` or higher".


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D141572/new/

https://reviews.llvm.org/D141572

Files:
  clang/docs/ReleaseNotes.rst
  clang/include/clang/Basic/DiagnosticDriverKinds.td
  clang/lib/Driver/ToolChains/Clang.cpp
  clang/test/Driver/coroutines.cpp
  libcxx/test/libcxx/assertions/headers_declare_verbose_abort.sh.cpp
  libcxx/test/libcxx/clang_tidy.sh.cpp
  libcxx/test/libcxx/double_include.sh.cpp
  libcxx/test/libcxx/min_max_macros.compile.pass.cpp
  libcxx/test/libcxx/modules_include.sh.cpp
  libcxx/test/libcxx/nasty_macros.compile.pass.cpp
  libcxx/test/libcxx/no_assert_include.compile.pass.cpp
  libcxx/utils/generate_header_tests.py

Index: libcxx/utils/generate_header_tests.py
===================================================================
--- libcxx/utils/generate_header_tests.py
+++ libcxx/utils/generate_header_tests.py
@@ -19,6 +19,9 @@
 
     "filesystem": "!defined(_LIBCPP_HAS_NO_FILESYSTEM_LIBRARY)",
 
+    # TODO LLVM17: simplify this to __cplusplus >= 202002L
+    "coroutine": "(defined(__cpp_impl_coroutine) && __cpp_impl_coroutine >= 201902L) || (defined(__cpp_coroutines) && __cpp_coroutines >= 201703L)",
+
     "clocale": "!defined(_LIBCPP_HAS_NO_LOCALIZATION)",
     "codecvt": "!defined(_LIBCPP_HAS_NO_LOCALIZATION)",
     "fstream": "!defined(_LIBCPP_HAS_NO_LOCALIZATION) && !defined(_LIBCPP_HAS_NO_FSTREAM)",
Index: libcxx/test/libcxx/no_assert_include.compile.pass.cpp
===================================================================
--- libcxx/test/libcxx/no_assert_include.compile.pass.cpp
+++ libcxx/test/libcxx/no_assert_include.compile.pass.cpp
@@ -66,7 +66,9 @@
 #include <complex.h>
 #include <concepts>
 #include <condition_variable>
-#include <coroutine>
+#if (defined(__cpp_impl_coroutine) && __cpp_impl_coroutine >= 201902L) || (defined(__cpp_coroutines) && __cpp_coroutines >= 201703L)
+#   include <coroutine>
+#endif
 #include <csetjmp>
 #include <csignal>
 #include <cstdarg>
Index: libcxx/test/libcxx/nasty_macros.compile.pass.cpp
===================================================================
--- libcxx/test/libcxx/nasty_macros.compile.pass.cpp
+++ libcxx/test/libcxx/nasty_macros.compile.pass.cpp
@@ -193,7 +193,9 @@
 #include <complex.h>
 #include <concepts>
 #include <condition_variable>
-#include <coroutine>
+#if (defined(__cpp_impl_coroutine) && __cpp_impl_coroutine >= 201902L) || (defined(__cpp_coroutines) && __cpp_coroutines >= 201703L)
+#   include <coroutine>
+#endif
 #include <csetjmp>
 #include <csignal>
 #include <cstdarg>
Index: libcxx/test/libcxx/modules_include.sh.cpp
===================================================================
--- libcxx/test/libcxx/modules_include.sh.cpp
+++ libcxx/test/libcxx/modules_include.sh.cpp
@@ -154,7 +154,7 @@
 #include <condition_variable>
 #endif
 // RUN: %{cxx} %s %{flags} %{compile_flags} -fmodules -fcxx-modules -fmodules-cache-path=%t -fsyntax-only -DTEST_26
-#if defined(TEST_26)
+#if defined(TEST_26) && (defined(__cpp_impl_coroutine) && __cpp_impl_coroutine >= 201902L) || (defined(__cpp_coroutines) && __cpp_coroutines >= 201703L)
 #include <coroutine>
 #endif
 // RUN: %{cxx} %s %{flags} %{compile_flags} -fmodules -fcxx-modules -fmodules-cache-path=%t -fsyntax-only -DTEST_27
Index: libcxx/test/libcxx/min_max_macros.compile.pass.cpp
===================================================================
--- libcxx/test/libcxx/min_max_macros.compile.pass.cpp
+++ libcxx/test/libcxx/min_max_macros.compile.pass.cpp
@@ -95,8 +95,10 @@
 TEST_MACROS();
 #include <condition_variable>
 TEST_MACROS();
-#include <coroutine>
+#if (defined(__cpp_impl_coroutine) && __cpp_impl_coroutine >= 201902L) || (defined(__cpp_coroutines) && __cpp_coroutines >= 201703L)
+#   include <coroutine>
 TEST_MACROS();
+#endif
 #include <csetjmp>
 TEST_MACROS();
 #include <csignal>
Index: libcxx/test/libcxx/double_include.sh.cpp
===================================================================
--- libcxx/test/libcxx/double_include.sh.cpp
+++ libcxx/test/libcxx/double_include.sh.cpp
@@ -69,7 +69,9 @@
 #include <complex.h>
 #include <concepts>
 #include <condition_variable>
-#include <coroutine>
+#if (defined(__cpp_impl_coroutine) && __cpp_impl_coroutine >= 201902L) || (defined(__cpp_coroutines) && __cpp_coroutines >= 201703L)
+#   include <coroutine>
+#endif
 #include <csetjmp>
 #include <csignal>
 #include <cstdarg>
Index: libcxx/test/libcxx/clang_tidy.sh.cpp
===================================================================
--- libcxx/test/libcxx/clang_tidy.sh.cpp
+++ libcxx/test/libcxx/clang_tidy.sh.cpp
@@ -68,7 +68,9 @@
 #include <complex.h>
 #include <concepts>
 #include <condition_variable>
-#include <coroutine>
+#if (defined(__cpp_impl_coroutine) && __cpp_impl_coroutine >= 201902L) || (defined(__cpp_coroutines) && __cpp_coroutines >= 201703L)
+#   include <coroutine>
+#endif
 #include <csetjmp>
 #include <csignal>
 #include <cstdarg>
Index: libcxx/test/libcxx/assertions/headers_declare_verbose_abort.sh.cpp
===================================================================
--- libcxx/test/libcxx/assertions/headers_declare_verbose_abort.sh.cpp
+++ libcxx/test/libcxx/assertions/headers_declare_verbose_abort.sh.cpp
@@ -199,7 +199,7 @@
 #endif
 
 // RUN: %{build} -DTEST_26
-#if defined(TEST_26)
+#if defined(TEST_26) && (defined(__cpp_impl_coroutine) && __cpp_impl_coroutine >= 201902L) || (defined(__cpp_coroutines) && __cpp_coroutines >= 201703L)
 #   include <coroutine>
     using HandlerType = decltype(std::__libcpp_verbose_abort);
 #endif
Index: clang/test/Driver/coroutines.cpp
===================================================================
--- clang/test/Driver/coroutines.cpp
+++ clang/test/Driver/coroutines.cpp
@@ -5,5 +5,6 @@
 
 // RUN: %clang -fcoroutines-ts -### %s 2>&1 | FileCheck -check-prefix=CHECK-HAS-CORO  %s
 // RUN: %clang -fno-coroutines-ts -fcoroutines-ts -### %s 2>&1 | FileCheck -check-prefix=CHECK-HAS-CORO %s
+// CHECK-HAS-CORO: the '-fcoroutines-ts' flag is deprecated and it will be removed in Clang 17; use '-std=c++20' or higher to use standard C++ coroutines instead
 // CHECK-HAS-CORO: -fcoroutines-ts
 
Index: clang/lib/Driver/ToolChains/Clang.cpp
===================================================================
--- clang/lib/Driver/ToolChains/Clang.cpp
+++ clang/lib/Driver/ToolChains/Clang.cpp
@@ -6453,6 +6453,7 @@
   if (Args.hasFlag(options::OPT_fcoroutines_ts, options::OPT_fno_coroutines_ts,
                    false) &&
       types::isCXX(InputType)) {
+    D.Diag(diag::warn_deperecated_fcoroutines_ts_flag);
     CmdArgs.push_back("-fcoroutines-ts");
   }
 
Index: clang/include/clang/Basic/DiagnosticDriverKinds.td
===================================================================
--- clang/include/clang/Basic/DiagnosticDriverKinds.td
+++ clang/include/clang/Basic/DiagnosticDriverKinds.td
@@ -630,6 +630,11 @@
   "command line to use the libc++ standard library instead">,
   InGroup<DiagGroup<"stdlibcxx-not-found">>;
 
+def warn_deperecated_fcoroutines_ts_flag : Warning<
+  "the '-fcoroutines-ts' flag is deprecated and it will be removed in Clang 17; "
+  "use '-std=c++20' or higher to use standard C++ coroutines instead">,
+  InGroup<DeprecatedExperimentalCoroutine>;
+
 def err_drv_cannot_mix_options : Error<"cannot specify '%1' along with '%0'">;
 
 def err_drv_invalid_object_mode : Error<
Index: clang/docs/ReleaseNotes.rst
===================================================================
--- clang/docs/ReleaseNotes.rst
+++ clang/docs/ReleaseNotes.rst
@@ -543,6 +543,8 @@
   has been deprecated. The flag will be removed in Clang 18.
   ``-ftrivial-auto-var-init=zero`` is now available unconditionally, to be
   compatible with GCC.
+- ``-fcoroutines-ts`` has been deprecated. The flag will be removed in Clang 17.
+  Please use ``-std=c++20`` or higher to use standard C++ coroutines instead.
 
 Modified Compiler Flags
 -----------------------
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to