Index: llvm/trunk/tools/dsymutil/BinaryHolder.h =================================================================== --- llvm/trunk/tools/dsymutil/BinaryHolder.h +++ llvm/trunk/tools/dsymutil/BinaryHolder.h @@ -19,9 +19,9 @@ #include "llvm/Object/Error.h" #include "llvm/Object/MachOUniversal.h" #include "llvm/Object/ObjectFile.h" +#include "llvm/Support/Chrono.h" #include "llvm/Support/Errc.h" #include "llvm/Support/ErrorOr.h" -#include "llvm/Support/TimeValue.h" namespace llvm { namespace dsymutil { @@ -54,7 +54,8 @@ /// potential match for the given \p Filename in the currently /// mapped archive if there is one. ErrorOr> - GetArchiveMemberBuffers(StringRef Filename, sys::TimeValue Timestamp); + GetArchiveMemberBuffers(StringRef Filename, + sys::TimePoint Timestamp); /// Interpret Filename as an archive member specification map the /// corresponding archive to memory and return the MemoryBufferRefs @@ -62,7 +63,8 @@ /// returned when there are multiple architectures available for the /// requested file. ErrorOr> - MapArchiveAndGetMemberBuffers(StringRef Filename, sys::TimeValue Timestamp); + MapArchiveAndGetMemberBuffers(StringRef Filename, + sys::TimePoint Timestamp); /// Return the MemoryBufferRef that holds the memory mapping for the /// given \p Filename. This function will try to parse archive @@ -74,7 +76,8 @@ /// Multiple buffers are returned when there are multiple /// architectures available for the requested file. ErrorOr> - GetMemoryBuffersForFile(StringRef Filename, sys::TimeValue Timestamp); + GetMemoryBuffersForFile(StringRef Filename, + sys::TimePoint Timestamp); void changeBackingMemoryBuffer(std::unique_ptr &&MemBuf); ErrorOr getObjfileForArch(const Triple &T); @@ -91,13 +94,15 @@ /// multiple architectures available for the requested file. ErrorOr> GetObjectFiles(StringRef Filename, - sys::TimeValue Timestamp = sys::TimeValue::PosixZeroTime()); + sys::TimePoint Timestamp = + sys::TimePoint()); /// Wraps GetObjectFiles() to return a derived ObjectFile type. template ErrorOr> GetFilesAs(StringRef Filename, - sys::TimeValue Timestamp = sys::TimeValue::PosixZeroTime()) { + sys::TimePoint Timestamp = + sys::TimePoint()) { auto ErrOrObjFile = GetObjectFiles(Filename, Timestamp); if (auto Err = ErrOrObjFile.getError()) return Err; Index: llvm/trunk/tools/dsymutil/BinaryHolder.cpp =================================================================== --- llvm/trunk/tools/dsymutil/BinaryHolder.cpp +++ llvm/trunk/tools/dsymutil/BinaryHolder.cpp @@ -41,9 +41,8 @@ CurrentMemoryBuffer = std::move(Buf); } -ErrorOr> -BinaryHolder::GetMemoryBuffersForFile(StringRef Filename, - sys::TimeValue Timestamp) { +ErrorOr> BinaryHolder::GetMemoryBuffersForFile( + StringRef Filename, sys::TimePoint Timestamp) { if (Verbose) outs() << "trying to open '" << Filename << "'\n"; @@ -85,9 +84,8 @@ *CurrentFatBinary); } -ErrorOr> -BinaryHolder::GetArchiveMemberBuffers(StringRef Filename, - sys::TimeValue Timestamp) { +ErrorOr> BinaryHolder::GetArchiveMemberBuffers( + StringRef Filename, sys::TimePoint Timestamp) { if (CurrentArchives.empty()) return make_error_code(errc::no_such_file_or_directory); @@ -106,10 +104,10 @@ for (auto Child : CurrentArchive->children(Err)) { if (auto NameOrErr = Child.getName()) { if (*NameOrErr == Filename) { - Expected ModTimeOrErr = Child.getLastModified(); + auto ModTimeOrErr = Child.getLastModified(); if (!ModTimeOrErr) return errorToErrorCode(ModTimeOrErr.takeError()); - if (Timestamp != sys::TimeValue::PosixZeroTime() && + if (Timestamp != sys::TimePoint<>() && Timestamp != ModTimeOrErr.get()) { if (Verbose) outs() << "\tmember had timestamp mismatch.\n"; @@ -134,8 +132,8 @@ } ErrorOr> -BinaryHolder::MapArchiveAndGetMemberBuffers(StringRef Filename, - sys::TimeValue Timestamp) { +BinaryHolder::MapArchiveAndGetMemberBuffers( + StringRef Filename, sys::TimePoint Timestamp) { StringRef ArchiveFilename = Filename.substr(0, Filename.find('(')); auto ErrOrBuff = MemoryBuffer::getFileOrSTDIN(ArchiveFilename); @@ -183,7 +181,8 @@ } ErrorOr> -BinaryHolder::GetObjectFiles(StringRef Filename, sys::TimeValue Timestamp) { +BinaryHolder::GetObjectFiles(StringRef Filename, + sys::TimePoint Timestamp) { auto ErrOrMemBufferRefs = GetMemoryBuffersForFile(Filename, Timestamp); if (auto Err = ErrOrMemBufferRefs.getError()) return Err; Index: llvm/trunk/tools/dsymutil/DebugMap.h =================================================================== --- llvm/trunk/tools/dsymutil/DebugMap.h +++ llvm/trunk/tools/dsymutil/DebugMap.h @@ -26,10 +26,10 @@ #include "llvm/ADT/Triple.h" #include "llvm/ADT/iterator_range.h" #include "llvm/Object/ObjectFile.h" +#include "llvm/Support/Chrono.h" #include "llvm/Support/ErrorOr.h" #include "llvm/Support/Format.h" #include "llvm/Support/Path.h" -#include "llvm/Support/TimeValue.h" #include "llvm/Support/YAMLTraits.h" #include @@ -92,8 +92,9 @@ /// This function adds an DebugMapObject to the list owned by this /// debug map. - DebugMapObject &addDebugMapObject(StringRef ObjectFilePath, - sys::TimeValue Timestamp); + DebugMapObject & + addDebugMapObject(StringRef ObjectFilePath, + sys::TimePoint Timestamp); const Triple &getTriple() const { return BinaryTriple; } @@ -149,7 +150,9 @@ llvm::StringRef getObjectFilename() const { return Filename; } - sys::TimeValue getTimestamp() const { return Timestamp; } + sys::TimePoint getTimestamp() const { + return Timestamp; + } iterator_range::const_iterator> symbols() const { return make_range(Symbols.begin(), Symbols.end()); @@ -162,10 +165,11 @@ private: friend class DebugMap; /// DebugMapObjects can only be constructed by the owning DebugMap. - DebugMapObject(StringRef ObjectFilename, sys::TimeValue Timestamp); + DebugMapObject(StringRef ObjectFilename, + sys::TimePoint Timestamp); std::string Filename; - sys::TimeValue Timestamp; + sys::TimePoint Timestamp; StringMap Symbols; DenseMap AddressToMapping; Index: llvm/trunk/tools/dsymutil/DebugMap.cpp =================================================================== --- llvm/trunk/tools/dsymutil/DebugMap.cpp +++ llvm/trunk/tools/dsymutil/DebugMap.cpp @@ -21,7 +21,7 @@ using namespace llvm::object; DebugMapObject::DebugMapObject(StringRef ObjectFilename, - sys::TimeValue Timestamp) + sys::TimePoint Timestamp) : Filename(ObjectFilename), Timestamp(Timestamp) {} bool DebugMapObject::addSymbol(StringRef Name, Optional ObjectAddress, @@ -62,8 +62,9 @@ void DebugMapObject::dump() const { print(errs()); } #endif -DebugMapObject &DebugMap::addDebugMapObject(StringRef ObjectFilePath, - sys::TimeValue Timestamp) { +DebugMapObject & +DebugMap::addDebugMapObject(StringRef ObjectFilePath, + sys::TimePoint Timestamp) { Objects.emplace_back(new DebugMapObject(ObjectFilePath, Timestamp)); return *Objects.back(); } @@ -132,7 +133,7 @@ dsymutil::DebugMapObject denormalize(IO &IO); std::string Filename; - sys::TimeValue::SecondsType Timestamp; + int64_t Timestamp; std::vector Entries; }; @@ -202,7 +203,7 @@ MappingTraits::YamlDMO::YamlDMO( IO &io, dsymutil::DebugMapObject &Obj) { Filename = Obj.Filename; - Timestamp = Obj.getTimestamp().toEpochTime(); + Timestamp = sys::toTimeT(Obj.getTimestamp()); Entries.reserve(Obj.Symbols.size()); for (auto &Entry : Obj.Symbols) Entries.push_back(std::make_pair(Entry.getKey(), Entry.getValue())); @@ -240,9 +241,7 @@ } } - sys::TimeValue TV; - TV.fromEpochTime(Timestamp); - dsymutil::DebugMapObject Res(Path, TV); + dsymutil::DebugMapObject Res(Path, sys::toTimePoint(Timestamp)); for (auto &Entry : Entries) { auto &Mapping = Entry.second; Optional ObjAddress; Index: llvm/trunk/tools/dsymutil/DwarfLinker.cpp =================================================================== --- llvm/trunk/tools/dsymutil/DwarfLinker.cpp +++ llvm/trunk/tools/dsymutil/DwarfLinker.cpp @@ -3294,7 +3294,7 @@ sys::path::append(Path, Filename); BinaryHolder ObjHolder(Options.Verbose); auto &Obj = - ModuleMap.addDebugMapObject(Path, sys::TimeValue::PosixZeroTime()); + ModuleMap.addDebugMapObject(Path, sys::TimePoint()); auto ErrOrObj = loadObject(ObjHolder, Obj, ModuleMap); if (!ErrOrObj) { // Try and emit more helpful warnings by applying some heuristics. Index: llvm/trunk/tools/dsymutil/MachODebugMapParser.cpp =================================================================== --- llvm/trunk/tools/dsymutil/MachODebugMapParser.cpp +++ llvm/trunk/tools/dsymutil/MachODebugMapParser.cpp @@ -65,7 +65,9 @@ std::unique_ptr parseOneBinary(const MachOObjectFile &MainBinary, StringRef BinaryPath); - void switchToNewDebugMapObject(StringRef Filename, sys::TimeValue Timestamp); + void + switchToNewDebugMapObject(StringRef Filename, + sys::TimePoint Timestamp); void resetParserState(); uint64_t getMainBinarySymbolAddress(StringRef Name); void loadMainBinarySymbols(const MachOObjectFile &MainBinary); @@ -110,8 +112,8 @@ /// Create a new DebugMapObject. This function resets the state of the /// parser that was referring to the last object file and sets /// everything up to add symbols to the new one. -void MachODebugMapParser::switchToNewDebugMapObject(StringRef Filename, - sys::TimeValue Timestamp) { +void MachODebugMapParser::switchToNewDebugMapObject( + StringRef Filename, sys::TimePoint Timestamp) { resetParserState(); SmallString<80> Path(PathPrefix); @@ -343,11 +345,8 @@ const char *Name = &MainBinaryStrings.data()[StringIndex]; // An N_OSO entry represents the start of a new object file description. - if (Type == MachO::N_OSO) { - sys::TimeValue Timestamp; - Timestamp.fromEpochTime(Value); - return switchToNewDebugMapObject(Name, Timestamp); - } + if (Type == MachO::N_OSO) + return switchToNewDebugMapObject(Name, sys::toTimePoint(Value)); // If the last N_OSO object file wasn't found, // CurrentDebugMapObject will be null. Do not update anything