20 Limit.MaxLength = MaxLength;
21 Limit.BeginOffset = getCurrentOffset();
45 int PaddingBytes = 4 -
Align;
46 while (PaddingBytes > 0) {
47 char Pad =
static_cast<uint8_t
>(LF_PAD0 + PaddingBytes);
72 Min = (Min.
hasValue()) ? std::min(*Min, *ThisMin) : *ThisMin;
74 assert(Min.
hasValue() &&
"Every field must have a maximum length!");
91 uint8_t Leaf = Reader->
peek();
96 unsigned BytesToAdvance = Leaf & 0x0F;
97 return Reader->
skip(BytesToAdvance);
101 const Twine &Comment) {
103 emitComment(Comment);
105 incrStreamedLen(Bytes.
size());
117 const Twine &Comment) {
122 Bytes.assign(BytesRef.
begin(), BytesRef.
end());
129 std::string TypeNameStr = Streamer->
getTypeName(TypeInd);
130 if (!TypeNameStr.empty())
131 emitComment(Comment +
": " + TypeNameStr);
133 emitComment(Comment);
135 incrStreamedLen(
sizeof(TypeInd.
getIndex()));
149 const Twine &Comment) {
152 emitEncodedUnsignedInteger(static_cast<uint64_t>(Value), Comment);
154 emitEncodedSignedInteger(Value, Comment);
157 if (
auto EC = writeEncodedUnsignedInteger(static_cast<uint64_t>(Value)))
160 if (
auto EC = writeEncodedSignedInteger(Value))
174 const Twine &Comment) {
176 emitEncodedUnsignedInteger(Value, Comment);
178 if (
auto EC = writeEncodedUnsignedInteger(Value))
192 emitEncodedSignedInteger(Value.
getSExtValue(), Comment);
194 emitEncodedUnsignedInteger(Value.
getZExtValue(), Comment);
198 return writeEncodedUnsignedInteger(Value.
getZExtValue());
200 return consume(*Reader, Value);
207 emitComment(Comment);
208 Streamer->
EmitBytes(NullTerminatedString);
209 incrStreamedLen(NullTerminatedString.size());
227 StringRef((reinterpret_cast<const char *>(&Guid)), GuidSize);
228 emitComment(Comment);
230 incrStreamedLen(GuidSize);
242 if (
auto EC = Reader->
readBytes(GuidBytes, GuidSize))
244 memcpy(Guid.
Guid, GuidBytes.
data(), GuidSize);
250 const Twine &Comment) {
253 emitComment(Comment);
254 for (
auto V : Value) {
258 uint8_t FinalZero = 0;
274 void CodeViewRecordIO::emitEncodedSignedInteger(
const int64_t &
Value,
275 const Twine &Comment) {
276 assert(
Value < 0 &&
"Encoded integer is not signed!");
277 if (
Value >= std::numeric_limits<int8_t>::min()) {
279 emitComment(Comment);
282 }
else if (
Value >= std::numeric_limits<int16_t>::min()) {
284 emitComment(Comment);
287 }
else if (
Value >= std::numeric_limits<int32_t>::min()) {
289 emitComment(Comment);
294 emitComment(Comment);
300 void CodeViewRecordIO::emitEncodedUnsignedInteger(
const uint64_t &
Value,
301 const Twine &Comment) {
302 if (
Value < LF_NUMERIC) {
303 emitComment(Comment);
308 emitComment(Comment);
313 emitComment(Comment);
318 emitComment(Comment);
324 Error CodeViewRecordIO::writeEncodedSignedInteger(
const int64_t &
Value) {
325 assert(Value < 0 &&
"Encoded integer is not signed!");
326 if (Value >= std::numeric_limits<int8_t>::min()) {
331 }
else if (Value >= std::numeric_limits<int16_t>::min()) {
336 }
else if (Value >= std::numeric_limits<int32_t>::min()) {
350 Error CodeViewRecordIO::writeEncodedUnsignedInteger(
const uint64_t &
Value) {
351 if (Value < LF_NUMERIC) {
LLVM_NODISCARD StringRef take_front(size_t N=1) const
Return a StringRef equal to 'this' but with only the first N elements remaining.
constexpr char Align[]
Key for Kernel::Arg::Metadata::mAlign.
Error padToAlignment(uint32_t Align)
Error writeBytes(ArrayRef< uint8_t > Buffer)
Write the bytes specified in Buffer to the underlying stream.
static GCMetadataPrinterRegistry::Add< ErlangGCPrinter > X("erlang", "erlang-compatible garbage collector")
virtual std::string getTypeName(TypeIndex TI)=0
uint64_t getZExtValue() const
Get zero extended value.
This class represents lattice values for constants.
Error readInteger(T &Dest)
Read an integer of the specified endianness into Dest and update the stream's offset.
void push_back(const T &Elt)
Error mapGuid(GUID &Guid, const Twine &Comment="")
uint8_t peek() const
Examine the next byte of the underlying stream without advancing the stream's offset.
Twine - A lightweight data structure for efficiently representing the concatenation of temporary valu...
void setIndex(uint32_t I)
ArrayRef< T > makeArrayRef(const T &OneElt)
Construct an ArrayRef from a single element.
Error beginRecord(Optional< uint32_t > MaxLength)
This represents the 'GUID' type from windows.h.
Error mapStringZVectorZ(std::vector< StringRef > &Value, const Twine &Comment="")
LLVM_NODISCARD bool empty() const
empty - Check if the string is empty.
Error readCString(StringRef &Dest)
Read a null terminated string from Dest.
int64_t getSExtValue() const
Get sign extended value.
uint32_t maxFieldLength() const
LLVM_NODISCARD size_t size() const
size - Get the string size.
Error padToAlignment(uint32_t Align)
size_t size() const
size - Get the array size.
virtual void EmitBytes(StringRef Data)=0
Error writeInteger(T Value)
Write the integer Value to the underlying stream in the specified endianness.
StringRef toStringRef(bool B)
Construct a string ref from a boolean.
Error mapInteger(TypeIndex &TypeInd, const Twine &Comment="")
This struct is a compact representation of a valid (non-zero power of two) alignment.
uint32_t getIndex() const
uint64_t getStreamedLen()
virtual void EmitIntValue(uint64_t Value, unsigned Size)=0
Error writeCString(StringRef Str)
Write the string Str to the underlying stream followed by a null terminator.
Error mapByteVectorTail(ArrayRef< uint8_t > &Bytes, const Twine &Comment="")
int64_t getExtValue() const
Get the correctly-extended int64_t value.
static ErrorSuccess success()
Create a success value.
Align max(MaybeAlign Lhs, Align Rhs)
Error mapEncodedInteger(int64_t &Value, const Twine &Comment="")
Error mapStringZ(StringRef &Value, const Twine &Comment="")
Error readBytes(ArrayRef< uint8_t > &Buffer, uint32_t Size)
Read Size bytes from the underlying stream at the current offset and and set Buffer to the resulting ...
LLVM_NODISCARD bool empty() const
Error padToAlignment(uint32_t Align)
Error skip(uint32_t Amount)
Advance the stream's offset by Amount bytes.
uint32_t bytesRemaining() const
Error consume(BinaryStreamReader &Reader)
LLVM_NODISCARD const char * data() const
data - Get a pointer to the start of the string (which may not be null terminated).
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
LLVM Value Representation.
Lightweight error class with error context and mandatory checking.
StringRef - Represent a constant reference to a string, i.e.
virtual void EmitBinaryData(StringRef Data)=0