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 | 04bc01833e876ab4cec316b2b77be94e61b785b3 (patch) | |
| tree | 4d19bd5a2c4f0d2e44f4b7ed2b2ff308cc18c2bc | |
| parent | a64c1e5452dea9d227276c21e5457ccd30a202c1 (diff) | |
| download | bcm5719-llvm-04bc01833e876ab4cec316b2b77be94e61b785b3.tar.gz bcm5719-llvm-04bc01833e876ab4cec316b2b77be94e61b785b3.zip | |
Integrate the following from the 'objective-rewrite' branch:
http://llvm.org/viewvc/llvm-project?view=rev&revision=80043
llvm-svn: 90860
| -rw-r--r-- | clang/lib/Lex/Lexer.cpp | 13 | ||||
| -rw-r--r-- | clang/test/Lexer/msdos-cpm-eof.c | 5 |
2 files changed, 14 insertions, 4 deletions
diff --git a/clang/lib/Lex/Lexer.cpp b/clang/lib/Lex/Lexer.cpp index 451e1cebfff..dc8609d4efc 100644 --- a/clang/lib/Lex/Lexer.cpp +++ b/clang/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; } diff --git a/clang/test/Lexer/msdos-cpm-eof.c b/clang/test/Lexer/msdos-cpm-eof.c new file mode 100644 index 00000000000..e4dacd9802f --- /dev/null +++ b/clang/test/Lexer/msdos-cpm-eof.c @@ -0,0 +1,5 @@ +// RUN: clang-cc -fsyntax-only -verify -fms-extensions %s + +int a; + + |

