[PATCH] Don't warn about Unicode characters in -E mode

Jordan Rose jordan_rose at apple.com
Tue Jan 29 16:12:42 PST 2013



================
Comment at: lib/Lex/Lexer.cpp:2836
@@ -2836,1 +2835,3 @@
+  if (!isASCII(*BufferPtr) && !isAllowedIDChar(C) &&
+      (isLexingRawMode() || !PP->isPreprocessedOutput())) {
     // Non-ASCII characters tend to creep into source code unintentionally.
----------------
Richard Smith wrote:
> Jordan Rose wrote:
> > Richard Smith wrote:
> > > Do you need the isLexingRawMode() check here? I guess it doesn't matter if we drop the non-ASCII characters in that case?
> > It's about the right behavior when raw-lexing without a preprocessor. I'm not sure what "the right behavior" is, though.
> I think if we're in -E mode we should keep all characters (and leave removing bad characters to whatever downstream process handles the file next), and I think it also makes sense to preserve them if we're in raw mode, so perhaps the check should be
> ##  if (... &&
>       !isLexingRawMode && !PP->isPreprocessedOutput())
> ##
Okay, sounds reasonable.


http://llvm-reviews.chandlerc.com/D346



More information about the cfe-commits mailing list