summaryrefslogtreecommitdiff
path: root/tools/llvm-ar
diff options
context:
space:
mode:
authorPavel Labath <labath@google.com>2016-10-24 10:59:17 +0000
committerPavel Labath <labath@google.com>2016-10-24 10:59:17 +0000
commit2864c2ae9036b57ac200a74db5be6ae1a4da6e3d (patch)
tree0fc5075fdc40342d51567606afdb9d254297bd76 /tools/llvm-ar
parent7577cb98e63eaed695d9c46b21ec07988cc2b18b (diff)
Remove TimeValue usage from llvm/Support
Summary: This is a follow-up to D25416. It removes all usages of TimeValue from llvm/Support library (except for the actual TimeValue declaration), and replaces them with appropriate usages of std::chrono. To facilitate this, I have added small utility functions for converting time points and durations into appropriate OS-specific types (FILETIME, struct timespec, ...). Reviewers: zturner, mehdi_amini Subscribers: llvm-commits Differential Revision: https://reviews.llvm.org/D25730 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@284966 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'tools/llvm-ar')
-rw-r--r--tools/llvm-ar/llvm-ar.cpp11
1 files changed, 6 insertions, 5 deletions
diff --git a/tools/llvm-ar/llvm-ar.cpp b/tools/llvm-ar/llvm-ar.cpp
index b7cb95972d5..18a5f2497f4 100644
--- a/tools/llvm-ar/llvm-ar.cpp
+++ b/tools/llvm-ar/llvm-ar.cpp
@@ -21,6 +21,7 @@
#include "llvm/Object/ArchiveWriter.h"
#include "llvm/Object/MachO.h"
#include "llvm/Object/ObjectFile.h"
+#include "llvm/Support/Chrono.h"
#include "llvm/Support/CommandLine.h"
#include "llvm/Support/Errc.h"
#include "llvm/Support/FileSystem.h"
@@ -353,9 +354,9 @@ static void doDisplayTable(StringRef Name, const object::Archive::Child &C) {
Expected<uint64_t> Size = C.getSize();
failIfError(Size.takeError());
outs() << ' ' << format("%6llu", Size.get());
- Expected<sys::TimeValue> ModTimeOrErr = C.getLastModified();
+ auto ModTimeOrErr = C.getLastModified();
failIfError(ModTimeOrErr.takeError());
- outs() << ' ' << ModTimeOrErr.get().str();
+ outs() << ' ' << ModTimeOrErr.get();
outs() << ' ';
}
outs() << Name << "\n";
@@ -387,7 +388,7 @@ static void doExtract(StringRef Name, const object::Archive::Child &C) {
// If we're supposed to retain the original modification times, etc. do so
// now.
if (OriginalDates) {
- Expected<sys::TimeValue> ModTimeOrErr = C.getLastModified();
+ auto ModTimeOrErr = C.getLastModified();
failIfError(ModTimeOrErr.takeError());
failIfError(
sys::fs::setLastModificationAndAccessTime(FD, ModTimeOrErr.get()));
@@ -525,9 +526,9 @@ static InsertAction computeInsertAction(ArchiveOperation Operation,
// operation.
sys::fs::file_status Status;
failIfError(sys::fs::status(*MI, Status), *MI);
- Expected<sys::TimeValue> ModTimeOrErr = Member.getLastModified();
+ auto ModTimeOrErr = Member.getLastModified();
failIfError(ModTimeOrErr.takeError());
- if (Status.getLastModificationTime() < ModTimeOrErr.get()) {
+ if (sys::TimeValue(Status.getLastModificationTime()) < ModTimeOrErr.get()) {
if (PosName.empty())
return IA_AddOldMember;
return IA_MoveOldMember;