diff options
author | Chris Lattner <sabre@nondot.org> | 2008-04-11 16:20:41 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2008-04-11 16:20:41 +0000 |
commit | 8fa3078cfe8b25fe8450e7d31dc5500b5888b95e (patch) | |
tree | 40b00f3f6179706b62fa2c11800dd930614318fa /lib/Lex/Lexer.cpp | |
parent | bb45c512e0dfbe96bfe377ac642e726c0ba0affa (diff) |
don't read off the front of the buffer. Thanks to Sam for pointing this out.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@49535 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Lex/Lexer.cpp')
-rw-r--r-- | lib/Lex/Lexer.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/Lex/Lexer.cpp b/lib/Lex/Lexer.cpp index 98bbb38630..e3daf31267 100644 --- a/lib/Lex/Lexer.cpp +++ b/lib/Lex/Lexer.cpp @@ -1142,7 +1142,7 @@ bool Lexer::LexEndOfFile(Token &Result, const char *CurPtr) { } // 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; |