From c69f13bfe1b7c0f663ea204f6e961d669f4bab02 Mon Sep 17 00:00:00 2001 From: Rafael Espindola Date: Fri, 12 Dec 2014 18:13:23 +0000 Subject: Move the resize file feature from mapped_file_region to the only user. This removes a duplicated stat on every file that llvm-ar looks at. llvm-svn: 224138 --- llvm/lib/Support/FileOutputBuffer.cpp | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'llvm/lib/Support/FileOutputBuffer.cpp') diff --git a/llvm/lib/Support/FileOutputBuffer.cpp b/llvm/lib/Support/FileOutputBuffer.cpp index e6e4da34652..df4ae9322bc 100644 --- a/llvm/lib/Support/FileOutputBuffer.cpp +++ b/llvm/lib/Support/FileOutputBuffer.cpp @@ -77,6 +77,10 @@ FileOutputBuffer::create(StringRef FilePath, size_t Size, if (EC) return EC; + EC = sys::fs::resize_file(FD, Size); + if (EC) + return EC; + auto MappedFile = llvm::make_unique( FD, mapped_file_region::readwrite, Size, 0, EC); int Ret = close(FD); -- cgit v1.2.3