Skip to content

Commit 05da52c

Browse files
committed
[coroutines] Rename driver flag -fcoroutines to -fcoroutines-ts
Summary: Also makes -fcoroutines_ts to be both a Driver and CC1 flag. Patch mostly by EricWF. Reviewers: rnk, cfe-commits, rsmith, EricWF Subscribers: mehdi_amini Differential Revision: https://reviews.llvm.org/D25130 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@283064 91177308-0d34-0410-b5e6-96231b3b80d8
1 parent 2127f33 commit 05da52c

File tree

15 files changed

+38
-14
lines changed

15 files changed

+38
-14
lines changed

include/clang/Basic/LangOptions.def

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ LANGOPT(Freestanding, 1, 0, "freestanding implementation")
133133
LANGOPT(NoBuiltin , 1, 0, "disable builtin functions")
134134
LANGOPT(NoMathBuiltin , 1, 0, "disable math builtin functions")
135135
LANGOPT(GNUAsm , 1, 1, "GNU-style inline assembly")
136-
LANGOPT(Coroutines , 1, 0, "C++ coroutines")
136+
LANGOPT(CoroutinesTS , 1, 0, "C++ coroutines TS")
137137

138138
BENIGN_LANGOPT(ThreadsafeStatics , 1, 1, "thread-safe static initializers")
139139
LANGOPT(POSIXThreads , 1, 0, "POSIX thread support")

include/clang/Driver/CC1Options.td

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -638,10 +638,6 @@ def fdefault_calling_conv_EQ : Joined<["-"], "fdefault-calling-conv=">,
638638
def finclude_default_header : Flag<["-"], "finclude-default-header">,
639639
HelpText<"Include the default header file for OpenCL">;
640640

641-
// C++ TSes.
642-
def fcoroutines : Flag<["-"], "fcoroutines">,
643-
HelpText<"Enable support for the C++ Coroutines TS">;
644-
645641
//===----------------------------------------------------------------------===//
646642
// Header Search Options
647643
//===----------------------------------------------------------------------===//

include/clang/Driver/Options.td

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -481,6 +481,13 @@ def fno_autolink : Flag <["-"], "fno-autolink">, Group<f_Group>,
481481
Flags<[DriverOption, CC1Option]>,
482482
HelpText<"Disable generation of linker directives for automatic library linking">;
483483

484+
// C++ Coroutines TS
485+
def fcoroutines_ts : Flag <["-"], "fcoroutines-ts">, Group<f_Group>,
486+
Flags<[DriverOption, CC1Option]>,
487+
HelpText<"Enable support for the C++ Coroutines TS">;
488+
def fno_coroutines_ts : Flag <["-"], "fno-coroutines-ts">, Group<f_Group>,
489+
Flags<[DriverOption]>;
490+
484491
def fembed_bitcode_EQ : Joined<["-"], "fembed-bitcode=">,
485492
Group<f_Group>, Flags<[DriverOption, CC1Option]>, MetaVarName<"<option>">,
486493
HelpText<"Embed LLVM bitcode (option: off, all, bitcode, marker)">;

