[cfe-commits] r49535 - /cfe/trunk/lib/Lex/Lexer.cpp

Chris Lattner sabre at nondot.org
Fri Apr 11 09:20:41 PDT 2008


Author: lattner
Date: Fri Apr 11 11:20:41 2008
New Revision: 49535

URL: http://llvm.org/viewvc/llvm-project?rev=49535&view=rev
Log:
don't read off the front of the buffer.  Thanks to Sam for pointing this out.

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=49535&r1=49534&r2=49535&view=diff

==============================================================================
--- cfe/trunk/lib/Lex/Lexer.cpp (original)
+++ cfe/trunk/lib/Lex/Lexer.cpp Fri Apr 11 11:20:41 2008
@@ -1142,7 +1142,7 @@
   }
   
   // If the file was empty or didn't end in a newline, issue a pedwarn.
-  if (CurPtr[-1] != '\n' && CurPtr[-1] != '\r')
+  if (CurPtr == BufferStart || (CurPtr[-1] != '\n' && CurPtr[-1] != '\r'))
     Diag(BufferEnd, diag::ext_no_newline_eof);
   
   BufferPtr = CurPtr;





More information about the cfe-commits mailing list