aboutsummaryrefslogtreecommitdiff
path: root/lib/Lex/Preprocessor.cpp
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2010-11-17 06:55:10 +0000
committerChris Lattner <sabre@nondot.org>2010-11-17 06:55:10 +0000
commit872a45e91778eb0b706ff57272fe547d4512eb19 (patch)
tree3c74b8560bd9ce02c0b9d77da1ad385ecab3a4d7 /lib/Lex/Preprocessor.cpp
parent6c66f07854c1334a1ce9eae1428d61d54182a6e1 (diff)
add a static version of PP::AdvanceToTokenCharacter.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@119472 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Lex/Preprocessor.cpp')
-rw-r--r--lib/Lex/Preprocessor.cpp13
1 files changed, 8 insertions, 5 deletions
diff --git a/lib/Lex/Preprocessor.cpp b/lib/Lex/Preprocessor.cpp
index e9b854306a..332c95679b 100644
--- a/lib/Lex/Preprocessor.cpp
+++ b/lib/Lex/Preprocessor.cpp
@@ -431,13 +431,14 @@ void Preprocessor::CreateString(const char *Buf, unsigned Len, Token &Tok,
/// AdvanceToTokenCharacter - Given a location that specifies the start of a
/// token, return a new location that specifies a character within the token.
-SourceLocation Preprocessor::AdvanceToTokenCharacter(SourceLocation TokStart,
- unsigned CharNo) {
+FullSourceLoc Preprocessor::AdvanceToTokenCharacter(FullSourceLoc TokStart,
+ unsigned CharNo,
+ const LangOptions &Features) {
// Figure out how many physical characters away the specified instantiation
// character is. This needs to take into consideration newlines and
// trigraphs.
bool Invalid = false;
- const char *TokPtr = SourceMgr.getCharacterData(TokStart, &Invalid);
+ const char *TokPtr = TokStart.getCharacterData(&Invalid);
// If they request the first char of the token, we're trivially done.
if (Invalid || (CharNo == 0 && Lexer::isObviouslySimpleCharacter(*TokPtr)))
@@ -450,7 +451,8 @@ SourceLocation Preprocessor::AdvanceToTokenCharacter(SourceLocation TokStart,
// chars, this method is extremely fast.
while (Lexer::isObviouslySimpleCharacter(*TokPtr)) {
if (CharNo == 0)
- return TokStart.getFileLocWithOffset(PhysOffset);
+ return FullSourceLoc(TokStart.getFileLocWithOffset(PhysOffset),
+ TokStart.getManager());
++TokPtr, --CharNo, ++PhysOffset;
}
@@ -470,7 +472,8 @@ SourceLocation Preprocessor::AdvanceToTokenCharacter(SourceLocation TokStart,
if (!Lexer::isObviouslySimpleCharacter(*TokPtr))
PhysOffset += Lexer::SkipEscapedNewLines(TokPtr)-TokPtr;
- return TokStart.getFileLocWithOffset(PhysOffset);
+ return FullSourceLoc(TokStart.getFileLocWithOffset(PhysOffset),
+ TokStart.getManager());
}
SourceLocation Preprocessor::getLocForEndOfToken(SourceLocation Loc,