Fix r173881 to properly skip invalid UTF-8 characters in raw lexing and -E.

This caused hangs as we processed the same invalid byte over and over.

<rdar://problem/13115651>

llvm-svn: 173959
This commit is contained in:
Jordan Rose
2013-01-30 19:21:12 +00:00
parent c84d151892
commit f649795f84
2 changed files with 7 additions and 0 deletions

View File

@@ -3538,6 +3538,7 @@ LexNextToken:
return LexUnicode(Result, CodePoint, CurPtr);
if (isLexingRawMode() || PP->isPreprocessedOutput()) {
++CurPtr;
Kind = tok::unknown;
break;
}

View File

@@ -1,6 +1,12 @@
// RUN: %clang_cc1 -fsyntax-only -verify %s
// RUN: %clang_cc1 -E %s -o /dev/null
// Note: this file contains invalid UTF-8 before the variable name in the
// next line. Please do not fix!
extern int x; // expected-error{{source file is not valid UTF-8}}
#if 0
// Don't warn about bad UTF-8 in raw lexing mode.
extern int x;
#endif