summaryrefslogtreecommitdiffstats
path: root/clang/lib/Lex
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
commiteb92dc0b09262ed29149bf4faaa74a38df738cec (patch)
tree89b03c6567597b8a33fba0e7e446cd55fe674d9a /clang/lib/Lex
parent0eb690390d35371c791d4076bdac973643f0de41 (diff)
downloadbcm5719-llvm-eb92dc0b09262ed29149bf4faaa74a38df738cec.tar.gz
bcm5719-llvm-eb92dc0b09262ed29149bf4faaa74a38df738cec.zip
Let SourceManager::getBufferData return StringRef instead of a pair of two const char*.
llvm-svn: 98630
Diffstat (limited to 'clang/lib/Lex')
-rw-r--r--clang/lib/Lex/Lexer.cpp9
-rw-r--r--clang/lib/Lex/TokenLexer.cpp2
2 files changed, 5 insertions, 6 deletions
diff --git a/clang/lib/Lex/Lexer.cpp b/clang/lib/Lex/Lexer.cpp
index d311b7e5ddc..6cdb96f37de 100644
--- a/clang/lib/Lex/Lexer.cpp
+++ b/clang/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);
diff --git a/clang/lib/Lex/TokenLexer.cpp b/clang/lib/Lex/TokenLexer.cpp
index 8f687655430..dbd1b8400de 100644
--- a/clang/lib/Lex/TokenLexer.cpp
+++ b/clang/lib/Lex/TokenLexer.cpp
@@ -441,7 +441,7 @@ bool TokenLexer::PasteTokens(Token &Tok) {
bool Invalid = false;
const char *ScratchBufStart
- = SourceMgr.getBufferData(LocFileID, &Invalid).first;
+ = SourceMgr.getBufferData(LocFileID, &Invalid).data();
if (Invalid)
return false;
OpenPOWER on IntegriCloud