[cfe-commits] r90860 - in /cfe/trunk: lib/Lex/Lexer.cpp test/Lexer/msdos-cpm-eof.c
Steve Naroff
snaroff at apple.com
Tue Dec 8 08:38:12 PST 2009
Author: snaroff
Date: Tue Dec 8 10:38:12 2009
New Revision: 90860
URL: http://llvm.org/viewvc/llvm-project?rev=90860&view=rev
Log:
Integrate the following from the 'objective-rewrite' branch:
http://llvm.org/viewvc/llvm-project?view=rev&revision=80043
Added:
cfe/trunk/test/Lexer/msdos-cpm-eof.c
Modified:
cfe/trunk/lib/Lex/Lexer.cpp
Modified: cfe/trunk/lib/Lex/Lexer.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Lex/Lexer.cpp?rev=90860&r1=90859&r2=90860&view=diff
==============================================================================
--- cfe/trunk/lib/Lex/Lexer.cpp (original)
+++ cfe/trunk/lib/Lex/Lexer.cpp Tue Dec 8 10:38:12 2009
@@ -33,7 +33,7 @@
#include <cctype>
using namespace clang;
-static void InitCharacterInfo();
+static void InitCharacterInfo(LangOptions);
//===----------------------------------------------------------------------===//
// Token Class Implementation
@@ -59,7 +59,7 @@
void Lexer::InitLexer(const char *BufStart, const char *BufPtr,
const char *BufEnd) {
- InitCharacterInfo();
+ InitCharacterInfo(Features);
BufferStart = BufStart;
BufferPtr = BufPtr;
@@ -253,7 +253,7 @@
// Statically initialize CharInfo table based on ASCII character set
// Reference: FreeBSD 7.2 /usr/share/misc/ascii
-static const unsigned char CharInfo[256] =
+static unsigned char CharInfo[256] =
{
// 0 NUL 1 SOH 2 STX 3 ETX
// 4 EOT 5 ENQ 6 ACK 7 BEL
@@ -321,7 +321,7 @@
0 , 0 , 0 , 0
};
-static void InitCharacterInfo() {
+static void InitCharacterInfo(LangOptions Features) {
static bool isInited = false;
if (isInited) return;
// check the statically-initialized CharInfo table
@@ -339,6 +339,11 @@
}
for (unsigned i = '0'; i <= '9'; ++i)
assert(CHAR_NUMBER == CharInfo[i]);
+
+ if (Features.Microsoft)
+ // Hack to treat DOS & CP/M EOF (^Z) as horizontal whitespace.
+ CharInfo[26/*sub*/] = CHAR_HORZ_WS;
+
isInited = true;
}
Added: cfe/trunk/test/Lexer/msdos-cpm-eof.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Lexer/msdos-cpm-eof.c?rev=90860&view=auto
==============================================================================
--- cfe/trunk/test/Lexer/msdos-cpm-eof.c (added)
+++ cfe/trunk/test/Lexer/msdos-cpm-eof.c Tue Dec 8 10:38:12 2009
@@ -0,0 +1,5 @@
+// RUN: clang-cc -fsyntax-only -verify -fms-extensions %s
+
+int a;
+
+
More information about the cfe-commits
mailing list