summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorSeth Cantrell <seth.cantrell@gmail.com>2012-04-13 01:00:34 +0000
committerSeth Cantrell <seth.cantrell@gmail.com>2012-04-13 01:00:34 +0000
commitd55522287e217746996238c6ab206babeec336d5 (patch)
treebb7aa551372132db8ec48737e6ecb9d638616a79 /lib
parent2c39d71bb7cefdfe6116fa52454f3b3dc5abd517 (diff)
C++11 no longer requires files to end with a newline
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@154643 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib')
-rw-r--r--lib/Lex/Lexer.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/lib/Lex/Lexer.cpp b/lib/Lex/Lexer.cpp
index c817e3f105..f0c2c8e4f6 100644
--- a/lib/Lex/Lexer.cpp
+++ b/lib/Lex/Lexer.cpp
@@ -2375,7 +2375,8 @@ 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'))
+ if (CurPtr != BufferStart && (CurPtr[-1] != '\n' && CurPtr[-1] != '\r')
+ && !LangOpts.CPlusPlus0x) // C++11 [lex.phases] 2.2 p2
Diag(BufferEnd, diag::ext_no_newline_eof)
<< FixItHint::CreateInsertion(getSourceLocation(BufferEnd), "\n");