[llvm-branch-commits] [cfe-branch] r80043 - /cfe/branches/Apple/objective-rewrite/tools/clang/lib/Lex/Lexer.cpp

Steve Naroff snaroff at apple.com
Tue Aug 25 15:48:46 PDT 2009


Author: snaroff
Date: Tue Aug 25 17:48:46 2009
New Revision: 80043

URL: http://llvm.org/viewvc/llvm-project?rev=80043&view=rev
Log:
Fix for <rdar://problem/6975290> clang can't digest MAPI headers.

Modified:
    cfe/branches/Apple/objective-rewrite/tools/clang/lib/Lex/Lexer.cpp

Modified: cfe/branches/Apple/objective-rewrite/tools/clang/lib/Lex/Lexer.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/Apple/objective-rewrite/tools/clang/lib/Lex/Lexer.cpp?rev=80043&r1=80042&r2=80043&view=diff

==============================================================================
--- cfe/branches/Apple/objective-rewrite/tools/clang/lib/Lex/Lexer.cpp (original)
+++ cfe/branches/Apple/objective-rewrite/tools/clang/lib/Lex/Lexer.cpp Tue Aug 25 17:48:46 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;
@@ -254,7 +254,7 @@
   CHAR_PERIOD   = 0x20   // .
 };
 
-static void InitCharacterInfo() {
+static void InitCharacterInfo(LangOptions Features) {
   static bool isInited = false;
   if (isInited) return;
   isInited = true;
@@ -265,6 +265,11 @@
   CharInfo[(int)'\f'] = CharInfo[(int)'\v'] = CHAR_HORZ_WS;
   CharInfo[(int)'\n'] = CharInfo[(int)'\r'] = CHAR_VERT_WS;
   
+  if (Features.Microsoft)
+    // Fix for <rdar://problem/6975290> clang can't digest MAPI headers.
+    // This Windows hack treats DOS & CP/M EOF as horizontal whitespace.
+    CharInfo[26/*sub*/] = CHAR_HORZ_WS;
+  
   CharInfo[(int)'_'] = CHAR_UNDER;
   CharInfo[(int)'.'] = CHAR_PERIOD;
   for (unsigned i = 'a'; i <= 'z'; ++i)





More information about the llvm-branch-commits mailing list