]> granicus.if.org Git - clang/commitdiff
[coroutines] Add feature-test macro for coroutines, defined to 1 to indicate
authorRichard Smith <richard-llvm@metafoo.co.uk>
Thu, 22 Oct 2015 04:27:47 +0000 (04:27 +0000)
committerRichard Smith <richard-llvm@metafoo.co.uk>
Thu, 22 Oct 2015 04:27:47 +0000 (04:27 +0000)
the implementation is incomplete.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@250982 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Frontend/InitPreprocessor.cpp
test/Lexer/cxx-features.cpp

index 0b445e8b65c173d108f1b0e5f7ba492874c2ed04..dc075793ac805881094e222df2fd5409d05d62c1 100644 (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,
index 4ec4d55ac08882fed0e67e81c103c7cfb63efe18..6c4a092b1c48fe0ccce66bee92097573ffcef67a 100644 (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
 
 #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