Update for llvm api change.

llvm-svn: 212408
This commit is contained in:
Rafael Espindola
2014-07-06 17:43:24 +00:00
parent c2199ecf1e
commit 2d2b420ab9
14 changed files with 79 additions and 53 deletions

View File

@@ -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;
}
}