From 5910a296f4cb21e3824da76d528624992dfaa691 Mon Sep 17 00:00:00 2001 From: Rafael Espindola Date: Sat, 13 Jul 2013 05:07:22 +0000 Subject: [PATCH] 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. llvm-svn: 186240 --- tools/llvm-ar/llvm-ar.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/tools/llvm-ar/llvm-ar.cpp b/tools/llvm-ar/llvm-ar.cpp index 5f47654b246..7632b00f916 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 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 File; - failIfError(MemoryBuffer::getFile(FileName, File), FileName); Out << File->getBuffer(); } else { object::Archive::child_iterator OldMember = I->getOld();