LLVM: llvm::BinaryStreamWriter Class Reference (original) (raw)
Provides write only access to a subclass of WritableBinaryStream. More...
#include "[llvm/Support/BinaryStreamWriter.h](BinaryStreamWriter%5F8h%5Fsource.html)"
| Public Member Functions | |
|---|---|
| BinaryStreamWriter ()=default | |
| LLVM_ABI | BinaryStreamWriter (WritableBinaryStreamRef Ref) |
| LLVM_ABI | BinaryStreamWriter (WritableBinaryStream &Stream) |
| LLVM_ABI | BinaryStreamWriter (MutableArrayRef< uint8_t > Data, llvm::endianness Endian) |
| BinaryStreamWriter (const BinaryStreamWriter &Other)=default | |
| BinaryStreamWriter & | operator= (const BinaryStreamWriter &Other)=default |
| virtual | ~BinaryStreamWriter ()=default |
| LLVM_ABI Error | writeBytes (ArrayRef< uint8_t > Buffer) |
| Write the bytes specified in Buffer to the underlying stream. | |
| template<typename T> | |
| Error | writeInteger (T Value) |
| Write the integer Value to the underlying stream in the specified endianness. | |
| template<typename T> | |
| Error | writeEnum (T Num) |
| Similar to writeInteger. | |
| LLVM_ABI Error | writeULEB128 (uint64_t Value) |
| Write the unsigned integer Value to the underlying stream using ULEB128 encoding. | |
| LLVM_ABI Error | writeSLEB128 (int64_t Value) |
| Write the unsigned integer Value to the underlying stream using ULEB128 encoding. | |
| LLVM_ABI Error | writeCString (StringRef Str) |
| Write the string Str to the underlying stream followed by a null terminator. | |
| LLVM_ABI Error | writeFixedString (StringRef Str) |
| Write the string Str to the underlying stream without a null terminator. | |
| LLVM_ABI Error | writeStreamRef (BinaryStreamRef Ref) |
| Efficiently reads all data from Ref, and writes it to this stream. | |
| LLVM_ABI Error | writeStreamRef (BinaryStreamRef Ref, uint64_t Size) |
| Efficiently reads Size bytes from Ref, and writes it to this stream. | |
| template<typename T> | |
| Error | writeObject (const T &Obj) |
| Writes the object Obj to the underlying stream, as if by using memcpy. | |
| template<typename T> | |
| Error | writeArray (ArrayRef< T > Array) |
| Writes an array of objects of type T to the underlying stream, as if by using memcpy. | |
| template<typename T, typename U> | |
| Error | writeArray (VarStreamArray< T, U > Array) |
| Writes all data from the array Array to the underlying stream. | |
| template<typename T> | |
| Error | writeArray (FixedStreamArray< T > Array) |
| Writes all elements from the array Array to the underlying stream. | |
| LLVM_ABI std::pair< BinaryStreamWriter, BinaryStreamWriter > | split (uint64_t Off) const |
| Splits the Writer into two Writers at a given offset. | |
| void | setOffset (uint64_t Off) |
| uint64_t | getOffset () const |
| uint64_t | getLength () const |
| uint64_t | bytesRemaining () const |
| LLVM_ABI Error | padToAlignment (uint32_t Align) |
Provides write only access to a subclass of WritableBinaryStream.
Provides bounds checking and helpers for writing certain common data types such as null-terminated strings, integers in various flavors of endianness, etc. Can be subclassed to provide reading and writing of custom datatypes, although no methods are overridable.
Definition at line 32 of file BinaryStreamWriter.h.
| llvm::BinaryStreamWriter::BinaryStreamWriter ( ) | default |
|---|
◆ BinaryStreamWriter() [2/5]
◆ BinaryStreamWriter() [3/5]
◆ BinaryStreamWriter() [4/5]
◆ BinaryStreamWriter() [5/5]
◆ ~BinaryStreamWriter()
| virtual llvm::BinaryStreamWriter::~BinaryStreamWriter ( ) | virtualdefault |
|---|
◆ bytesRemaining()
| uint64_t llvm::BinaryStreamWriter::bytesRemaining ( ) const | inline |
|---|
◆ getLength()
| uint64_t llvm::BinaryStreamWriter::getLength ( ) const | inline |
|---|
◆ getOffset()
| uint64_t llvm::BinaryStreamWriter::getOffset ( ) const | inline |
|---|
◆ operator=()
◆ padToAlignment()
◆ setOffset()
| void llvm::BinaryStreamWriter::setOffset ( uint64_t Off) | inline |
|---|
◆ split()
◆ writeArray() [1/3]
template<typename T>
| Error llvm::BinaryStreamWriter::writeArray ( ArrayRef< T > Array) | inline |
|---|
Writes an array of objects of type T to the underlying stream, as if by using memcpy.
It is up to the caller to ensure that type of Obj can be safely copied in this fashion, as no checks are made to ensure that this is safe.
Returns
a success error code if the data was successfully written, otherwise returns an appropriate error code.
Definition at line 145 of file BinaryStreamWriter.h.
References llvm::invalid_array_size, llvm::make_error(), llvm::Error::success(), T, and writeBytes().
Referenced by llvm::pdb::DbiStreamBuilder::addDbgStream(), llvm::codeview::DebugChecksumsSubsection::commit(), llvm::codeview::DebugCrossModuleImportsSubsection::commit(), llvm::codeview::DebugFrameDataSubsection::commit(), llvm::codeview::DebugInlineeLinesSubsection::commit(), llvm::codeview::DebugLinesSubsection::commit(), llvm::codeview::DebugSymbolRVASubsection::commit(), llvm::msf::MSFBuilder::commit(), llvm::pdb::DbiStreamBuilder::commit(), llvm::pdb::GSIHashStreamBuilder::commit(), llvm::pdb::DbiStreamBuilder::finalizeMsfLayout(), and padToAlignment().
◆ writeArray() [2/3]
Writes all elements from the array Array to the underlying stream.
Returns
a success error code if the data was successfully written, otherwise returns an appropriate error code.
Definition at line 170 of file BinaryStreamWriter.h.
References writeStreamRef().
◆ writeArray() [3/3]
template<typename T, typename U>
Writes all data from the array Array to the underlying stream.
Returns
a success error code if the data was successfully written, otherwise returns an appropriate error code.
Definition at line 162 of file BinaryStreamWriter.h.
References writeStreamRef().
◆ writeBytes()
Write the bytes specified in Buffer to the underlying stream.
On success, updates the offset so that subsequent writes will occur at the next unwritten position.
Returns
a success error code if the data was successfully written, otherwise returns an appropriate error code.
Definition at line 28 of file BinaryStreamWriter.cpp.
References Offset, llvm::ArrayRef< T >::size(), Stream, and llvm::Error::success().
Referenced by llvm::codeview::DebugSymbolsSubsection::commit(), llvm::pdb::PDBFileBuilder::commit(), llvm::pdb::TpiStreamBuilder::commit(), llvm::pdb::DbiModuleDescriptorBuilder::commitSymbolStream(), llvm::msf::WritableMappedBlockStream::createFpmStream(), llvm::CodeViewYAML::toDebugT(), writeArray(), writeFixedString(), writeInteger(), writeObject(), writePublics(), writeSLEB128(), writeStreamRef(), and writeULEB128().
◆ writeCString()
◆ writeEnum()
template<typename T>
| Error llvm::BinaryStreamWriter::writeEnum ( T Num) | inline |
|---|
◆ writeFixedString()
◆ writeInteger()
template<typename T>
| Error llvm::BinaryStreamWriter::writeInteger ( T Value) | inline |
|---|
Write the integer [Value](classllvm%5F1%5F1Value.html "LLVM Value Representation.") to the underlying stream in the specified endianness.
On success, updates the offset so that subsequent writes occur at the next unwritten position.
Returns
a success error code if the data was successfully written, otherwise returns an appropriate error code.
Definition at line 60 of file BinaryStreamWriter.h.
References Stream, T, llvm::support::endian::write(), and writeBytes().
Referenced by addPadding(), addPadding(), llvm::codeview::DebugCrossModuleExportsSubsection::commit(), llvm::codeview::DebugFrameDataSubsection::commit(), llvm::codeview::DebugInlineeLinesSubsection::commit(), llvm::msf::MSFBuilder::commit(), llvm::pdb::const_iterator< SrcHeaderBlockEntry >::commit(), llvm::pdb::DbiStreamBuilder::commit(), llvm::pdb::InfoStreamBuilder::commit(), llvm::pdb::NamedStreamMap::commit(), llvm::pdb::DbiModuleDescriptorBuilder::commitSymbolStream(), llvm::jitlink::aarch64::lowerPointer64AuthEdgesToSigningFunction(), llvm::CodeViewYAML::toDebugH(), toDebugS(), llvm::CodeViewYAML::toDebugT(), writeEnum(), and llvm::pdb::writeSparseBitVector().
◆ writeObject()
template<typename T>
| Error llvm::BinaryStreamWriter::writeObject ( const T & Obj) | inline |
|---|
Writes the object Obj to the underlying stream, as if by using memcpy.
It is up to the caller to ensure that type of Obj can be safely copied in this fashion, as no checks are made to ensure that this is safe.
Returns
a success error code if the data was successfully written, otherwise returns an appropriate error code.
Definition at line 129 of file BinaryStreamWriter.h.
References T, and writeBytes().
Referenced by llvm::codeview::DebugChecksumsSubsection::commit(), llvm::codeview::DebugCrossModuleImportsSubsection::commit(), llvm::codeview::DebugInlineeLinesSubsection::commit(), llvm::codeview::DebugLinesSubsection::commit(), llvm::codeview::DebugSubsectionRecordBuilder::commit(), llvm::msf::MSFBuilder::commit(), llvm::pdb::const_iterator< SrcHeaderBlockEntry >::commit(), llvm::pdb::DbiModuleDescriptorBuilder::commit(), llvm::pdb::DbiStreamBuilder::commit(), llvm::pdb::GSIHashStreamBuilder::commit(), llvm::pdb::InfoStreamBuilder::commit(), llvm::pdb::TpiStreamBuilder::commit(), commitFpm(), llvm::codeview::SimpleTypeSerializer::serialize(), and writeCString().
◆ writeSLEB128()
| Error BinaryStreamWriter::writeSLEB128 | ( | int64_t | Value | ) |
|---|
◆ writeStreamRef() [1/2]
Efficiently reads all data from Ref, and writes it to this stream.
This operation will not invoke any copies of the source data, regardless of the source stream's implementation.
Returns
a success error code if the data was successfully written, otherwise returns an appropriate error code.
Definition at line 61 of file BinaryStreamWriter.cpp.
References llvm::Ref, and writeStreamRef().
Referenced by llvm::codeview::DebugSubsectionRecordBuilder::commit(), llvm::pdb::DbiStreamBuilder::commit(), llvm::pdb::TpiStreamBuilder::commit(), writeArray(), writeArray(), writeRecords(), and writeStreamRef().
◆ writeStreamRef() [2/2]
◆ writeULEB128()
◆ Offset
| uint64_t llvm::BinaryStreamWriter::Offset = 0 | protected |
|---|
◆ Stream
The documentation for this class was generated from the following files:
- include/llvm/Support/BinaryStreamWriter.h
- lib/Support/BinaryStreamWriter.cpp