Move the resize file feature from mapped_file_region to the only user.
[oota-llvm.git] / lib / Support / FileOutputBuffer.cpp
index e6e4da346520cfb53e585fb7118d6bd58dbfd7b1..df4ae9322bcdffdc486c7617a4a236f16d656bcd 100644 (file)
@@ -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);