23 Limit.MaxLength = MaxLength;
24 Limit.BeginOffset = getCurrentOffset();
25 Limits.push_back(Limit);
30 assert(!Limits.empty() &&
"Not in a record!");
48 int PaddingBytes = 4 -
Align;
49 while (PaddingBytes > 0) {
50 char Pad =
static_cast<uint8_t>(LF_PAD0 + PaddingBytes);
52 Streamer->emitBytes(BytesSR);
64 assert(!Limits.empty() &&
"Not in a record!");
71 std::optional<uint32_t> Min = Limits.front().bytesRemaining(
Offset);
72 for (
auto X :
ArrayRef(Limits).drop_front()) {
73 std::optional<uint32_t> ThisMin =
X.bytesRemaining(
Offset);
75 Min = Min ? std::min(*Min, *ThisMin) : *ThisMin;
77 assert(Min &&
"Every field must have a maximum length!");
84 return Reader->padToAlignment(
Align);
85 return Writer->padToAlignment(
Align);
91 if (Reader->bytesRemaining() == 0)
99 unsigned BytesToAdvance = Leaf & 0x0F;
100 return Reader->skip(BytesToAdvance);
104 const Twine &Comment) {
106 emitComment(Comment);
108 incrStreamedLen(Bytes.
size());
110 if (
auto EC = Writer->writeBytes(Bytes))
113 if (
auto EC = Reader->readBytes(Bytes, Reader->bytesRemaining()))
120 const Twine &Comment) {
125 Bytes.assign(BytesRef.
begin(), BytesRef.
end());
132 std::string TypeNameStr = Streamer->getTypeName(TypeInd);
133 if (!TypeNameStr.empty())
134 emitComment(Comment +
": " + TypeNameStr);
136 emitComment(Comment);
138 incrStreamedLen(
sizeof(TypeInd.
getIndex()));
140 if (
auto EC = Writer->writeInteger(TypeInd.
getIndex()))
144 if (
auto EC = Reader->readInteger(
I))
152 const Twine &Comment) {
155 emitComment(Comment);
156 Streamer->emitAPSIntValue(V);
161 return Writer->writeInt128(V);
165 const Twine &Comment) {
183 const Twine &Comment) {
199 if (
Value.isUnsigned())
200 return mapWriteEncodedUnsignedInteger(
Value, Comment);
202 return mapWriteEncodedSignedInteger(
Value, Comment);
209 emitComment(Comment);
210 Streamer->emitBytes(NullTerminatedString);
211 incrStreamedLen(NullTerminatedString.size());
215 if (
auto EC = Writer->writeCString(S))
218 if (
auto EC = Reader->readCString(
Value))
229 StringRef((
reinterpret_cast<const char *
>(&
Guid)), GuidSize);
230 emitComment(Comment);
231 Streamer->emitBytes(GuidSR);
232 incrStreamedLen(GuidSize);
240 if (
auto EC = Writer->writeBytes(
Guid.Guid))
244 if (
auto EC = Reader->readBytes(GuidBytes, GuidSize))
246 memcpy(
Guid.Guid, GuidBytes.
data(), GuidSize);
252 const Twine &Comment) {
255 emitComment(Comment);
256 for (
auto V :
Value) {
276Error CodeViewRecordIO::mapWriteEncodedSignedInteger(
const APSInt &APValue,
277 const Twine &Comment) {
292 if (
Value >= std::numeric_limits<int8_t>::min() &&
293 Value <= std::numeric_limits<int8_t>::max()) {
299 if (
Value >= std::numeric_limits<int16_t>::min() &&
300 Value <= std::numeric_limits<int16_t>::max()) {
306 if (
Value >= std::numeric_limits<int32_t>::min() &&
307 Value <= std::numeric_limits<int32_t>::max()) {
318Error CodeViewRecordIO::mapWriteEncodedUnsignedInteger(
const APSInt &APValue,
319 const Twine &Comment) {
331 if (
Value < LF_NUMERIC)
334 if (
Value <= std::numeric_limits<uint16_t>::max()) {
340 if (
Value <= std::numeric_limits<uint32_t>::max()) {
assert(UImm &&(UImm !=~static_cast< T >(0)) &&"Invalid immediate!")
#define LLVM_UNLIKELY(EXPR)
Class for arbitrary precision integers.
uint64_t getZExtValue() const
Get zero extended value.
unsigned getActiveBits() const
Compute the number of active bits in the value.
bool isSingleWord() const
Determine if this APInt just has one word to store value.
int64_t getSExtValue() const
Get sign extended value.
An arbitrary precision integer that knows its signedness.
Represent a constant reference to an array (0 or more elements consecutively in memory),...
size_t size() const
Get the array size.
Lightweight error class with error context and mandatory checking.
static ErrorSuccess success()
Create a success value.
Represent a constant reference to a string, i.e.
constexpr bool empty() const
Check if the string is empty.
Twine - A lightweight data structure for efficiently representing the concatenation of temporary valu...
LLVM Value Representation.
LLVM_ABI Error padToAlignment(uint32_t Align)
LLVM_ABI Error endRecord()
LLVM_ABI Error mapInteger(TypeIndex &TypeInd, const Twine &Comment="")
LLVM_ABI Error mapGuid(GUID &Guid, const Twine &Comment="")
LLVM_ABI Error mapStringZVectorZ(std::vector< StringRef > &Value, const Twine &Comment="")
LLVM_ABI Error skipPadding()
LLVM_ABI Error mapStringZ(StringRef &Value, const Twine &Comment="")
LLVM_ABI Error mapWriteInt128(const APSInt &Value, const Twine &Comment="")
Error mapWriteInteger(const T &Value, const Twine &Comment="")
uint64_t getStreamedLen()
LLVM_ABI Error mapEncodedInteger(int64_t &Value, const Twine &Comment="")
LLVM_ABI Error beginRecord(std::optional< uint32_t > MaxLength)
LLVM_ABI Error mapByteVectorTail(ArrayRef< uint8_t > &Bytes, const Twine &Comment="")
LLVM_ABI uint32_t maxFieldLength() const
void setIndex(uint32_t I)
uint32_t getIndex() const
This is an optimization pass for GlobalISel generic memory operations.
RelativeUniformCounterPtr ValuesPtrExpr VTableAddr Value
Error make_error(ArgTs &&... Args)
Make a Error instance representing failure using the given error info type.
ArrayRef(const T &OneElt) -> ArrayRef< T >
StringRef toStringRef(bool B)
Construct a string ref from a boolean.
This struct is a compact representation of a valid (non-zero power of two) alignment.
This represents the 'GUID' type from windows.h.