]> granicus.if.org Git - clang/commitdiff
[coroutines] Rename driver flag -fcoroutines to -fcoroutines-ts
authorGor Nishanov <GorNishanov@gmail.com>
Sun, 2 Oct 2016 03:31:58 +0000 (03:31 +0000)
committerGor Nishanov <GorNishanov@gmail.com>
Sun, 2 Oct 2016 03:31:58 +0000 (03:31 +0000)
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

15 files changed:
include/clang/Basic/LangOptions.def
include/clang/Driver/CC1Options.td
include/clang/Driver/Options.td
lib/Basic/IdentifierTable.cpp
lib/Driver/Tools.cpp
lib/Frontend/CompilerInvocation.cpp
lib/Frontend/InitPreprocessor.cpp
lib/Sema/SemaDecl.cpp
test/CodeGenCoroutines/microsoft-abi-operator-coawait.cpp
test/Driver/coroutines.c [new file with mode: 0644]
test/Driver/coroutines.cpp [new file with mode: 0644]
test/Lexer/coroutines.cpp
test/Lexer/cxx-features.cpp
test/Parser/cxx1z-coroutines.cpp
test/SemaCXX/coroutines.cpp

index aed11ffd39acd1f855cf650a61560e96a15b2746..e65811b361152bc12579c232f0011358e6589c17 100644 (file)
@@ -133,7 +133,7 @@ LANGOPT(Freestanding, 1, 0, "freestanding implementation")
 LANGOPT(NoBuiltin         , 1, 0, "disable builtin functions")
 LANGOPT(NoMathBuiltin     , 1, 0, "disable math builtin functions")
 LANGOPT(GNUAsm            , 1, 1, "GNU-style inline assembly")
-LANGOPT(Coroutines        , 1, 0, "C++ coroutines")
+LANGOPT(CoroutinesTS      , 1, 0, "C++ coroutines TS")
 
 BENIGN_LANGOPT(ThreadsafeStatics , 1, 1, "thread-safe static initializers")
 LANGOPT(POSIXThreads      , 1, 0, "POSIX thread support")
index 66e1ad6fc6e9889aa23a4b9fdb54c475685a7181..73ab5e68e93d853643618379344b535b643ba405 100644 (file)
@@ -638,10 +638,6 @@ def fdefault_calling_conv_EQ : Joined<["-"], "fdefault-calling-conv=">,
 def finclude_default_header : Flag<["-"], "finclude-default-header">,
   HelpText<"Include the default header file for OpenCL">;
 
-// C++ TSes.
-def fcoroutines : Flag<["-"], "fcoroutines">,
-  HelpText<"Enable support for the C++ Coroutines TS">;
-
 //===----------------------------------------------------------------------===//
 // Header Search Options
 //===----------------------------------------------------------------------===//
index f9390a971dacc7178784fe8993273eb69b17f880..80ec59461588894b3cc81b57ddbb249dee814665 100644 (file)
@@ -481,6 +481,13 @@ def fno_autolink : Flag <["-"], "fno-autolink">, Group<f_Group>,
   Flags<[DriverOption, CC1Option]>,
   HelpText<"Disable generation of linker directives for automatic library linking">;
 
+// C++ Coroutines TS
+def fcoroutines_ts : Flag <["-"], "fcoroutines-ts">, Group<f_Group>,
+  Flags<[DriverOption, CC1Option]>,
+  HelpText<"Enable support for the C++ Coroutines TS">;
+def fno_coroutines_ts : Flag <["-"], "fno-coroutines-ts">, Group<f_Group>,
+  Flags<[DriverOption]>;
+
 def fembed_bitcode_EQ : Joined<["-"], "fembed-bitcode=">,
     Group<f_Group>, Flags<[DriverOption, CC1Option]>, MetaVarName<"<option>">,
     HelpText<"Embed LLVM bitcode (option: off, all, bitcode, marker)">;
