summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Support/FileOutputBuffer.cpp
diff options
context:
space:
mode:
authorAhmed Charles <ahmedcharles@gmail.com>2014-03-05 10:27:34 +0000
committerAhmed Charles <ahmedcharles@gmail.com>2014-03-05 10:27:34 +0000
commitfba066461fdb036b77d7da1fe8039781dcca9910 (patch)
tree0c71e3f3385eb002340cd4d01472c099f0872e3e /llvm/lib/Support/FileOutputBuffer.cpp
parent64e9aa5c93d54bd26d0e8d337a2fb48979eaafa2 (diff)
downloadbcm5719-llvm-fba066461fdb036b77d7da1fe8039781dcca9910.tar.gz
bcm5719-llvm-fba066461fdb036b77d7da1fe8039781dcca9910.zip
[C++11] Add overloads for externally used OwningPtr functions.
This will allow external callers of these functions to switch over time rather than forcing a breaking change all a once. These particular functions were determined by building clang/lld/lldb. llvm-svn: 202959
Diffstat (limited to 'llvm/lib/Support/FileOutputBuffer.cpp')
-rw-r--r--llvm/lib/Support/FileOutputBuffer.cpp16
1 files changed, 13 insertions, 3 deletions
diff --git a/llvm/lib/Support/FileOutputBuffer.cpp b/llvm/lib/Support/FileOutputBuffer.cpp
index c01778f9600..8f2c9fcce08 100644
--- a/llvm/lib/Support/FileOutputBuffer.cpp
+++ b/llvm/lib/Support/FileOutputBuffer.cpp
@@ -33,7 +33,7 @@ FileOutputBuffer::~FileOutputBuffer() {
error_code FileOutputBuffer::create(StringRef FilePath,
size_t Size,
- OwningPtr<FileOutputBuffer> &Result,
+ std::unique_ptr<FileOutputBuffer> &Result,
unsigned Flags) {
// If file already exists, it must be a regular file (to be mappable).
sys::fs::file_status Stat;
@@ -73,18 +73,28 @@ error_code FileOutputBuffer::create(StringRef FilePath,
if (EC)
return EC;
- OwningPtr<mapped_file_region> MappedFile(new mapped_file_region(
+ std::unique_ptr<mapped_file_region> MappedFile(new mapped_file_region(
FD, true, mapped_file_region::readwrite, Size, 0, EC));
if (EC)
return EC;
Result.reset(new FileOutputBuffer(MappedFile.get(), FilePath, TempFilePath));
if (Result)
- MappedFile.take();
+ MappedFile.release();
return error_code::success();
}
+error_code FileOutputBuffer::create(StringRef FilePath,
+ size_t Size,
+ OwningPtr<FileOutputBuffer> &Result,
+ unsigned Flags) {
+ std::unique_ptr<FileOutputBuffer> FOB;
+ error_code ec = create(FilePath, Size, FOB, Flags);
+ Result = std::move(FOB);
+ return ec;
+}
+
error_code FileOutputBuffer::commit(int64_t NewSmallerSize) {
// Unmap buffer, letting OS flush dirty pages to file on disk.
Region.reset(0);
OpenPOWER on IntegriCloud