r282652 - Mark P0127R3 as done, and replace its __has_feature check with the corresponding SD-6 macro.

Richard Smith via cfe-commits cfe-commits at lists.llvm.org
Wed Sep 28 17:08:05 PDT 2016


Author: rsmith
Date: Wed Sep 28 19:08:05 2016
New Revision: 282652

URL: http://llvm.org/viewvc/llvm-project?rev=282652&view=rev
Log:
Mark P0127R3 as done, and replace its __has_feature check with the corresponding SD-6 macro.

Modified:
    cfe/trunk/lib/Frontend/InitPreprocessor.cpp
    cfe/trunk/lib/Lex/PPMacroExpansion.cpp
    cfe/trunk/test/Lexer/cxx-features.cpp
    cfe/trunk/www/cxx_status.html

Modified: cfe/trunk/lib/Frontend/InitPreprocessor.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Frontend/InitPreprocessor.cpp?rev=282652&r1=282651&r2=282652&view=diff
==============================================================================
--- cfe/trunk/lib/Frontend/InitPreprocessor.cpp (original)
+++ cfe/trunk/lib/Frontend/InitPreprocessor.cpp Wed Sep 28 19:08:05 2016
@@ -505,7 +505,7 @@ static void InitializeCPlusPlusFeatureTe
     //Builder.defineMacro("__cpp_noexcept_function_type", "201510");
     Builder.defineMacro("__cpp_capture_star_this", "201603");
     Builder.defineMacro("__cpp_if_constexpr", "201606");
-    //Builder.defineMacro("__cpp_template_auto", "201606");
+    Builder.defineMacro("__cpp_template_auto", "201606");
     Builder.defineMacro("__cpp_namespace_attributes", "201411");
     Builder.defineMacro("__cpp_enumerator_attributes", "201411");
     Builder.defineMacro("__cpp_nested_namespace_definitions", "201411");

Modified: cfe/trunk/lib/Lex/PPMacroExpansion.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Lex/PPMacroExpansion.cpp?rev=282652&r1=282651&r2=282652&view=diff
==============================================================================
--- cfe/trunk/lib/Lex/PPMacroExpansion.cpp (original)
+++ cfe/trunk/lib/Lex/PPMacroExpansion.cpp Wed Sep 28 19:08:05 2016
@@ -1192,7 +1192,7 @@ static bool HasFeature(const Preprocesso
       .Case("cxx_unrestricted_unions", LangOpts.CPlusPlus11)
       .Case("cxx_user_literals", LangOpts.CPlusPlus11)
       .Case("cxx_variadic_templates", LangOpts.CPlusPlus11)
-      // C++1y features
+      // C++14 features
       .Case("cxx_aggregate_nsdmi", LangOpts.CPlusPlus14)
       .Case("cxx_binary_literals", LangOpts.CPlusPlus14)
       .Case("cxx_contextual_conversions", LangOpts.CPlusPlus14)
@@ -1202,8 +1202,9 @@ static bool HasFeature(const Preprocesso
       .Case("cxx_relaxed_constexpr", LangOpts.CPlusPlus14)
       .Case("cxx_return_type_deduction", LangOpts.CPlusPlus14)
       .Case("cxx_variable_templates", LangOpts.CPlusPlus14)
-      // C++1z features
-      .Case("cxx_template_auto", LangOpts.CPlusPlus1z)
+      // NOTE: For features covered by SD-6, it is preferable to provide *only*
+      // the SD-6 macro and not a __has_feature check.
+
       // C++ TSes
       //.Case("cxx_runtime_arrays", LangOpts.CPlusPlusTSArrays)
       //.Case("cxx_concepts", LangOpts.CPlusPlusTSConcepts)
@@ -1287,7 +1288,7 @@ static bool HasExtension(const Preproces
            .Case("cxx_reference_qualified_functions", LangOpts.CPlusPlus)
            .Case("cxx_rvalue_references", LangOpts.CPlusPlus)
            .Case("cxx_variadic_templates", LangOpts.CPlusPlus)
-           // C++1y features supported by other languages as extensions.
+           // C++14 features supported by other languages as extensions.
            .Case("cxx_binary_literals", true)
            .Case("cxx_init_captures", LangOpts.CPlusPlus11)
            .Case("cxx_variable_templates", LangOpts.CPlusPlus)

Modified: cfe/trunk/test/Lexer/cxx-features.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Lexer/cxx-features.cpp?rev=282652&r1=282651&r2=282652&view=diff
==============================================================================
--- cfe/trunk/test/Lexer/cxx-features.cpp (original)
+++ cfe/trunk/test/Lexer/cxx-features.cpp Wed Sep 28 19:08:05 2016
@@ -58,8 +58,7 @@
 
 // static_assert checked below
 
-#if check(template_auto, 0, 0, 0, 0) // FIXME: provisional name
-// FIXME: value shuld be 201606 for cxx1z once implemented
+#if check(template_auto, 0, 0, 0, 201606) // FIXME: provisional name
 #error "wrong value for __cpp_template_auto"
 #endif
 

Modified: cfe/trunk/www/cxx_status.html
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/www/cxx_status.html?rev=282652&r1=282651&r2=282652&view=diff
==============================================================================
--- cfe/trunk/www/cxx_status.html (original)
+++ cfe/trunk/www/cxx_status.html Wed Sep 28 19:08:05 2016
@@ -689,7 +689,7 @@ as the draft C++1z standard evolves.
     <tr>
       <td>Non-type template parameters with <tt>auto</tt> type</td>
       <td><a href="http://wg21.link/p0127r2">P0127R2</a></td>
-      <td class="none" align="center">No</td>
+      <td class="svn" align="center">SVN</td>
     </tr>
     <tr>
       <td>Guaranteed copy elision</td>




More information about the cfe-commits mailing list