diff options
author | Chris Lattner <sabre@nondot.org> | 2009-01-17 08:30:10 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2009-01-17 08:30:10 +0000 |
commit | 5509d533f6843a977e8f11819b747f6cd09f3273 (patch) | |
tree | 9b77dc7eb548c74b19576cdb659fc113ac0f3f2c /clang/lib/Lex/Lexer.cpp | |
parent | 757169b60f5ee7ee6ec22bd13e0d8d05a4548565 (diff) | |
download | bcm5719-llvm-5509d533f6843a977e8f11819b747f6cd09f3273.tar.gz bcm5719-llvm-5509d533f6843a977e8f11819b747f6cd09f3273.zip |
simplify some lookups.
llvm-svn: 62426
Diffstat (limited to 'clang/lib/Lex/Lexer.cpp')
-rw-r--r-- | clang/lib/Lex/Lexer.cpp | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/clang/lib/Lex/Lexer.cpp b/clang/lib/Lex/Lexer.cpp index e6c3056547b..90785b5e193 100644 --- a/clang/lib/Lex/Lexer.cpp +++ b/clang/lib/Lex/Lexer.cpp @@ -216,15 +216,15 @@ unsigned Lexer::MeasureTokenLength(SourceLocation Loc, // the token this macro expanded to. Loc = SM.getInstantiationLoc(Loc); - const char *StrData = SM.getCharacterData(Loc); - // TODO: this could be special cased for common tokens like identifiers, ')', // etc to make this faster, if it mattered. Just look at StrData[0] to handle // all obviously single-char tokens. This could use // Lexer::isObviouslySimpleCharacter for example to handle identifiers or // something. - std::pair<const char *,const char *> Buffer = SM.getBufferData(Loc); - + std::pair<FileID, unsigned> LocInfo = SM.getDecomposedFileLoc(Loc); + std::pair<const char *,const char *> Buffer = SM.getBufferData(LocInfo.first); + const char *StrData = Buffer.first+LocInfo.second; + // Create a langops struct and enable trigraphs. This is sufficient for // measuring tokens. LangOptions LangOpts; |