aboutsummaryrefslogtreecommitdiff
path: root/lib/Lex/Lexer.cpp
diff options
context:
space:
mode:
authorMike Stump <mrs@apple.com>2009-04-02 02:29:42 +0000
committerMike Stump <mrs@apple.com>2009-04-02 02:29:42 +0000
commit20d0ee5d23c0f0e879ce1711d11df3118b3fb033 (patch)
tree1a2856f4bd6a6791cb67fe051ca8ddd71ff1c4c3 /lib/Lex/Lexer.cpp
parent75ae2f14f164b44ad6da3e91eb93cd813f8061ce (diff)
A code modification hint for files that don't end in a newline.
Eventually, would be nice to be able to run these modifications even when we don't want the warning or errors for the actual diagnostic. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@68272 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Lex/Lexer.cpp')
-rw-r--r--lib/Lex/Lexer.cpp4
1 files changed, 3 insertions, 1 deletions
diff --git a/lib/Lex/Lexer.cpp b/lib/Lex/Lexer.cpp
index a8a22ebc35..3a3e86a3cf 100644
--- a/lib/Lex/Lexer.cpp
+++ b/lib/Lex/Lexer.cpp
@@ -1224,7 +1224,9 @@ bool Lexer::LexEndOfFile(Token &Result, const char *CurPtr) {
// 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);
+ Diag(BufferEnd, diag::ext_no_newline_eof)
+ << CodeModificationHint::CreateInsertion(getSourceLocation(BufferEnd),
+ "\n");
BufferPtr = CurPtr;