[cfe-dev] C++11 newline eof
Seth Cantrell
seth.cantrell at gmail.com
Thu Apr 12 15:40:10 PDT 2012
Please review this patch:
> diff --git a/lib/Lex/Lexer.cpp b/lib/Lex/Lexer.cpp
> index e5d26ff..f27e238 100644
> --- a/lib/Lex/Lexer.cpp
> +++ b/lib/Lex/Lexer.cpp
> @@ -2382,7 +2382,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");
>
>
>
Also, can anyone tell me why when I run clang with -verify and -std=c++11 I get a warning "clang: warning: argument unused during compilation: '-verify'"? I've verified that my patch changes the warnings output from clang based on the -std=c++11 flag, but since -verify doesn't seen work I can't add a working test. Here's a test that should fail but doesn't for me:
-------------- next part --------------
A non-text attachment was scrubbed...
Name: newline-eof-c++11.cpp
Type: application/octet-stream
Size: 183 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20120412/aa2ab3cc/attachment.obj>
More information about the cfe-dev
mailing list