From: Richard Smith
Use __has_feature(cxx_reference_qualified_functions) to determine if support for reference-qualified functions (e.g., member functions with &
or &&
applied to *this
) is enabled.
Use __has_feature(cxx_range_for) to determine if support for +the range-based for loop is enabled.
+Use __has_feature(cxx_rvalue_references) to determine if support for diff --git a/lib/Lex/PPMacroExpansion.cpp b/lib/Lex/PPMacroExpansion.cpp index 6e9f598f1f..b078bc8577 100644 --- a/lib/Lex/PPMacroExpansion.cpp +++ b/lib/Lex/PPMacroExpansion.cpp @@ -565,6 +565,7 @@ static bool HasFeature(const Preprocessor &PP, const IdentifierInfo *II) { .Case("cxx_noexcept", LangOpts.CPlusPlus0x) //.Case("cxx_nullptr", false) .Case("cxx_override_control", LangOpts.CPlusPlus0x) + .Case("cxx_range_for", LangOpts.CPlusPlus0x) .Case("cxx_reference_qualified_functions", LangOpts.CPlusPlus0x) .Case("cxx_rvalue_references", LangOpts.CPlusPlus0x) .Case("cxx_strong_enums", LangOpts.CPlusPlus0x) diff --git a/test/Lexer/has_feature_cxx0x.cpp b/test/Lexer/has_feature_cxx0x.cpp index 27ea1062bb..57949e3017 100644 --- a/test/Lexer/has_feature_cxx0x.cpp +++ b/test/Lexer/has_feature_cxx0x.cpp @@ -109,6 +109,17 @@ int no_inline_namespaces(); // CHECK-0X: has_inline_namespaces // CHECK-NO-0X: no_inline_namespaces + +#if __has_feature(cxx_range_for) +int has_range_for(); +#else +int no_range_for(); +#endif + +// CHECK-0X: has_range_for +// CHECK-NO-0X: no_range_for + + #if __has_feature(cxx_reference_qualified_functions) int has_reference_qualified_functions(); #else