diff options
author | Rafael Espindola <rafael.espindola@gmail.com> | 2013-07-13 05:07:22 +0000 |
---|---|---|
committer | Rafael Espindola <rafael.espindola@gmail.com> | 2013-07-13 05:07:22 +0000 |
commit | 718af7892033aa965efafbf63c7636d91728662b (patch) | |
tree | 8df35a178ebb16e609598cd59fa191fb134f1402 | |
parent | ee795f35f7f0e852b20f7a8052ea796e3174efd8 (diff) | |
download | external_llvm-718af7892033aa965efafbf63c7636d91728662b.zip external_llvm-718af7892033aa965efafbf63c7636d91728662b.tar.gz external_llvm-718af7892033aa965efafbf63c7636d91728662b.tar.bz2 |
Try to open the file before use data from stat.
Looks like on mingw we get bogus last modification times on directories.
Should fix the mingw bots.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@186240 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | tools/llvm-ar/llvm-ar.cpp | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/tools/llvm-ar/llvm-ar.cpp b/tools/llvm-ar/llvm-ar.cpp index 5f47654..7632b00 100644 --- a/tools/llvm-ar/llvm-ar.cpp +++ b/tools/llvm-ar/llvm-ar.cpp @@ -560,6 +560,9 @@ static void performWriteOperation(ArchiveOperation Operation, sys::fs::file_status Status; failIfError(sys::fs::status(FileName, Status), FileName); + OwningPtr<MemoryBuffer> File; + failIfError(MemoryBuffer::getFile(FileName, File), FileName); + uint64_t secondsSinceEpoch = Status.getLastModificationTime().toEpochTime(); printWithSpacePadding(Out, secondsSinceEpoch, 12); @@ -570,8 +573,6 @@ static void performWriteOperation(ArchiveOperation Operation, printWithSpacePadding(Out, Status.getSize(), 10); Out << "`\n"; - OwningPtr<MemoryBuffer> File; - failIfError(MemoryBuffer::getFile(FileName, File), FileName); Out << File->getBuffer(); } else { object::Archive::child_iterator OldMember = I->getOld(); |