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
diff --git a/lib/Lex/Preprocessor.cpp b/lib/Lex/Preprocessor.cpp
index ff84b0a..54c1748 100644
--- a/lib/Lex/Preprocessor.cpp
+++ b/lib/Lex/Preprocessor.cpp
@@ -320,18 +320,16 @@
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);