diff options
author | Steve Naroff <snaroff@apple.com> | 2009-12-08 16:38:12 +0000 |
---|---|---|
committer | Steve Naroff <snaroff@apple.com> | 2009-12-08 16:38:12 +0000 |
commit | 7b682656310b0d7e94a98d982444bc7ddedc653f (patch) | |
tree | cb119ec73641d85f51fe14bdaad5991eda338c5f /lib/Lex/Lexer.cpp | |
parent | 1237259bda343504cc0bd3cfe2198bdeea2b2fdf (diff) |
Integrate the following from the 'objective-rewrite' branch:
http://llvm.org/viewvc/llvm-project?view=rev&revision=80043
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@90860 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Lex/Lexer.cpp')
-rw-r--r-- | lib/Lex/Lexer.cpp | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/lib/Lex/Lexer.cpp b/lib/Lex/Lexer.cpp index 451e1cebff..dc8609d4ef 100644 --- a/lib/Lex/Lexer.cpp +++ b/lib/Lex/Lexer.cpp @@ -33,7 +33,7 @@ #include <cctype> using namespace clang; -static void InitCharacterInfo(); +static void InitCharacterInfo(LangOptions); //===----------------------------------------------------------------------===// // Token Class Implementation @@ -59,7 +59,7 @@ tok::ObjCKeywordKind Token::getObjCKeywordID() const { void Lexer::InitLexer(const char *BufStart, const char *BufPtr, const char *BufEnd) { - InitCharacterInfo(); + InitCharacterInfo(Features); BufferStart = BufStart; BufferPtr = BufPtr; @@ -253,7 +253,7 @@ enum { // 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 @@ static const unsigned char CharInfo[256] = 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 @@ static void InitCharacterInfo() { } 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; } |