summaryrefslogtreecommitdiffstats
path: root/clang
diff options
context:
space:
mode:
Diffstat (limited to 'clang')
-rw-r--r--clang/Lex/Lexer.cpp8
-rw-r--r--clang/include/clang/Lex/Lexer.h6
2 files changed, 7 insertions, 7 deletions
diff --git a/clang/Lex/Lexer.cpp b/clang/Lex/Lexer.cpp
index 27cc29b2e2b..417d1d8d376 100644
--- a/clang/Lex/Lexer.cpp
+++ b/clang/Lex/Lexer.cpp
@@ -452,7 +452,7 @@ void Lexer::LexStringLiteral(LexerToken &Result, const char *CurPtr) {
C = getAndAdvanceChar(CurPtr, Result);
} else if (C == '\n' || C == '\r' || // Newline.
(C == 0 && CurPtr-1 == BufferEnd)) { // End of file.
- Diag(BufferPtr, diag::err_unterminated_string);
+ if (!LexingRawMode) Diag(BufferPtr, diag::err_unterminated_string);
Result.SetKind(tok::unknown);
FormTokenWithChars(Result, CurPtr-1);
return;
@@ -484,7 +484,7 @@ void Lexer::LexAngledStringLiteral(LexerToken &Result, const char *CurPtr) {
C = getAndAdvanceChar(CurPtr, Result);
} else if (C == '\n' || C == '\r' || // Newline.
(C == 0 && CurPtr-1 == BufferEnd)) { // End of file.
- Diag(BufferPtr, diag::err_unterminated_string);
+ if (!LexingRawMode) Diag(BufferPtr, diag::err_unterminated_string);
Result.SetKind(tok::unknown);
FormTokenWithChars(Result, CurPtr-1);
return;
@@ -512,7 +512,7 @@ void Lexer::LexCharConstant(LexerToken &Result, const char *CurPtr) {
// Handle the common case of 'x' and '\y' efficiently.
char C = getAndAdvanceChar(CurPtr, Result);
if (C == '\'') {
- Diag(BufferPtr, diag::err_empty_character);
+ if (!LexingRawMode) Diag(BufferPtr, diag::err_empty_character);
Result.SetKind(tok::unknown);
FormTokenWithChars(Result, CurPtr);
return;
@@ -533,7 +533,7 @@ void Lexer::LexCharConstant(LexerToken &Result, const char *CurPtr) {
C = getAndAdvanceChar(CurPtr, Result);
} else if (C == '\n' || C == '\r' || // Newline.
(C == 0 && CurPtr-1 == BufferEnd)) { // End of file.
- Diag(BufferPtr, diag::err_unterminated_char);
+ if (!LexingRawMode) Diag(BufferPtr, diag::err_unterminated_char);
Result.SetKind(tok::unknown);
FormTokenWithChars(Result, CurPtr-1);
return;
diff --git a/clang/include/clang/Lex/Lexer.h b/clang/include/clang/Lex/Lexer.h
index 4fe8cda50b8..fb337db1756 100644
--- a/clang/include/clang/Lex/Lexer.h
+++ b/clang/include/clang/Lex/Lexer.h
@@ -82,9 +82,9 @@ class Lexer {
/// effect of this, implicit macro expansion is naturally disabled.
/// 3. "#" tokens at the start of a line are treated as normal tokens, not
/// implicitly transformed by the lexer.
- /// 4. All notes, warnings, and extension messages are disabled.
- /// 5. The only callback made into the preprocessor is to report hard errors.
- ///
+ /// 4. All diagnostic messages are disabled, except for unterminated /*.
+ /// 5. The only callback made into the preprocessor is to report a hard error
+ /// on an unterminated '/*' comment.
bool LexingRawMode;
//===--------------------------------------------------------------------===//
OpenPOWER on IntegriCloud