From 8ddb5cf0cf14a07531cfb4ec86661612d9ac6875 Mon Sep 17 00:00:00 2001 From: Chris Lattner Date: Sat, 17 Jan 2009 07:57:25 +0000 Subject: in Preprocessor::AdvanceToTokenCharacter, don't actually bother creating a whole lexer when we just want one static method. llvm-svn: 62420 --- clang/lib/Lex/Preprocessor.cpp | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) (limited to 'clang/lib/Lex/Preprocessor.cpp') diff --git a/clang/lib/Lex/Preprocessor.cpp b/clang/lib/Lex/Preprocessor.cpp index ff84b0abf36..54c17488c85 100644 --- a/clang/lib/Lex/Preprocessor.cpp +++ b/clang/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); -- cgit v1.2.3