aboutsummaryrefslogtreecommitdiff
path: root/clang/lib/Basic/VirtualFileSystem.cpp
diff options
context:
space:
mode:
authorRafael Espindola <rafael.espindola@gmail.com>2014-07-06 17:43:24 +0000
committerRafael Espindola <rafael.espindola@gmail.com>2014-07-06 17:43:24 +0000
commit2d2b420ab9452afe2b298418ceeb40096e72d935 (patch)
treec977ec0bcf859f214acc265f1b1e7052f3d6ddfe /clang/lib/Basic/VirtualFileSystem.cpp
parentc2199ecf1e833dc4b5e269141ecc72d3deb11616 (diff)
downloadllvm-2d2b420ab9452afe2b298418ceeb40096e72d935.zip
llvm-2d2b420ab9452afe2b298418ceeb40096e72d935.tar.gz
llvm-2d2b420ab9452afe2b298418ceeb40096e72d935.tar.bz2
Update for llvm api change.
llvm-svn: 212408
Diffstat (limited to 'clang/lib/Basic/VirtualFileSystem.cpp')
-rw-r--r--clang/lib/Basic/VirtualFileSystem.cpp11
1 files changed, 8 insertions, 3 deletions
diff --git a/clang/lib/Basic/VirtualFileSystem.cpp b/clang/lib/Basic/VirtualFileSystem.cpp
index 3d5e1ad..1f2a856 100644
--- a/clang/lib/Basic/VirtualFileSystem.cpp
+++ b/clang/lib/Basic/VirtualFileSystem.cpp
@@ -126,8 +126,13 @@ std::error_code RealFile::getBuffer(const Twine &Name,
bool RequiresNullTerminator,
bool IsVolatile) {
assert(FD != -1 && "cannot get buffer for closed file");
- return MemoryBuffer::getOpenFile(FD, Name.str().c_str(), Result, FileSize,
- RequiresNullTerminator, IsVolatile);
+ ErrorOr<std::unique_ptr<MemoryBuffer>> BufferOrErr =
+ MemoryBuffer::getOpenFile(FD, Name.str().c_str(), FileSize,
+ RequiresNullTerminator, IsVolatile);
+ if (std::error_code EC = BufferOrErr.getError())
+ return EC;
+ Result = std::move(BufferOrErr.get());
+ return std::error_code();
}
// FIXME: This is terrible, we need this for ::close.
@@ -1202,4 +1207,4 @@ recursive_directory_iterator::increment(std::error_code &EC) {
State.reset(); // end iterator
return *this;
-} \ No newline at end of file
+}