diff options
author | Chris Lattner <sabre@nondot.org> | 2009-01-17 07:57:25 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2009-01-17 07:57:25 +0000 |
commit | 28c90ad7ef7c609a0b10c2f68b519ef69e7084d1 (patch) | |
tree | 515d44992ff6c9c26fc47658251b1b51d4a7cc2e /lib/Lex/Preprocessor.cpp | |
parent | 0770dabb1ae81a2a9c2e7199262067103062a0b3 (diff) |
in Preprocessor::AdvanceToTokenCharacter, don't actually bother
creating a whole lexer when we just want one static method.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@62420 91177308-0d34-0410-b5e6-96231b3b80d8
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); |