diff options
author | Chris Lattner <sabre@nondot.org> | 2008-10-12 01:31:51 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2008-10-12 01:31:51 +0000 |
commit | 0af574270d3be2b0e73a3379dfaa633746f8fc6f (patch) | |
tree | 0def8a7acb239a0455748576f9eb7985e3f17116 /lib/Lex/Lexer.cpp | |
parent | 8527b71b1944b155a2bd60ec364d700299bc3ff7 (diff) |
Simplify raw mode lexing by treating an unterminate /**/ comment the
same we we do an unterminated string or character literal. This makes
it so we can guarantee that the lexer never calls into the
preprocessor (which would be suicide for a raw lexer).
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@57395 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Lex/Lexer.cpp')
-rw-r--r-- | lib/Lex/Lexer.cpp | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/lib/Lex/Lexer.cpp b/lib/Lex/Lexer.cpp index 63bf58a12c..44a32dbe25 100644 --- a/lib/Lex/Lexer.cpp +++ b/lib/Lex/Lexer.cpp @@ -931,7 +931,8 @@ bool Lexer::SkipBlockComment(Token &Result, const char *CurPtr) { unsigned char C = getCharAndSize(CurPtr, CharSize); CurPtr += CharSize; if (C == 0 && CurPtr == BufferEnd+1) { - Diag(BufferPtr, diag::err_unterminated_block_comment); + if (!LexingRawMode) + Diag(BufferPtr, diag::err_unterminated_block_comment); BufferPtr = CurPtr-1; return true; } @@ -1000,10 +1001,10 @@ bool Lexer::SkipBlockComment(Token &Result, const char *CurPtr) { // If this is a /* inside of the comment, emit a warning. Don't do this // if this is a /*/, which will end the comment. This misses cases with // embedded escaped newlines, but oh well. - Diag(CurPtr-1, diag::nested_block_comment); + Diag(CurPtr-1, diag::warn_nested_block_comment); } } else if (C == 0 && CurPtr == BufferEnd+1) { - Diag(BufferPtr, diag::err_unterminated_block_comment); + if (!LexingRawMode) Diag(BufferPtr, diag::err_unterminated_block_comment); // Note: the user probably forgot a */. We could continue immediately // after the /*, but this would involve lexing a lot of what really is the // comment, which surely would confuse the parser. |