Re-land "Extract construction of DataBufferLLVM into FileSystem"

This fixes some UB in isLocal detected by the sanitized bot.

llvm-svn: 346707
diff --git a/lldb/source/Symbol/ObjectFile.cpp b/lldb/source/Symbol/ObjectFile.cpp
index bd94ec0..d56acd2 100644
--- a/lldb/source/Symbol/ObjectFile.cpp
+++ b/lldb/source/Symbol/ObjectFile.cpp
@@ -19,7 +19,6 @@
 #include "lldb/Target/Target.h"
 #include "lldb/Utility/DataBuffer.h"
 #include "lldb/Utility/DataBufferHeap.h"
-#include "lldb/Utility/DataBufferLLVM.h"
 #include "lldb/Utility/Log.h"
 #include "lldb/Utility/RegularExpression.h"
 #include "lldb/Utility/Timer.h"
@@ -75,8 +74,8 @@
         // container plug-ins can use these bytes to see if they can parse this
         // file.
         if (file_size > 0) {
-          data_sp =
-              DataBufferLLVM::CreateSliceFromPath(file->GetPath(), 512, file_offset);
+          data_sp = FileSystem::Instance().CreateDataBuffer(file->GetPath(),
+                                                            512, file_offset);
           data_offset = 0;
         }
       }
@@ -120,8 +119,8 @@
             }
             // We failed to find any cached object files in the container plug-
             // ins, so lets read the first 512 bytes and try again below...
-            data_sp = DataBufferLLVM::CreateSliceFromPath(archive_file.GetPath(),
-                                                     512, file_offset);
+            data_sp = FileSystem::Instance().CreateDataBuffer(
+                archive_file.GetPath(), 512, file_offset);
           }
         }
       }
@@ -209,7 +208,8 @@
                                            lldb::offset_t file_offset,
                                            lldb::offset_t file_size,
                                            ModuleSpecList &specs) {
-  DataBufferSP data_sp = DataBufferLLVM::CreateSliceFromPath(file.GetPath(), 512, file_offset);
+  DataBufferSP data_sp =
+      FileSystem::Instance().CreateDataBuffer(file.GetPath(), 512, file_offset);
   if (data_sp) {
     if (file_size == 0) {
       const lldb::offset_t actual_file_size =
@@ -682,5 +682,5 @@
 
 DataBufferSP ObjectFile::MapFileData(const FileSpec &file, uint64_t Size,
                                      uint64_t Offset) {
-  return DataBufferLLVM::CreateSliceFromPath(file.GetPath(), Size, Offset);
+  return FileSystem::Instance().CreateDataBuffer(file.GetPath(), Size, Offset);
 }