[cfe-commits] r38711 - in /cfe/cfe/trunk: Lex/Lexer.cpp include/clang/Basic/DiagnosticKinds.def include/clang/Basic/TokenKinds.def include/clang/Lex/Lexer.h
sabre at cs.uiuc.edu
sabre at cs.uiuc.edu
Wed Jul 11 09:24:01 PDT 2007
Author: sabre
Date: Wed Jul 11 11:24:00 2007
New Revision: 38711
URL: http://llvm.org/viewvc/llvm-project?rev=38711&view=rev
Log:
Lex the microsoft 'charize' extension.
Modified:
cfe/cfe/trunk/Lex/Lexer.cpp
cfe/cfe/trunk/include/clang/Basic/DiagnosticKinds.def
cfe/cfe/trunk/include/clang/Basic/TokenKinds.def
cfe/cfe/trunk/include/clang/Lex/Lexer.h
Modified: cfe/cfe/trunk/Lex/Lexer.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/cfe/trunk/Lex/Lexer.cpp?rev=38711&r1=38710&r2=38711&view=diff
==============================================================================
--- cfe/cfe/trunk/Lex/Lexer.cpp (original)
+++ cfe/cfe/trunk/Lex/Lexer.cpp Wed Jul 11 11:24:00 2007
@@ -1200,11 +1200,15 @@
CurPtr = ConsumeChar(CurPtr, SizeTmp, Result);
} else if (Features.Digraphs && Char == ':') {
CurPtr = ConsumeChar(CurPtr, SizeTmp, Result);
- if (getCharAndSize(CurPtr, SizeTmp) == '%' &&
- getCharAndSize(CurPtr+SizeTmp, SizeTmp2) == ':') {
+ Char = getCharAndSize(CurPtr, SizeTmp);
+ if (Char == '%' && getCharAndSize(CurPtr+SizeTmp, SizeTmp2) == ':') {
Result.SetKind(tok::hashhash); // '%:%:' -> '##'
CurPtr = ConsumeChar(ConsumeChar(CurPtr, SizeTmp, Result),
SizeTmp2, Result);
+ } else if (Char == '@' && Features.Microsoft) { // %:@ -> #@ -> Charize
+ Result.SetKind(tok::hashat);
+ CurPtr = ConsumeChar(CurPtr, SizeTmp, Result);
+ Diag(BufferPtr, diag::charize_microsoft_ext);
} else {
Result.SetKind(tok::hash); // '%:' -> '#'
@@ -1351,6 +1355,10 @@
if (Char == '#') {
Result.SetKind(tok::hashhash);
CurPtr = ConsumeChar(CurPtr, SizeTmp, Result);
+ } else if (Char == '@' && Features.Microsoft) { // #@ -> Charize
+ Result.SetKind(tok::hashat);
+ Diag(BufferPtr, diag::charize_microsoft_ext);
+ CurPtr = ConsumeChar(CurPtr, SizeTmp, Result);
} else {
Result.SetKind(tok::hash);
// We parsed a # character. If this occurs at the start of the line,
Modified: cfe/cfe/trunk/include/clang/Basic/DiagnosticKinds.def
URL: http://llvm.org/viewvc/llvm-project/cfe/cfe/trunk/include/clang/Basic/DiagnosticKinds.def?rev=38711&r1=38710&r2=38711&view=diff
==============================================================================
--- cfe/cfe/trunk/include/clang/Basic/DiagnosticKinds.def (original)
+++ cfe/cfe/trunk/include/clang/Basic/DiagnosticKinds.def Wed Jul 11 11:24:00 2007
@@ -59,6 +59,8 @@
"backslash-newline at end of file")
DIAG(ext_dollar_in_identifier, EXTENSION,
"'$' in identifier")
+DIAG(charize_microsoft_ext, EXTENSION,
+ "@# is a microsoft extension")
DIAG(ext_token_used, EXTENSION,
"extension used")
Modified: cfe/cfe/trunk/include/clang/Basic/TokenKinds.def
URL: http://llvm.org/viewvc/llvm-project/cfe/cfe/trunk/include/clang/Basic/TokenKinds.def?rev=38711&r1=38710&r2=38711&view=diff
==============================================================================
--- cfe/cfe/trunk/include/clang/Basic/TokenKinds.def (original)
+++ cfe/cfe/trunk/include/clang/Basic/TokenKinds.def Wed Jul 11 11:24:00 2007
@@ -91,6 +91,7 @@
TOK(comma) // ,
TOK(hash) // #
TOK(hashhash) // ##
+TOK(hashat) // #@
// C++ Support
TOK(periodstar) // .*
Modified: cfe/cfe/trunk/include/clang/Lex/Lexer.h
URL: http://llvm.org/viewvc/llvm-project/cfe/cfe/trunk/include/clang/Lex/Lexer.h?rev=38711&r1=38710&r2=38711&view=diff
==============================================================================
--- cfe/cfe/trunk/include/clang/Lex/Lexer.h (original)
+++ cfe/cfe/trunk/include/clang/Lex/Lexer.h Wed Jul 11 11:24:00 2007
@@ -32,6 +32,7 @@
unsigned Digraphs : 1; // When added to C? C99?
unsigned HexFloats : 1; // C99 Hexadecimal float constants.
unsigned C99 : 1; // C99 Support
+ unsigned Microsoft : 1; // Microsoft extensions.
unsigned CPlusPlus : 1; // C++ Support
unsigned CPPMinMax : 1; // C++ <?=, >?= tokens.
unsigned NoExtensions : 1; // All extensions are disabled, strict mode.
@@ -41,7 +42,7 @@
LangOptions() {
Trigraphs = BCPLComment = DollarIdents = Digraphs = ObjC1 = ObjC2 = 0;
- C99 = CPlusPlus = CPPMinMax = NoExtensions = 0;
+ C99 = Microsoft = CPlusPlus = CPPMinMax = NoExtensions = 0;
}
};
More information about the cfe-commits
mailing list