summaryrefslogtreecommitdiffstats
path: root/clang/lib/Lex/Preprocessor.cpp
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2009-01-17 07:57:25 +0000
committerChris Lattner <sabre@nondot.org>2009-01-17 07:57:25 +0000
commit8ddb5cf0cf14a07531cfb4ec86661612d9ac6875 (patch)
tree907740dbf5326a5919da3a36645b27cdf433000d /clang/lib/Lex/Preprocessor.cpp
parent5965a28a4b7a5ba204c045297097da1f925eb285 (diff)
downloadbcm5719-llvm-8ddb5cf0cf14a07531cfb4ec86661612d9ac6875.tar.gz
bcm5719-llvm-8ddb5cf0cf14a07531cfb4ec86661612d9ac6875.zip
in Preprocessor::AdvanceToTokenCharacter, don't actually bother
creating a whole lexer when we just want one static method. llvm-svn: 62420
Diffstat (limited to 'clang/lib/Lex/Preprocessor.cpp')
-rw-r--r--clang/lib/Lex/Preprocessor.cpp16
1 files changed, 7 insertions, 9 deletions
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);
OpenPOWER on IntegriCloud