lib/Basic/IdentifierTable.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,7 @@ static KeywordStatus getKeywordStatus(const LangOptions &LangOpts,
150150
if (LangOpts.ObjC2 && (Flags & KEYARC)) return KS_Enabled;
151151
if (LangOpts.ObjC2 && (Flags & KEYOBJC2)) return KS_Enabled;
152152
if (LangOpts.ConceptsTS && (Flags & KEYCONCEPTS)) return KS_Enabled;
153-
if (LangOpts.Coroutines && (Flags & KEYCOROUTINES)) return KS_Enabled;
153+
if (LangOpts.CoroutinesTS && (Flags & KEYCOROUTINES)) return KS_Enabled;
154154
if (LangOpts.ModulesTS && (Flags & KEYMODULES)) return KS_Enabled;
155155
if (LangOpts.CPlusPlus && (Flags & KEYCXX11)) return KS_Future;
156156
return KS_Disabled;

lib/Driver/Tools.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5416,6 +5416,12 @@ void Clang::ConstructJob(Compilation &C, const JobAction &JA,
54165416
CmdArgs.push_back("-fblocks-runtime-optional");
54175417
}
54185418

5419+
if (Args.hasFlag(options::OPT_fcoroutines_ts, options::OPT_fno_coroutines_ts,
5420+
false) &&
5421+
types::isCXX(InputType)) {
5422+
CmdArgs.push_back("-fcoroutines-ts");
5423+
}
5424+
54195425
// -fmodules enables the use of precompiled modules (off by default).
54205426
// Users can pass -fno-cxx-modules to turn off modules support for
54215427
// C++/Objective-C++ programs.

lib/Frontend/CompilerInvocation.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1916,7 +1916,7 @@ static void ParseLangArgs(LangOptions &Opts, ArgList &Args, InputKind IK,
19161916
Opts.Blocks = Args.hasArg(OPT_fblocks) || (Opts.OpenCL
19171917
&& Opts.OpenCLVersion >= 200);
19181918
Opts.BlocksRuntimeOptional = Args.hasArg(OPT_fblocks_runtime_optional);
1919-
Opts.Coroutines = Args.hasArg(OPT_fcoroutines);
1919+
Opts.CoroutinesTS = Args.hasArg(OPT_fcoroutines_ts);
19201920
Opts.ModulesTS = Args.hasArg(OPT_fmodules_ts);
19211921
Opts.Modules = Args.hasArg(OPT_fmodules) || Opts.ModulesTS;
19221922
Opts.ModulesStrictDeclUse = Args.hasArg(OPT_fmodules_strict_decluse);

lib/Frontend/InitPreprocessor.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -526,7 +526,7 @@ static void InitializeCPlusPlusFeatureTestMacros(const LangOptions &LangOpts,
526526
// TS features.
527527
if (LangOpts.ConceptsTS)
528528
Builder.defineMacro("__cpp_experimental_concepts", "1");
529-
if (LangOpts.Coroutines)
529+
if (LangOpts.CoroutinesTS)
530530
Builder.defineMacro("__cpp_coroutines", "1");
531531
}
532532

lib/Sema/SemaDecl.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11602,7 +11602,7 @@ Decl *Sema::ActOnFinishFunctionBody(Decl *dcl, Stmt *Body,
1160211602
sema::AnalysisBasedWarnings::Policy WP = AnalysisWarnings.getDefaultPolicy();
1160311603
sema::AnalysisBasedWarnings::Policy *ActivePolicy = nullptr;
1160411604

11605-
if (getLangOpts().Coroutines && !getCurFunction()->CoroutineStmts.empty())
11605+
if (getLangOpts().CoroutinesTS && !getCurFunction()->CoroutineStmts.empty())
1160611606
CheckCompletedCoroutineBody(FD, Body);
1160711607

1160811608
if (FD) {

test/CodeGenCoroutines/microsoft-abi-operator-coawait.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// RUN: %clang_cc1 -triple x86_64-pc-windows-msvc18.0.0 -fcoroutines -emit-llvm %s -o - -std=c++14 -disable-llvm-passes | FileCheck %s
1+
// RUN: %clang_cc1 -triple x86_64-pc-windows-msvc18.0.0 -fcoroutines-ts -emit-llvm %s -o - -std=c++14 -disable-llvm-passes | FileCheck %s
22
struct no_suspend {
33
bool await_ready() { return true; }
44
template <typename F> void await_suspend(F) {}

test/Driver/coroutines.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
// RUN: %clang -### %s 2>&1 | FileCheck -check-prefix=CHECK-NO-CORO %s
2+
// RUN: %clang -fcoroutines-ts -### %s 2>&1 | FileCheck -check-prefix=CHECK-NO-CORO %s
3+
// RUN: %clang -fno-coroutines-ts -### %s 2>&1 | FileCheck -check-prefix=CHECK-NO-CORO %s
4+
// RUN: %clang -fno-coroutines-ts -fcoroutines-ts -### %s 2>&1 | FileCheck -check-prefix=CHECK-NO-CORO %s
5+
// CHECK-NO-CORO-NOT: -fcoroutines-ts
6+

0 commit comments

Comments
 (0)