[PATCH] D66471: [Support] Improve readNativeFile(Slice) interface
Pavel Labath via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Aug 20 05:14:29 PDT 2019
labath created this revision.
labath added reviewers: aganea, rnk.
Herald added a subscriber: kristina.
Herald added a project: LLVM.
There was a subtle, but pretty important difference between the Slice
and regular versions of this function. The Slice function was
zero-initializing the rest of the buffer when the read syscall returned
less bytes than expected, while the regular function did not.
This patch removes the inconsistency by making both functions *not*
zero-initialize the buffer. The zeroing code is moved to the
MemoryBuffer class, which is currently the only user of this code. This
makes the API more consistent, and the code shorter.
While in there, I also refactor the functions to return the number of
bytes through the regular return value (via Expected<size_t>) instead of
a separate by-ref argument.
Repository:
rL LLVM
https://reviews.llvm.org/D66471
Files:
include/llvm/Support/FileSystem.h
lib/Support/MemoryBuffer.cpp
lib/Support/Unix/Path.inc
lib/Support/Windows/Path.inc
unittests/Support/Path.cpp
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D66471.216104.patch
Type: text/x-patch
Size: 13288 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190820/2fb2874a/attachment.bin>
More information about the llvm-commits
mailing list