[cfe-commits] r166139 - in /cfe/trunk: include/clang/Basic/LangOptions.def include/clang/Frontend/LangStandard.h include/clang/Frontend/LangStandards.def lib/Frontend/CompilerInvocation.cpp lib/Frontend/InitPreprocessor.cpp test/Driver/std.cpp
Richard Smith
richard-llvm at metafoo.co.uk
Wed Oct 17 16:07:52 PDT 2012
Author: rsmith
Date: Wed Oct 17 18:07:52 2012
New Revision: 166139
URL: http://llvm.org/viewvc/llvm-project?rev=166139&view=rev
Log:
Add -std=c++1y argument, for *highly* experimental C++14 support.
Modified:
cfe/trunk/include/clang/Basic/LangOptions.def
cfe/trunk/include/clang/Frontend/LangStandard.h
cfe/trunk/include/clang/Frontend/LangStandards.def
cfe/trunk/lib/Frontend/CompilerInvocation.cpp
cfe/trunk/lib/Frontend/InitPreprocessor.cpp
cfe/trunk/test/Driver/std.cpp
Modified: cfe/trunk/include/clang/Basic/LangOptions.def
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/LangOptions.def?rev=166139&r1=166138&r2=166139&view=diff
==============================================================================
--- cfe/trunk/include/clang/Basic/LangOptions.def (original)
+++ cfe/trunk/include/clang/Basic/LangOptions.def Wed Oct 17 18:07:52 2012
@@ -48,6 +48,7 @@
LANGOPT(Borland , 1, 0, "Borland extensions")
LANGOPT(CPlusPlus , 1, 0, "C++")
LANGOPT(CPlusPlus0x , 1, 0, "C++0x")
+LANGOPT(CPlusPlus1y , 1, 0, "C++1y")
LANGOPT(ObjC1 , 1, 0, "Objective-C 1")
LANGOPT(ObjC2 , 1, 0, "Objective-C 2")
BENIGN_LANGOPT(ObjCDefaultSynthProperties , 1, 0,
Modified: cfe/trunk/include/clang/Frontend/LangStandard.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Frontend/LangStandard.h?rev=166139&r1=166138&r2=166139&view=diff
==============================================================================
--- cfe/trunk/include/clang/Frontend/LangStandard.h (original)
+++ cfe/trunk/include/clang/Frontend/LangStandard.h Wed Oct 17 18:07:52 2012
@@ -24,10 +24,11 @@
C11 = (1 << 3),
CPlusPlus = (1 << 4),
CPlusPlus0x = (1 << 5),
- Digraphs = (1 << 6),
- GNUMode = (1 << 7),
- HexFloat = (1 << 8),
- ImplicitInt = (1 << 9)
+ CPlusPlus1y = (1 << 6),
+ Digraphs = (1 << 7),
+ GNUMode = (1 << 8),
+ HexFloat = (1 << 9),
+ ImplicitInt = (1 << 10)
};
}
@@ -71,6 +72,9 @@
/// isCPlusPlus0x - Language is a C++0x variant.
bool isCPlusPlus0x() const { return Flags & frontend::CPlusPlus0x; }
+ /// isCPlusPlus1y - Language is a C++1y variant.
+ bool isCPlusPlus1y() const { return Flags & frontend::CPlusPlus1y; }
+
/// hasDigraphs - Language supports digraphs.
bool hasDigraphs() const { return Flags & frontend::Digraphs; }
Modified: cfe/trunk/include/clang/Frontend/LangStandards.def
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Frontend/LangStandards.def?rev=166139&r1=166138&r2=166139&view=diff
==============================================================================
--- cfe/trunk/include/clang/Frontend/LangStandards.def (original)
+++ cfe/trunk/include/clang/Frontend/LangStandards.def Wed Oct 17 18:07:52 2012
@@ -107,6 +107,14 @@
"ISO C++ 2011 with amendments and GNU extensions",
BCPLComment | CPlusPlus | CPlusPlus0x | Digraphs | GNUMode)
+LANGSTANDARD(cxx1y, "c++1y",
+ "Working draft for ISO C++ 2014",
+ BCPLComment | CPlusPlus | CPlusPlus0x | CPlusPlus1y | Digraphs)
+LANGSTANDARD(gnucxx1y, "gnu++1y",
+ "Working draft for ISO C++ 2014 with GNU extensions",
+ BCPLComment | CPlusPlus | CPlusPlus0x | CPlusPlus1y | Digraphs |
+ GNUMode)
+
// OpenCL
LANGSTANDARD(opencl, "cl",
"OpenCL 1.0",
Modified: cfe/trunk/lib/Frontend/CompilerInvocation.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Frontend/CompilerInvocation.cpp?rev=166139&r1=166138&r2=166139&view=diff
==============================================================================
--- cfe/trunk/lib/Frontend/CompilerInvocation.cpp (original)
+++ cfe/trunk/lib/Frontend/CompilerInvocation.cpp Wed Oct 17 18:07:52 2012
@@ -1839,6 +1839,7 @@
Opts.C11 = Std.isC11();
Opts.CPlusPlus = Std.isCPlusPlus();
Opts.CPlusPlus0x = Std.isCPlusPlus0x();
+ Opts.CPlusPlus1y = Std.isCPlusPlus1y();
Opts.Digraphs = Std.hasDigraphs();
Opts.GNUMode = Std.isGNUMode();
Opts.GNUInline = !Std.isC99();
Modified: cfe/trunk/lib/Frontend/InitPreprocessor.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Frontend/InitPreprocessor.cpp?rev=166139&r1=166138&r2=166139&view=diff
==============================================================================
--- cfe/trunk/lib/Frontend/InitPreprocessor.cpp (original)
+++ cfe/trunk/lib/Frontend/InitPreprocessor.cpp Wed Oct 17 18:07:52 2012
@@ -288,6 +288,8 @@
else if (!LangOpts.GNUMode && LangOpts.Digraphs)
Builder.defineMacro("__STDC_VERSION__", "199409L");
} else {
+ // FIXME: LangOpts.CPlusPlus1y
+
// C++11 [cpp.predefined]p1:
// The name __cplusplus is defined to the value 201103L when compiling a
// C++ translation unit.
Modified: cfe/trunk/test/Driver/std.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/std.cpp?rev=166139&r1=166138&r2=166139&view=diff
==============================================================================
--- cfe/trunk/test/Driver/std.cpp (original)
+++ cfe/trunk/test/Driver/std.cpp Wed Oct 17 18:07:52 2012
@@ -5,6 +5,8 @@
// RUN: %clang -std=gnu++0x %s -fsyntax-only 2>&1 | FileCheck -check-prefix=GNUXX11 %s
// RUN: %clang -std=c++11 %s -fsyntax-only 2>&1 | FileCheck -check-prefix=CXX11 %s
// RUN: %clang -std=gnu++11 %s -fsyntax-only 2>&1 | FileCheck -check-prefix=GNUXX11 %s
+// RUN: %clang -std=c++1y %s -fsyntax-only 2>&1 | FileCheck -check-prefix=CXX1Y %s
+// RUN: %clang -std=gnu++1y %s -fsyntax-only 2>&1 | FileCheck -check-prefix=GNUXX1Y %s
void f(int n) {
typeof(n)();
@@ -22,3 +24,9 @@
// GNUXX11-NOT: undeclared identifier 'typeof'
// GNUXX11-NOT: undeclared identifier 'decltype'
+
+// CXX1Y: undeclared identifier 'typeof'
+// CXX1Y-NOT: undeclared identifier 'decltype'
+
+// GNUXX1Y-NOT: undeclared identifier 'typeof'
+// GNUXX1Y-NOT: undeclared identifier 'decltype'
More information about the cfe-commits
mailing list