Delete various lldb FileSystem functions.

Use LLVM's equivalent versions instead.

Differential Revision: https://reviews.llvm.org/D31111

llvm-svn: 298334
This commit is contained in:
Zachary Turner
2017-03-21 04:01:04 +00:00
parent ab2dae0a9c
commit bfe8bcbc43
12 changed files with 39 additions and 224 deletions

View File

@@ -13,7 +13,6 @@
#include "lldb/Core/ModuleList.h"
#include "lldb/Core/ModuleSpec.h"
#include "lldb/Host/File.h"
#include "lldb/Host/FileSystem.h"
#include "lldb/Host/LockFile.h"
#include "lldb/Utility/Log.h"
#include "llvm/Support/FileSystem.h"
@@ -101,11 +100,12 @@ void DeleteExistingModule(const FileSpec &root_dir_spec,
module_uuid.GetAsString().c_str(), error.AsCString());
}
auto link_count = FileSystem::GetHardlinkCount(sysroot_module_path_spec);
if (link_count == -1)
namespace fs = llvm::sys::fs;
fs::file_status st;
if (status(sysroot_module_path_spec.GetPath(), st))
return;
if (link_count > 2) // module is referred by other hosts.
if (st.getLinkCount() > 2) // module is referred by other hosts.
return;
const auto module_spec_dir = GetModuleDirectory(root_dir_spec, module_uuid);
@@ -119,11 +119,10 @@ void DecrementRefExistingModule(const FileSpec &root_dir_spec,
DeleteExistingModule(root_dir_spec, sysroot_module_path_spec);
// Remove sysroot link.
FileSystem::Unlink(sysroot_module_path_spec);
llvm::sys::fs::remove(sysroot_module_path_spec.GetPath());
FileSpec symfile_spec = GetSymbolFileSpec(sysroot_module_path_spec);
if (symfile_spec.Exists()) // delete module's symbol file if exists.
FileSystem::Unlink(symfile_spec);
llvm::sys::fs::remove(symfile_spec.GetPath());
}
Error CreateHostSysRootModuleLink(const FileSpec &root_dir_spec,
@@ -146,7 +145,8 @@ Error CreateHostSysRootModuleLink(const FileSpec &root_dir_spec,
if (error.Fail())
return error;
return FileSystem::Hardlink(sysroot_module_path_spec, local_module_spec);
return llvm::sys::fs::create_hard_link(local_module_spec.GetPath(),
sysroot_module_path_spec.GetPath());
}
} // namespace
@@ -179,7 +179,7 @@ void ModuleLock::Delete() {
return;
m_file.Close();
FileSystem::Unlink(m_file_spec);
llvm::sys::fs::remove(m_file_spec.GetPath());
}
/////////////////////////////////////////////////////////////////////////