From 27143d82f0c42f237f0999e5c3f3f6214a757540 Mon Sep 17 00:00:00 2001 From: Richard Smith 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. llvm-svn: 282652 --- clang/lib/Frontend/InitPreprocessor.cpp | 2 +- clang/lib/Lex/PPMacroExpansion.cpp | 9 +++++---- clang/test/Lexer/cxx-features.cpp | 3 +-- clang/www/cxx_status.html | 2 +- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/clang/lib/Frontend/InitPreprocessor.cpp b/clang/lib/Frontend/InitPreprocessor.cpp index 0ffc0c6ee60b..7d15e4cd589c 100644 --- a/clang/lib/Frontend/InitPreprocessor.cpp +++ b/clang/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/clang/lib/Lex/PPMacroExpansion.cpp b/clang/lib/Lex/PPMacroExpansion.cpp index 1be1801ac2fe..940192bafb7b 100644 --- a/clang/lib/Lex/PPMacroExpansion.cpp +++ b/clang/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/clang/test/Lexer/cxx-features.cpp b/clang/test/Lexer/cxx-features.cpp index f7a4ce12985c..5a4c45ddc1a9 100644 --- a/clang/test/Lexer/cxx-features.cpp +++ b/clang/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/clang/www/cxx_status.html b/clang/www/cxx_status.html index eaedc484d860..1fe28d5dcbc7 100644 --- a/clang/www/cxx_status.html +++ b/clang/www/cxx_status.html @@ -689,7 +689,7 @@ as the draft C++1z standard evolves. Non-type template parameters with auto type P0127R2 - No + SVN Guaranteed copy elision