stringref'ize API


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@119997 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Basic/FileManager.cpp b/lib/Basic/FileManager.cpp
index ff07c79..e5ec545 100644
--- a/lib/Basic/FileManager.cpp
+++ b/lib/Basic/FileManager.cpp
@@ -385,20 +385,27 @@
   return UFE;
 }
 
-llvm::MemoryBuffer *FileManager::
-getBufferForFile(const char *FilenameStart, const char *FilenameEnd,
-                 const FileSystemOptions &FileSystemOpts,
-                 std::string *ErrorStr,
-                 int64_t FileSize,
-                 struct stat *FileInfo) {
-  assert(FilenameEnd[0] == 0);
-  if (FileSystemOpts.WorkingDir.empty())
-    return llvm::MemoryBuffer::getFile(FilenameStart, ErrorStr,
-                                       FileSize, FileInfo);
-  llvm::sys::Path FilePath(llvm::StringRef(FilenameStart,
-                                           FilenameEnd-FilenameStart));
-  FixupRelativePath(FilePath, FileSystemOpts);
+void FileManager::FixupRelativePath(llvm::sys::Path &path,
+                                    const FileSystemOptions &FSOpts) {
+  if (FSOpts.WorkingDir.empty() || path.isAbsolute()) return;
+  
+  llvm::sys::Path NewPath(FSOpts.WorkingDir);
+  NewPath.appendComponent(path.str());
+  path = NewPath;
+}
 
+
+
+llvm::MemoryBuffer *FileManager::
+getBufferForFile(llvm::StringRef Filename,
+                 const FileSystemOptions &FileSystemOpts,
+                 std::string *ErrorStr, int64_t FileSize,
+                 struct stat *FileInfo) {
+  if (FileSystemOpts.WorkingDir.empty())
+    return llvm::MemoryBuffer::getFile(Filename, ErrorStr, FileSize, FileInfo);
+  
+  llvm::sys::Path FilePath(Filename);
+  FixupRelativePath(FilePath, FileSystemOpts);
   return llvm::MemoryBuffer::getFile(FilePath.c_str(), ErrorStr,
                                      FileSize, FileInfo);
 }
@@ -415,15 +422,6 @@
                          : stat(FilePath.c_str(), buf);
 }
 
-void FileManager::FixupRelativePath(llvm::sys::Path &path,
-                                    const FileSystemOptions &FSOpts) {
-  if (!FSOpts.WorkingDir.empty() && !path.isAbsolute()) {
-    llvm::sys::Path NewPath(FSOpts.WorkingDir);
-    NewPath.appendComponent(path.str());
-    path = NewPath;
-  }
-}
-
 void FileManager::PrintStats() const {
   llvm::errs() << "\n*** File Manager Stats:\n";
   llvm::errs() << UniqueFiles.size() << " files found, "