diff options
Diffstat (limited to 'lib/Lex/Preprocessor.cpp')
-rw-r--r-- | lib/Lex/Preprocessor.cpp | 16 |
1 files changed, 7 insertions, 9 deletions
diff --git a/lib/Lex/Preprocessor.cpp b/lib/Lex/Preprocessor.cpp index ff84b0abf3..54c17488c8 100644 --- a/lib/Lex/Preprocessor.cpp +++ b/lib/Lex/Preprocessor.cpp @@ -320,18 +320,16 @@ SourceLocation Preprocessor::AdvanceToTokenCharacter(SourceLocation TokStart, while (CharNo && Lexer::isObviouslySimpleCharacter(*TokPtr)) ++TokPtr, --CharNo, ++PhysOffset; - // If we have a character that may be a trigraph or escaped newline, create a + // If we have a character that may be a trigraph or escaped newline, use a // lexer to parse it correctly. if (CharNo != 0) { - // Create a lexer starting at this token position. - Lexer TheLexer(TokStart, *this, TokPtr); - Token Tok; // Skip over characters the remaining characters. - const char *TokStartPtr = TokPtr; - for (; CharNo; --CharNo) - TheLexer.getAndAdvanceChar(TokPtr, Tok); - - PhysOffset += TokPtr-TokStartPtr; + for (; CharNo; --CharNo) { + unsigned Size; + Lexer::getCharAndSizeNoWarn(TokPtr, Size, Features); + TokPtr += Size; + PhysOffset += Size; + } } return TokStart.getFileLocWithOffset(PhysOffset); |