[cfe-commits] r38703 - in /cfe/cfe/trunk: Lex/Lexer.cpp include/clang/Basic/DiagnosticKinds.def

sabre at cs.uiuc.edu sabre at cs.uiuc.edu
Wed Jul 11 09:23:57 PDT 2007


Author: sabre
Date: Wed Jul 11 11:23:57 2007
New Revision: 38703

URL: http://llvm.org/viewvc/llvm-project?rev=38703&view=rev
Log:
The lexer should not warn about stray characters, it should just return
tok::unknown tokens.  This fixes test/Lexer/unknown-char.c

Modified:
    cfe/cfe/trunk/Lex/Lexer.cpp
    cfe/cfe/trunk/include/clang/Basic/DiagnosticKinds.def

Modified: cfe/cfe/trunk/Lex/Lexer.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/cfe/trunk/Lex/Lexer.cpp?rev=38703&r1=38702&r2=38703&view=diff

==============================================================================
--- cfe/cfe/trunk/Lex/Lexer.cpp (original)
+++ cfe/cfe/trunk/Lex/Lexer.cpp Wed Jul 11 11:23:57 2007
@@ -1394,9 +1394,8 @@
       return LexIdentifier(Result, CurPtr);
     }
     
-    if (!LexingRawMode) Diag(CurPtr-1, diag::err_stray_character);
-    BufferPtr = CurPtr;
-    goto LexNextToken;   // GCC isn't tail call eliminating.
+    Result.SetKind(tok::unknown);
+    break;
   }
   
   // Notify MIOpt that we read a non-whitespace/non-comment token.

Modified: cfe/cfe/trunk/include/clang/Basic/DiagnosticKinds.def
URL: http://llvm.org/viewvc/llvm-project/cfe/cfe/trunk/include/clang/Basic/DiagnosticKinds.def?rev=38703&r1=38702&r2=38703&view=diff

==============================================================================
--- cfe/cfe/trunk/include/clang/Basic/DiagnosticKinds.def (original)
+++ cfe/cfe/trunk/include/clang/Basic/DiagnosticKinds.def Wed Jul 11 11:23:57 2007
@@ -71,8 +71,6 @@
      "empty character constant")
 DIAG(err_unterminated_block_comment, ERROR,
      "unterminated /* comment")
-DIAG(err_stray_character, ERROR,
-     "stray character in program")
 
 //===----------------------------------------------------------------------===//
 // Preprocessor Diagnostics





More information about the cfe-commits mailing list