From 98a155cae02da907830e6bf18b79b8cfd34c2423 Mon Sep 17 00:00:00 2001 From: Richard Smith <richard-llvm@metafoo.co.uk> Date: Thu, 29 Sep 2016 00:08:05 +0000 Subject: [PATCH] Mark P0127R3 as done, and replace its __has_feature check with the corresponding SD-6 macro. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@282652 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Frontend/InitPreprocessor.cpp | 2 +- lib/Lex/PPMacroExpansion.cpp | 9 +++++---- test/Lexer/cxx-features.cpp | 3 +-- www/cxx_status.html | 2 +- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/lib/Frontend/InitPreprocessor.cpp b/lib/Frontend/InitPreprocessor.cpp index 0ffc0c6ee60..7d15e4cd589 100644 --- a/lib/Frontend/InitPreprocessor.cpp +++ b/lib/Frontend/InitPreprocessor.cpp @@ -505,7 +505,7 @@ static void InitializeCPlusPlusFeatureTestMacros(const LangOptions &LangOpts, //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"); diff --git a/lib/Lex/PPMacroExpansion.cpp b/lib/Lex/PPMacroExpansion.cpp index 1be1801ac2f..940192bafb7 100644 --- a/lib/Lex/PPMacroExpansion.cpp +++ b/lib/Lex/PPMacroExpansion.cpp @@ -1192,7 +1192,7 @@ static bool HasFeature(const Preprocessor &PP, StringRef Feature) { .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 Preprocessor &PP, StringRef Feature) { .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 Preprocessor &PP, StringRef Extension) { .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) diff --git a/test/Lexer/cxx-features.cpp b/test/Lexer/cxx-features.cpp index f7a4ce12985..5a4c45ddc1a 100644 --- a/test/Lexer/cxx-features.cpp +++ b/test/Lexer/cxx-features.cpp @@ -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 diff --git a/www/cxx_status.html b/www/cxx_status.html index eaedc484d86..1fe28d5dcbc 100644 --- a/www/cxx_status.html +++ b/www/cxx_status.html @@ -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> -- GitLab