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
diff --git a/lib/Lex/Lexer.cpp b/lib/Lex/Lexer.cpp
index d311b7e..6cdb96f 100644
--- a/lib/Lex/Lexer.cpp
+++ b/lib/Lex/Lexer.cpp
@@ -230,18 +230,17 @@
   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/lib/Lex/TokenLexer.cpp b/lib/Lex/TokenLexer.cpp
index 8f68765..dbd1b84 100644
--- a/lib/Lex/TokenLexer.cpp
+++ b/lib/Lex/TokenLexer.cpp
@@ -441,7 +441,7 @@
 
       bool Invalid = false;
       const char *ScratchBufStart
-        = SourceMgr.getBufferData(LocFileID, &Invalid).first;
+        = SourceMgr.getBufferData(LocFileID, &Invalid).data();
       if (Invalid)
         return false;