r354736 - Enable coroutines under -std=c++2a.
Richard Smith via cfe-commits
cfe-commits at lists.llvm.org
Sat Feb 23 13:06:26 PST 2019
Author: rsmith
Date: Sat Feb 23 13:06:26 2019
New Revision: 354736
URL: http://llvm.org/viewvc/llvm-project?rev=354736&view=rev
Log:
Enable coroutines under -std=c++2a.
Modified:
cfe/trunk/include/clang/Basic/LangOptions.def
cfe/trunk/include/clang/Basic/TokenKinds.def
cfe/trunk/lib/Basic/IdentifierTable.cpp
cfe/trunk/lib/Basic/Module.cpp
cfe/trunk/lib/CodeGen/BackendUtil.cpp
cfe/trunk/lib/Frontend/CompilerInvocation.cpp
cfe/trunk/lib/Frontend/InitPreprocessor.cpp
cfe/trunk/lib/Sema/SemaDecl.cpp
cfe/trunk/test/Lexer/cxx-features.cpp
cfe/trunk/test/Lexer/cxx2a_keyword_as_cxx17.cpp
cfe/trunk/www/cxx_status.html
Modified: cfe/trunk/include/clang/Basic/LangOptions.def
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/LangOptions.def?rev=354736&r1=354735&r2=354736&view=diff
==============================================================================
--- cfe/trunk/include/clang/Basic/LangOptions.def (original)
+++ cfe/trunk/include/clang/Basic/LangOptions.def Sat Feb 23 13:06:26 2019
@@ -136,7 +136,7 @@ LANGOPT(Freestanding, 1, 0, "freestandin
LANGOPT(NoBuiltin , 1, 0, "disable builtin functions")
LANGOPT(NoMathBuiltin , 1, 0, "disable math builtin functions")
LANGOPT(GNUAsm , 1, 1, "GNU-style inline assembly")
-LANGOPT(CoroutinesTS , 1, 0, "C++ coroutines TS")
+LANGOPT(Coroutines , 1, 0, "C++20 coroutines")
LANGOPT(DllExportInlines , 1, 1, "dllexported classes dllexport inline methods")
LANGOPT(RelaxedTemplateTemplateArgs, 1, 0, "C++17 relaxed matching of template template arguments")
Modified: cfe/trunk/include/clang/Basic/TokenKinds.def
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/TokenKinds.def?rev=354736&r1=354735&r2=354736&view=diff
==============================================================================
--- cfe/trunk/include/clang/Basic/TokenKinds.def (original)
+++ cfe/trunk/include/clang/Basic/TokenKinds.def Sat Feb 23 13:06:26 2019
@@ -32,6 +32,9 @@
#ifndef CONCEPTS_KEYWORD
#define CONCEPTS_KEYWORD(X) CXX2A_KEYWORD(X,KEYCONCEPTS)
#endif
+#ifndef COROUTINES_KEYWORD
+#define COROUTINES_KEYWORD(X) CXX2A_KEYWORD(X,KEYCOROUTINES)
+#endif
#ifndef MODULES_KEYWORD
#define MODULES_KEYWORD(X) KEYWORD(X,KEYMODULES)
#endif
@@ -254,8 +257,7 @@ PUNCTUATOR(caretcaret, "^^")
// KEYZVECTOR - This is a keyword for the System z vector extensions,
// which are heavily based on AltiVec
// KEYBORLAND - This is a keyword if Borland extensions are enabled
-// KEYCOROUTINES - This is a keyword if support for the C++ coroutines
-// TS is enabled
+// KEYCOROUTINES - This is a keyword if support for C++ coroutines is enabled
// BOOLSUPPORT - This is a keyword if 'bool' is a built-in type
// HALFSUPPORT - This is a keyword if 'half' is a built-in type
// WCHARSUPPORT - This is a keyword if 'wchar_t' is a built-in type
@@ -371,17 +373,17 @@ CXX11_KEYWORD(thread_local , 0)
CONCEPTS_KEYWORD(concept)
CONCEPTS_KEYWORD(requires)
-// C++ coroutines TS keywords
-KEYWORD(co_await , KEYCOROUTINES)
-KEYWORD(co_return , KEYCOROUTINES)
-KEYWORD(co_yield , KEYCOROUTINES)
+// C++2a / coroutines TS keywords
+COROUTINES_KEYWORD(co_await)
+COROUTINES_KEYWORD(co_return)
+COROUTINES_KEYWORD(co_yield)
// C++ modules TS keywords
MODULES_KEYWORD(module)
MODULES_KEYWORD(import)
// C++ char8_t proposal
-KEYWORD(char8_t , CHAR8SUPPORT)
+CXX2A_KEYWORD(char8_t , CHAR8SUPPORT)
// C11 Extension
KEYWORD(_Float16 , KEYALL)
Modified: cfe/trunk/lib/Basic/IdentifierTable.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Basic/IdentifierTable.cpp?rev=354736&r1=354735&r2=354736&view=diff
==============================================================================
--- cfe/trunk/lib/Basic/IdentifierTable.cpp (original)
+++ cfe/trunk/lib/Basic/IdentifierTable.cpp Sat Feb 23 13:06:26 2019
@@ -143,7 +143,7 @@ static KeywordStatus getKeywordStatus(co
// in non-arc mode.
if (LangOpts.ObjC && (Flags & KEYOBJC)) return KS_Enabled;
if (LangOpts.ConceptsTS && (Flags & KEYCONCEPTS)) return KS_Enabled;
- if (LangOpts.CoroutinesTS && (Flags & KEYCOROUTINES)) return KS_Enabled;
+ if (LangOpts.Coroutines && (Flags & KEYCOROUTINES)) return KS_Enabled;
if (LangOpts.ModulesTS && (Flags & KEYMODULES)) return KS_Enabled;
if (LangOpts.CPlusPlus && (Flags & KEYALLCXX)) return KS_Future;
return KS_Disabled;
Modified: cfe/trunk/lib/Basic/Module.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Basic/Module.cpp?rev=354736&r1=354735&r2=354736&view=diff
==============================================================================
--- cfe/trunk/lib/Basic/Module.cpp (original)
+++ cfe/trunk/lib/Basic/Module.cpp Sat Feb 23 13:06:26 2019
@@ -108,7 +108,7 @@ static bool hasFeature(StringRef Feature
bool HasFeature = llvm::StringSwitch<bool>(Feature)
.Case("altivec", LangOpts.AltiVec)
.Case("blocks", LangOpts.Blocks)
- .Case("coroutines", LangOpts.CoroutinesTS)
+ .Case("coroutines", LangOpts.Coroutines)
.Case("cplusplus", LangOpts.CPlusPlus)
.Case("cplusplus11", LangOpts.CPlusPlus11)
.Case("cplusplus14", LangOpts.CPlusPlus14)
Modified: cfe/trunk/lib/CodeGen/BackendUtil.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/BackendUtil.cpp?rev=354736&r1=354735&r2=354736&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/BackendUtil.cpp (original)
+++ cfe/trunk/lib/CodeGen/BackendUtil.cpp Sat Feb 23 13:06:26 2019
@@ -581,7 +581,7 @@ void EmitAssemblyHelper::CreatePasses(le
addObjCARCOptPass);
}
- if (LangOpts.CoroutinesTS)
+ if (LangOpts.Coroutines)
addCoroutinePassesToExtensionPoints(PMBuilder);
if (LangOpts.Sanitize.has(SanitizerKind::LocalBounds)) {
Modified: cfe/trunk/lib/Frontend/CompilerInvocation.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Frontend/CompilerInvocation.cpp?rev=354736&r1=354735&r2=354736&view=diff
==============================================================================
--- cfe/trunk/lib/Frontend/CompilerInvocation.cpp (original)
+++ cfe/trunk/lib/Frontend/CompilerInvocation.cpp Sat Feb 23 13:06:26 2019
@@ -2577,7 +2577,7 @@ static void ParseLangArgs(LangOptions &O
Opts.Blocks = Args.hasArg(OPT_fblocks) || (Opts.OpenCL
&& Opts.OpenCLVersion == 200);
Opts.BlocksRuntimeOptional = Args.hasArg(OPT_fblocks_runtime_optional);
- Opts.CoroutinesTS = Args.hasArg(OPT_fcoroutines_ts);
+ Opts.Coroutines = Opts.CPlusPlus2a || Args.hasArg(OPT_fcoroutines_ts);
// Enable [[]] attributes in C++11 by default.
Opts.DoubleSquareBracketAttributes =
Modified: cfe/trunk/lib/Frontend/InitPreprocessor.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Frontend/InitPreprocessor.cpp?rev=354736&r1=354735&r2=354736&view=diff
==============================================================================
--- cfe/trunk/lib/Frontend/InitPreprocessor.cpp (original)
+++ cfe/trunk/lib/Frontend/InitPreprocessor.cpp Sat Feb 23 13:06:26 2019
@@ -547,7 +547,7 @@ static void InitializeCPlusPlusFeatureTe
// TS features.
if (LangOpts.ConceptsTS)
Builder.defineMacro("__cpp_experimental_concepts", "1L");
- if (LangOpts.CoroutinesTS)
+ if (LangOpts.Coroutines)
Builder.defineMacro("__cpp_coroutines", "201703L");
}
Modified: cfe/trunk/lib/Sema/SemaDecl.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaDecl.cpp?rev=354736&r1=354735&r2=354736&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaDecl.cpp (original)
+++ cfe/trunk/lib/Sema/SemaDecl.cpp Sat Feb 23 13:06:26 2019
@@ -13116,7 +13116,7 @@ Decl *Sema::ActOnFinishFunctionBody(Decl
sema::AnalysisBasedWarnings::Policy WP = AnalysisWarnings.getDefaultPolicy();
sema::AnalysisBasedWarnings::Policy *ActivePolicy = nullptr;
- if (getLangOpts().CoroutinesTS && getCurFunction()->isCoroutine())
+ if (getLangOpts().Coroutines && getCurFunction()->isCoroutine())
CheckCompletedCoroutineBody(FD, Body);
// Do not call PopExpressionEvaluationContext() if it is a lambda because one
Modified: cfe/trunk/test/Lexer/cxx-features.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Lexer/cxx-features.cpp?rev=354736&r1=354735&r2=354736&view=diff
==============================================================================
--- cfe/trunk/test/Lexer/cxx-features.cpp (original)
+++ cfe/trunk/test/Lexer/cxx-features.cpp Sat Feb 23 13:06:26 2019
@@ -271,6 +271,6 @@
#error "wrong value for __cpp_experimental_concepts"
#endif
-#if defined(COROUTINES) ? check(coroutines, 201703L, 201703L, 201703L, 201703L, 201703L) : check(coroutines, 0, 0, 0, 0, 0)
+#if defined(COROUTINES) ? check(coroutines, 201703L, 201703L, 201703L, 201703L, 201703L) : check(coroutines, 0, 0, 0, 0, 201703L)
#error "wrong value for __cpp_coroutines"
#endif
Modified: cfe/trunk/test/Lexer/cxx2a_keyword_as_cxx17.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Lexer/cxx2a_keyword_as_cxx17.cpp?rev=354736&r1=354735&r2=354736&view=diff
==============================================================================
--- cfe/trunk/test/Lexer/cxx2a_keyword_as_cxx17.cpp (original)
+++ cfe/trunk/test/Lexer/cxx2a_keyword_as_cxx17.cpp Sat Feb 23 13:06:26 2019
@@ -5,5 +5,9 @@ template<typename T>
concept x = 0;
#undef concept
+int co_await = 0; // expected-warning {{'co_await' is a keyword in C++2a}}
+int co_return = 0; // expected-warning {{'co_return' is a keyword in C++2a}}
+int co_yield = 0; // expected-warning {{'co_yield' is a keyword in C++2a}}
+int char8_t = 0; // expected-warning {{'char8_t' is a keyword in C++2a}}
int concept = 0; // expected-warning {{'concept' is a keyword in C++2a}}
int requires = 0; // expected-warning {{'requires' is a keyword in C++2a}}
Modified: cfe/trunk/www/cxx_status.html
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/www/cxx_status.html?rev=354736&r1=354735&r2=354736&view=diff
==============================================================================
--- cfe/trunk/www/cxx_status.html (original)
+++ cfe/trunk/www/cxx_status.html Sat Feb 23 13:06:26 2019
@@ -1060,7 +1060,7 @@ as the draft C++2a standard evolves.
<tr>
<td>Coroutines</td>
<td><a href="http://wg21.link/p0912r5">P0912R5</a></td>
- <td class="partial" align="center">Partial (<tt>-fcoroutines-ts</tt>)</td>
+ <td class="partial" align="center">Partial</td>
</tr>
</table>
More information about the cfe-commits
mailing list