[Support] Fix lifetime of file descriptors when using MemoryBuffer.

Clients of MemoryBuffer::getOpenFile expect it not to take ownership of the file
descriptor passed in. So don't.

llvm-svn: 176995
This commit is contained in:
Michael J. Spencer
2013-03-14 00:20:10 +00:00
parent ad145509eb
commit 42ad29fa05
5 changed files with 41 additions and 26 deletions

View 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;