index 537a2b702d84e167f93e5fe8c78c21a3342fd06f..dcd1e8b8dca0e8b60b84659c77837ed5f6f4d248 100644 (file)
@@ -150,7 +150,7 @@ static KeywordStatus getKeywordStatus(const LangOptions &LangOpts,
   if (LangOpts.ObjC2 && (Flags & KEYARC)) return KS_Enabled;
   if (LangOpts.ObjC2 && (Flags & KEYOBJC2)) return KS_Enabled;
   if (LangOpts.ConceptsTS && (Flags & KEYCONCEPTS)) return KS_Enabled;
-  if (LangOpts.Coroutines && (Flags & KEYCOROUTINES)) return KS_Enabled;
+  if (LangOpts.CoroutinesTS && (Flags & KEYCOROUTINES)) return KS_Enabled;
   if (LangOpts.ModulesTS && (Flags & KEYMODULES)) return KS_Enabled;
   if (LangOpts.CPlusPlus && (Flags & KEYCXX11)) return KS_Future;
   return KS_Disabled;
index 97ffd2b4a8f7e61eae32a92358b2d42e380759d8..5138d7528d8f46eed004b75bd535fb1b3c99972b 100644 (file)
@@ -5416,6 +5416,12 @@ void Clang::ConstructJob(Compilation &C, const JobAction &JA,
       CmdArgs.push_back("-fblocks-runtime-optional");
   }
 
+  if (Args.hasFlag(options::OPT_fcoroutines_ts, options::OPT_fno_coroutines_ts,
+                   false) &&
+      types::isCXX(InputType)) {
+    CmdArgs.push_back("-fcoroutines-ts");
+  }
+
   // -fmodules enables the use of precompiled modules (off by default).
   // Users can pass -fno-cxx-modules to turn off modules support for
   // C++/Objective-C++ programs.
index 3406c324645e37a3d93556bde20a6362d7f349e9..0dd05b5d9a927c9f7e40113ccf7a755e1cb1e27d 100644 (file)
@@ -1916,7 +1916,7 @@ static void ParseLangArgs(LangOptions &Opts, ArgList &Args, InputKind IK,
   Opts.Blocks = Args.hasArg(OPT_fblocks) || (Opts.OpenCL
     && Opts.OpenCLVersion >= 200);
   Opts.BlocksRuntimeOptional = Args.hasArg(OPT_fblocks_runtime_optional);
-  Opts.Coroutines = Args.hasArg(OPT_fcoroutines);
+  Opts.CoroutinesTS = Args.hasArg(OPT_fcoroutines_ts);
   Opts.ModulesTS = Args.hasArg(OPT_fmodules_ts);
   Opts.Modules = Args.hasArg(OPT_fmodules) || Opts.ModulesTS;
   Opts.ModulesStrictDeclUse = Args.hasArg(OPT_fmodules_strict_decluse);
index d7dccb1340b29fa9eb3cd197405ac7781d5582d8..1c3374f1f45b9143312b8ac0025785e8b2c7ed6e 100644 (file)
@@ -526,7 +526,7 @@ static void InitializeCPlusPlusFeatureTestMacros(const LangOptions &LangOpts,
   // TS features.
   if (LangOpts.ConceptsTS)
     Builder.defineMacro("__cpp_experimental_concepts", "1");
-  if (LangOpts.Coroutines)
+  if (LangOpts.CoroutinesTS)
     Builder.defineMacro("__cpp_coroutines", "1");
 }
 
index cf3ea30bd2c4313261178ad2cff9f77efbb71c41..d85a612e0b70beb42f7803cc2e303ece15098351 100644 (file)
@@ -11602,7 +11602,7 @@ Decl *Sema::ActOnFinishFunctionBody(Decl *dcl, Stmt *Body,
   sema::AnalysisBasedWarnings::Policy WP = AnalysisWarnings.getDefaultPolicy();
   sema::AnalysisBasedWarnings::Policy *ActivePolicy = nullptr;
 
-  if (getLangOpts().Coroutines && !getCurFunction()->CoroutineStmts.empty())
+  if (getLangOpts().CoroutinesTS && !getCurFunction()->CoroutineStmts.empty())
     CheckCompletedCoroutineBody(FD, Body);
 
   if (FD) {
index e87fed09f19cea413f5847facf27a22b5220a9ac..1921c06e5af03ffc0e8e50970021511b5b38d3d4 100644 (file)
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -triple x86_64-pc-windows-msvc18.0.0 -fcoroutines -emit-llvm %s -o - -std=c++14 -disable-llvm-passes | FileCheck %s
+// 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
 struct no_suspend {
   bool await_ready() { return true; }
   template <typename F> void await_suspend(F) {}
diff --git a/test/Driver/coroutines.c b/test/Driver/coroutines.c
new file mode 100644 (file)
index 0000000..d610234
--- /dev/null
@@ -0,0 +1,6 @@
+// RUN: %clang -### %s 2>&1 | FileCheck -check-prefix=CHECK-NO-CORO %s
+// RUN: %clang -fcoroutines-ts -### %s 2>&1 | FileCheck -check-prefix=CHECK-NO-CORO %s
+// RUN: %clang -fno-coroutines-ts -### %s 2>&1 | FileCheck -check-prefix=CHECK-NO-CORO %s
+// RUN: %clang -fno-coroutines-ts -fcoroutines-ts -### %s 2>&1 | FileCheck -check-prefix=CHECK-NO-CORO %s
+// CHECK-NO-CORO-NOT: -fcoroutines-ts
+
diff --git a/test/Driver/coroutines.cpp b/test/Driver/coroutines.cpp
new file mode 100644 (file)
index 0000000..99e0ff5
--- /dev/null
@@ -0,0 +1,9 @@
+// RUN: %clang -### %s 2>&1 | FileCheck -check-prefix=CHECK-NO-CORO %s
+// RUN: %clang -fcoroutines-ts -fno-coroutines-ts -### %s 2>&1 | FileCheck -check-prefix=CHECK-NO-CORO %s
+// RUN: %clang -fno-coroutines-ts -### %s 2>&1 | FileCheck -check-prefix=CHECK-NO-CORO %s
+// CHECK-NO-CORO-NOT: -fcoroutines-ts
+
+// 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: -fcoroutines-ts
+
index 86d5f969374d62bf6bbf35e91d56793cca99a173..186c84b36ed6f7c033ee70bd19646838aebae710 100644 (file)
@@ -1,5 +1,5 @@
 // RUN: %clang_cc1 -fsyntax-only %s
-// RUN: %clang_cc1 -fcoroutines -DCORO -fsyntax-only %s
+// RUN: %clang_cc1 -fcoroutines-ts -DCORO -fsyntax-only %s
 
 #ifdef CORO
 #define CORO_KEYWORD(NAME) _Static_assert(!__is_identifier(NAME), #NAME)
index 5a4c45ddc1a9771388b1c25bbe5816e037b7704d..2f751acc81673387f69b324058b9026bb5fe6102 100644 (file)
@@ -5,7 +5,7 @@
 // RUN: %clang_cc1 -std=c++1z -fcxx-exceptions -fsized-deallocation -verify %s
 // RUN: %clang_cc1 -std=c++1z -fcxx-exceptions -fsized-deallocation -fconcepts-ts -DCONCEPTS_TS=1 -verify %s
 // RUN: %clang_cc1 -fno-rtti -verify %s -DNO_EXCEPTIONS -DNO_RTTI
-// RUN: %clang_cc1 -fcoroutines -DNO_EXCEPTIONS -DCOROUTINES -verify %s
+// RUN: %clang_cc1 -fcoroutines-ts -DNO_EXCEPTIONS -DCOROUTINES -verify %s
 
 // expected-no-diagnostics
 
index 3e698404a60037ec6977e96dbaa13c1524325ce7..68ef91c81727ebb5ce1b61d726c90583be99ecbd 100644 (file)
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -std=c++11 -fcoroutines %s -verify
+// RUN: %clang_cc1 -std=c++11 -fcoroutines-ts %s -verify
 
 template<typename T, typename U>
 U f(T t) {
index 92fdc7947442bdae225781d12db7e9f36af9457e..17bf5d0481925b5584c062a0cc3a5c0af0e20eb8 100644 (file)
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -std=c++14 -fcoroutines -verify %s
+// RUN: %clang_cc1 -std=c++14 -fcoroutines-ts -verify %s
 
 void no_coroutine_traits_bad_arg_await() {
   co_await a; // expected-error {{include <coroutine>}}