[PATCH] D121141: [Clang] Add `-funstable` flag to enable unstable and experimental features: follow-up fixes

Egor Zhdan via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Mar 7 11:36:01 PST 2022


egorzhdan created this revision.
Herald added a subscriber: dang.
Herald added a project: All.
egorzhdan requested review of this revision.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.

This is a follow-up for https://reviews.llvm.org/D120160 that addresses some of the post-merge feedback.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D121141

Files:
  clang/docs/ClangCommandLineReference.rst
  clang/include/clang/Driver/Options.td
  clang/lib/Driver/ToolChain.cpp
  clang/lib/Driver/ToolChains/Clang.cpp
  clang/test/Driver/unstable-flag.cpp


Index: clang/test/Driver/unstable-flag.cpp
===================================================================
--- clang/test/Driver/unstable-flag.cpp
+++ clang/test/Driver/unstable-flag.cpp
@@ -1,5 +1,4 @@
 // RUN: %clang -funstable -### %s 2>&1 | FileCheck %s
 
 // CHECK: -funstable
-// CHECK: -fcoroutines-ts
 // CHECK: -fmodules-ts
Index: clang/lib/Driver/ToolChains/Clang.cpp
===================================================================
--- clang/lib/Driver/ToolChains/Clang.cpp
+++ clang/lib/Driver/ToolChains/Clang.cpp
@@ -5766,8 +5766,6 @@
 
   if (Args.hasArg(options::OPT_funstable)) {
     CmdArgs.push_back("-funstable");
-    if (!Args.hasArg(options::OPT_fno_coroutines_ts))
-      CmdArgs.push_back("-fcoroutines-ts");
     CmdArgs.push_back("-fmodules-ts");
   }
 
Index: clang/lib/Driver/ToolChain.cpp
===================================================================
--- clang/lib/Driver/ToolChain.cpp
+++ clang/lib/Driver/ToolChain.cpp
@@ -966,6 +966,8 @@
   switch (Type) {
   case ToolChain::CST_Libcxx:
     CmdArgs.push_back("-lc++");
+    if (Args.hasArg(options::OPT_funstable))
+      CmdArgs.push_back("-lc++experimental");
     break;
 
   case ToolChain::CST_Libstdcxx:
Index: clang/include/clang/Driver/Options.td
===================================================================
--- clang/include/clang/Driver/Options.td
+++ clang/include/clang/Driver/Options.td
@@ -1162,7 +1162,10 @@
 
 defm unstable : BoolFOption<"unstable",
   LangOpts<"Unstable">, DefaultFalse,
-  PosFlag<SetTrue, [CC1Option, CoreOption], "Enable unstable and experimental features">,
+  PosFlag<SetTrue, [CC1Option, CoreOption], "Enable unstable and experimental language and library features. "
+          "This option enables various language and library features that are either experimental (also known as TSes),"
+          " or have been standardized but are not stable yet. This option should not be used in production code, since "
+          "neither ABI nor API stability are guaranteed">,
   NegFlag<SetFalse>>;
 
 def fembed_offload_object_EQ : Joined<["-"], "fembed-offload-object=">,
Index: clang/docs/ClangCommandLineReference.rst
===================================================================
--- clang/docs/ClangCommandLineReference.rst
+++ clang/docs/ClangCommandLineReference.rst
@@ -271,6 +271,12 @@
 
 Build this module as a system module. Only used with -emit-module
 
+.. option:: -funstable
+
+Enable unstable and experimental language and library features.
+
+This option enables various language and library features that are either experimental (also known as TSes), or have been standardized but are not stable yet. This option should not be used in production code, since neither ABI nor API stability are guaranteed.
+
 .. option:: -fuse-cuid=<arg>
 
 Method to generate ID's for compilation units for single source offloading languages CUDA and HIP: 'hash' (ID's generated by hashing file path and command line options) \| 'random' (ID's generated as random numbers) \| 'none' (disabled). Default is 'hash'. This option will be overridden by option '-cuid=\[ID\]' if it is specified.


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D121141.413572.patch
Type: text/x-patch
Size: 3138 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20220307/38cf88af/attachment-0001.bin>


More information about the cfe-commits mailing list