Author: labath Date: Wed Nov 9 08:04:08 2016 New Revision: 286366 URL: http://llvm.org/viewvc/llvm-project?rev=286366&view=rev Log: Remove TimeValue usage from lldb/Core. NFC.
Modified: lldb/trunk/include/lldb/Core/ModuleSpec.h lldb/trunk/include/lldb/Core/SourceManager.h lldb/trunk/source/Core/ModuleList.cpp lldb/trunk/source/Core/SourceManager.cpp lldb/trunk/source/Target/Process.cpp Modified: lldb/trunk/include/lldb/Core/ModuleSpec.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Core/ModuleSpec.h?rev=286366&r1=286365&r2=286366&view=diff ============================================================================== --- lldb/trunk/include/lldb/Core/ModuleSpec.h (original) +++ lldb/trunk/include/lldb/Core/ModuleSpec.h Wed Nov 9 08:04:08 2016 @@ -10,20 +10,21 @@ #ifndef liblldb_ModuleSpec_h_ #define liblldb_ModuleSpec_h_ -// C Includes -// C++ Includes -#include <mutex> -#include <vector> - -// Other libraries and framework includes // Project includes #include "lldb/Core/ArchSpec.h" #include "lldb/Core/Stream.h" #include "lldb/Core/UUID.h" #include "lldb/Host/FileSpec.h" -#include "lldb/Host/TimeValue.h" #include "lldb/Target/PathMappingList.h" +// Other libraries and framework includes +#include "llvm/Support/Chrono.h" + +// C Includes +// C++ Includes +#include <mutex> +#include <vector> + namespace lldb_private { class ModuleSpec { @@ -31,19 +32,17 @@ public: ModuleSpec() : m_file(), m_platform_file(), m_symbol_file(), m_arch(), m_uuid(), m_object_name(), m_object_offset(0), m_object_size(0), - m_object_mod_time(), m_source_mappings() {} + m_source_mappings() {} ModuleSpec(const FileSpec &file_spec) : m_file(file_spec), m_platform_file(), m_symbol_file(), m_arch(), m_uuid(), m_object_name(), m_object_offset(0), - m_object_size(file_spec.GetByteSize()), m_object_mod_time(), - m_source_mappings() {} + m_object_size(file_spec.GetByteSize()), m_source_mappings() {} ModuleSpec(const FileSpec &file_spec, const ArchSpec &arch) : m_file(file_spec), m_platform_file(), m_symbol_file(), m_arch(arch), m_uuid(), m_object_name(), m_object_offset(0), - m_object_size(file_spec.GetByteSize()), m_object_mod_time(), - m_source_mappings() {} + m_object_size(file_spec.GetByteSize()), m_source_mappings() {} ModuleSpec(const ModuleSpec &rhs) : m_file(rhs.m_file), m_platform_file(rhs.m_platform_file), @@ -139,9 +138,11 @@ public: void SetObjectSize(uint64_t object_size) { m_object_size = object_size; } - TimeValue &GetObjectModificationTime() { return m_object_mod_time; } + llvm::sys::TimePoint<> &GetObjectModificationTime() { + return m_object_mod_time; + } - const TimeValue &GetObjectModificationTime() const { + const llvm::sys::TimePoint<> &GetObjectModificationTime() const { return m_object_mod_time; } @@ -157,7 +158,7 @@ public: m_object_offset = 0; m_object_size = 0; m_source_mappings.Clear(false); - m_object_mod_time.Clear(); + m_object_mod_time = llvm::sys::TimePoint<>(); } explicit operator bool() const { @@ -175,7 +176,7 @@ public: return true; if (m_object_size) return true; - if (m_object_mod_time.IsValid()) + if (m_object_mod_time != llvm::sys::TimePoint<>()) return true; return false; } @@ -236,11 +237,11 @@ public: strm.Printf("object size = %" PRIu64, m_object_size); dumped_something = true; } - if (m_object_mod_time.IsValid()) { + if (m_object_mod_time != llvm::sys::TimePoint<>()) { if (dumped_something) strm.PutCString(", "); strm.Printf("object_mod_time = 0x%" PRIx64, - m_object_mod_time.GetAsSecondsSinceJan1_1970()); + llvm::sys::toTimeT(m_object_mod_time)); } } @@ -294,7 +295,7 @@ protected: ConstString m_object_name; uint64_t m_object_offset; uint64_t m_object_size; - TimeValue m_object_mod_time; + llvm::sys::TimePoint<> m_object_mod_time; mutable PathMappingList m_source_mappings; }; Modified: lldb/trunk/include/lldb/Core/SourceManager.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Core/SourceManager.h?rev=286366&r1=286365&r2=286366&view=diff ============================================================================== --- lldb/trunk/include/lldb/Core/SourceManager.h (original) +++ lldb/trunk/include/lldb/Core/SourceManager.h Wed Nov 9 08:04:08 2016 @@ -10,18 +10,19 @@ #ifndef liblldb_SourceManager_h_ #define liblldb_SourceManager_h_ +// Project includes +#include "lldb/Host/FileSpec.h" +#include "lldb/lldb-private.h" + +// Other libraries and framework includes +#include "llvm/Support/Chrono.h" + // C Includes // C++ Includes #include <map> #include <memory> #include <vector> -// Other libraries and framework includes -// Project includes -#include "lldb/Host/FileSpec.h" -#include "lldb/Host/TimeValue.h" -#include "lldb/lldb-private.h" - namespace lldb_private { class SourceManager { @@ -71,8 +72,9 @@ public: FileSpec m_file_spec; // The actually file spec being used (if the target // has source mappings, this might be different from // m_file_spec_orig) - TimeValue m_mod_time; // Keep the modification time that this file data is - // valid for + + // Keep the modification time that this file data is valid for + llvm::sys::TimePoint<> m_mod_time; // If the target uses path remappings, be sure to clear our notion of a // source file if the path modification ID changes Modified: lldb/trunk/source/Core/ModuleList.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/ModuleList.cpp?rev=286366&r1=286365&r2=286366&view=diff ============================================================================== --- lldb/trunk/source/Core/ModuleList.cpp (original) +++ lldb/trunk/source/Core/ModuleList.cpp Wed Nov 9 08:04:08 2016 @@ -856,9 +856,9 @@ Error ModuleList::GetSharedModule(const // If we didn't have a UUID in mind when looking for the object file, // then we should make sure the modification time hasn't changed! if (platform_module_spec.GetUUIDPtr() == nullptr) { - TimeValue file_spec_mod_time(FileSystem::GetModificationTime( - located_binary_modulespec.GetFileSpec())); - if (file_spec_mod_time.IsValid()) { + auto file_spec_mod_time = FileSystem::GetModificationTime( + located_binary_modulespec.GetFileSpec()); + if (file_spec_mod_time != llvm::sys::TimePoint<>()) { if (file_spec_mod_time != module_sp->GetModificationTime()) { if (old_module_sp_ptr) *old_module_sp_ptr = module_sp; Modified: lldb/trunk/source/Core/SourceManager.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/SourceManager.cpp?rev=286366&r1=286365&r2=286366&view=diff ============================================================================== --- lldb/trunk/source/Core/SourceManager.cpp (original) +++ lldb/trunk/source/Core/SourceManager.cpp Wed Nov 9 08:04:08 2016 @@ -346,7 +346,7 @@ SourceManager::File::File(const FileSpec void SourceManager::File::CommonInitializer(const FileSpec &file_spec, Target *target) { - if (!m_mod_time.IsValid()) { + if (m_mod_time == llvm::sys::TimePoint<>()) { if (target) { m_source_map_mod_id = target->GetSourcePathMap().GetModificationID(); @@ -403,7 +403,7 @@ void SourceManager::File::CommonInitiali } } - if (m_mod_time.IsValid()) + if (m_mod_time != llvm::sys::TimePoint<>()) m_data_sp = m_file_spec.ReadFileContents(); } @@ -477,9 +477,10 @@ void SourceManager::File::UpdateIfNeeded // TODO: use host API to sign up for file modifications to anything in our // source cache and only update when we determine a file has been updated. // For now we check each time we want to display info for the file. - TimeValue curr_mod_time(FileSystem::GetModificationTime(m_file_spec)); + auto curr_mod_time = FileSystem::GetModificationTime(m_file_spec); - if (curr_mod_time.IsValid() && m_mod_time != curr_mod_time) { + if (curr_mod_time != llvm::sys::TimePoint<>() && + m_mod_time != curr_mod_time) { m_mod_time = curr_mod_time; m_data_sp = m_file_spec.ReadFileContents(); m_offsets.clear(); @@ -602,18 +603,9 @@ bool SourceManager::File::FileSpecMatche bool lldb_private::operator==(const SourceManager::File &lhs, const SourceManager::File &rhs) { - if (lhs.m_file_spec == rhs.m_file_spec) { - if (lhs.m_mod_time.IsValid()) { - if (rhs.m_mod_time.IsValid()) - return lhs.m_mod_time == rhs.m_mod_time; - else - return false; - } else if (rhs.m_mod_time.IsValid()) - return false; - else - return true; - } else + if (lhs.m_file_spec != rhs.m_file_spec) return false; + return lhs.m_mod_time == rhs.m_mod_time; } bool SourceManager::File::CalculateLineOffsets(uint32_t line) { Modified: lldb/trunk/source/Target/Process.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/Process.cpp?rev=286366&r1=286365&r2=286366&view=diff ============================================================================== --- lldb/trunk/source/Target/Process.cpp (original) +++ lldb/trunk/source/Target/Process.cpp Wed Nov 9 08:04:08 2016 @@ -35,6 +35,7 @@ #include "lldb/Host/Pipe.h" #include "lldb/Host/Terminal.h" #include "lldb/Host/ThreadLauncher.h" +#include "lldb/Host/TimeValue.h" #include "lldb/Interpreter/CommandInterpreter.h" #include "lldb/Interpreter/OptionValueProperties.h" #include "lldb/Symbol/Function.h" _______________________________________________ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits