hanchenye-llvm-project/llvm/unittests
Pavel Labath 1b30ea2c50 [Support] Improve readNativeFile(Slice) interface
Summary:
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.

Reviewers: aganea, rnk

Subscribers: kristina, Bigcheese, llvm-commits

Tags: #llvm

Differential Revision: https://reviews.llvm.org/D66471

llvm-svn: 369627
2019-08-22 08:13:30 +00:00
..
ADT reland [gtest] Fix printing of StringRef and SmallString in assert messages. 2019-08-21 13:56:29 +00:00
Analysis [llvm] Migrate llvm::make_unique to std::make_unique 2019-08-15 15:54:37 +00:00
AsmParser Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
BinaryFormat [BinaryFormat] Teach identify_magic about Tapi files. 2019-08-21 21:00:16 +00:00
Bitcode [Bitcode] Move Bitstream to a separate library 2019-07-03 22:40:07 +00:00
Bitstream [Bitcode] Move Bitstream to a separate library 2019-07-03 22:40:07 +00:00
CodeGen [llvm] Migrate llvm::make_unique to std::make_unique 2019-08-15 15:54:37 +00:00
DebugInfo Add FileWriter to GSYM and encode/decode functions to AddressRange and AddressRanges 2019-08-21 21:48:11 +00:00
Demangle Update more file headers across all of the LLVM projects in the monorepo 2019-01-19 10:56:40 +00:00
ExecutionEngine [cmake] Link in LLVMPasses due to dependency by LLVMOrcJIT; NFC 2019-08-19 23:12:48 +00:00
FuzzMutate [llvm] Migrate llvm::make_unique to std::make_unique 2019-08-15 15:54:37 +00:00
IR [llvm] Migrate llvm::make_unique to std::make_unique 2019-08-15 15:54:37 +00:00
LineEditor Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
Linker [llvm] Migrate llvm::make_unique to std::make_unique 2019-08-15 15:54:37 +00:00
MC [llvm] Migrate llvm::make_unique to std::make_unique 2019-08-15 15:54:37 +00:00
MI MachineModuleInfo: Store more specific reference to LLVMTargetMachine; NFC 2018-11-05 23:49:13 +00:00
Object Minidump: Add support for the MemoryList stream 2019-05-16 15:17:30 +00:00
ObjectYAML MinidumpYAML: move serialization code to MinidumpEmitter.cpp 2019-08-21 11:30:48 +00:00
Option Option spell checking: Penalize delimiter flags if input has no argument 2019-05-01 16:45:15 +00:00
Passes Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
ProfileData [llvm] Migrate llvm::make_unique to std::make_unique 2019-08-15 15:54:37 +00:00
Remarks Reland: [Remarks] Add an LLVM-bitstream-based remark serializer 2019-07-31 00:13:51 +00:00
Support [Support] Improve readNativeFile(Slice) interface 2019-08-22 08:13:30 +00:00
Target [llvm] Migrate llvm::make_unique to std::make_unique 2019-08-15 15:54:37 +00:00
TextAPI [TextAPI] Update reader to be supported by lib/Object 2019-08-16 15:30:48 +00:00
Transforms [llvm] Migrate llvm::make_unique to std::make_unique 2019-08-15 15:54:37 +00:00
XRay [llvm] Migrate llvm::make_unique to std::make_unique 2019-08-15 15:54:37 +00:00
tools Revert CMake: Make most target symbols hidden by default 2019-06-11 03:21:13 +00:00
CMakeLists.txt [Bitcode] Move Bitstream to a separate library 2019-07-03 22:40:07 +00:00
unittest.cfg.in Add support for unittest inputs. 2018-09-05 23:30:17 +00:00