LANGOPT(CPlusPlus , 1, 0, "C++")
LANGOPT(CPlusPlus11 , 1, 0, "C++11")
LANGOPT(CPlusPlus1y , 1, 0, "C++1y")
+LANGOPT(CPlusPlus1z , 1, 0, "C++1z")
LANGOPT(ObjC1 , 1, 0, "Objective-C 1")
LANGOPT(ObjC2 , 1, 0, "Objective-C 2")
BENIGN_LANGOPT(ObjCDefaultSynthProperties , 1, 0,
CPlusPlus = (1 << 4),
CPlusPlus11 = (1 << 5),
CPlusPlus1y = (1 << 6),
- Digraphs = (1 << 7),
- GNUMode = (1 << 8),
- HexFloat = (1 << 9),
- ImplicitInt = (1 << 10)
+ CPlusPlus1z = (1 << 7),
+ Digraphs = (1 << 8),
+ GNUMode = (1 << 9),
+ HexFloat = (1 << 10),
+ ImplicitInt = (1 << 11)
};
}
/// isCPlusPlus - Language is a C++ variant.
bool isCPlusPlus() const { return Flags & frontend::CPlusPlus; }
- /// isCPlusPlus11 - Language is a C++0x variant.
+ /// isCPlusPlus11 - Language is a C++11 variant (or later).
bool isCPlusPlus11() const { return Flags & frontend::CPlusPlus11; }
- /// isCPlusPlus1y - Language is a C++1y variant.
+ /// isCPlusPlus1y - Language is a C++14 variant (or later).
bool isCPlusPlus1y() const { return Flags & frontend::CPlusPlus1y; }
+ /// isCPlusPlus1z - Language is a C++17 variant (or later).
+ bool isCPlusPlus1z() const { return Flags & frontend::CPlusPlus1z; }
+
/// hasDigraphs - Language supports digraphs.
bool hasDigraphs() const { return Flags & frontend::Digraphs; }
LineComment | CPlusPlus | CPlusPlus11 | CPlusPlus1y | Digraphs |
GNUMode)
+LANGSTANDARD(cxx1z, "c++1z",
+ "Working draft for ISO C++ 2017",
+ LineComment | CPlusPlus | CPlusPlus11 | CPlusPlus1y | CPlusPlus1z |
+ Digraphs)
+LANGSTANDARD(gnucxx1z, "gnu++1z",
+ "Working draft for ISO C++ 2017 with GNU extensions",
+ LineComment | CPlusPlus | CPlusPlus11 | CPlusPlus1y | CPlusPlus1z |
+ Digraphs | GNUMode)
+
// OpenCL
LANGSTANDARD(opencl, "cl",
"OpenCL 1.0",
Opts.CPlusPlus = Std.isCPlusPlus();
Opts.CPlusPlus11 = Std.isCPlusPlus11();
Opts.CPlusPlus1y = Std.isCPlusPlus1y();
+ Opts.CPlusPlus1z = Std.isCPlusPlus1z();
Opts.Digraphs = Std.hasDigraphs();
Opts.GNUMode = Std.isGNUMode();
Opts.GNUInline = !Std.isC99();
else if (!LangOpts.GNUMode && LangOpts.Digraphs)
Builder.defineMacro("__STDC_VERSION__", "199409L");
} else {
+ // FIXME: Use correct value for C++17.
+ if (LangOpts.CPlusPlus1z)
+ Builder.defineMacro("__cplusplus", "201406L");
// C++1y [cpp.predefined]p1:
// The name __cplusplus is defined to the value 201402L when compiling a
// C++ translation unit.
- if (LangOpts.CPlusPlus1y)
+ else if (LangOpts.CPlusPlus1y)
Builder.defineMacro("__cplusplus", "201402L");
// C++11 [cpp.predefined]p1:
// The name __cplusplus is defined to the value 201103L when compiling a
// RUN: not %clang -std=gnu++11 %s -fsyntax-only 2>&1 | FileCheck -check-prefix=GNUXX11 %s
// RUN: not %clang -std=c++1y %s -fsyntax-only 2>&1 | FileCheck -check-prefix=CXX1Y %s
// RUN: not %clang -std=gnu++1y %s -fsyntax-only 2>&1 | FileCheck -check-prefix=GNUXX1Y %s
+// RUN: not %clang -std=c++1z %s -fsyntax-only 2>&1 | FileCheck -check-prefix=CXX1Z %s
+// RUN: not %clang -std=gnu++1z %s -fsyntax-only 2>&1 | FileCheck -check-prefix=GNUXX1Z %s
void f(int n) {
typeof(n)();
// GNUXX1Y-NOT: undeclared identifier 'typeof'
// GNUXX1Y-NOT: undeclared identifier 'decltype'
+
+// CXX1Z: undeclared identifier 'typeof'
+// CXX1Z-NOT: undeclared identifier 'decltype'
+
+// GNUXX1Z-NOT: undeclared identifier 'typeof'
+// GNUXX1Z-NOT: undeclared identifier 'decltype'
// BLOCKS:#define __block __attribute__((__blocks__(byref)))
//
//
+// RUN: %clang_cc1 -x c++ -std=c++1z -E -dM < /dev/null | FileCheck -check-prefix CXX1Z %s
+//
+// CXX1Z:#define __GNUG__
+// CXX1Z:#define __GXX_EXPERIMENTAL_CXX0X__ 1
+// CXX1Z:#define __GXX_RTTI 1
+// CXX1Z:#define __GXX_WEAK__ 1
+// CXX1Z:#define __cplusplus 201406L
+// CXX1Z:#define __private_extern__ extern
+//
+//
// RUN: %clang_cc1 -x c++ -std=c++1y -E -dM < /dev/null | FileCheck -check-prefix CXX1Y %s
//
// CXX1Y:#define __GNUG__
// FREESTANDING:#define __STDC_HOSTED__ 0
//
//
+// RUN: %clang_cc1 -x c++ -std=gnu++1z -E -dM < /dev/null | FileCheck -check-prefix GXX1Z %s
+//
+// GXX1Z:#define __GNUG__
+// GXX1Z:#define __GXX_WEAK__ 1
+// GXX1Z:#define __cplusplus 201406L
+// GXX1Z:#define __private_extern__ extern
+//
+//
// RUN: %clang_cc1 -x c++ -std=gnu++1y -E -dM < /dev/null | FileCheck -check-prefix GXX1Y %s
//
// GXX1Y:#define __GNUG__