[cfe-commits] r139149 - in /cfe/trunk: lib/Lex/PPMacroExpansion.cpp test/Lexer/has_extension_cxx.cpp test/SemaCXX/for-range-no-std.cpp
Richard Smith
richard-llvm at metafoo.co.uk
Tue Sep 6 11:03:41 PDT 2011
Author: rsmith
Date: Tue Sep 6 13:03:41 2011
New Revision: 139149
URL: http://llvm.org/viewvc/llvm-project?rev=139149&view=rev
Log:
Advertise support for cxx_range_for as an extension in C++98 mode. Patch by Jean-Daniel Dupas!
Also provide a modicum of test coverage for ranged for in C++98.
Modified:
cfe/trunk/lib/Lex/PPMacroExpansion.cpp
cfe/trunk/test/Lexer/has_extension_cxx.cpp
cfe/trunk/test/SemaCXX/for-range-no-std.cpp
Modified: cfe/trunk/lib/Lex/PPMacroExpansion.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Lex/PPMacroExpansion.cpp?rev=139149&r1=139148&r2=139149&view=diff
==============================================================================
--- cfe/trunk/lib/Lex/PPMacroExpansion.cpp (original)
+++ cfe/trunk/lib/Lex/PPMacroExpansion.cpp Tue Sep 6 13:03:41 2011
@@ -705,6 +705,7 @@
.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);
Modified: cfe/trunk/test/Lexer/has_extension_cxx.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Lexer/has_extension_cxx.cpp?rev=139149&r1=139148&r2=139149&view=diff
==============================================================================
--- cfe/trunk/test/Lexer/has_extension_cxx.cpp (original)
+++ cfe/trunk/test/Lexer/has_extension_cxx.cpp Tue Sep 6 13:03:41 2011
@@ -25,6 +25,11 @@
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();
Modified: cfe/trunk/test/SemaCXX/for-range-no-std.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaCXX/for-range-no-std.cpp?rev=139149&r1=139148&r2=139149&view=diff
==============================================================================
--- cfe/trunk/test/SemaCXX/for-range-no-std.cpp (original)
+++ cfe/trunk/test/SemaCXX/for-range-no-std.cpp Tue Sep 6 13:03:41 2011
@@ -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();
More information about the cfe-commits
mailing list