summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Support/FileOutputBuffer.cpp
diff options
context:
space:
mode:
authorRafael Espindola <rafael.espindola@gmail.com>2015-08-13 00:31:39 +0000
committerRafael Espindola <rafael.espindola@gmail.com>2015-08-13 00:31:39 +0000
commit169284a67b1632a161e4970d06f2636cccb9005c (patch)
tree5897d17b891503727b93ce028047fa1bdbddc35d /llvm/lib/Support/FileOutputBuffer.cpp
parented8aa2745a2c108e9e665b0738471ad502adfca7 (diff)
downloadbcm5719-llvm-169284a67b1632a161e4970d06f2636cccb9005c.tar.gz
bcm5719-llvm-169284a67b1632a161e4970d06f2636cccb9005c.zip
Return ErrorOr from FileOutputBuffer::create. NFC.
llvm-svn: 244848
Diffstat (limited to 'llvm/lib/Support/FileOutputBuffer.cpp')
-rw-r--r--llvm/lib/Support/FileOutputBuffer.cpp11
1 files changed, 4 insertions, 7 deletions
diff --git a/llvm/lib/Support/FileOutputBuffer.cpp b/llvm/lib/Support/FileOutputBuffer.cpp
index 307ff09afed..e68ecaaa98c 100644
--- a/llvm/lib/Support/FileOutputBuffer.cpp
+++ b/llvm/lib/Support/FileOutputBuffer.cpp
@@ -34,10 +34,8 @@ FileOutputBuffer::~FileOutputBuffer() {
sys::fs::remove(Twine(TempPath));
}
-std::error_code
-FileOutputBuffer::create(StringRef FilePath, size_t Size,
- std::unique_ptr<FileOutputBuffer> &Result,
- unsigned Flags) {
+ErrorOr<std::unique_ptr<FileOutputBuffer>>
+FileOutputBuffer::create(StringRef FilePath, size_t Size, unsigned Flags) {
// If file already exists, it must be a regular file (to be mappable).
sys::fs::file_status Stat;
std::error_code EC = sys::fs::status(FilePath, Stat);
@@ -95,10 +93,9 @@ FileOutputBuffer::create(StringRef FilePath, size_t Size,
if (Ret)
return std::error_code(errno, std::generic_category());
- Result.reset(
+ std::unique_ptr<FileOutputBuffer> Buf(
new FileOutputBuffer(std::move(MappedFile), FilePath, TempFilePath));
-
- return std::error_code();
+ return std::move(Buf);
}
std::error_code FileOutputBuffer::commit() {
OpenPOWER on IntegriCloud