[cfe-commits] r129553 - in /cfe/trunk: include/clang/Basic/DiagnosticFrontendKinds.td include/clang/Basic/LangOptions.h include/clang/Basic/TokenKinds.def include/clang/Frontend/LangStandard.h include/clang/Frontend/LangStandards.def lib/Basic/IdentifierTable.cpp lib/Frontend/CompilerInvocation.cpp lib/Serialization/ASTReader.cpp lib/Serialization/ASTWriter.cpp
Peter Collingbourne
peter at pcc.me.uk
Thu Apr 14 17:35:23 PDT 2011
Author: pcc
Date: Thu Apr 14 19:35:23 2011
New Revision: 129553
URL: http://llvm.org/viewvc/llvm-project?rev=129553&view=rev
Log:
C1X: add a language standard
Modified:
cfe/trunk/include/clang/Basic/DiagnosticFrontendKinds.td
cfe/trunk/include/clang/Basic/LangOptions.h
cfe/trunk/include/clang/Basic/TokenKinds.def
cfe/trunk/include/clang/Frontend/LangStandard.h
cfe/trunk/include/clang/Frontend/LangStandards.def
cfe/trunk/lib/Basic/IdentifierTable.cpp
cfe/trunk/lib/Frontend/CompilerInvocation.cpp
cfe/trunk/lib/Serialization/ASTReader.cpp
cfe/trunk/lib/Serialization/ASTWriter.cpp
Modified: cfe/trunk/include/clang/Basic/DiagnosticFrontendKinds.td
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/DiagnosticFrontendKinds.td?rev=129553&r1=129552&r2=129553&view=diff
==============================================================================
--- cfe/trunk/include/clang/Basic/DiagnosticFrontendKinds.td (original)
+++ cfe/trunk/include/clang/Basic/DiagnosticFrontendKinds.td Thu Apr 14 19:35:23 2011
@@ -115,6 +115,9 @@
def warn_pch_c99 : Error<
"C99 support was %select{disabled|enabled}0 in PCH file but is "
"currently %select{disabled|enabled}1">;
+def warn_pch_c1x : Error<
+ "C1X support was %select{disabled|enabled}0 in PCH file but is "
+ "currently %select{disabled|enabled}1">;
def warn_pch_cplusplus : Error<
"C++ support was %select{disabled|enabled}0 in PCH file but is "
"currently %select{disabled|enabled}1">;
Modified: cfe/trunk/include/clang/Basic/LangOptions.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/LangOptions.h?rev=129553&r1=129552&r2=129553&view=diff
==============================================================================
--- cfe/trunk/include/clang/Basic/LangOptions.h (original)
+++ cfe/trunk/include/clang/Basic/LangOptions.h Thu Apr 14 19:35:23 2011
@@ -34,6 +34,7 @@
unsigned Digraphs : 1; // C94, C99 and C++
unsigned HexFloats : 1; // C99 Hexadecimal float constants.
unsigned C99 : 1; // C99 Support
+ unsigned C1X : 1; // C1X Support
unsigned Microsoft : 1; // Microsoft extensions.
unsigned Borland : 1; // Borland extensions.
unsigned CPlusPlus : 1; // C++ Support
@@ -170,7 +171,7 @@
AppleKext = 0;
ObjCDefaultSynthProperties = 0;
NoConstantCFStrings = 0; InlineVisibilityHidden = 0;
- C99 = Microsoft = Borland = CPlusPlus = CPlusPlus0x = 0;
+ C99 = C1X = Microsoft = Borland = CPlusPlus = CPlusPlus0x = 0;
CXXOperatorNames = PascalStrings = WritableStrings = ConstStrings = 0;
Exceptions = ObjCExceptions = CXXExceptions = SjLjExceptions = 0;
TraditionalCPP = Freestanding = NoBuiltin = 0;
Modified: cfe/trunk/include/clang/Basic/TokenKinds.def
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/TokenKinds.def?rev=129553&r1=129552&r2=129553&view=diff
==============================================================================
--- cfe/trunk/include/clang/Basic/TokenKinds.def (original)
+++ cfe/trunk/include/clang/Basic/TokenKinds.def Thu Apr 14 19:35:23 2011
@@ -190,6 +190,7 @@
// is a keyword in the implementation namespace that should
// always be treated as a keyword
// KEYC99 - This is a keyword introduced to C in C99
+// KEYC1X - This is a keyword introduced to C in C1X
// KEYCXX - This is a C++ keyword, or a C++-specific keyword in the
// implementation namespace
// KEYNOCXX - This is a keyword in every non-C++ dialect.
Modified: cfe/trunk/include/clang/Frontend/LangStandard.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Frontend/LangStandard.h?rev=129553&r1=129552&r2=129553&view=diff
==============================================================================
--- cfe/trunk/include/clang/Frontend/LangStandard.h (original)
+++ cfe/trunk/include/clang/Frontend/LangStandard.h Thu Apr 14 19:35:23 2011
@@ -19,12 +19,13 @@
enum LangFeatures {
BCPLComment = (1 << 0),
C99 = (1 << 1),
- CPlusPlus = (1 << 2),
- CPlusPlus0x = (1 << 3),
- Digraphs = (1 << 4),
- GNUMode = (1 << 5),
- HexFloat = (1 << 6),
- ImplicitInt = (1 << 7)
+ C1X = (1 << 2),
+ CPlusPlus = (1 << 3),
+ CPlusPlus0x = (1 << 4),
+ Digraphs = (1 << 5),
+ GNUMode = (1 << 6),
+ HexFloat = (1 << 7),
+ ImplicitInt = (1 << 8)
};
}
@@ -56,6 +57,9 @@
/// isC99 - Language is a superset of C99.
bool isC99() const { return Flags & frontend::C99; }
+ /// isC1X - Language is a superset of C1X.
+ bool isC1X() const { return Flags & frontend::C1X; }
+
/// isCPlusPlus - Language is a C++ variant.
bool isCPlusPlus() const { return Flags & frontend::CPlusPlus; }
Modified: cfe/trunk/include/clang/Frontend/LangStandards.def
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Frontend/LangStandards.def?rev=129553&r1=129552&r2=129553&view=diff
==============================================================================
--- cfe/trunk/include/clang/Frontend/LangStandards.def (original)
+++ cfe/trunk/include/clang/Frontend/LangStandards.def Thu Apr 14 19:35:23 2011
@@ -59,6 +59,18 @@
"ISO C 1999 with GNU extensions",
BCPLComment | C99 | Digraphs | GNUMode | HexFloat)
+// C1X modes
+LANGSTANDARD(c1x, "c1x",
+ "ISO C 201X",
+ BCPLComment | C99 | C1X | Digraphs | HexFloat)
+LANGSTANDARD(iso9899_201x,
+ "iso9899:201x", "ISO C 201X",
+ BCPLComment | C99 | C1X | Digraphs | HexFloat)
+
+LANGSTANDARD(gnu1x, "gnu1x",
+ "ISO C 201X with GNU extensions",
+ BCPLComment | C99 | C1X | Digraphs | GNUMode | HexFloat)
+
// C++ modes
LANGSTANDARD(cxx98, "c++98",
"ISO C++ 1998 with amendments",
Modified: cfe/trunk/lib/Basic/IdentifierTable.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Basic/IdentifierTable.cpp?rev=129553&r1=129552&r2=129553&view=diff
==============================================================================
--- cfe/trunk/lib/Basic/IdentifierTable.cpp (original)
+++ cfe/trunk/lib/Basic/IdentifierTable.cpp Thu Apr 14 19:35:23 2011
@@ -91,7 +91,8 @@
KEYNOCXX = 0x80,
KEYBORLAND = 0x100,
KEYOPENCL = 0x200,
- KEYALL = 0x3ff
+ KEYC1X = 0x400,
+ KEYALL = 0x7ff
};
}
@@ -118,6 +119,7 @@
else if (LangOpts.AltiVec && (Flags & KEYALTIVEC)) AddResult = 2;
else if (LangOpts.OpenCL && (Flags & KEYOPENCL)) AddResult = 2;
else if (!LangOpts.CPlusPlus && (Flags & KEYNOCXX)) AddResult = 2;
+ else if (LangOpts.C1X && (Flags & KEYC1X)) AddResult = 2;
// Don't add this keyword if disabled in this language.
if (AddResult == 0) return;
Modified: cfe/trunk/lib/Frontend/CompilerInvocation.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Frontend/CompilerInvocation.cpp?rev=129553&r1=129552&r2=129553&view=diff
==============================================================================
--- cfe/trunk/lib/Frontend/CompilerInvocation.cpp (original)
+++ cfe/trunk/lib/Frontend/CompilerInvocation.cpp Thu Apr 14 19:35:23 2011
@@ -1335,6 +1335,7 @@
const LangStandard &Std = LangStandard::getLangStandardForKind(LangStd);
Opts.BCPLComment = Std.hasBCPLComments();
Opts.C99 = Std.isC99();
+ Opts.C1X = Std.isC1X();
Opts.CPlusPlus = Std.isCPlusPlus();
Opts.CPlusPlus0x = Std.isCPlusPlus0x();
Opts.Digraphs = Std.hasDigraphs();
Modified: cfe/trunk/lib/Serialization/ASTReader.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Serialization/ASTReader.cpp?rev=129553&r1=129552&r2=129553&view=diff
==============================================================================
--- cfe/trunk/lib/Serialization/ASTReader.cpp (original)
+++ cfe/trunk/lib/Serialization/ASTReader.cpp Thu Apr 14 19:35:23 2011
@@ -79,6 +79,7 @@
PARSE_LANGOPT_BENIGN(Digraphs);
PARSE_LANGOPT_BENIGN(HexFloats);
PARSE_LANGOPT_IMPORTANT(C99, diag::warn_pch_c99);
+ PARSE_LANGOPT_IMPORTANT(C1X, diag::warn_pch_c1x);
PARSE_LANGOPT_IMPORTANT(Microsoft, diag::warn_pch_microsoft_extensions);
PARSE_LANGOPT_BENIGN(MSCVersion);
PARSE_LANGOPT_IMPORTANT(CPlusPlus, diag::warn_pch_cplusplus);
@@ -2799,6 +2800,7 @@
PARSE_LANGOPT(Digraphs);
PARSE_LANGOPT(HexFloats);
PARSE_LANGOPT(C99);
+ PARSE_LANGOPT(C1X);
PARSE_LANGOPT(Microsoft);
PARSE_LANGOPT(CPlusPlus);
PARSE_LANGOPT(CPlusPlus0x);
Modified: cfe/trunk/lib/Serialization/ASTWriter.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Serialization/ASTWriter.cpp?rev=129553&r1=129552&r2=129553&view=diff
==============================================================================
--- cfe/trunk/lib/Serialization/ASTWriter.cpp (original)
+++ cfe/trunk/lib/Serialization/ASTWriter.cpp Thu Apr 14 19:35:23 2011
@@ -1007,6 +1007,7 @@
Record.push_back(LangOpts.Digraphs); // C94, C99 and C++
Record.push_back(LangOpts.HexFloats); // C99 Hexadecimal float constants.
Record.push_back(LangOpts.C99); // C99 Support
+ Record.push_back(LangOpts.C1X); // C1X Support
Record.push_back(LangOpts.Microsoft); // Microsoft extensions.
// LangOpts.MSCVersion is ignored because all it does it set a macro, which is
// already saved elsewhere.
More information about the cfe-commits
mailing list