From 1408bf7231c22bce70fea5470a865955ee40399b Mon Sep 17 00:00:00 2001 From: Pavel Labath Date: Tue, 1 Nov 2016 16:11:14 +0000 Subject: Remove TimeValue usage from FileSpec.h Summary: The only usage there was in GetModificationTime(). I also took the opportunity to move this function from FileSpec to the FileSystem class - since we are using FileSpecs to also represent remote files for which we cannot (easily) retrieve modification time, it makes sense to make the decision to get the modification time more explicit. The new function returns a llvm::sys::TimePoint<>. To aid the transition from TimeValue, I have added a constructor to it which enables implicit conversion from a time_point. Reviewers: zturner, clayborg Subscribers: mehdi_amini, tberghammer, danalbert, beanz, mgorny, lldb-commits Differential Revision: https://reviews.llvm.org/D25392 llvm-svn: 285702 --- lldb/source/Host/common/FileSystem.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'lldb/source/Host/common/FileSystem.cpp') diff --git a/lldb/source/Host/common/FileSystem.cpp b/lldb/source/Host/common/FileSystem.cpp index c865bf3b3e0..88f29b46f36 100644 --- a/lldb/source/Host/common/FileSystem.cpp +++ b/lldb/source/Host/common/FileSystem.cpp @@ -9,6 +9,7 @@ #include "lldb/Host/FileSystem.h" +#include "llvm/Support/FileSystem.h" #include "llvm/Support/MD5.h" #include @@ -90,3 +91,12 @@ bool FileSystem::CalculateMD5AsString(const FileSpec &file_spec, digest_str = result_str.c_str(); return true; } + +llvm::sys::TimePoint<> +FileSystem::GetModificationTime(const FileSpec &file_spec) { + llvm::sys::fs::file_status status; + std::error_code ec = llvm::sys::fs::status(file_spec.GetPath(), status); + if (ec) + return llvm::sys::TimePoint<>(); + return status.getLastModificationTime(); +} -- cgit v1.2.3