forked from OSchip/llvm-project
[coroutines] Add lexer support for co_await, co_yield, and co_return keywords.
Add -fcoroutines flag (just for -cc1 for now) to enable the feature. Early indications are that this will be part of -std=c++1z. llvm-svn: 250980
This commit is contained in:
parent
9c077cf33d
commit
eb7927ee8f
|
@ -118,6 +118,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 TS")
|
||||
|
||||
BENIGN_LANGOPT(ThreadsafeStatics , 1, 1, "thread-safe static initializers")
|
||||
LANGOPT(POSIXThreads , 1, 0, "POSIX thread support")
|
||||
|
|
|
@ -242,6 +242,8 @@ PUNCTUATOR(greatergreatergreater, ">>>")
|
|||
// 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
|
||||
// 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
|
||||
|
@ -356,6 +358,11 @@ 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)
|
||||
|
||||
// GNU Extensions (in impl-reserved namespace)
|
||||
KEYWORD(_Decimal32 , KEYALL)
|
||||
KEYWORD(_Decimal64 , KEYALL)
|
||||
|
|
|
@ -580,6 +580,10 @@ def fnative_half_type: Flag<["-"], "fnative-half-type">,
|
|||
def fallow_half_arguments_and_returns : Flag<["-"], "fallow-half-arguments-and-returns">,
|
||||
HelpText<"Allow function arguments and returns of type half">;
|
||||
|
||||
// C++ TSes.
|
||||
def fcoroutines : Flag<["-"], "fcoroutines">,
|
||||
HelpText<"Enable support for the C++ Coroutines TS">;
|
||||
|
||||
//===----------------------------------------------------------------------===//
|
||||
// Header Search Options
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
|
|
@ -111,7 +111,8 @@ namespace {
|
|||
KEYCONCEPTS = 0x10000,
|
||||
KEYOBJC2 = 0x20000,
|
||||
KEYZVECTOR = 0x40000,
|
||||
KEYALL = (0x7ffff & ~KEYNOMS18 &
|
||||
KEYCOROUTINES = 0x80000,
|
||||
KEYALL = (0xfffff & ~KEYNOMS18 &
|
||||
~KEYNOOPENCL) // KEYNOMS18 and KEYNOOPENCL are used to exclude.
|
||||
};
|
||||
|
||||
|
@ -147,6 +148,7 @@ static KeywordStatus getKeywordStatus(const LangOptions &LangOpts,
|
|||
if (LangOpts.ObjC2 && (Flags & KEYARC)) return KS_Enabled;
|
||||
if (LangOpts.ConceptsTS && (Flags & KEYCONCEPTS)) return KS_Enabled;
|
||||
if (LangOpts.ObjC2 && (Flags & KEYOBJC2)) return KS_Enabled;
|
||||
if (LangOpts.Coroutines && (Flags & KEYCOROUTINES)) return KS_Enabled;
|
||||
if (LangOpts.CPlusPlus && (Flags & KEYCXX11)) return KS_Future;
|
||||
return KS_Disabled;
|
||||
}
|
||||
|
|
|
@ -1536,6 +1536,7 @@ static void ParseLangArgs(LangOptions &Opts, ArgList &Args, InputKind IK,
|
|||
Opts.RTTIData = Opts.RTTI && !Args.hasArg(OPT_fno_rtti_data);
|
||||
Opts.Blocks = Args.hasArg(OPT_fblocks);
|
||||
Opts.BlocksRuntimeOptional = Args.hasArg(OPT_fblocks_runtime_optional);
|
||||
Opts.Coroutines = Args.hasArg(OPT_fcoroutines);
|
||||
Opts.Modules = Args.hasArg(OPT_fmodules);
|
||||
Opts.ModulesStrictDeclUse = Args.hasArg(OPT_fmodules_strict_decluse);
|
||||
Opts.ModulesDeclUse =
|
||||
|
|
Loading…
Reference in New Issue