aboutsummaryrefslogtreecommitdiff
path: root/lib/Lex/Lexer.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'lib/Lex/Lexer.cpp')
-rw-r--r--lib/Lex/Lexer.cpp2
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;