[Lldb-commits] [lldb] r286373 - Remove TimeValue usage from ObjectContainerBSDArchive
Pavel Labath via lldb-commits
lldb-commits at lists.llvm.org
Wed Nov 9 07:05:46 PST 2016
Author: labath
Date: Wed Nov 9 09:05:45 2016
New Revision: 286373
URL: http://llvm.org/viewvc/llvm-project?rev=286373&view=rev
Log:
Remove TimeValue usage from ObjectContainerBSDArchive
Modified:
lldb/trunk/source/Plugins/ObjectContainer/BSD-Archive/ObjectContainerBSDArchive.cpp
lldb/trunk/source/Plugins/ObjectContainer/BSD-Archive/ObjectContainerBSDArchive.h
Modified: lldb/trunk/source/Plugins/ObjectContainer/BSD-Archive/ObjectContainerBSDArchive.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/ObjectContainer/BSD-Archive/ObjectContainerBSDArchive.cpp?rev=286373&r1=286372&r2=286373&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/ObjectContainer/BSD-Archive/ObjectContainerBSDArchive.cpp (original)
+++ lldb/trunk/source/Plugins/ObjectContainer/BSD-Archive/ObjectContainerBSDArchive.cpp Wed Nov 9 09:05:45 2016
@@ -134,7 +134,7 @@ ObjectContainerBSDArchive::Object::Extra
}
ObjectContainerBSDArchive::Archive::Archive(const lldb_private::ArchSpec &arch,
- const lldb_private::TimeValue &time,
+ const llvm::sys::TimePoint<> &time,
lldb::offset_t file_offset,
lldb_private::DataExtractor &data)
: m_arch(arch), m_time(time), m_file_offset(file_offset), m_objects(),
@@ -169,13 +169,14 @@ size_t ObjectContainerBSDArchive::Archiv
ObjectContainerBSDArchive::Object *
ObjectContainerBSDArchive::Archive::FindObject(
- const ConstString &object_name, const TimeValue &object_mod_time) {
+ const ConstString &object_name,
+ const llvm::sys::TimePoint<> &object_mod_time) {
const ObjectNameToIndexMap::Entry *match =
m_object_name_to_index_map.FindFirstValueForName(
object_name.GetStringRef());
if (match) {
- if (object_mod_time.IsValid()) {
- const uint64_t object_date = object_mod_time.GetAsSecondsSinceJan1_1970();
+ if (object_mod_time != llvm::sys::TimePoint<>()) {
+ const uint64_t object_date = llvm::sys::toTimeT(object_mod_time);
if (m_objects[match->value].ar_date == object_date)
return &m_objects[match->value];
const ObjectNameToIndexMap::Entry *next_match =
@@ -195,8 +196,8 @@ ObjectContainerBSDArchive::Archive::Find
ObjectContainerBSDArchive::Archive::shared_ptr
ObjectContainerBSDArchive::Archive::FindCachedArchive(
- const FileSpec &file, const ArchSpec &arch, const TimeValue &time,
- lldb::offset_t file_offset) {
+ const FileSpec &file, const ArchSpec &arch,
+ const llvm::sys::TimePoint<> &time, lldb::offset_t file_offset) {
std::lock_guard<std::recursive_mutex> guard(Archive::GetArchiveCacheMutex());
shared_ptr archive_sp;
Archive::Map &archive_map = Archive::GetArchiveCache();
@@ -236,8 +237,9 @@ ObjectContainerBSDArchive::Archive::Find
ObjectContainerBSDArchive::Archive::shared_ptr
ObjectContainerBSDArchive::Archive::ParseAndCacheArchiveForFile(
- const FileSpec &file, const ArchSpec &arch, const TimeValue &time,
- lldb::offset_t file_offset, DataExtractor &data) {
+ const FileSpec &file, const ArchSpec &arch,
+ const llvm::sys::TimePoint<> &time, lldb::offset_t file_offset,
+ DataExtractor &data) {
shared_ptr archive_sp(new Archive(arch, time, file_offset, data));
if (archive_sp) {
const size_t num_objects = archive_sp->ParseObjects();
@@ -453,7 +455,8 @@ size_t ObjectContainerBSDArchive::GetMod
data.SetData(data_sp, data_offset, data_sp->GetByteSize());
if (file && data_sp && ObjectContainerBSDArchive::MagicBytesMatch(data)) {
const size_t initial_count = specs.GetSize();
- TimeValue file_mod_time = FileSystem::GetModificationTime(file);
+ llvm::sys::TimePoint<> file_mod_time =
+ FileSystem::GetModificationTime(file);
Archive::shared_ptr archive_sp(Archive::FindCachedArchive(
file, ArchSpec(), file_mod_time, file_offset));
bool set_archive_arch = false;
@@ -480,8 +483,8 @@ size_t ObjectContainerBSDArchive::GetMod
specs)) {
ModuleSpec &spec =
specs.GetModuleSpecRefAtIndex(specs.GetSize() - 1);
- TimeValue object_mod_time;
- object_mod_time.OffsetWithSeconds(object->ar_date);
+ llvm::sys::TimePoint<> object_mod_time(
+ std::chrono::seconds(object->ar_date));
spec.GetObjectName() = object->ar_name;
spec.SetObjectOffset(object_file_offset);
spec.SetObjectSize(file_size - object_file_offset);
Modified: lldb/trunk/source/Plugins/ObjectContainer/BSD-Archive/ObjectContainerBSDArchive.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/ObjectContainer/BSD-Archive/ObjectContainerBSDArchive.h?rev=286373&r1=286372&r2=286373&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/ObjectContainer/BSD-Archive/ObjectContainerBSDArchive.h (original)
+++ lldb/trunk/source/Plugins/ObjectContainer/BSD-Archive/ObjectContainerBSDArchive.h Wed Nov 9 09:05:45 2016
@@ -10,19 +10,20 @@
#ifndef liblldb_ObjectContainerBSDArchive_h_
#define liblldb_ObjectContainerBSDArchive_h_
-// C Includes
-// C++ Includes
-#include <mutex>
-
-// Other libraries and framework includes
// Project includes
#include "lldb/Core/ArchSpec.h"
#include "lldb/Core/ConstString.h"
#include "lldb/Core/UniqueCStringMap.h"
#include "lldb/Host/FileSpec.h"
-#include "lldb/Host/TimeValue.h"
#include "lldb/Symbol/ObjectContainer.h"
+// Other libraries and framework includes
+#include "llvm/Support/Chrono.h"
+
+// C Includes
+// C++ Includes
+#include <mutex>
+
class ObjectContainerBSDArchive : public lldb_private::ObjectContainer {
public:
ObjectContainerBSDArchive(const lldb::ModuleSP &module_sp,
@@ -110,7 +111,7 @@ protected:
typedef std::multimap<lldb_private::FileSpec, shared_ptr> Map;
Archive(const lldb_private::ArchSpec &arch,
- const lldb_private::TimeValue &mod_time, lldb::offset_t file_offset,
+ const llvm::sys::TimePoint<> &mod_time, lldb::offset_t file_offset,
lldb_private::DataExtractor &data);
~Archive();
@@ -121,11 +122,11 @@ protected:
static Archive::shared_ptr FindCachedArchive(
const lldb_private::FileSpec &file, const lldb_private::ArchSpec &arch,
- const lldb_private::TimeValue &mod_time, lldb::offset_t file_offset);
+ const llvm::sys::TimePoint<> &mod_time, lldb::offset_t file_offset);
static Archive::shared_ptr ParseAndCacheArchiveForFile(
const lldb_private::FileSpec &file, const lldb_private::ArchSpec &arch,
- const lldb_private::TimeValue &mod_time, lldb::offset_t file_offset,
+ const llvm::sys::TimePoint<> &mod_time, lldb::offset_t file_offset,
lldb_private::DataExtractor &data);
size_t GetNumObjects() const { return m_objects.size(); }
@@ -139,11 +140,11 @@ protected:
size_t ParseObjects();
Object *FindObject(const lldb_private::ConstString &object_name,
- const lldb_private::TimeValue &object_mod_time);
+ const llvm::sys::TimePoint<> &object_mod_time);
lldb::offset_t GetFileOffset() const { return m_file_offset; }
- const lldb_private::TimeValue &GetModificationTime() { return m_time; }
+ const llvm::sys::TimePoint<> &GetModificationTime() { return m_time; }
const lldb_private::ArchSpec &GetArchitecture() const { return m_arch; }
@@ -159,7 +160,7 @@ protected:
// Member Variables
//----------------------------------------------------------------------
lldb_private::ArchSpec m_arch;
- lldb_private::TimeValue m_time;
+ llvm::sys::TimePoint<> m_time;
lldb::offset_t m_file_offset;
Object::collection m_objects;
ObjectNameToIndexMap m_object_name_to_index_map;
More information about the lldb-commits
mailing list