summaryrefslogtreecommitdiffstats
path: root/clang/lib/Lex/Lexer.cpp
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2008-10-12 01:31:51 +0000
committerChris Lattner <sabre@nondot.org>2008-10-12 01:31:51 +0000
commit7c2e9809b12610fcfa6e661bda88cd02f55e093b (patch)
treecde4104cbe0a0bd1bc987ac81aa80a9b686768b4 /clang/lib/Lex/Lexer.cpp
parent6b0c5ad0965ef13e14ee79aaeedec24a5d3ee3e1 (diff)
downloadbcm5719-llvm-7c2e9809b12610fcfa6e661bda88cd02f55e093b.tar.gz
bcm5719-llvm-7c2e9809b12610fcfa6e661bda88cd02f55e093b.zip
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). llvm-svn: 57395
Diffstat (limited to 'clang/lib/Lex/Lexer.cpp')
-rw-r--r--clang/lib/Lex/Lexer.cpp7
1 files changed, 4 insertions, 3 deletions
diff --git a/clang/lib/Lex/Lexer.cpp b/clang/lib/Lex/Lexer.cpp
index 63bf58a12c8..44a32dbe254 100644
--- a/clang/lib/Lex/Lexer.cpp
+++ b/clang/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.
OpenPOWER on IntegriCloud