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

Chris Lattner sabre at nondot.org
Fri Apr 11 22:54:25 PDT 2008


Author: lattner
Date: Sat Apr 12 00:54:25 2008
New Revision: 49575

URL: http://llvm.org/viewvc/llvm-project?rev=49575&view=rev
Log:
don't diagnose empty source files, thanks Neil!

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=49575&r1=49574&r2=49575&view=diff

==============================================================================
--- cfe/trunk/lib/Lex/Lexer.cpp (original)
+++ cfe/trunk/lib/Lex/Lexer.cpp Sat Apr 12 00:54:25 2008
@@ -1141,8 +1141,9 @@
     ConditionalStack.pop_back();
   }
   
-  // If the file was empty or didn't end in a newline, issue a pedwarn.
-  if (CurPtr == BufferStart || (CurPtr[-1] != '\n' && CurPtr[-1] != '\r'))
+  // C99 5.1.1.2p2: If the file is non-empty and didn't end in a newline, issue
+  // a pedwarn.
+  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