aboutsummaryrefslogtreecommitdiff
path: root/lib/Lex/Lexer.cpp
diff options
context:
space:
mode:
authorBenjamin Kramer <benny.kra@googlemail.com>2010-03-16 14:14:31 +0000
committerBenjamin Kramer <benny.kra@googlemail.com>2010-03-16 14:14:31 +0000
commitf6ac97b101c8840efa92bf29166077ce4049e293 (patch)
treeae3c4bd11598f49ee678e6fba5a3e2df38d24427 /lib/Lex/Lexer.cpp
parentc506357c3778092c2a3251243f12524e8eb89274 (diff)
Let SourceManager::getBufferData return StringRef instead of a pair of two const char*.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@98630 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Lex/Lexer.cpp')
-rw-r--r--lib/Lex/Lexer.cpp9
1 files changed, 4 insertions, 5 deletions
diff --git a/lib/Lex/Lexer.cpp b/lib/Lex/Lexer.cpp
index d311b7e5dd..6cdb96f37d 100644
--- a/lib/Lex/Lexer.cpp
+++ b/lib/Lex/Lexer.cpp
@@ -230,18 +230,17 @@ unsigned Lexer::MeasureTokenLength(SourceLocation Loc,
Loc = SM.getInstantiationLoc(Loc);
std::pair<FileID, unsigned> LocInfo = SM.getDecomposedLoc(Loc);
bool Invalid = false;
- std::pair<const char *,const char *> Buffer = SM.getBufferData(LocInfo.first,
- &Invalid);
+ llvm::StringRef Buffer = SM.getBufferData(LocInfo.first, &Invalid);
if (Invalid)
return 0;
-
- const char *StrData = Buffer.first+LocInfo.second;
+
+ const char *StrData = Buffer.data()+LocInfo.second;
if (isWhitespace(StrData[0]))
return 0;
// Create a lexer starting at the beginning of this token.
- Lexer TheLexer(Loc, LangOpts, Buffer.first, StrData, Buffer.second);
+ Lexer TheLexer(Loc, LangOpts, Buffer.begin(), StrData, Buffer.end());
TheLexer.SetCommentRetentionState(true);
Token TheTok;
TheLexer.LexFromRawLexer(TheTok);