[all-commits] [llvm/llvm-project] 345223: Support: Extract sys::fs::readNativeFileToEOF() fr...
Duncan P. N. Exon Smith via All-commits
all-commits at lists.llvm.org
Tue Jan 11 18:06:09 PST 2022
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: 345223a7be3c3c93a10f8453d96287a3a03b6754
https://github.com/llvm/llvm-project/commit/345223a7be3c3c93a10f8453d96287a3a03b6754
Author: Duncan P. N. Exon Smith <dexonsmith at apple.com>
Date: 2022-01-11 (Tue, 11 Jan 2022)
Changed paths:
M llvm/include/llvm/Support/FileSystem.h
M llvm/lib/Support/MemoryBuffer.cpp
M llvm/lib/Support/Path.cpp
M llvm/unittests/Support/Path.cpp
Log Message:
-----------
Support: Extract sys::fs::readNativeFileToEOF() from MemoryBuffer
Extract the `readNativeFile()` loop from
`MemoryBuffer::getMemoryBufferForStream()` into `readNativeFileToEOF()`
to allow reuse. The chunk size is configurable; the default of `4*4096`
is exposed as `sys::fs::DefaultReadChunkSize` to allow sizing of
SmallVectors.
There's somewhere I'd like to read a usually-small file without overhead
of a MemoryBuffer; extracting existing logic rather than duplicating it.
Differential Revision: https://reviews.llvm.org/D115397
More information about the All-commits
mailing list