diff options
author | Rafael Espindola <rafael.espindola@gmail.com> | 2014-12-12 18:13:23 +0000 |
---|---|---|
committer | Rafael Espindola <rafael.espindola@gmail.com> | 2014-12-12 18:13:23 +0000 |
commit | c69f13bfe1b7c0f663ea204f6e961d669f4bab02 (patch) | |
tree | 799e8c7483b1f2a83d663ee849f6a473ceb41204 /llvm/lib/Support/FileOutputBuffer.cpp | |
parent | 555a7a6ad2267c196993839930e962588a1f62d0 (diff) | |
download | bcm5719-llvm-c69f13bfe1b7c0f663ea204f6e961d669f4bab02.tar.gz bcm5719-llvm-c69f13bfe1b7c0f663ea204f6e961d669f4bab02.zip |
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
Diffstat (limited to 'llvm/lib/Support/FileOutputBuffer.cpp')
-rw-r--r-- | llvm/lib/Support/FileOutputBuffer.cpp | 4 |
1 files changed, 4 insertions, 0 deletions
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<mapped_file_region>( FD, mapped_file_region::readwrite, Size, 0, EC); int Ret = close(FD); |