Index: include/clang/Lex/Lexer.h
===================================================================
--- include/clang/Lex/Lexer.h	(revision 112597)
+++ include/clang/Lex/Lexer.h	(working copy)
@@ -404,6 +404,7 @@
   bool SaveBCPLComment       (Token &Result, const char *CurPtr);
   
   bool IsStartOfConflictMarker(const char *CurPtr);
+  bool isHexaLiteral(const char *Start);
   bool HandleEndOfConflictMarker(const char *CurPtr);
 };
 
Index: lib/Lex/Lexer.cpp
===================================================================
--- lib/Lex/Lexer.cpp	(revision 112597)
+++ lib/Lex/Lexer.cpp	(working copy)
@@ -921,13 +921,14 @@
 }
 
 /// isHexaLiteral - Return true if Start points to a hex constant.
-/// FIXME: This isn't correct, it will mislex:
-///     0\       <- escaped newline.
-///     x1234e+1
 /// in microsoft mode (where this is supposed to be several different tokens).
-static inline bool isHexaLiteral(const char *Start, const char *End) {
-  return ((End - Start > 2) && Start[0] == '0' && 
-          (Start[1] == 'x' || Start[1] == 'X'));
+bool Lexer::isHexaLiteral(const char *Start) {
+  unsigned Size;
+  char C1 = getCharAndSize(Start, Size);
+  if (C1 != '0')
+    return false;
+  char C2 = getCharAndSize(Start + Size, Size);
+  return (C2 == 'x' || C2 == 'X');
 }
 
 /// LexNumericConstant - Lex the remainder of a integer or floating point
@@ -947,7 +948,7 @@
   if ((C == '-' || C == '+') && (PrevCh == 'E' || PrevCh == 'e')) {
     // If we are in Microsoft mode, don't continue if the constant is hex.
     // For example, MSVC will accept the following as 3 tokens: 0x1234567e+1
-    if (!Features.Microsoft || !isHexaLiteral(BufferPtr, CurPtr))
+    if (!Features.Microsoft || !isHexaLiteral(BufferPtr))
       return LexNumericConstant(Result, ConsumeChar(CurPtr, Size, Result));
   }
 
Index: test/Lexer/ms-extensions.c
===================================================================
--- test/Lexer/ms-extensions.c	(revision 112597)
+++ test/Lexer/ms-extensions.c	(working copy)
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -fsyntax-only -verify -fms-extensions %s
+// RUN: %clang_cc1 -fsyntax-only -verify -w -fms-extensions %s
 
 __int8 x1  = 3i8;
 __int16 x2 = 4i16;
@@ -30,4 +30,11 @@
   int var2 = 0X1111111e+1;
   int var3 = 0xe+1;
   int var4 = 0XE+1;
+
+  int var5=    0\
+x1234e+1;
+
+  int var6=      0\       
+x1234e+1;                      
 }
+
