diff --git a/clang/docs/ClangCommandLineReference.rst b/clang/docs/ClangCommandLineReference.rst --- a/clang/docs/ClangCommandLineReference.rst +++ b/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= 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. diff --git a/clang/include/clang/Driver/Options.td b/clang/include/clang/Driver/Options.td --- a/clang/include/clang/Driver/Options.td +++ b/clang/include/clang/Driver/Options.td @@ -1162,7 +1162,10 @@ defm unstable : BoolFOption<"unstable", LangOpts<"Unstable">, DefaultFalse, - PosFlag, + PosFlag, NegFlag>; def fembed_offload_object_EQ : Joined<["-"], "fembed-offload-object=">, diff --git a/clang/lib/Driver/ToolChain.cpp b/clang/lib/Driver/ToolChain.cpp --- a/clang/lib/Driver/ToolChain.cpp +++ b/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: diff --git a/clang/lib/Driver/ToolChains/Clang.cpp b/clang/lib/Driver/ToolChains/Clang.cpp --- a/clang/lib/Driver/ToolChains/Clang.cpp +++ b/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"); } diff --git a/clang/test/Driver/unstable-flag.cpp b/clang/test/Driver/unstable-flag.cpp --- a/clang/test/Driver/unstable-flag.cpp +++ b/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