[Support] Fix lifetime of file descriptors when using MemoryBuffer.
[oota-llvm.git] / lib / Support / FileOutputBuffer.cpp
index cd430f218bc367ea23e9b4f0ebf8bc8be75e7b04..1ee69b60234f6f69c4171ba35db497dd06473ee5 100644 (file)
@@ -70,8 +70,8 @@ error_code FileOutputBuffer::create(StringRef FilePath,
   if (EC)
     return EC;
 
-  OwningPtr<mapped_file_region> MappedFile(
-    new mapped_file_region(FD, mapped_file_region::readwrite, Size, 0, EC));
+  OwningPtr<mapped_file_region> MappedFile(new mapped_file_region(
+      FD, true, mapped_file_region::readwrite, Size, 0, EC));
   if (EC)
     return EC;