[FileSystem] Extend file system and have it use the VFS.
This patch extends the FileSystem class with a bunch of functions that are currently implemented as methods of the FileSpec class. These methods will be removed in future commits and replaced by calls to the file system. The new functions are operated in terms of the virtual file system which was recently moved from clang into LLVM so it could be reused in lldb. Because the VFS is stateful, we turned the FileSystem class into a singleton. Differential revision: https://reviews.llvm.org/D53532 llvm-svn: 345783
This commit is contained in:
@@ -171,10 +171,10 @@ Module::Module(const ModuleSpec &module_spec)
|
||||
}
|
||||
|
||||
if (module_spec.GetFileSpec())
|
||||
m_mod_time = FileSystem::GetModificationTime(module_spec.GetFileSpec());
|
||||
m_mod_time = FileSystem::Instance().GetModificationTime(module_spec.GetFileSpec());
|
||||
else if (matching_module_spec.GetFileSpec())
|
||||
m_mod_time =
|
||||
FileSystem::GetModificationTime(matching_module_spec.GetFileSpec());
|
||||
FileSystem::Instance().GetModificationTime(matching_module_spec.GetFileSpec());
|
||||
|
||||
// Copy the architecture from the actual spec if we got one back, else use
|
||||
// the one that was specified
|
||||
@@ -219,7 +219,7 @@ Module::Module(const ModuleSpec &module_spec)
|
||||
Module::Module(const FileSpec &file_spec, const ArchSpec &arch,
|
||||
const ConstString *object_name, lldb::offset_t object_offset,
|
||||
const llvm::sys::TimePoint<> &object_mod_time)
|
||||
: m_mod_time(FileSystem::GetModificationTime(file_spec)), m_arch(arch),
|
||||
: m_mod_time(FileSystem::Instance().GetModificationTime(file_spec)), m_arch(arch),
|
||||
m_file(file_spec), m_object_offset(object_offset),
|
||||
m_object_mod_time(object_mod_time), m_file_has_changed(false),
|
||||
m_first_file_changed_log(false) {
|
||||
@@ -1062,7 +1062,7 @@ void Module::SetFileSpecAndObjectName(const FileSpec &file,
|
||||
// Container objects whose paths do not specify a file directly can call this
|
||||
// function to correct the file and object names.
|
||||
m_file = file;
|
||||
m_mod_time = FileSystem::GetModificationTime(file);
|
||||
m_mod_time = FileSystem::Instance().GetModificationTime(file);
|
||||
m_object_name = object_name;
|
||||
}
|
||||
|
||||
@@ -1125,7 +1125,7 @@ void Module::ReportError(const char *format, ...) {
|
||||
bool Module::FileHasChanged() const {
|
||||
if (!m_file_has_changed)
|
||||
m_file_has_changed =
|
||||
(FileSystem::GetModificationTime(m_file) != m_mod_time);
|
||||
(FileSystem::Instance().GetModificationTime(m_file) != m_mod_time);
|
||||
return m_file_has_changed;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user