[PATCH] D66471: [Support] Improve readNativeFile(Slice) interface
Pavel Labath via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Aug 20 08:00:17 PDT 2019
labath marked an inline comment as done.
labath added inline comments.
================
Comment at: lib/Support/MemoryBuffer.cpp:467
+ Expected<size_t> ReadBytes =
+ sys::fs::readNativeFileSlice(FD, Buf->getBuffer(), Offset);
+ if (!ReadBytes)
----------------
aganea wrote:
> Shouldn't we use `ToRead` here instead of `Buf->getBuffer()`? Could you please test two sequential reads in the unittests?
Woops, indeed it should. Thanks for catching that!
As for the test, I am not sure how I could force the read syscall to return partial data here. For the non-slice version, I suppose I could make this read from a pipe, and then make sure I write to the pipe very slowly. However, the slice version requires a seekable fd, and I don't know what to do there... Do you have any suggestion?
Repository:
rL LLVM
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D66471/new/
https://reviews.llvm.org/D66471
More information about the llvm-commits
mailing list