]> granicus.if.org Git - clang/commitdiff
Advertise support for cxx_range_for as an extension in C++98 mode. Patch by Jean...
authorRichard Smith <richard-llvm@metafoo.co.uk>
Tue, 6 Sep 2011 18:03:41 +0000 (18:03 +0000)
committerRichard Smith <richard-llvm@metafoo.co.uk>
Tue, 6 Sep 2011 18:03:41 +0000 (18:03 +0000)
Also provide a modicum of test coverage for ranged for in C++98.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@139149 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Lex/PPMacroExpansion.cpp
test/Lexer/has_extension_cxx.cpp
test/SemaCXX/for-range-no-std.cpp

index d0828d0d5d51a407395fbf15c67fd8c5ec734cd3..fce593fe9e93a78f27208fb7388327147aa91e0d 100644 (file)
@@ -705,6 +705,7 @@ static bool HasExtension(const Preprocessor &PP, const IdentifierInfo *II) {
            .Case("cxx_inline_namespaces", LangOpts.CPlusPlus)
            .Case("cxx_nonstatic_member_init", LangOpts.CPlusPlus)
            .Case("cxx_override_control", LangOpts.CPlusPlus)
+           .Case("cxx_range_for", LangOpts.CPlusPlus)
            .Case("cxx_reference_qualified_functions", LangOpts.CPlusPlus)
            .Case("cxx_rvalue_references", LangOpts.CPlusPlus)
            .Default(false);
index 77efa357938c744e64bc9296367c7aa0b39e2736..5481b596cc4a32115d73750b8f8cc248d3ee13a2 100644 (file)
@@ -25,6 +25,11 @@ int has_inline_namespaces();
 int has_override_control();
 #endif
 
+// CHECK: has_range_for
+#if __has_extension(cxx_range_for)
+int has_range_for();
+#endif
+
 // CHECK: has_reference_qualified_functions
 #if __has_extension(cxx_reference_qualified_functions)
 int has_reference_qualified_functions();
index 8cc71e5111a203b09879a64420432be8620b9359..31b3581d1cf61d229e7482aaf47a33680ad35b1c 100644 (file)
@@ -1,4 +1,5 @@
 // RUN: %clang_cc1 -fsyntax-only -verify %s -std=c++0x
+// RUN: %clang_cc1 -fsyntax-only -verify %s -std=c++98 -Wno-c++0x-extensions
 
 struct S {
   int *begin();