summaryrefslogtreecommitdiffstats
path: root/clang/lib/Lex/Lexer.cpp
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2008-04-11 16:20:41 +0000
committerChris Lattner <sabre@nondot.org>2008-04-11 16:20:41 +0000
commit9b7206eb4f10fc70fca34935d760eecf6a567243 (patch)
tree0b0e087a90797b610ea49391ccf6d7d698b3752d /clang/lib/Lex/Lexer.cpp
parent703ae9624b31fa44e3c4b8292d96dfb51b24c15f (diff)
downloadbcm5719-llvm-9b7206eb4f10fc70fca34935d760eecf6a567243.tar.gz
bcm5719-llvm-9b7206eb4f10fc70fca34935d760eecf6a567243.zip
don't read off the front of the buffer. Thanks to Sam for pointing this out.
llvm-svn: 49535
Diffstat (limited to 'clang/lib/Lex/Lexer.cpp')
-rw-r--r--clang/lib/Lex/Lexer.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/clang/lib/Lex/Lexer.cpp b/clang/lib/Lex/Lexer.cpp
index 98bbb386305..e3daf312671 100644
--- a/clang/lib/Lex/Lexer.cpp
+++ b/clang/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;
OpenPOWER on IntegriCloud