summaryrefslogtreecommitdiffstats
path: root/clang/lib/Basic/FileManager.cpp
diff options
context:
space:
mode:
authorRafael Espindola <rafael.espindola@gmail.com>2014-08-26 19:54:40 +0000
committerRafael Espindola <rafael.espindola@gmail.com>2014-08-26 19:54:40 +0000
commit6406f7b8e0fc43c5f9d14bb3cd1d7d9192e3d277 (patch)
treee1d44a3a5a3732181039d9607893c24807a2fc65 /clang/lib/Basic/FileManager.cpp
parentcb5674b9c2e4d7944bd8fe0ed92f316e8e5d5f30 (diff)
downloadbcm5719-llvm-6406f7b8e0fc43c5f9d14bb3cd1d7d9192e3d277.tar.gz
bcm5719-llvm-6406f7b8e0fc43c5f9d14bb3cd1d7d9192e3d277.zip
Return a std::unique_ptr from getBufferForFile. NFC.
llvm-svn: 216476
Diffstat (limited to 'clang/lib/Basic/FileManager.cpp')
-rw-r--r--clang/lib/Basic/FileManager.cpp20
1 files changed, 10 insertions, 10 deletions
diff --git a/clang/lib/Basic/FileManager.cpp b/clang/lib/Basic/FileManager.cpp
index 07297baf6d5..c0522966e38 100644
--- a/clang/lib/Basic/FileManager.cpp
+++ b/clang/lib/Basic/FileManager.cpp
@@ -386,9 +386,9 @@ void FileManager::FixupRelativePath(SmallVectorImpl<char> &path) const {
path = NewPath;
}
-llvm::MemoryBuffer *FileManager::
-getBufferForFile(const FileEntry *Entry, std::string *ErrorStr,
- bool isVolatile, bool ShouldCloseOpenFile) {
+std::unique_ptr<llvm::MemoryBuffer>
+FileManager::getBufferForFile(const FileEntry *Entry, std::string *ErrorStr,
+ bool isVolatile, bool ShouldCloseOpenFile) {
std::unique_ptr<llvm::MemoryBuffer> Result;
std::error_code ec;
@@ -409,7 +409,7 @@ getBufferForFile(const FileEntry *Entry, std::string *ErrorStr,
// FileEntry is open or not.
if (ShouldCloseOpenFile)
Entry->closeFile();
- return Result.release();
+ return Result;
}
// Otherwise, open the file.
@@ -419,7 +419,7 @@ getBufferForFile(const FileEntry *Entry, std::string *ErrorStr,
/*RequiresNullTerminator=*/true, isVolatile);
if (ec && ErrorStr)
*ErrorStr = ec.message();
- return Result.release();
+ return Result;
}
SmallString<128> FilePath(Entry->getName());
@@ -428,18 +428,18 @@ getBufferForFile(const FileEntry *Entry, std::string *ErrorStr,
/*RequiresNullTerminator=*/true, isVolatile);
if (ec && ErrorStr)
*ErrorStr = ec.message();
- return Result.release();
+ return Result;
}
-llvm::MemoryBuffer *FileManager::
-getBufferForFile(StringRef Filename, std::string *ErrorStr) {
+std::unique_ptr<llvm::MemoryBuffer>
+FileManager::getBufferForFile(StringRef Filename, std::string *ErrorStr) {
std::unique_ptr<llvm::MemoryBuffer> Result;
std::error_code ec;
if (FileSystemOpts.WorkingDir.empty()) {
ec = FS->getBufferForFile(Filename, Result);
if (ec && ErrorStr)
*ErrorStr = ec.message();
- return Result.release();
+ return Result;
}
SmallString<128> FilePath(Filename);
@@ -447,7 +447,7 @@ getBufferForFile(StringRef Filename, std::string *ErrorStr) {
ec = FS->getBufferForFile(FilePath.c_str(), Result);
if (ec && ErrorStr)
*ErrorStr = ec.message();
- return Result.release();
+ return Result;
}
/// getStatValue - Get the 'stat' information for the specified path,
OpenPOWER on IntegriCloud