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

Richard Smith via cfe-commits cfe-commits at lists.llvm.org
Wed Oct 21 21:27:47 PDT 2015


Author: rsmith
Date: Wed Oct 21 23:27:47 2015
New Revision: 250982

URL: http://llvm.org/viewvc/llvm-project?rev=250982&view=rev
Log:
[coroutines] Add feature-test macro for coroutines, defined to 1 to indicate
the implementation is incomplete.

Modified:
    cfe/trunk/lib/Frontend/InitPreprocessor.cpp
    cfe/trunk/test/Lexer/cxx-features.cpp

Modified: cfe/trunk/lib/Frontend/InitPreprocessor.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Frontend/InitPreprocessor.cpp?rev=250982&r1=250981&r2=250982&view=diff
==============================================================================
--- cfe/trunk/lib/Frontend/InitPreprocessor.cpp (original)
+++ cfe/trunk/lib/Frontend/InitPreprocessor.cpp Wed Oct 21 23:27:47 2015
@@ -456,6 +456,8 @@ static void InitializeCPlusPlusFeatureTe
     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,

Modified: cfe/trunk/test/Lexer/cxx-features.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Lexer/cxx-features.cpp?rev=250982&r1=250981&r2=250982&view=diff
==============================================================================
--- cfe/trunk/test/Lexer/cxx-features.cpp (original)
+++ cfe/trunk/test/Lexer/cxx-features.cpp Wed Oct 21 23:27:47 2015
@@ -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




More information about the cfe-commits mailing list