diff options
Diffstat (limited to 'clang/lib/Basic/VirtualFileSystem.cpp')
-rw-r--r-- | clang/lib/Basic/VirtualFileSystem.cpp | 11 |
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 +} |