[cfe-commits] r38751 - in /cfe/cfe/trunk: Lex/Lexer.cpp include/clang/Lex/Lexer.h
sabre at cs.uiuc.edu
sabre at cs.uiuc.edu
Wed Jul 11 09:24:19 PDT 2007
Author: sabre
Date: Wed Jul 11 11:24:19 2007
New Revision: 38751
URL: http://llvm.org/viewvc/llvm-project?rev=38751&view=rev
Log:
disable malformed string/character errors when in raw mode. This fixes
test/Lexer/badstring_in_if0.c
Modified:
cfe/cfe/trunk/Lex/Lexer.cpp
cfe/cfe/trunk/include/clang/Lex/Lexer.h
Modified: cfe/cfe/trunk/Lex/Lexer.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/cfe/trunk/Lex/Lexer.cpp?rev=38751&r1=38750&r2=38751&view=diff
==============================================================================
--- cfe/cfe/trunk/Lex/Lexer.cpp (original)
+++ cfe/cfe/trunk/Lex/Lexer.cpp Wed Jul 11 11:24:19 2007
@@ -452,7 +452,7 @@
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 @@
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 @@
// 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 @@
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;
Modified: cfe/cfe/trunk/include/clang/Lex/Lexer.h
URL: http://llvm.org/viewvc/llvm-project/cfe/cfe/trunk/include/clang/Lex/Lexer.h?rev=38751&r1=38750&r2=38751&view=diff
==============================================================================
--- cfe/cfe/trunk/include/clang/Lex/Lexer.h (original)
+++ cfe/cfe/trunk/include/clang/Lex/Lexer.h Wed Jul 11 11:24:19 2007
@@ -82,9 +82,9 @@
/// 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;
//===--------------------------------------------------------------------===//
More information about the cfe-commits
mailing list