summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Support/FileOutputBuffer.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'llvm/lib/Support/FileOutputBuffer.cpp')
-rw-r--r--llvm/lib/Support/FileOutputBuffer.cpp4
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);
OpenPOWER on IntegriCloud