[PATCH] D141572: [C++] [Coroutines] Deprecates the '-fcoroutines-ts' flag

Chuanqi Xu via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Jan 12 00:29:43 PST 2023


ChuanqiXu created this revision.
ChuanqiXu added reviewers: aaron.ballman, ldionne.
ChuanqiXu added a project: clang-language-wg.
Herald added a project: All.
ChuanqiXu requested review of this revision.
Herald added subscribers: cfe-commits, MaskRay.
Herald added a project: clang.

According to the discussion of https://github.com/llvm/llvm-project/issues/59110, we should deprecate the use of `-fcoroutines-ts` in LLVM16 and remove it in LLVM17.

I've tested this with libcxx and it is fine since we disabled all the warnings for the test of <experimental/coroutine>. See https://github.com/llvm/llvm-project/blob/cefa5cefdce2d5090002c3116403f7e5ca5700b9/libcxx/test/std/experimental/language.support/support.coroutines/lit.local.cfg#L7-L8


Repository:
  rG LLVM Github Monorepo

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


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 LLVM17; use C++20 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
@@ -6449,6 +6449,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
@@ -627,6 +627,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 LLVM17; "
+  "use C++20 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 @@
 -----------------------
 - Clang now permits specifying ``--config=`` multiple times, to load multiple
   configuration files.
+- Clang now deprecates the ``-fcoroutines-ts`` flag and the flag will be
+  removed in LLVM17. Please use C++20 Coroutines instead.
 
 Removed Compiler Flags
 -------------------------


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D141572.488504.patch
Type: text/x-patch
Size: 2243 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20230112/76d8dc13/attachment.bin>


More information about the cfe-commits mailing list