[coroutines] Add feature-test macro for coroutines, defined to 1 to indicate

the implementation is incomplete.

llvm-svn: 250982
This commit is contained in:
Richard Smith 2015-10-22 04:27:47 +00:00
parent 76a2d615ad
commit 3fa73f3602
2 changed files with 7 additions and 0 deletions

View File

@ -456,6 +456,8 @@ static void InitializeCPlusPlusFeatureTestMacros(const LangOptions &LangOpts,
Builder.defineMacro("__cpp_sized_deallocation", "201309");
if (LangOpts.ConceptsTS)
Builder.defineMacro("__cpp_experimental_concepts", "1");
if (LangOpts.Coroutines)
Builder.defineMacro("__cpp_coroutines", "1");
}
static void InitializePredefinedMacros(const TargetInfo &TI,

View File

@ -2,6 +2,7 @@
// RUN: %clang_cc1 -std=c++11 -verify %s
// RUN: %clang_cc1 -std=c++1y -fsized-deallocation -verify %s
// RUN: %clang_cc1 -std=c++1y -fsized-deallocation -fconcepts-ts -DCONCEPTS_TS=1 -verify %s
// RUN: %clang_cc1 -fcoroutines -DCOROUTINES -verify %s
// expected-no-diagnostics
@ -128,3 +129,7 @@
#if check(experimental_concepts, 0, 0, CONCEPTS_TS)
#error "wrong value for __cpp_experimental_concepts"
#endif
#if (COROUTINES && !__cpp_coroutines) || (!COROUTINES && __cpp_coroutines)
#error "wrong value for __cpp_coroutines"
#endif