LLVM 20.0.0git
|
A simplified binary data writer class that doesn't require targets, target definitions, architectures, or require any other optional compile time libraries to be enabled via the build process. More...
#include "llvm/DebugInfo/GSYM/FileWriter.h"
Public Member Functions | |
FileWriter (llvm::raw_pwrite_stream &S, llvm::endianness B) | |
~FileWriter () | |
void | writeU8 (uint8_t Value) |
Write a single uint8_t value into the stream at the current file position. | |
void | writeU16 (uint16_t Value) |
Write a single uint16_t value into the stream at the current file position. | |
void | writeU32 (uint32_t Value) |
Write a single uint32_t value into the stream at the current file position. | |
void | writeU64 (uint64_t Value) |
Write a single uint64_t value into the stream at the current file position. | |
void | writeSLEB (int64_t Value) |
Write the value into the stream encoded using signed LEB128 at the current file position. | |
void | writeULEB (uint64_t Value) |
Write the value into the stream encoded using unsigned LEB128 at the current file position. | |
void | writeData (llvm::ArrayRef< uint8_t > Data) |
Write an array of uint8_t values into the stream at the current file position. | |
void | writeNullTerminated (llvm::StringRef Str) |
Write a NULL terminated C string into the stream at the current file position. | |
void | fixup32 (uint32_t Value, uint64_t Offset) |
Fixup a uint32_t value at the specified offset in the stream. | |
void | alignTo (size_t Align) |
Pad with zeroes at the current file position until the current file position matches the specified alignment. | |
uint64_t | tell () |
Return the current offset within the file. | |
llvm::raw_pwrite_stream & | get_stream () |
llvm::endianness | getByteOrder () const |
A simplified binary data writer class that doesn't require targets, target definitions, architectures, or require any other optional compile time libraries to be enabled via the build process.
This class needs the ability to seek to different spots in the binary stream that is produces to fixup offsets and sizes.
Definition at line 29 of file FileWriter.h.
|
inline |
Definition at line 34 of file FileWriter.h.
References OS.
FileWriter::~FileWriter | ( | ) |
Definition at line 17 of file FileWriter.cpp.
References llvm::raw_ostream::flush().
void FileWriter::alignTo | ( | size_t | Align | ) |
Pad with zeroes at the current file position until the current file position matches the specified alignment.
Align | An integer speciying the desired alignment. This does not need to be a power of two. |
Definition at line 70 of file FileWriter.cpp.
References llvm::Offset, llvm::raw_ostream::tell(), and llvm::raw_ostream::write_zeros().
Referenced by llvm::gsym::FunctionInfo::encode().
Fixup a uint32_t value at the specified offset in the stream.
This function will save the current file position, seek to the specified offset, overwrite the data using Value, and then restore the file position to the previous file position.
Value | The value to write into the stream. |
Offset | The offset at which to write the Value within the stream. |
Definition at line 52 of file FileWriter.cpp.
References llvm::support::endian::byte_swap(), llvm::Offset, and llvm::raw_pwrite_stream::pwrite().
Referenced by llvm::gsym::MergedFunctionsInfo::encode(), and llvm::gsym::FunctionInfo::encode().
|
inline |
Definition at line 113 of file FileWriter.h.
References OS.
|
inline |
Definition at line 117 of file FileWriter.h.
Referenced by llvm::gsym::FunctionInfo::encode().
uint64_t FileWriter::tell | ( | ) |
Return the current offset within the file.
Definition at line 66 of file FileWriter.cpp.
References llvm::raw_ostream::tell().
Referenced by llvm::gsym::MergedFunctionsInfo::encode(), and llvm::gsym::FunctionInfo::encode().
void FileWriter::writeData | ( | llvm::ArrayRef< uint8_t > | Data | ) |
Write an array of uint8_t values into the stream at the current file position.
Data | An array of values to write into the stream. |
Definition at line 58 of file FileWriter.cpp.
References llvm::Data, and llvm::raw_ostream::write().
Referenced by llvm::gsym::FunctionInfo::encode().
void FileWriter::writeNullTerminated | ( | llvm::StringRef | Str | ) |
Write a NULL terminated C string into the stream at the current file position.
The entire contents of Str will be written into the steam at the current file position and then an extra NULL termation byte will be written. It is up to the user to ensure that Str doesn't contain any NULL characters unless the additional NULL characters are desired.
Str | The value to write into the stream. |
Definition at line 62 of file FileWriter.cpp.
void FileWriter::writeSLEB | ( | int64_t | Value | ) |
Write the value into the stream encoded using signed LEB128 at the current file position.
Value | The value to write into the stream. |
Definition at line 19 of file FileWriter.cpp.
References assert(), llvm::encodeSLEB128(), llvm::Length, and llvm::raw_ostream::write().
Referenced by llvm::gsym::LineTable::encode().
void FileWriter::writeU16 | ( | uint16_t | Value | ) |
Write a single uint16_t value into the stream at the current file position.
The value will be byte swapped if needed to match the byte order specified during construction.
Value | The value to write into the stream. |
Definition at line 37 of file FileWriter.cpp.
References llvm::support::endian::byte_swap(), and llvm::raw_ostream::write().
void FileWriter::writeU32 | ( | uint32_t | Value | ) |
Write a single uint32_t value into the stream at the current file position.
The value will be byte swapped if needed to match the byte order specified during construction.
Value | The value to write into the stream. |
Definition at line 42 of file FileWriter.cpp.
References llvm::support::endian::byte_swap(), and llvm::raw_ostream::write().
Referenced by llvm::gsym::MergedFunctionsInfo::encode(), and llvm::gsym::FunctionInfo::encode().
void FileWriter::writeU64 | ( | uint64_t | Value | ) |
Write a single uint64_t value into the stream at the current file position.
The value will be byte swapped if needed to match the byte order specified during construction.
Value | The value to write into the stream. |
Definition at line 47 of file FileWriter.cpp.
References llvm::support::endian::byte_swap(), and llvm::raw_ostream::write().
void FileWriter::writeU8 | ( | uint8_t | Value | ) |
Write a single uint8_t value into the stream at the current file position.
Value | The value to write into the stream. |
Definition at line 33 of file FileWriter.cpp.
References llvm::raw_ostream::write().
Referenced by llvm::gsym::LineTable::encode().
void FileWriter::writeULEB | ( | uint64_t | Value | ) |
Write the value into the stream encoded using unsigned LEB128 at the current file position.
Value | The value to write into the stream. |
Definition at line 26 of file FileWriter.cpp.
References assert(), llvm::encodeULEB128(), llvm::Length, and llvm::raw_ostream::write().
Referenced by llvm::gsym::LineTable::encode().