diff options
author | Chris Lattner <sabre@nondot.org> | 2010-11-17 06:55:10 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2010-11-17 06:55:10 +0000 |
commit | b1ab2c2d3de3a4d027cc40a00f17a90431145d7b (patch) | |
tree | 47752ec89c5bab0cdde770dd2d3a11f99782f4d4 /clang/lib/Lex/Preprocessor.cpp | |
parent | bde1b81eb8550bb61c0c6600882ca9f8100e2d3d (diff) | |
download | bcm5719-llvm-b1ab2c2d3de3a4d027cc40a00f17a90431145d7b.tar.gz bcm5719-llvm-b1ab2c2d3de3a4d027cc40a00f17a90431145d7b.zip |
add a static version of PP::AdvanceToTokenCharacter.
llvm-svn: 119472
Diffstat (limited to 'clang/lib/Lex/Preprocessor.cpp')
-rw-r--r-- | clang/lib/Lex/Preprocessor.cpp | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/clang/lib/Lex/Preprocessor.cpp b/clang/lib/Lex/Preprocessor.cpp index e9b854306aa..332c95679b5 100644 --- a/clang/lib/Lex/Preprocessor.cpp +++ b/clang/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, |