forked from OSchip/llvm-project
[CodeView] Use llvm::Error instead of std::error_code.
This eliminates the remnants of std::error_code from the DebugInfo libraries. llvm-svn: 277758
This commit is contained in:
parent
7a0088bbae
commit
660230eba4
|
@ -58,10 +58,12 @@ public:
|
||||||
#define SYMBOL_RECORD(EnumName, EnumVal, Name) \
|
#define SYMBOL_RECORD(EnumName, EnumVal, Name) \
|
||||||
case EnumName: { \
|
case EnumName: { \
|
||||||
SymbolRecordKind RK = static_cast<SymbolRecordKind>(EnumName); \
|
SymbolRecordKind RK = static_cast<SymbolRecordKind>(EnumName); \
|
||||||
auto Result = Name::deserialize(RK, RecordOffset, Data); \
|
auto ExpectedResult = Name::deserialize(RK, RecordOffset, Data); \
|
||||||
if (Result.getError()) \
|
if (!ExpectedResult) { \
|
||||||
|
consumeError(ExpectedResult.takeError()); \
|
||||||
return parseError(); \
|
return parseError(); \
|
||||||
DerivedThis->visit##Name(Record.Type, *Result); \
|
} \
|
||||||
|
DerivedThis->visit##Name(Record.Type, *ExpectedResult); \
|
||||||
break; \
|
break; \
|
||||||
}
|
}
|
||||||
#define SYMBOL_RECORD_ALIAS(EnumName, EnumVal, Name, AliasName) \
|
#define SYMBOL_RECORD_ALIAS(EnumName, EnumVal, Name, AliasName) \
|
||||||
|
|
|
@ -13,8 +13,10 @@
|
||||||
#include "llvm/ADT/APSInt.h"
|
#include "llvm/ADT/APSInt.h"
|
||||||
#include "llvm/ADT/ArrayRef.h"
|
#include "llvm/ADT/ArrayRef.h"
|
||||||
#include "llvm/ADT/StringRef.h"
|
#include "llvm/ADT/StringRef.h"
|
||||||
#include "llvm/Support/Endian.h"
|
|
||||||
#include "llvm/DebugInfo/CodeView/CodeView.h"
|
#include "llvm/DebugInfo/CodeView/CodeView.h"
|
||||||
|
#include "llvm/DebugInfo/CodeView/CodeViewError.h"
|
||||||
|
#include "llvm/Support/Endian.h"
|
||||||
|
#include "llvm/Support/Error.h"
|
||||||
#include <cinttypes>
|
#include <cinttypes>
|
||||||
#include <tuple>
|
#include <tuple>
|
||||||
|
|
||||||
|
@ -38,49 +40,48 @@ StringRef getBytesAsCString(ArrayRef<uint8_t> LeafData);
|
||||||
/// there are not enough bytes remaining. Reinterprets the consumed bytes as a
|
/// there are not enough bytes remaining. Reinterprets the consumed bytes as a
|
||||||
/// T object and points 'Res' at them.
|
/// T object and points 'Res' at them.
|
||||||
template <typename T, typename U>
|
template <typename T, typename U>
|
||||||
inline std::error_code consumeObject(U &Data, const T *&Res) {
|
inline Error consumeObject(U &Data, const T *&Res) {
|
||||||
if (Data.size() < sizeof(*Res))
|
if (Data.size() < sizeof(*Res))
|
||||||
return std::make_error_code(std::errc::illegal_byte_sequence);
|
return make_error<CodeViewError>(
|
||||||
|
cv_error_code::insufficient_buffer,
|
||||||
|
"Error consuming object. Not enough data for requested object size.");
|
||||||
Res = reinterpret_cast<const T *>(Data.data());
|
Res = reinterpret_cast<const T *>(Data.data());
|
||||||
Data = Data.drop_front(sizeof(*Res));
|
Data = Data.drop_front(sizeof(*Res));
|
||||||
return std::error_code();
|
return Error::success();
|
||||||
}
|
}
|
||||||
|
|
||||||
inline std::error_code consume(ArrayRef<uint8_t> &Data) {
|
inline Error consume(ArrayRef<uint8_t> &Data) { return Error::success(); }
|
||||||
return std::error_code();
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Decodes a numeric "leaf" value. These are integer literals encountered in
|
/// Decodes a numeric "leaf" value. These are integer literals encountered in
|
||||||
/// the type stream. If the value is positive and less than LF_NUMERIC (1 <<
|
/// the type stream. If the value is positive and less than LF_NUMERIC (1 <<
|
||||||
/// 15), it is emitted directly in Data. Otherwise, it has a tag like LF_CHAR
|
/// 15), it is emitted directly in Data. Otherwise, it has a tag like LF_CHAR
|
||||||
/// that indicates the bitwidth and sign of the numeric data.
|
/// that indicates the bitwidth and sign of the numeric data.
|
||||||
std::error_code consume(ArrayRef<uint8_t> &Data, APSInt &Num);
|
Error consume(ArrayRef<uint8_t> &Data, APSInt &Num);
|
||||||
std::error_code consume(StringRef &Data, APSInt &Num);
|
Error consume(StringRef &Data, APSInt &Num);
|
||||||
|
|
||||||
/// Decodes a numeric leaf value that is known to be a particular type.
|
/// Decodes a numeric leaf value that is known to be a particular type.
|
||||||
std::error_code consume_numeric(ArrayRef<uint8_t> &Data, uint64_t &Value);
|
Error consume_numeric(ArrayRef<uint8_t> &Data, uint64_t &Value);
|
||||||
|
|
||||||
/// Decodes signed and unsigned fixed-length integers.
|
/// Decodes signed and unsigned fixed-length integers.
|
||||||
std::error_code consume(ArrayRef<uint8_t> &Data, uint32_t &Item);
|
Error consume(ArrayRef<uint8_t> &Data, uint32_t &Item);
|
||||||
std::error_code consume(StringRef &Data, uint32_t &Item);
|
Error consume(StringRef &Data, uint32_t &Item);
|
||||||
std::error_code consume(ArrayRef<uint8_t> &Data, int32_t &Item);
|
Error consume(ArrayRef<uint8_t> &Data, int32_t &Item);
|
||||||
|
|
||||||
/// Decodes a null terminated string.
|
/// Decodes a null terminated string.
|
||||||
std::error_code consume(ArrayRef<uint8_t> &Data, StringRef &Item);
|
Error consume(ArrayRef<uint8_t> &Data, StringRef &Item);
|
||||||
|
|
||||||
/// Decodes an arbitrary object whose layout matches that of the underlying
|
/// Decodes an arbitrary object whose layout matches that of the underlying
|
||||||
/// byte sequence, and returns a pointer to the object.
|
/// byte sequence, and returns a pointer to the object.
|
||||||
template <typename T>
|
template <typename T> Error consume(ArrayRef<uint8_t> &Data, T *&Item) {
|
||||||
std::error_code consume(ArrayRef<uint8_t> &Data, T *&Item) {
|
|
||||||
return consumeObject(Data, Item);
|
return consumeObject(Data, Item);
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename T, typename U> struct serialize_conditional_impl {
|
template <typename T, typename U> struct serialize_conditional_impl {
|
||||||
serialize_conditional_impl(T &Item, U Func) : Item(Item), Func(Func) {}
|
serialize_conditional_impl(T &Item, U Func) : Item(Item), Func(Func) {}
|
||||||
|
|
||||||
std::error_code deserialize(ArrayRef<uint8_t> &Data) const {
|
Error deserialize(ArrayRef<uint8_t> &Data) const {
|
||||||
if (!Func())
|
if (!Func())
|
||||||
return std::error_code();
|
return Error::success();
|
||||||
return consume(Data, Item);
|
return consume(Data, Item);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -96,22 +97,26 @@ serialize_conditional_impl<T, U> serialize_conditional(T &Item, U Func) {
|
||||||
template <typename T, typename U> struct serialize_array_impl {
|
template <typename T, typename U> struct serialize_array_impl {
|
||||||
serialize_array_impl(ArrayRef<T> &Item, U Func) : Item(Item), Func(Func) {}
|
serialize_array_impl(ArrayRef<T> &Item, U Func) : Item(Item), Func(Func) {}
|
||||||
|
|
||||||
std::error_code deserialize(ArrayRef<uint8_t> &Data) const {
|
Error deserialize(ArrayRef<uint8_t> &Data) const {
|
||||||
uint32_t N = Func();
|
uint32_t N = Func();
|
||||||
if (N == 0)
|
if (N == 0)
|
||||||
return std::error_code();
|
return Error::success();
|
||||||
|
|
||||||
uint32_t Size = sizeof(T) * N;
|
uint32_t Size = sizeof(T) * N;
|
||||||
|
|
||||||
if (Size / sizeof(T) != N)
|
if (Size / sizeof(T) != N)
|
||||||
return std::make_error_code(std::errc::illegal_byte_sequence);
|
return make_error<CodeViewError>(
|
||||||
|
cv_error_code::corrupt_record,
|
||||||
|
"Array<T> length is not a multiple of sizeof(T)");
|
||||||
|
|
||||||
if (Data.size() < Size)
|
if (Data.size() < Size)
|
||||||
return std::make_error_code(std::errc::illegal_byte_sequence);
|
return make_error<CodeViewError>(
|
||||||
|
cv_error_code::corrupt_record,
|
||||||
|
"Array<T> does not contain enough data for all elements");
|
||||||
|
|
||||||
Item = ArrayRef<T>(reinterpret_cast<const T *>(Data.data()), N);
|
Item = ArrayRef<T>(reinterpret_cast<const T *>(Data.data()), N);
|
||||||
Data = Data.drop_front(Size);
|
Data = Data.drop_front(Size);
|
||||||
return std::error_code();
|
return Error::success();
|
||||||
}
|
}
|
||||||
|
|
||||||
ArrayRef<T> &Item;
|
ArrayRef<T> &Item;
|
||||||
|
@ -121,7 +126,7 @@ template <typename T, typename U> struct serialize_array_impl {
|
||||||
template <typename T> struct serialize_vector_tail_impl {
|
template <typename T> struct serialize_vector_tail_impl {
|
||||||
serialize_vector_tail_impl(std::vector<T> &Item) : Item(Item) {}
|
serialize_vector_tail_impl(std::vector<T> &Item) : Item(Item) {}
|
||||||
|
|
||||||
std::error_code deserialize(ArrayRef<uint8_t> &Data) const {
|
Error deserialize(ArrayRef<uint8_t> &Data) const {
|
||||||
T Field;
|
T Field;
|
||||||
// Stop when we run out of bytes or we hit record padding bytes.
|
// Stop when we run out of bytes or we hit record padding bytes.
|
||||||
while (!Data.empty() && Data.front() < LF_PAD0) {
|
while (!Data.empty() && Data.front() < LF_PAD0) {
|
||||||
|
@ -129,7 +134,7 @@ template <typename T> struct serialize_vector_tail_impl {
|
||||||
return EC;
|
return EC;
|
||||||
Item.push_back(Field);
|
Item.push_back(Field);
|
||||||
}
|
}
|
||||||
return std::error_code();
|
return Error::success();
|
||||||
}
|
}
|
||||||
|
|
||||||
std::vector<T> &Item;
|
std::vector<T> &Item;
|
||||||
|
@ -139,9 +144,11 @@ struct serialize_null_term_string_array_impl {
|
||||||
serialize_null_term_string_array_impl(std::vector<StringRef> &Item)
|
serialize_null_term_string_array_impl(std::vector<StringRef> &Item)
|
||||||
: Item(Item) {}
|
: Item(Item) {}
|
||||||
|
|
||||||
std::error_code deserialize(ArrayRef<uint8_t> &Data) const {
|
Error deserialize(ArrayRef<uint8_t> &Data) const {
|
||||||
if (Data.empty())
|
if (Data.empty())
|
||||||
return std::make_error_code(std::errc::illegal_byte_sequence);
|
return make_error<CodeViewError>(
|
||||||
|
cv_error_code::insufficient_buffer,
|
||||||
|
"Null terminated string buffer is empty!");
|
||||||
|
|
||||||
StringRef Field;
|
StringRef Field;
|
||||||
// Stop when we run out of bytes or we hit record padding bytes.
|
// Stop when we run out of bytes or we hit record padding bytes.
|
||||||
|
@ -150,10 +157,12 @@ struct serialize_null_term_string_array_impl {
|
||||||
return EC;
|
return EC;
|
||||||
Item.push_back(Field);
|
Item.push_back(Field);
|
||||||
if (Data.empty())
|
if (Data.empty())
|
||||||
return std::make_error_code(std::errc::illegal_byte_sequence);
|
return make_error<CodeViewError>(
|
||||||
|
cv_error_code::insufficient_buffer,
|
||||||
|
"Null terminated string buffer is empty!");
|
||||||
}
|
}
|
||||||
Data = Data.drop_front(1);
|
Data = Data.drop_front(1);
|
||||||
return std::error_code();
|
return Error::success();
|
||||||
}
|
}
|
||||||
|
|
||||||
std::vector<StringRef> &Item;
|
std::vector<StringRef> &Item;
|
||||||
|
@ -162,10 +171,10 @@ struct serialize_null_term_string_array_impl {
|
||||||
template <typename T> struct serialize_arrayref_tail_impl {
|
template <typename T> struct serialize_arrayref_tail_impl {
|
||||||
serialize_arrayref_tail_impl(ArrayRef<T> &Item) : Item(Item) {}
|
serialize_arrayref_tail_impl(ArrayRef<T> &Item) : Item(Item) {}
|
||||||
|
|
||||||
std::error_code deserialize(ArrayRef<uint8_t> &Data) const {
|
Error deserialize(ArrayRef<uint8_t> &Data) const {
|
||||||
uint32_t Count = Data.size() / sizeof(T);
|
uint32_t Count = Data.size() / sizeof(T);
|
||||||
Item = ArrayRef<T>(reinterpret_cast<const T *>(Data.begin()), Count);
|
Item = ArrayRef<T>(reinterpret_cast<const T *>(Data.begin()), Count);
|
||||||
return std::error_code();
|
return Error::success();
|
||||||
}
|
}
|
||||||
|
|
||||||
ArrayRef<T> &Item;
|
ArrayRef<T> &Item;
|
||||||
|
@ -174,7 +183,7 @@ template <typename T> struct serialize_arrayref_tail_impl {
|
||||||
template <typename T> struct serialize_numeric_impl {
|
template <typename T> struct serialize_numeric_impl {
|
||||||
serialize_numeric_impl(T &Item) : Item(Item) {}
|
serialize_numeric_impl(T &Item) : Item(Item) {}
|
||||||
|
|
||||||
std::error_code deserialize(ArrayRef<uint8_t> &Data) const {
|
Error deserialize(ArrayRef<uint8_t> &Data) const {
|
||||||
return consume_numeric(Data, Item);
|
return consume_numeric(Data, Item);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -226,44 +235,40 @@ template <typename T> serialize_numeric_impl<T> serialize_numeric(T &Item) {
|
||||||
#define CV_NUMERIC_FIELD(I) serialize_numeric(I)
|
#define CV_NUMERIC_FIELD(I) serialize_numeric(I)
|
||||||
|
|
||||||
template <typename T, typename U>
|
template <typename T, typename U>
|
||||||
std::error_code consume(ArrayRef<uint8_t> &Data,
|
Error consume(ArrayRef<uint8_t> &Data,
|
||||||
const serialize_conditional_impl<T, U> &Item) {
|
const serialize_conditional_impl<T, U> &Item) {
|
||||||
return Item.deserialize(Data);
|
return Item.deserialize(Data);
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename T, typename U>
|
template <typename T, typename U>
|
||||||
std::error_code consume(ArrayRef<uint8_t> &Data,
|
Error consume(ArrayRef<uint8_t> &Data, const serialize_array_impl<T, U> &Item) {
|
||||||
const serialize_array_impl<T, U> &Item) {
|
|
||||||
return Item.deserialize(Data);
|
return Item.deserialize(Data);
|
||||||
}
|
}
|
||||||
|
|
||||||
inline std::error_code
|
inline Error consume(ArrayRef<uint8_t> &Data,
|
||||||
consume(ArrayRef<uint8_t> &Data,
|
|
||||||
const serialize_null_term_string_array_impl &Item) {
|
const serialize_null_term_string_array_impl &Item) {
|
||||||
return Item.deserialize(Data);
|
return Item.deserialize(Data);
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
std::error_code consume(ArrayRef<uint8_t> &Data,
|
Error consume(ArrayRef<uint8_t> &Data,
|
||||||
const serialize_vector_tail_impl<T> &Item) {
|
const serialize_vector_tail_impl<T> &Item) {
|
||||||
return Item.deserialize(Data);
|
return Item.deserialize(Data);
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
std::error_code consume(ArrayRef<uint8_t> &Data,
|
Error consume(ArrayRef<uint8_t> &Data,
|
||||||
const serialize_arrayref_tail_impl<T> &Item) {
|
const serialize_arrayref_tail_impl<T> &Item) {
|
||||||
return Item.deserialize(Data);
|
return Item.deserialize(Data);
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
std::error_code consume(ArrayRef<uint8_t> &Data,
|
Error consume(ArrayRef<uint8_t> &Data, const serialize_numeric_impl<T> &Item) {
|
||||||
const serialize_numeric_impl<T> &Item) {
|
|
||||||
return Item.deserialize(Data);
|
return Item.deserialize(Data);
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename T, typename U, typename... Args>
|
template <typename T, typename U, typename... Args>
|
||||||
std::error_code consume(ArrayRef<uint8_t> &Data, T &&X, U &&Y,
|
Error consume(ArrayRef<uint8_t> &Data, T &&X, U &&Y, Args &&... Rest) {
|
||||||
Args &&... Rest) {
|
|
||||||
if (auto EC = consume(Data, X))
|
if (auto EC = consume(Data, X))
|
||||||
return EC;
|
return EC;
|
||||||
return consume(Data, Y, std::forward<Args>(Rest)...);
|
return consume(Data, Y, std::forward<Args>(Rest)...);
|
||||||
|
@ -271,7 +276,7 @@ std::error_code consume(ArrayRef<uint8_t> &Data, T &&X, U &&Y,
|
||||||
|
|
||||||
#define CV_DESERIALIZE(...) \
|
#define CV_DESERIALIZE(...) \
|
||||||
if (auto EC = consume(__VA_ARGS__)) \
|
if (auto EC = consume(__VA_ARGS__)) \
|
||||||
return EC;
|
return std::move(EC);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -61,7 +61,7 @@ public:
|
||||||
: SymbolRecord(Kind), RecordOffset(RecordOffset), Header(*H), Name(Name) {
|
: SymbolRecord(Kind), RecordOffset(RecordOffset), Header(*H), Name(Name) {
|
||||||
}
|
}
|
||||||
|
|
||||||
static ErrorOr<ProcSym> deserialize(SymbolRecordKind Kind,
|
static Expected<ProcSym> deserialize(SymbolRecordKind Kind,
|
||||||
uint32_t RecordOffset,
|
uint32_t RecordOffset,
|
||||||
ArrayRef<uint8_t> &Data) {
|
ArrayRef<uint8_t> &Data) {
|
||||||
const Hdr *H = nullptr;
|
const Hdr *H = nullptr;
|
||||||
|
@ -100,7 +100,7 @@ public:
|
||||||
: SymbolRecord(Kind), RecordOffset(RecordOffset), Header(*H), Name(Name),
|
: SymbolRecord(Kind), RecordOffset(RecordOffset), Header(*H), Name(Name),
|
||||||
VariantData(VariantData) {}
|
VariantData(VariantData) {}
|
||||||
|
|
||||||
static ErrorOr<Thunk32Sym> deserialize(SymbolRecordKind Kind,
|
static Expected<Thunk32Sym> deserialize(SymbolRecordKind Kind,
|
||||||
uint32_t RecordOffset,
|
uint32_t RecordOffset,
|
||||||
ArrayRef<uint8_t> &Data) {
|
ArrayRef<uint8_t> &Data) {
|
||||||
const Hdr *H = nullptr;
|
const Hdr *H = nullptr;
|
||||||
|
@ -133,7 +133,7 @@ public:
|
||||||
TrampolineSym(SymbolRecordKind Kind, uint32_t RecordOffset, const Hdr *H)
|
TrampolineSym(SymbolRecordKind Kind, uint32_t RecordOffset, const Hdr *H)
|
||||||
: SymbolRecord(Kind), RecordOffset(RecordOffset), Header(*H) {}
|
: SymbolRecord(Kind), RecordOffset(RecordOffset), Header(*H) {}
|
||||||
|
|
||||||
static ErrorOr<TrampolineSym> deserialize(SymbolRecordKind Kind,
|
static Expected<TrampolineSym> deserialize(SymbolRecordKind Kind,
|
||||||
uint32_t RecordOffset,
|
uint32_t RecordOffset,
|
||||||
ArrayRef<uint8_t> &Data) {
|
ArrayRef<uint8_t> &Data) {
|
||||||
const Hdr *H = nullptr;
|
const Hdr *H = nullptr;
|
||||||
|
@ -165,7 +165,7 @@ public:
|
||||||
: SymbolRecord(Kind), RecordOffset(RecordOffset), Header(*H), Name(Name) {
|
: SymbolRecord(Kind), RecordOffset(RecordOffset), Header(*H), Name(Name) {
|
||||||
}
|
}
|
||||||
|
|
||||||
static ErrorOr<SectionSym> deserialize(SymbolRecordKind Kind,
|
static Expected<SectionSym> deserialize(SymbolRecordKind Kind,
|
||||||
uint32_t RecordOffset,
|
uint32_t RecordOffset,
|
||||||
ArrayRef<uint8_t> &Data) {
|
ArrayRef<uint8_t> &Data) {
|
||||||
const Hdr *H = nullptr;
|
const Hdr *H = nullptr;
|
||||||
|
@ -197,7 +197,7 @@ public:
|
||||||
: SymbolRecord(Kind), RecordOffset(RecordOffset), Header(*H), Name(Name) {
|
: SymbolRecord(Kind), RecordOffset(RecordOffset), Header(*H), Name(Name) {
|
||||||
}
|
}
|
||||||
|
|
||||||
static ErrorOr<CoffGroupSym> deserialize(SymbolRecordKind Kind,
|
static Expected<CoffGroupSym> deserialize(SymbolRecordKind Kind,
|
||||||
uint32_t RecordOffset,
|
uint32_t RecordOffset,
|
||||||
ArrayRef<uint8_t> &Data) {
|
ArrayRef<uint8_t> &Data) {
|
||||||
const Hdr *H = nullptr;
|
const Hdr *H = nullptr;
|
||||||
|
@ -218,7 +218,7 @@ public:
|
||||||
ScopeEndSym(SymbolRecordKind Kind, uint32_t RecordOffset)
|
ScopeEndSym(SymbolRecordKind Kind, uint32_t RecordOffset)
|
||||||
: SymbolRecord(Kind), RecordOffset(RecordOffset) {}
|
: SymbolRecord(Kind), RecordOffset(RecordOffset) {}
|
||||||
|
|
||||||
static ErrorOr<ScopeEndSym> deserialize(SymbolRecordKind Kind,
|
static Expected<ScopeEndSym> deserialize(SymbolRecordKind Kind,
|
||||||
uint32_t RecordOffset,
|
uint32_t RecordOffset,
|
||||||
ArrayRef<uint8_t> &Data) {
|
ArrayRef<uint8_t> &Data) {
|
||||||
return ScopeEndSym(Kind, RecordOffset);
|
return ScopeEndSym(Kind, RecordOffset);
|
||||||
|
@ -237,7 +237,7 @@ public:
|
||||||
: SymbolRecord(Kind), RecordOffset(RecordOffset), Header(*Header),
|
: SymbolRecord(Kind), RecordOffset(RecordOffset), Header(*Header),
|
||||||
Indices(Indices) {}
|
Indices(Indices) {}
|
||||||
|
|
||||||
static ErrorOr<CallerSym> deserialize(SymbolRecordKind Kind,
|
static Expected<CallerSym> deserialize(SymbolRecordKind Kind,
|
||||||
uint32_t RecordOffset,
|
uint32_t RecordOffset,
|
||||||
ArrayRef<uint8_t> &Data) {
|
ArrayRef<uint8_t> &Data) {
|
||||||
const Hdr *Header;
|
const Hdr *Header;
|
||||||
|
@ -446,7 +446,7 @@ public:
|
||||||
: SymbolRecord(SymbolRecordKind::InlineSiteSym),
|
: SymbolRecord(SymbolRecordKind::InlineSiteSym),
|
||||||
RecordOffset(RecordOffset), Header(*H), Annotations(Annotations) {}
|
RecordOffset(RecordOffset), Header(*H), Annotations(Annotations) {}
|
||||||
|
|
||||||
static ErrorOr<InlineSiteSym> deserialize(SymbolRecordKind Kind,
|
static Expected<InlineSiteSym> deserialize(SymbolRecordKind Kind,
|
||||||
uint32_t RecordOffset,
|
uint32_t RecordOffset,
|
||||||
ArrayRef<uint8_t> &Data) {
|
ArrayRef<uint8_t> &Data) {
|
||||||
const Hdr *H = nullptr;
|
const Hdr *H = nullptr;
|
||||||
|
@ -482,7 +482,7 @@ public:
|
||||||
: SymbolRecord(SymbolRecordKind::PublicSym32), RecordOffset(RecordOffset),
|
: SymbolRecord(SymbolRecordKind::PublicSym32), RecordOffset(RecordOffset),
|
||||||
Header(*H), Name(Name) {}
|
Header(*H), Name(Name) {}
|
||||||
|
|
||||||
static ErrorOr<PublicSym32> deserialize(SymbolRecordKind Kind,
|
static Expected<PublicSym32> deserialize(SymbolRecordKind Kind,
|
||||||
uint32_t RecordOffset,
|
uint32_t RecordOffset,
|
||||||
ArrayRef<uint8_t> &Data) {
|
ArrayRef<uint8_t> &Data) {
|
||||||
const Hdr *H = nullptr;
|
const Hdr *H = nullptr;
|
||||||
|
@ -510,7 +510,7 @@ public:
|
||||||
: SymbolRecord(SymbolRecordKind::RegisterSym), RecordOffset(RecordOffset),
|
: SymbolRecord(SymbolRecordKind::RegisterSym), RecordOffset(RecordOffset),
|
||||||
Header(*H), Name(Name) {}
|
Header(*H), Name(Name) {}
|
||||||
|
|
||||||
static ErrorOr<RegisterSym> deserialize(SymbolRecordKind Kind,
|
static Expected<RegisterSym> deserialize(SymbolRecordKind Kind,
|
||||||
uint32_t RecordOffset,
|
uint32_t RecordOffset,
|
||||||
ArrayRef<uint8_t> &Data) {
|
ArrayRef<uint8_t> &Data) {
|
||||||
const Hdr *H = nullptr;
|
const Hdr *H = nullptr;
|
||||||
|
@ -539,7 +539,7 @@ public:
|
||||||
: SymbolRecord(SymbolRecordKind::ProcRefSym), RecordOffset(RecordOffset),
|
: SymbolRecord(SymbolRecordKind::ProcRefSym), RecordOffset(RecordOffset),
|
||||||
Header(*H), Name(Name) {}
|
Header(*H), Name(Name) {}
|
||||||
|
|
||||||
static ErrorOr<ProcRefSym> deserialize(SymbolRecordKind Kind,
|
static Expected<ProcRefSym> deserialize(SymbolRecordKind Kind,
|
||||||
uint32_t RecordOffset,
|
uint32_t RecordOffset,
|
||||||
ArrayRef<uint8_t> &Data) {
|
ArrayRef<uint8_t> &Data) {
|
||||||
const Hdr *H = nullptr;
|
const Hdr *H = nullptr;
|
||||||
|
@ -567,7 +567,7 @@ public:
|
||||||
: SymbolRecord(SymbolRecordKind::LocalSym), RecordOffset(RecordOffset),
|
: SymbolRecord(SymbolRecordKind::LocalSym), RecordOffset(RecordOffset),
|
||||||
Header(*H), Name(Name) {}
|
Header(*H), Name(Name) {}
|
||||||
|
|
||||||
static ErrorOr<LocalSym> deserialize(SymbolRecordKind Kind,
|
static Expected<LocalSym> deserialize(SymbolRecordKind Kind,
|
||||||
uint32_t RecordOffset,
|
uint32_t RecordOffset,
|
||||||
ArrayRef<uint8_t> &Data) {
|
ArrayRef<uint8_t> &Data) {
|
||||||
const Hdr *H = nullptr;
|
const Hdr *H = nullptr;
|
||||||
|
@ -609,7 +609,7 @@ public:
|
||||||
: SymbolRecord(SymbolRecordKind::DefRangeSym), RecordOffset(RecordOffset),
|
: SymbolRecord(SymbolRecordKind::DefRangeSym), RecordOffset(RecordOffset),
|
||||||
Header(*H), Gaps(Gaps) {}
|
Header(*H), Gaps(Gaps) {}
|
||||||
|
|
||||||
static ErrorOr<DefRangeSym> deserialize(SymbolRecordKind Kind,
|
static Expected<DefRangeSym> deserialize(SymbolRecordKind Kind,
|
||||||
uint32_t RecordOffset,
|
uint32_t RecordOffset,
|
||||||
ArrayRef<uint8_t> &Data) {
|
ArrayRef<uint8_t> &Data) {
|
||||||
const Hdr *H = nullptr;
|
const Hdr *H = nullptr;
|
||||||
|
@ -642,7 +642,7 @@ public:
|
||||||
: SymbolRecord(SymbolRecordKind::DefRangeSubfieldSym),
|
: SymbolRecord(SymbolRecordKind::DefRangeSubfieldSym),
|
||||||
RecordOffset(RecordOffset), Header(*H), Gaps(Gaps) {}
|
RecordOffset(RecordOffset), Header(*H), Gaps(Gaps) {}
|
||||||
|
|
||||||
static ErrorOr<DefRangeSubfieldSym> deserialize(SymbolRecordKind Kind,
|
static Expected<DefRangeSubfieldSym> deserialize(SymbolRecordKind Kind,
|
||||||
uint32_t RecordOffset,
|
uint32_t RecordOffset,
|
||||||
ArrayRef<uint8_t> &Data) {
|
ArrayRef<uint8_t> &Data) {
|
||||||
const Hdr *H = nullptr;
|
const Hdr *H = nullptr;
|
||||||
|
@ -688,7 +688,7 @@ public:
|
||||||
Header.Range.Range = Range;
|
Header.Range.Range = Range;
|
||||||
}
|
}
|
||||||
|
|
||||||
static ErrorOr<DefRangeRegisterSym> deserialize(SymbolRecordKind Kind,
|
static Expected<DefRangeRegisterSym> deserialize(SymbolRecordKind Kind,
|
||||||
uint32_t RecordOffset,
|
uint32_t RecordOffset,
|
||||||
ArrayRef<uint8_t> &Data) {
|
ArrayRef<uint8_t> &Data) {
|
||||||
const Hdr *H = nullptr;
|
const Hdr *H = nullptr;
|
||||||
|
@ -733,7 +733,7 @@ public:
|
||||||
Header.OffsetInParent = OffsetInParent;
|
Header.OffsetInParent = OffsetInParent;
|
||||||
}
|
}
|
||||||
|
|
||||||
static ErrorOr<DefRangeSubfieldRegisterSym>
|
static Expected<DefRangeSubfieldRegisterSym>
|
||||||
deserialize(SymbolRecordKind Kind, uint32_t RecordOffset,
|
deserialize(SymbolRecordKind Kind, uint32_t RecordOffset,
|
||||||
ArrayRef<uint8_t> &Data) {
|
ArrayRef<uint8_t> &Data) {
|
||||||
const Hdr *H = nullptr;
|
const Hdr *H = nullptr;
|
||||||
|
@ -766,7 +766,7 @@ public:
|
||||||
: SymbolRecord(SymbolRecordKind::DefRangeFramePointerRelSym),
|
: SymbolRecord(SymbolRecordKind::DefRangeFramePointerRelSym),
|
||||||
RecordOffset(RecordOffset), Header(*H), Gaps(Gaps) {}
|
RecordOffset(RecordOffset), Header(*H), Gaps(Gaps) {}
|
||||||
|
|
||||||
static ErrorOr<DefRangeFramePointerRelSym>
|
static Expected<DefRangeFramePointerRelSym>
|
||||||
deserialize(SymbolRecordKind Kind, uint32_t RecordOffset,
|
deserialize(SymbolRecordKind Kind, uint32_t RecordOffset,
|
||||||
ArrayRef<uint8_t> &Data) {
|
ArrayRef<uint8_t> &Data) {
|
||||||
const Hdr *H = nullptr;
|
const Hdr *H = nullptr;
|
||||||
|
@ -815,7 +815,7 @@ public:
|
||||||
Header.Range.Range = Range;
|
Header.Range.Range = Range;
|
||||||
}
|
}
|
||||||
|
|
||||||
static ErrorOr<DefRangeRegisterRelSym> deserialize(SymbolRecordKind Kind,
|
static Expected<DefRangeRegisterRelSym> deserialize(SymbolRecordKind Kind,
|
||||||
uint32_t RecordOffset,
|
uint32_t RecordOffset,
|
||||||
ArrayRef<uint8_t> &Data) {
|
ArrayRef<uint8_t> &Data) {
|
||||||
const Hdr *H = nullptr;
|
const Hdr *H = nullptr;
|
||||||
|
@ -848,7 +848,7 @@ public:
|
||||||
: SymbolRecord(SymbolRecordKind::DefRangeFramePointerRelFullScopeSym),
|
: SymbolRecord(SymbolRecordKind::DefRangeFramePointerRelFullScopeSym),
|
||||||
RecordOffset(RecordOffset), Header(*H) {}
|
RecordOffset(RecordOffset), Header(*H) {}
|
||||||
|
|
||||||
static ErrorOr<DefRangeFramePointerRelFullScopeSym>
|
static Expected<DefRangeFramePointerRelFullScopeSym>
|
||||||
deserialize(SymbolRecordKind Kind, uint32_t RecordOffset,
|
deserialize(SymbolRecordKind Kind, uint32_t RecordOffset,
|
||||||
ArrayRef<uint8_t> &Data) {
|
ArrayRef<uint8_t> &Data) {
|
||||||
const Hdr *H = nullptr;
|
const Hdr *H = nullptr;
|
||||||
|
@ -877,7 +877,7 @@ public:
|
||||||
: SymbolRecord(SymbolRecordKind::BlockSym), RecordOffset(RecordOffset),
|
: SymbolRecord(SymbolRecordKind::BlockSym), RecordOffset(RecordOffset),
|
||||||
Header(*H), Name(Name) {}
|
Header(*H), Name(Name) {}
|
||||||
|
|
||||||
static ErrorOr<BlockSym> deserialize(SymbolRecordKind Kind,
|
static Expected<BlockSym> deserialize(SymbolRecordKind Kind,
|
||||||
uint32_t RecordOffset,
|
uint32_t RecordOffset,
|
||||||
ArrayRef<uint8_t> &Data) {
|
ArrayRef<uint8_t> &Data) {
|
||||||
const Hdr *H = nullptr;
|
const Hdr *H = nullptr;
|
||||||
|
@ -910,7 +910,7 @@ public:
|
||||||
: SymbolRecord(SymbolRecordKind::LabelSym), RecordOffset(RecordOffset),
|
: SymbolRecord(SymbolRecordKind::LabelSym), RecordOffset(RecordOffset),
|
||||||
Header(*H), Name(Name) {}
|
Header(*H), Name(Name) {}
|
||||||
|
|
||||||
static ErrorOr<LabelSym> deserialize(SymbolRecordKind Kind,
|
static Expected<LabelSym> deserialize(SymbolRecordKind Kind,
|
||||||
uint32_t RecordOffset,
|
uint32_t RecordOffset,
|
||||||
ArrayRef<uint8_t> &Data) {
|
ArrayRef<uint8_t> &Data) {
|
||||||
const Hdr *H = nullptr;
|
const Hdr *H = nullptr;
|
||||||
|
@ -941,7 +941,7 @@ public:
|
||||||
: SymbolRecord(SymbolRecordKind::ObjNameSym), RecordOffset(RecordOffset),
|
: SymbolRecord(SymbolRecordKind::ObjNameSym), RecordOffset(RecordOffset),
|
||||||
Header(*H), Name(Name) {}
|
Header(*H), Name(Name) {}
|
||||||
|
|
||||||
static ErrorOr<ObjNameSym> deserialize(SymbolRecordKind Kind,
|
static Expected<ObjNameSym> deserialize(SymbolRecordKind Kind,
|
||||||
uint32_t RecordOffset,
|
uint32_t RecordOffset,
|
||||||
ArrayRef<uint8_t> &Data) {
|
ArrayRef<uint8_t> &Data) {
|
||||||
const Hdr *H = nullptr;
|
const Hdr *H = nullptr;
|
||||||
|
@ -969,7 +969,7 @@ public:
|
||||||
: SymbolRecord(SymbolRecordKind::EnvBlockSym), RecordOffset(RecordOffset),
|
: SymbolRecord(SymbolRecordKind::EnvBlockSym), RecordOffset(RecordOffset),
|
||||||
Header(*H), Fields(Fields) {}
|
Header(*H), Fields(Fields) {}
|
||||||
|
|
||||||
static ErrorOr<EnvBlockSym> deserialize(SymbolRecordKind Kind,
|
static Expected<EnvBlockSym> deserialize(SymbolRecordKind Kind,
|
||||||
uint32_t RecordOffset,
|
uint32_t RecordOffset,
|
||||||
ArrayRef<uint8_t> &Data) {
|
ArrayRef<uint8_t> &Data) {
|
||||||
const Hdr *H = nullptr;
|
const Hdr *H = nullptr;
|
||||||
|
@ -997,7 +997,7 @@ public:
|
||||||
: SymbolRecord(SymbolRecordKind::ExportSym), RecordOffset(RecordOffset),
|
: SymbolRecord(SymbolRecordKind::ExportSym), RecordOffset(RecordOffset),
|
||||||
Header(*H), Name(Name) {}
|
Header(*H), Name(Name) {}
|
||||||
|
|
||||||
static ErrorOr<ExportSym> deserialize(SymbolRecordKind Kind,
|
static Expected<ExportSym> deserialize(SymbolRecordKind Kind,
|
||||||
uint32_t RecordOffset,
|
uint32_t RecordOffset,
|
||||||
ArrayRef<uint8_t> &Data) {
|
ArrayRef<uint8_t> &Data) {
|
||||||
const Hdr *H = nullptr;
|
const Hdr *H = nullptr;
|
||||||
|
@ -1026,7 +1026,7 @@ public:
|
||||||
: SymbolRecord(SymbolRecordKind::FileStaticSym),
|
: SymbolRecord(SymbolRecordKind::FileStaticSym),
|
||||||
RecordOffset(RecordOffset), Header(*H), Name(Name) {}
|
RecordOffset(RecordOffset), Header(*H), Name(Name) {}
|
||||||
|
|
||||||
static ErrorOr<FileStaticSym> deserialize(SymbolRecordKind Kind,
|
static Expected<FileStaticSym> deserialize(SymbolRecordKind Kind,
|
||||||
uint32_t RecordOffset,
|
uint32_t RecordOffset,
|
||||||
ArrayRef<uint8_t> &Data) {
|
ArrayRef<uint8_t> &Data) {
|
||||||
const Hdr *H = nullptr;
|
const Hdr *H = nullptr;
|
||||||
|
@ -1062,7 +1062,7 @@ public:
|
||||||
: SymbolRecord(SymbolRecordKind::Compile2Sym), RecordOffset(RecordOffset),
|
: SymbolRecord(SymbolRecordKind::Compile2Sym), RecordOffset(RecordOffset),
|
||||||
Header(*H), Version(Version) {}
|
Header(*H), Version(Version) {}
|
||||||
|
|
||||||
static ErrorOr<Compile2Sym> deserialize(SymbolRecordKind Kind,
|
static Expected<Compile2Sym> deserialize(SymbolRecordKind Kind,
|
||||||
uint32_t RecordOffset,
|
uint32_t RecordOffset,
|
||||||
ArrayRef<uint8_t> &Data) {
|
ArrayRef<uint8_t> &Data) {
|
||||||
const Hdr *H = nullptr;
|
const Hdr *H = nullptr;
|
||||||
|
@ -1099,7 +1099,7 @@ public:
|
||||||
: SymbolRecord(SymbolRecordKind::Compile3Sym), RecordOffset(RecordOffset),
|
: SymbolRecord(SymbolRecordKind::Compile3Sym), RecordOffset(RecordOffset),
|
||||||
Header(*H), Version(Version) {}
|
Header(*H), Version(Version) {}
|
||||||
|
|
||||||
static ErrorOr<Compile3Sym> deserialize(SymbolRecordKind Kind,
|
static Expected<Compile3Sym> deserialize(SymbolRecordKind Kind,
|
||||||
uint32_t RecordOffset,
|
uint32_t RecordOffset,
|
||||||
ArrayRef<uint8_t> &Data) {
|
ArrayRef<uint8_t> &Data) {
|
||||||
const Hdr *H = nullptr;
|
const Hdr *H = nullptr;
|
||||||
|
@ -1131,7 +1131,7 @@ public:
|
||||||
: SymbolRecord(SymbolRecordKind::FrameProcSym),
|
: SymbolRecord(SymbolRecordKind::FrameProcSym),
|
||||||
RecordOffset(RecordOffset), Header(*H) {}
|
RecordOffset(RecordOffset), Header(*H) {}
|
||||||
|
|
||||||
static ErrorOr<FrameProcSym> deserialize(SymbolRecordKind Kind,
|
static Expected<FrameProcSym> deserialize(SymbolRecordKind Kind,
|
||||||
uint32_t RecordOffset,
|
uint32_t RecordOffset,
|
||||||
ArrayRef<uint8_t> &Data) {
|
ArrayRef<uint8_t> &Data) {
|
||||||
const Hdr *H = nullptr;
|
const Hdr *H = nullptr;
|
||||||
|
@ -1158,7 +1158,7 @@ public:
|
||||||
: SymbolRecord(SymbolRecordKind::CallSiteInfoSym),
|
: SymbolRecord(SymbolRecordKind::CallSiteInfoSym),
|
||||||
RecordOffset(RecordOffset), Header(*H) {}
|
RecordOffset(RecordOffset), Header(*H) {}
|
||||||
|
|
||||||
static ErrorOr<CallSiteInfoSym> deserialize(SymbolRecordKind Kind,
|
static Expected<CallSiteInfoSym> deserialize(SymbolRecordKind Kind,
|
||||||
uint32_t RecordOffset,
|
uint32_t RecordOffset,
|
||||||
ArrayRef<uint8_t> &Data) {
|
ArrayRef<uint8_t> &Data) {
|
||||||
const Hdr *H = nullptr;
|
const Hdr *H = nullptr;
|
||||||
|
@ -1189,7 +1189,7 @@ public:
|
||||||
: SymbolRecord(SymbolRecordKind::HeapAllocationSiteSym),
|
: SymbolRecord(SymbolRecordKind::HeapAllocationSiteSym),
|
||||||
RecordOffset(RecordOffset), Header(*H) {}
|
RecordOffset(RecordOffset), Header(*H) {}
|
||||||
|
|
||||||
static ErrorOr<HeapAllocationSiteSym> deserialize(SymbolRecordKind Kind,
|
static Expected<HeapAllocationSiteSym> deserialize(SymbolRecordKind Kind,
|
||||||
uint32_t RecordOffset,
|
uint32_t RecordOffset,
|
||||||
ArrayRef<uint8_t> &Data) {
|
ArrayRef<uint8_t> &Data) {
|
||||||
const Hdr *H = nullptr;
|
const Hdr *H = nullptr;
|
||||||
|
@ -1220,7 +1220,7 @@ public:
|
||||||
: SymbolRecord(SymbolRecordKind::FrameCookieSym),
|
: SymbolRecord(SymbolRecordKind::FrameCookieSym),
|
||||||
RecordOffset(RecordOffset), Header(*H) {}
|
RecordOffset(RecordOffset), Header(*H) {}
|
||||||
|
|
||||||
static ErrorOr<FrameCookieSym> deserialize(SymbolRecordKind Kind,
|
static Expected<FrameCookieSym> deserialize(SymbolRecordKind Kind,
|
||||||
uint32_t RecordOffset,
|
uint32_t RecordOffset,
|
||||||
ArrayRef<uint8_t> &Data) {
|
ArrayRef<uint8_t> &Data) {
|
||||||
const Hdr *H = nullptr;
|
const Hdr *H = nullptr;
|
||||||
|
@ -1249,7 +1249,7 @@ public:
|
||||||
: SymbolRecord(SymbolRecordKind::UDTSym), RecordOffset(RecordOffset),
|
: SymbolRecord(SymbolRecordKind::UDTSym), RecordOffset(RecordOffset),
|
||||||
Header(*H), Name(Name) {}
|
Header(*H), Name(Name) {}
|
||||||
|
|
||||||
static ErrorOr<UDTSym> deserialize(SymbolRecordKind Kind,
|
static Expected<UDTSym> deserialize(SymbolRecordKind Kind,
|
||||||
uint32_t RecordOffset,
|
uint32_t RecordOffset,
|
||||||
ArrayRef<uint8_t> &Data) {
|
ArrayRef<uint8_t> &Data) {
|
||||||
const Hdr *H = nullptr;
|
const Hdr *H = nullptr;
|
||||||
|
@ -1275,7 +1275,7 @@ public:
|
||||||
: SymbolRecord(SymbolRecordKind::BuildInfoSym),
|
: SymbolRecord(SymbolRecordKind::BuildInfoSym),
|
||||||
RecordOffset(RecordOffset), Header(*H) {}
|
RecordOffset(RecordOffset), Header(*H) {}
|
||||||
|
|
||||||
static ErrorOr<BuildInfoSym> deserialize(SymbolRecordKind Kind,
|
static Expected<BuildInfoSym> deserialize(SymbolRecordKind Kind,
|
||||||
uint32_t RecordOffset,
|
uint32_t RecordOffset,
|
||||||
ArrayRef<uint8_t> &Data) {
|
ArrayRef<uint8_t> &Data) {
|
||||||
const Hdr *H = nullptr;
|
const Hdr *H = nullptr;
|
||||||
|
@ -1301,7 +1301,7 @@ public:
|
||||||
: SymbolRecord(SymbolRecordKind::BPRelativeSym),
|
: SymbolRecord(SymbolRecordKind::BPRelativeSym),
|
||||||
RecordOffset(RecordOffset), Header(*H), Name(Name) {}
|
RecordOffset(RecordOffset), Header(*H), Name(Name) {}
|
||||||
|
|
||||||
static ErrorOr<BPRelativeSym> deserialize(SymbolRecordKind Kind,
|
static Expected<BPRelativeSym> deserialize(SymbolRecordKind Kind,
|
||||||
uint32_t RecordOffset,
|
uint32_t RecordOffset,
|
||||||
ArrayRef<uint8_t> &Data) {
|
ArrayRef<uint8_t> &Data) {
|
||||||
const Hdr *H = nullptr;
|
const Hdr *H = nullptr;
|
||||||
|
@ -1330,7 +1330,7 @@ public:
|
||||||
: SymbolRecord(SymbolRecordKind::RegRelativeSym),
|
: SymbolRecord(SymbolRecordKind::RegRelativeSym),
|
||||||
RecordOffset(RecordOffset), Header(*H), Name(Name) {}
|
RecordOffset(RecordOffset), Header(*H), Name(Name) {}
|
||||||
|
|
||||||
static ErrorOr<RegRelativeSym> deserialize(SymbolRecordKind Kind,
|
static Expected<RegRelativeSym> deserialize(SymbolRecordKind Kind,
|
||||||
uint32_t RecordOffset,
|
uint32_t RecordOffset,
|
||||||
ArrayRef<uint8_t> &Data) {
|
ArrayRef<uint8_t> &Data) {
|
||||||
const Hdr *H = nullptr;
|
const Hdr *H = nullptr;
|
||||||
|
@ -1359,7 +1359,7 @@ public:
|
||||||
: SymbolRecord(SymbolRecordKind::ConstantSym), RecordOffset(RecordOffset),
|
: SymbolRecord(SymbolRecordKind::ConstantSym), RecordOffset(RecordOffset),
|
||||||
Header(*H), Value(Value), Name(Name) {}
|
Header(*H), Value(Value), Name(Name) {}
|
||||||
|
|
||||||
static ErrorOr<ConstantSym> deserialize(SymbolRecordKind Kind,
|
static Expected<ConstantSym> deserialize(SymbolRecordKind Kind,
|
||||||
uint32_t RecordOffset,
|
uint32_t RecordOffset,
|
||||||
ArrayRef<uint8_t> &Data) {
|
ArrayRef<uint8_t> &Data) {
|
||||||
const Hdr *H = nullptr;
|
const Hdr *H = nullptr;
|
||||||
|
@ -1390,7 +1390,7 @@ public:
|
||||||
: SymbolRecord(SymbolRecordKind::DataSym), RecordOffset(RecordOffset),
|
: SymbolRecord(SymbolRecordKind::DataSym), RecordOffset(RecordOffset),
|
||||||
Header(*H), Name(Name) {}
|
Header(*H), Name(Name) {}
|
||||||
|
|
||||||
static ErrorOr<DataSym> deserialize(SymbolRecordKind Kind,
|
static Expected<DataSym> deserialize(SymbolRecordKind Kind,
|
||||||
uint32_t RecordOffset,
|
uint32_t RecordOffset,
|
||||||
ArrayRef<uint8_t> &Data) {
|
ArrayRef<uint8_t> &Data) {
|
||||||
const Hdr *H = nullptr;
|
const Hdr *H = nullptr;
|
||||||
|
@ -1423,7 +1423,7 @@ public:
|
||||||
: SymbolRecord(SymbolRecordKind::ThreadLocalDataSym),
|
: SymbolRecord(SymbolRecordKind::ThreadLocalDataSym),
|
||||||
RecordOffset(RecordOffset), Header(*H), Name(Name) {}
|
RecordOffset(RecordOffset), Header(*H), Name(Name) {}
|
||||||
|
|
||||||
static ErrorOr<ThreadLocalDataSym> deserialize(SymbolRecordKind Kind,
|
static Expected<ThreadLocalDataSym> deserialize(SymbolRecordKind Kind,
|
||||||
uint32_t RecordOffset,
|
uint32_t RecordOffset,
|
||||||
ArrayRef<uint8_t> &Data) {
|
ArrayRef<uint8_t> &Data) {
|
||||||
const Hdr *H = nullptr;
|
const Hdr *H = nullptr;
|
||||||
|
|
|
@ -16,7 +16,7 @@
|
||||||
#include "llvm/DebugInfo/CodeView/CVRecord.h"
|
#include "llvm/DebugInfo/CodeView/CVRecord.h"
|
||||||
#include "llvm/DebugInfo/CodeView/CodeView.h"
|
#include "llvm/DebugInfo/CodeView/CodeView.h"
|
||||||
#include "llvm/DebugInfo/CodeView/TypeIndex.h"
|
#include "llvm/DebugInfo/CodeView/TypeIndex.h"
|
||||||
#include "llvm/Support/ErrorOr.h"
|
#include "llvm/Support/Error.h"
|
||||||
#include <cinttypes>
|
#include <cinttypes>
|
||||||
#include <utility>
|
#include <utility>
|
||||||
|
|
||||||
|
@ -83,7 +83,7 @@ public:
|
||||||
/// is not in the map.
|
/// is not in the map.
|
||||||
bool remapTypeIndices(ArrayRef<TypeIndex> IndexMap);
|
bool remapTypeIndices(ArrayRef<TypeIndex> IndexMap);
|
||||||
|
|
||||||
static ErrorOr<MemberPointerInfo> deserialize(ArrayRef<uint8_t> &Data);
|
static Expected<MemberPointerInfo> deserialize(ArrayRef<uint8_t> &Data);
|
||||||
|
|
||||||
TypeIndex getContainingType() const { return ContainingType; }
|
TypeIndex getContainingType() const { return ContainingType; }
|
||||||
PointerToMemberRepresentation getRepresentation() const {
|
PointerToMemberRepresentation getRepresentation() const {
|
||||||
|
@ -122,7 +122,7 @@ public:
|
||||||
/// is not in the map.
|
/// is not in the map.
|
||||||
bool remapTypeIndices(ArrayRef<TypeIndex> IndexMap);
|
bool remapTypeIndices(ArrayRef<TypeIndex> IndexMap);
|
||||||
|
|
||||||
static ErrorOr<ModifierRecord> deserialize(TypeRecordKind Kind,
|
static Expected<ModifierRecord> deserialize(TypeRecordKind Kind,
|
||||||
ArrayRef<uint8_t> &Data);
|
ArrayRef<uint8_t> &Data);
|
||||||
|
|
||||||
TypeIndex getModifiedType() const { return ModifiedType; }
|
TypeIndex getModifiedType() const { return ModifiedType; }
|
||||||
|
@ -152,7 +152,7 @@ public:
|
||||||
/// is not in the map.
|
/// is not in the map.
|
||||||
bool remapTypeIndices(ArrayRef<TypeIndex> IndexMap);
|
bool remapTypeIndices(ArrayRef<TypeIndex> IndexMap);
|
||||||
|
|
||||||
static ErrorOr<ProcedureRecord> deserialize(TypeRecordKind Kind,
|
static Expected<ProcedureRecord> deserialize(TypeRecordKind Kind,
|
||||||
ArrayRef<uint8_t> &Data);
|
ArrayRef<uint8_t> &Data);
|
||||||
|
|
||||||
static uint32_t getLayoutSize() { return 2 + sizeof(Layout); }
|
static uint32_t getLayoutSize() { return 2 + sizeof(Layout); }
|
||||||
|
@ -196,7 +196,7 @@ public:
|
||||||
/// is not in the map.
|
/// is not in the map.
|
||||||
bool remapTypeIndices(ArrayRef<TypeIndex> IndexMap);
|
bool remapTypeIndices(ArrayRef<TypeIndex> IndexMap);
|
||||||
|
|
||||||
static ErrorOr<MemberFunctionRecord> deserialize(TypeRecordKind Kind,
|
static Expected<MemberFunctionRecord> deserialize(TypeRecordKind Kind,
|
||||||
ArrayRef<uint8_t> &Data);
|
ArrayRef<uint8_t> &Data);
|
||||||
|
|
||||||
TypeIndex getReturnType() const { return ReturnType; }
|
TypeIndex getReturnType() const { return ReturnType; }
|
||||||
|
@ -242,7 +242,7 @@ public:
|
||||||
/// is not in the map.
|
/// is not in the map.
|
||||||
bool remapTypeIndices(ArrayRef<TypeIndex> IndexMap);
|
bool remapTypeIndices(ArrayRef<TypeIndex> IndexMap);
|
||||||
|
|
||||||
static ErrorOr<MemberFuncIdRecord> deserialize(TypeRecordKind Kind,
|
static Expected<MemberFuncIdRecord> deserialize(TypeRecordKind Kind,
|
||||||
ArrayRef<uint8_t> &Data);
|
ArrayRef<uint8_t> &Data);
|
||||||
TypeIndex getClassType() const { return ClassType; }
|
TypeIndex getClassType() const { return ClassType; }
|
||||||
TypeIndex getFunctionType() const { return FunctionType; }
|
TypeIndex getFunctionType() const { return FunctionType; }
|
||||||
|
@ -269,7 +269,7 @@ public:
|
||||||
/// is not in the map.
|
/// is not in the map.
|
||||||
bool remapTypeIndices(ArrayRef<TypeIndex> IndexMap);
|
bool remapTypeIndices(ArrayRef<TypeIndex> IndexMap);
|
||||||
|
|
||||||
static ErrorOr<ArgListRecord> deserialize(TypeRecordKind Kind,
|
static Expected<ArgListRecord> deserialize(TypeRecordKind Kind,
|
||||||
ArrayRef<uint8_t> &Data);
|
ArrayRef<uint8_t> &Data);
|
||||||
|
|
||||||
ArrayRef<TypeIndex> getIndices() const { return StringIndices; }
|
ArrayRef<TypeIndex> getIndices() const { return StringIndices; }
|
||||||
|
@ -313,7 +313,7 @@ public:
|
||||||
/// is not in the map.
|
/// is not in the map.
|
||||||
bool remapTypeIndices(ArrayRef<TypeIndex> IndexMap);
|
bool remapTypeIndices(ArrayRef<TypeIndex> IndexMap);
|
||||||
|
|
||||||
static ErrorOr<PointerRecord> deserialize(TypeRecordKind Kind,
|
static Expected<PointerRecord> deserialize(TypeRecordKind Kind,
|
||||||
ArrayRef<uint8_t> &Data);
|
ArrayRef<uint8_t> &Data);
|
||||||
|
|
||||||
TypeIndex getReferentType() const { return ReferentType; }
|
TypeIndex getReferentType() const { return ReferentType; }
|
||||||
|
@ -389,7 +389,7 @@ public:
|
||||||
/// is not in the map.
|
/// is not in the map.
|
||||||
bool remapTypeIndices(ArrayRef<TypeIndex> IndexMap);
|
bool remapTypeIndices(ArrayRef<TypeIndex> IndexMap);
|
||||||
|
|
||||||
static ErrorOr<NestedTypeRecord> deserialize(TypeRecordKind Kind,
|
static Expected<NestedTypeRecord> deserialize(TypeRecordKind Kind,
|
||||||
ArrayRef<uint8_t> &Data);
|
ArrayRef<uint8_t> &Data);
|
||||||
|
|
||||||
TypeIndex getNestedType() const { return Type; }
|
TypeIndex getNestedType() const { return Type; }
|
||||||
|
@ -418,7 +418,7 @@ public:
|
||||||
/// is not in the map.
|
/// is not in the map.
|
||||||
bool remapTypeIndices(ArrayRef<TypeIndex> IndexMap);
|
bool remapTypeIndices(ArrayRef<TypeIndex> IndexMap);
|
||||||
|
|
||||||
static ErrorOr<ArrayRecord> deserialize(TypeRecordKind Kind,
|
static Expected<ArrayRecord> deserialize(TypeRecordKind Kind,
|
||||||
ArrayRef<uint8_t> &Data);
|
ArrayRef<uint8_t> &Data);
|
||||||
|
|
||||||
TypeIndex getElementType() const { return ElementType; }
|
TypeIndex getElementType() const { return ElementType; }
|
||||||
|
@ -486,7 +486,7 @@ public:
|
||||||
/// is not in the map.
|
/// is not in the map.
|
||||||
bool remapTypeIndices(ArrayRef<TypeIndex> IndexMap);
|
bool remapTypeIndices(ArrayRef<TypeIndex> IndexMap);
|
||||||
|
|
||||||
static ErrorOr<ClassRecord> deserialize(TypeRecordKind Kind,
|
static Expected<ClassRecord> deserialize(TypeRecordKind Kind,
|
||||||
ArrayRef<uint8_t> &Data);
|
ArrayRef<uint8_t> &Data);
|
||||||
|
|
||||||
HfaKind getHfa() const { return Hfa; }
|
HfaKind getHfa() const { return Hfa; }
|
||||||
|
@ -527,7 +527,7 @@ struct UnionRecord : public TagRecord {
|
||||||
UniqueName),
|
UniqueName),
|
||||||
Hfa(Hfa), Size(Size) {}
|
Hfa(Hfa), Size(Size) {}
|
||||||
|
|
||||||
static ErrorOr<UnionRecord> deserialize(TypeRecordKind Kind,
|
static Expected<UnionRecord> deserialize(TypeRecordKind Kind,
|
||||||
ArrayRef<uint8_t> &Data);
|
ArrayRef<uint8_t> &Data);
|
||||||
|
|
||||||
HfaKind getHfa() const { return Hfa; }
|
HfaKind getHfa() const { return Hfa; }
|
||||||
|
@ -563,7 +563,7 @@ public:
|
||||||
/// Rewrite member type indices with IndexMap. Returns false if a type index is not in the map.
|
/// Rewrite member type indices with IndexMap. Returns false if a type index is not in the map.
|
||||||
bool remapTypeIndices(ArrayRef<TypeIndex> IndexMap);
|
bool remapTypeIndices(ArrayRef<TypeIndex> IndexMap);
|
||||||
|
|
||||||
static ErrorOr<EnumRecord> deserialize(TypeRecordKind Kind,
|
static Expected<EnumRecord> deserialize(TypeRecordKind Kind,
|
||||||
ArrayRef<uint8_t> &Data);
|
ArrayRef<uint8_t> &Data);
|
||||||
|
|
||||||
TypeIndex getUnderlyingType() const { return UnderlyingType; }
|
TypeIndex getUnderlyingType() const { return UnderlyingType; }
|
||||||
|
@ -595,7 +595,7 @@ public:
|
||||||
/// is not in the map.
|
/// is not in the map.
|
||||||
bool remapTypeIndices(ArrayRef<TypeIndex> IndexMap);
|
bool remapTypeIndices(ArrayRef<TypeIndex> IndexMap);
|
||||||
|
|
||||||
static ErrorOr<BitFieldRecord> deserialize(TypeRecordKind Kind,
|
static Expected<BitFieldRecord> deserialize(TypeRecordKind Kind,
|
||||||
ArrayRef<uint8_t> &Data);
|
ArrayRef<uint8_t> &Data);
|
||||||
|
|
||||||
TypeIndex getType() const { return Type; }
|
TypeIndex getType() const { return Type; }
|
||||||
|
@ -626,7 +626,7 @@ public:
|
||||||
/// is not in the map.
|
/// is not in the map.
|
||||||
bool remapTypeIndices(ArrayRef<TypeIndex> IndexMap);
|
bool remapTypeIndices(ArrayRef<TypeIndex> IndexMap);
|
||||||
|
|
||||||
static ErrorOr<VFTableShapeRecord> deserialize(TypeRecordKind Kind,
|
static Expected<VFTableShapeRecord> deserialize(TypeRecordKind Kind,
|
||||||
ArrayRef<uint8_t> &Data);
|
ArrayRef<uint8_t> &Data);
|
||||||
|
|
||||||
ArrayRef<VFTableSlotKind> getSlots() const {
|
ArrayRef<VFTableSlotKind> getSlots() const {
|
||||||
|
@ -661,7 +661,7 @@ public:
|
||||||
/// is not in the map.
|
/// is not in the map.
|
||||||
bool remapTypeIndices(ArrayRef<TypeIndex> IndexMap);
|
bool remapTypeIndices(ArrayRef<TypeIndex> IndexMap);
|
||||||
|
|
||||||
static ErrorOr<TypeServer2Record> deserialize(TypeRecordKind Kind,
|
static Expected<TypeServer2Record> deserialize(TypeRecordKind Kind,
|
||||||
ArrayRef<uint8_t> &Data);
|
ArrayRef<uint8_t> &Data);
|
||||||
|
|
||||||
StringRef getGuid() const { return Guid; }
|
StringRef getGuid() const { return Guid; }
|
||||||
|
@ -692,7 +692,7 @@ public:
|
||||||
/// is not in the map.
|
/// is not in the map.
|
||||||
bool remapTypeIndices(ArrayRef<TypeIndex> IndexMap);
|
bool remapTypeIndices(ArrayRef<TypeIndex> IndexMap);
|
||||||
|
|
||||||
static ErrorOr<StringIdRecord> deserialize(TypeRecordKind Kind,
|
static Expected<StringIdRecord> deserialize(TypeRecordKind Kind,
|
||||||
ArrayRef<uint8_t> &Data);
|
ArrayRef<uint8_t> &Data);
|
||||||
|
|
||||||
TypeIndex getId() const { return Id; }
|
TypeIndex getId() const { return Id; }
|
||||||
|
@ -720,7 +720,7 @@ public:
|
||||||
/// is not in the map.
|
/// is not in the map.
|
||||||
bool remapTypeIndices(ArrayRef<TypeIndex> IndexMap);
|
bool remapTypeIndices(ArrayRef<TypeIndex> IndexMap);
|
||||||
|
|
||||||
static ErrorOr<FuncIdRecord> deserialize(TypeRecordKind Kind,
|
static Expected<FuncIdRecord> deserialize(TypeRecordKind Kind,
|
||||||
ArrayRef<uint8_t> &Data);
|
ArrayRef<uint8_t> &Data);
|
||||||
|
|
||||||
TypeIndex getParentScope() const { return ParentScope; }
|
TypeIndex getParentScope() const { return ParentScope; }
|
||||||
|
@ -752,7 +752,7 @@ public:
|
||||||
/// is not in the map.
|
/// is not in the map.
|
||||||
bool remapTypeIndices(ArrayRef<TypeIndex> IndexMap);
|
bool remapTypeIndices(ArrayRef<TypeIndex> IndexMap);
|
||||||
|
|
||||||
static ErrorOr<UdtSourceLineRecord> deserialize(TypeRecordKind Kind,
|
static Expected<UdtSourceLineRecord> deserialize(TypeRecordKind Kind,
|
||||||
ArrayRef<uint8_t> &Data);
|
ArrayRef<uint8_t> &Data);
|
||||||
|
|
||||||
TypeIndex getUDT() const { return UDT; }
|
TypeIndex getUDT() const { return UDT; }
|
||||||
|
@ -781,7 +781,7 @@ public:
|
||||||
|
|
||||||
bool remapTypeIndices(ArrayRef<TypeIndex> IndexMap);
|
bool remapTypeIndices(ArrayRef<TypeIndex> IndexMap);
|
||||||
|
|
||||||
static ErrorOr<UdtModSourceLineRecord> deserialize(TypeRecordKind Kind,
|
static Expected<UdtModSourceLineRecord> deserialize(TypeRecordKind Kind,
|
||||||
ArrayRef<uint8_t> &Data) {
|
ArrayRef<uint8_t> &Data) {
|
||||||
const Layout *L = nullptr;
|
const Layout *L = nullptr;
|
||||||
CV_DESERIALIZE(Data, L);
|
CV_DESERIALIZE(Data, L);
|
||||||
|
@ -820,7 +820,7 @@ public:
|
||||||
/// is not in the map.
|
/// is not in the map.
|
||||||
bool remapTypeIndices(ArrayRef<TypeIndex> IndexMap);
|
bool remapTypeIndices(ArrayRef<TypeIndex> IndexMap);
|
||||||
|
|
||||||
static ErrorOr<BuildInfoRecord> deserialize(TypeRecordKind Kind,
|
static Expected<BuildInfoRecord> deserialize(TypeRecordKind Kind,
|
||||||
ArrayRef<uint8_t> &Data);
|
ArrayRef<uint8_t> &Data);
|
||||||
|
|
||||||
ArrayRef<TypeIndex> getArgs() const { return ArgIndices; }
|
ArrayRef<TypeIndex> getArgs() const { return ArgIndices; }
|
||||||
|
@ -853,7 +853,7 @@ public:
|
||||||
/// is not in the map.
|
/// is not in the map.
|
||||||
bool remapTypeIndices(ArrayRef<TypeIndex> IndexMap);
|
bool remapTypeIndices(ArrayRef<TypeIndex> IndexMap);
|
||||||
|
|
||||||
static ErrorOr<VFTableRecord> deserialize(TypeRecordKind Kind,
|
static Expected<VFTableRecord> deserialize(TypeRecordKind Kind,
|
||||||
ArrayRef<uint8_t> &Data);
|
ArrayRef<uint8_t> &Data);
|
||||||
|
|
||||||
TypeIndex getCompleteClass() const { return CompleteClass; }
|
TypeIndex getCompleteClass() const { return CompleteClass; }
|
||||||
|
@ -897,7 +897,7 @@ public:
|
||||||
/// is not in the map.
|
/// is not in the map.
|
||||||
bool remapTypeIndices(ArrayRef<TypeIndex> IndexMap);
|
bool remapTypeIndices(ArrayRef<TypeIndex> IndexMap);
|
||||||
|
|
||||||
static ErrorOr<OneMethodRecord> deserialize(TypeRecordKind Kind,
|
static Expected<OneMethodRecord> deserialize(TypeRecordKind Kind,
|
||||||
ArrayRef<uint8_t> &Data);
|
ArrayRef<uint8_t> &Data);
|
||||||
|
|
||||||
TypeIndex getType() const { return Type; }
|
TypeIndex getType() const { return Type; }
|
||||||
|
@ -939,8 +939,8 @@ public:
|
||||||
/// is not in the map.
|
/// is not in the map.
|
||||||
bool remapTypeIndices(ArrayRef<TypeIndex> IndexMap);
|
bool remapTypeIndices(ArrayRef<TypeIndex> IndexMap);
|
||||||
|
|
||||||
static ErrorOr<MethodOverloadListRecord> deserialize(TypeRecordKind Kind,
|
static Expected<MethodOverloadListRecord>
|
||||||
ArrayRef<uint8_t> &Data);
|
deserialize(TypeRecordKind Kind, ArrayRef<uint8_t> &Data);
|
||||||
|
|
||||||
ArrayRef<OneMethodRecord> getMethods() const { return Methods; }
|
ArrayRef<OneMethodRecord> getMethods() const { return Methods; }
|
||||||
|
|
||||||
|
@ -969,7 +969,7 @@ public:
|
||||||
/// is not in the map.
|
/// is not in the map.
|
||||||
bool remapTypeIndices(ArrayRef<TypeIndex> IndexMap);
|
bool remapTypeIndices(ArrayRef<TypeIndex> IndexMap);
|
||||||
|
|
||||||
static ErrorOr<OverloadedMethodRecord> deserialize(TypeRecordKind Kind,
|
static Expected<OverloadedMethodRecord> deserialize(TypeRecordKind Kind,
|
||||||
ArrayRef<uint8_t> &Data);
|
ArrayRef<uint8_t> &Data);
|
||||||
|
|
||||||
uint16_t getNumOverloads() const { return NumOverloads; }
|
uint16_t getNumOverloads() const { return NumOverloads; }
|
||||||
|
@ -1000,7 +1000,7 @@ public:
|
||||||
/// is not in the map.
|
/// is not in the map.
|
||||||
bool remapTypeIndices(ArrayRef<TypeIndex> IndexMap);
|
bool remapTypeIndices(ArrayRef<TypeIndex> IndexMap);
|
||||||
|
|
||||||
static ErrorOr<DataMemberRecord> deserialize(TypeRecordKind Kind,
|
static Expected<DataMemberRecord> deserialize(TypeRecordKind Kind,
|
||||||
ArrayRef<uint8_t> &Data);
|
ArrayRef<uint8_t> &Data);
|
||||||
|
|
||||||
MemberAccess getAccess() const { return Access; }
|
MemberAccess getAccess() const { return Access; }
|
||||||
|
@ -1033,7 +1033,7 @@ public:
|
||||||
/// is not in the map.
|
/// is not in the map.
|
||||||
bool remapTypeIndices(ArrayRef<TypeIndex> IndexMap);
|
bool remapTypeIndices(ArrayRef<TypeIndex> IndexMap);
|
||||||
|
|
||||||
static ErrorOr<StaticDataMemberRecord> deserialize(TypeRecordKind Kind,
|
static Expected<StaticDataMemberRecord> deserialize(TypeRecordKind Kind,
|
||||||
ArrayRef<uint8_t> &Data);
|
ArrayRef<uint8_t> &Data);
|
||||||
|
|
||||||
MemberAccess getAccess() const { return Access; }
|
MemberAccess getAccess() const { return Access; }
|
||||||
|
@ -1063,7 +1063,7 @@ public:
|
||||||
/// is not in the map.
|
/// is not in the map.
|
||||||
bool remapTypeIndices(ArrayRef<TypeIndex> IndexMap);
|
bool remapTypeIndices(ArrayRef<TypeIndex> IndexMap);
|
||||||
|
|
||||||
static ErrorOr<EnumeratorRecord> deserialize(TypeRecordKind Kind,
|
static Expected<EnumeratorRecord> deserialize(TypeRecordKind Kind,
|
||||||
ArrayRef<uint8_t> &Data);
|
ArrayRef<uint8_t> &Data);
|
||||||
|
|
||||||
MemberAccess getAccess() const { return Access; }
|
MemberAccess getAccess() const { return Access; }
|
||||||
|
@ -1092,7 +1092,7 @@ public:
|
||||||
/// is not in the map.
|
/// is not in the map.
|
||||||
bool remapTypeIndices(ArrayRef<TypeIndex> IndexMap);
|
bool remapTypeIndices(ArrayRef<TypeIndex> IndexMap);
|
||||||
|
|
||||||
static ErrorOr<VFPtrRecord> deserialize(TypeRecordKind Kind,
|
static Expected<VFPtrRecord> deserialize(TypeRecordKind Kind,
|
||||||
ArrayRef<uint8_t> &Data);
|
ArrayRef<uint8_t> &Data);
|
||||||
|
|
||||||
TypeIndex getType() const { return Type; }
|
TypeIndex getType() const { return Type; }
|
||||||
|
@ -1116,7 +1116,7 @@ public:
|
||||||
/// is not in the map.
|
/// is not in the map.
|
||||||
bool remapTypeIndices(ArrayRef<TypeIndex> IndexMap);
|
bool remapTypeIndices(ArrayRef<TypeIndex> IndexMap);
|
||||||
|
|
||||||
static ErrorOr<BaseClassRecord> deserialize(TypeRecordKind Kind,
|
static Expected<BaseClassRecord> deserialize(TypeRecordKind Kind,
|
||||||
ArrayRef<uint8_t> &Data);
|
ArrayRef<uint8_t> &Data);
|
||||||
|
|
||||||
MemberAccess getAccess() const { return Access; }
|
MemberAccess getAccess() const { return Access; }
|
||||||
|
@ -1147,7 +1147,7 @@ public:
|
||||||
/// is not in the map.
|
/// is not in the map.
|
||||||
bool remapTypeIndices(ArrayRef<TypeIndex> IndexMap);
|
bool remapTypeIndices(ArrayRef<TypeIndex> IndexMap);
|
||||||
|
|
||||||
static ErrorOr<VirtualBaseClassRecord> deserialize(TypeRecordKind Kind,
|
static Expected<VirtualBaseClassRecord> deserialize(TypeRecordKind Kind,
|
||||||
ArrayRef<uint8_t> &Data);
|
ArrayRef<uint8_t> &Data);
|
||||||
|
|
||||||
MemberAccess getAccess() const { return Access; }
|
MemberAccess getAccess() const { return Access; }
|
||||||
|
@ -1183,7 +1183,7 @@ public:
|
||||||
|
|
||||||
bool remapTypeIndices(ArrayRef<TypeIndex> IndexMap);
|
bool remapTypeIndices(ArrayRef<TypeIndex> IndexMap);
|
||||||
|
|
||||||
static ErrorOr<ListContinuationRecord> deserialize(TypeRecordKind Kind,
|
static Expected<ListContinuationRecord> deserialize(TypeRecordKind Kind,
|
||||||
ArrayRef<uint8_t> &Data);
|
ArrayRef<uint8_t> &Data);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
|
@ -45,10 +45,10 @@ Error CVTypeVisitor::visitTypeRecord(const CVRecord<TypeLeafKind> &Record) {
|
||||||
#define TYPE_RECORD(EnumName, EnumVal, Name) \
|
#define TYPE_RECORD(EnumName, EnumVal, Name) \
|
||||||
case EnumName: { \
|
case EnumName: { \
|
||||||
TypeRecordKind RK = static_cast<TypeRecordKind>(EnumName); \
|
TypeRecordKind RK = static_cast<TypeRecordKind>(EnumName); \
|
||||||
auto Result = Name##Record::deserialize(RK, LeafData); \
|
auto ExpectedRecord = Name##Record::deserialize(RK, LeafData); \
|
||||||
if (Result.getError()) \
|
if (!ExpectedRecord) \
|
||||||
return llvm::make_error<CodeViewError>(cv_error_code::corrupt_record); \
|
return ExpectedRecord.takeError(); \
|
||||||
if (auto EC = Callbacks.visit##Name(*Result)) \
|
if (auto EC = Callbacks.visit##Name(*ExpectedRecord)) \
|
||||||
return EC; \
|
return EC; \
|
||||||
break; \
|
break; \
|
||||||
}
|
}
|
||||||
|
@ -106,10 +106,10 @@ Error CVTypeVisitor::visitFieldList(const CVRecord<TypeLeafKind> &Record) {
|
||||||
#define MEMBER_RECORD(EnumName, EnumVal, Name) \
|
#define MEMBER_RECORD(EnumName, EnumVal, Name) \
|
||||||
case EnumName: { \
|
case EnumName: { \
|
||||||
TypeRecordKind RK = static_cast<TypeRecordKind>(EnumName); \
|
TypeRecordKind RK = static_cast<TypeRecordKind>(EnumName); \
|
||||||
auto Result = Name##Record::deserialize(RK, RecordData); \
|
auto ExpectedRecord = Name##Record::deserialize(RK, RecordData); \
|
||||||
if (Result.getError()) \
|
if (!ExpectedRecord) \
|
||||||
return llvm::make_error<CodeViewError>(cv_error_code::corrupt_record); \
|
return ExpectedRecord.takeError(); \
|
||||||
if (auto EC = Callbacks.visit##Name(*Result)) \
|
if (auto EC = Callbacks.visit##Name(*ExpectedRecord)) \
|
||||||
return EC; \
|
return EC; \
|
||||||
break; \
|
break; \
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,6 +14,7 @@
|
||||||
#include "llvm/DebugInfo/CodeView/RecordSerialization.h"
|
#include "llvm/DebugInfo/CodeView/RecordSerialization.h"
|
||||||
#include "llvm/ADT/APInt.h"
|
#include "llvm/ADT/APInt.h"
|
||||||
#include "llvm/ADT/APSInt.h"
|
#include "llvm/ADT/APSInt.h"
|
||||||
|
#include "llvm/DebugInfo/CodeView/CodeViewError.h"
|
||||||
#include "llvm/DebugInfo/CodeView/TypeRecord.h"
|
#include "llvm/DebugInfo/CodeView/TypeRecord.h"
|
||||||
|
|
||||||
using namespace llvm;
|
using namespace llvm;
|
||||||
|
@ -31,87 +32,104 @@ StringRef llvm::codeview::getBytesAsCString(ArrayRef<uint8_t> LeafData) {
|
||||||
return getBytesAsCharacters(LeafData).split('\0').first;
|
return getBytesAsCharacters(LeafData).split('\0').first;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::error_code llvm::codeview::consume(ArrayRef<uint8_t> &Data, APSInt &Num) {
|
Error llvm::codeview::consume(ArrayRef<uint8_t> &Data, APSInt &Num) {
|
||||||
// Used to avoid overload ambiguity on APInt construtor.
|
// Used to avoid overload ambiguity on APInt construtor.
|
||||||
bool FalseVal = false;
|
bool FalseVal = false;
|
||||||
if (Data.size() < 2)
|
if (Data.size() < 2)
|
||||||
return std::make_error_code(std::errc::illegal_byte_sequence);
|
return make_error<CodeViewError>(
|
||||||
|
cv_error_code::insufficient_buffer,
|
||||||
|
"Buffer does not contain enough data for an APSInt");
|
||||||
uint16_t Short = *reinterpret_cast<const ulittle16_t *>(Data.data());
|
uint16_t Short = *reinterpret_cast<const ulittle16_t *>(Data.data());
|
||||||
Data = Data.drop_front(2);
|
Data = Data.drop_front(2);
|
||||||
if (Short < LF_NUMERIC) {
|
if (Short < LF_NUMERIC) {
|
||||||
Num = APSInt(APInt(/*numBits=*/16, Short, /*isSigned=*/false),
|
Num = APSInt(APInt(/*numBits=*/16, Short, /*isSigned=*/false),
|
||||||
/*isUnsigned=*/true);
|
/*isUnsigned=*/true);
|
||||||
return std::error_code();
|
return Error::success();
|
||||||
}
|
}
|
||||||
switch (Short) {
|
switch (Short) {
|
||||||
case LF_CHAR:
|
case LF_CHAR:
|
||||||
if (Data.size() < 1)
|
if (Data.size() < 1)
|
||||||
return std::make_error_code(std::errc::illegal_byte_sequence);
|
return make_error<CodeViewError>(
|
||||||
|
cv_error_code::insufficient_buffer,
|
||||||
|
"Buffer does not contain enough data for an LF_CHAR");
|
||||||
Num = APSInt(APInt(/*numBits=*/8,
|
Num = APSInt(APInt(/*numBits=*/8,
|
||||||
*reinterpret_cast<const int8_t *>(Data.data()),
|
*reinterpret_cast<const int8_t *>(Data.data()),
|
||||||
/*isSigned=*/true),
|
/*isSigned=*/true),
|
||||||
/*isUnsigned=*/false);
|
/*isUnsigned=*/false);
|
||||||
Data = Data.drop_front(1);
|
Data = Data.drop_front(1);
|
||||||
return std::error_code();
|
return Error::success();
|
||||||
case LF_SHORT:
|
case LF_SHORT:
|
||||||
if (Data.size() < 2)
|
if (Data.size() < 2)
|
||||||
return std::make_error_code(std::errc::illegal_byte_sequence);
|
return make_error<CodeViewError>(
|
||||||
|
cv_error_code::insufficient_buffer,
|
||||||
|
"Buffer does not contain enough data for an LF_SHORT");
|
||||||
Num = APSInt(APInt(/*numBits=*/16,
|
Num = APSInt(APInt(/*numBits=*/16,
|
||||||
*reinterpret_cast<const little16_t *>(Data.data()),
|
*reinterpret_cast<const little16_t *>(Data.data()),
|
||||||
/*isSigned=*/true),
|
/*isSigned=*/true),
|
||||||
/*isUnsigned=*/false);
|
/*isUnsigned=*/false);
|
||||||
Data = Data.drop_front(2);
|
Data = Data.drop_front(2);
|
||||||
return std::error_code();
|
return Error::success();
|
||||||
case LF_USHORT:
|
case LF_USHORT:
|
||||||
if (Data.size() < 2)
|
if (Data.size() < 2)
|
||||||
return std::make_error_code(std::errc::illegal_byte_sequence);
|
return make_error<CodeViewError>(
|
||||||
|
cv_error_code::insufficient_buffer,
|
||||||
|
"Buffer does not contain enough data for an LF_USHORT");
|
||||||
Num = APSInt(APInt(/*numBits=*/16,
|
Num = APSInt(APInt(/*numBits=*/16,
|
||||||
*reinterpret_cast<const ulittle16_t *>(Data.data()),
|
*reinterpret_cast<const ulittle16_t *>(Data.data()),
|
||||||
/*isSigned=*/false),
|
/*isSigned=*/false),
|
||||||
/*isUnsigned=*/true);
|
/*isUnsigned=*/true);
|
||||||
Data = Data.drop_front(2);
|
Data = Data.drop_front(2);
|
||||||
return std::error_code();
|
return Error::success();
|
||||||
case LF_LONG:
|
case LF_LONG:
|
||||||
if (Data.size() < 4)
|
if (Data.size() < 4)
|
||||||
return std::make_error_code(std::errc::illegal_byte_sequence);
|
return make_error<CodeViewError>(
|
||||||
|
cv_error_code::insufficient_buffer,
|
||||||
|
"Buffer does not contain enough data for an LF_LONG");
|
||||||
Num = APSInt(APInt(/*numBits=*/32,
|
Num = APSInt(APInt(/*numBits=*/32,
|
||||||
*reinterpret_cast<const little32_t *>(Data.data()),
|
*reinterpret_cast<const little32_t *>(Data.data()),
|
||||||
/*isSigned=*/true),
|
/*isSigned=*/true),
|
||||||
/*isUnsigned=*/false);
|
/*isUnsigned=*/false);
|
||||||
Data = Data.drop_front(4);
|
Data = Data.drop_front(4);
|
||||||
return std::error_code();
|
return Error::success();
|
||||||
case LF_ULONG:
|
case LF_ULONG:
|
||||||
if (Data.size() < 4)
|
if (Data.size() < 4)
|
||||||
return std::make_error_code(std::errc::illegal_byte_sequence);
|
return make_error<CodeViewError>(
|
||||||
|
cv_error_code::insufficient_buffer,
|
||||||
|
"Buffer does not contain enough data for an LF_ULONG");
|
||||||
Num = APSInt(APInt(/*numBits=*/32,
|
Num = APSInt(APInt(/*numBits=*/32,
|
||||||
*reinterpret_cast<const ulittle32_t *>(Data.data()),
|
*reinterpret_cast<const ulittle32_t *>(Data.data()),
|
||||||
/*isSigned=*/FalseVal),
|
/*isSigned=*/FalseVal),
|
||||||
/*isUnsigned=*/true);
|
/*isUnsigned=*/true);
|
||||||
Data = Data.drop_front(4);
|
Data = Data.drop_front(4);
|
||||||
return std::error_code();
|
return Error::success();
|
||||||
case LF_QUADWORD:
|
case LF_QUADWORD:
|
||||||
if (Data.size() < 8)
|
if (Data.size() < 8)
|
||||||
return std::make_error_code(std::errc::illegal_byte_sequence);
|
return make_error<CodeViewError>(
|
||||||
|
cv_error_code::insufficient_buffer,
|
||||||
|
"Buffer does not contain enough data for an LF_QUADWORD");
|
||||||
Num = APSInt(APInt(/*numBits=*/64,
|
Num = APSInt(APInt(/*numBits=*/64,
|
||||||
*reinterpret_cast<const little64_t *>(Data.data()),
|
*reinterpret_cast<const little64_t *>(Data.data()),
|
||||||
/*isSigned=*/true),
|
/*isSigned=*/true),
|
||||||
/*isUnsigned=*/false);
|
/*isUnsigned=*/false);
|
||||||
Data = Data.drop_front(8);
|
Data = Data.drop_front(8);
|
||||||
return std::error_code();
|
return Error::success();
|
||||||
case LF_UQUADWORD:
|
case LF_UQUADWORD:
|
||||||
if (Data.size() < 8)
|
if (Data.size() < 8)
|
||||||
return std::make_error_code(std::errc::illegal_byte_sequence);
|
return make_error<CodeViewError>(
|
||||||
|
cv_error_code::insufficient_buffer,
|
||||||
|
"Buffer does not contain enough data for an LF_UQUADWORD");
|
||||||
Num = APSInt(APInt(/*numBits=*/64,
|
Num = APSInt(APInt(/*numBits=*/64,
|
||||||
*reinterpret_cast<const ulittle64_t *>(Data.data()),
|
*reinterpret_cast<const ulittle64_t *>(Data.data()),
|
||||||
/*isSigned=*/false),
|
/*isSigned=*/false),
|
||||||
/*isUnsigned=*/true);
|
/*isUnsigned=*/true);
|
||||||
Data = Data.drop_front(8);
|
Data = Data.drop_front(8);
|
||||||
return std::error_code();
|
return Error::success();
|
||||||
}
|
}
|
||||||
return std::make_error_code(std::errc::illegal_byte_sequence);
|
return make_error<CodeViewError>(cv_error_code::corrupt_record,
|
||||||
|
"Buffer contains invalid APSInt type");
|
||||||
}
|
}
|
||||||
|
|
||||||
std::error_code llvm::codeview::consume(StringRef &Data, APSInt &Num) {
|
Error llvm::codeview::consume(StringRef &Data, APSInt &Num) {
|
||||||
ArrayRef<uint8_t> Bytes(Data.bytes_begin(), Data.bytes_end());
|
ArrayRef<uint8_t> Bytes(Data.bytes_begin(), Data.bytes_end());
|
||||||
auto EC = consume(Bytes, Num);
|
auto EC = consume(Bytes, Num);
|
||||||
Data = StringRef(reinterpret_cast<const char *>(Bytes.data()), Bytes.size());
|
Data = StringRef(reinterpret_cast<const char *>(Bytes.data()), Bytes.size());
|
||||||
|
@ -119,53 +137,52 @@ std::error_code llvm::codeview::consume(StringRef &Data, APSInt &Num) {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Decode a numeric leaf value that is known to be a uint64_t.
|
/// Decode a numeric leaf value that is known to be a uint64_t.
|
||||||
std::error_code llvm::codeview::consume_numeric(ArrayRef<uint8_t> &Data,
|
Error llvm::codeview::consume_numeric(ArrayRef<uint8_t> &Data, uint64_t &Num) {
|
||||||
uint64_t &Num) {
|
|
||||||
APSInt N;
|
APSInt N;
|
||||||
if (auto EC = consume(Data, N))
|
if (auto EC = consume(Data, N))
|
||||||
return EC;
|
return EC;
|
||||||
if (N.isSigned() || !N.isIntN(64))
|
if (N.isSigned() || !N.isIntN(64))
|
||||||
return std::make_error_code(std::errc::illegal_byte_sequence);
|
return make_error<CodeViewError>(cv_error_code::corrupt_record,
|
||||||
|
"Data is not a numeric value!");
|
||||||
Num = N.getLimitedValue();
|
Num = N.getLimitedValue();
|
||||||
return std::error_code();
|
return Error::success();
|
||||||
}
|
}
|
||||||
|
|
||||||
std::error_code llvm::codeview::consume(ArrayRef<uint8_t> &Data,
|
Error llvm::codeview::consume(ArrayRef<uint8_t> &Data, uint32_t &Item) {
|
||||||
uint32_t &Item) {
|
|
||||||
const support::ulittle32_t *IntPtr;
|
const support::ulittle32_t *IntPtr;
|
||||||
if (auto EC = consumeObject(Data, IntPtr))
|
if (auto EC = consumeObject(Data, IntPtr))
|
||||||
return EC;
|
return EC;
|
||||||
Item = *IntPtr;
|
Item = *IntPtr;
|
||||||
return std::error_code();
|
return Error::success();
|
||||||
}
|
}
|
||||||
|
|
||||||
std::error_code llvm::codeview::consume(StringRef &Data, uint32_t &Item) {
|
Error llvm::codeview::consume(StringRef &Data, uint32_t &Item) {
|
||||||
ArrayRef<uint8_t> Bytes(Data.bytes_begin(), Data.bytes_end());
|
ArrayRef<uint8_t> Bytes(Data.bytes_begin(), Data.bytes_end());
|
||||||
auto EC = consume(Bytes, Item);
|
auto EC = consume(Bytes, Item);
|
||||||
Data = StringRef(reinterpret_cast<const char *>(Bytes.data()), Bytes.size());
|
Data = StringRef(reinterpret_cast<const char *>(Bytes.data()), Bytes.size());
|
||||||
return EC;
|
return EC;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::error_code llvm::codeview::consume(ArrayRef<uint8_t> &Data,
|
Error llvm::codeview::consume(ArrayRef<uint8_t> &Data, int32_t &Item) {
|
||||||
int32_t &Item) {
|
|
||||||
const support::little32_t *IntPtr;
|
const support::little32_t *IntPtr;
|
||||||
if (auto EC = consumeObject(Data, IntPtr))
|
if (auto EC = consumeObject(Data, IntPtr))
|
||||||
return EC;
|
return EC;
|
||||||
Item = *IntPtr;
|
Item = *IntPtr;
|
||||||
return std::error_code();
|
return Error::success();
|
||||||
}
|
}
|
||||||
|
|
||||||
std::error_code llvm::codeview::consume(ArrayRef<uint8_t> &Data,
|
Error llvm::codeview::consume(ArrayRef<uint8_t> &Data, StringRef &Item) {
|
||||||
StringRef &Item) {
|
|
||||||
if (Data.empty())
|
if (Data.empty())
|
||||||
return std::make_error_code(std::errc::illegal_byte_sequence);
|
return make_error<CodeViewError>(cv_error_code::corrupt_record,
|
||||||
|
"Null terminated string buffer is empty!");
|
||||||
|
|
||||||
StringRef Rest;
|
StringRef Rest;
|
||||||
std::tie(Item, Rest) = getBytesAsCharacters(Data).split('\0');
|
std::tie(Item, Rest) = getBytesAsCharacters(Data).split('\0');
|
||||||
// We expect this to be null terminated. If it was not, it is an error.
|
// We expect this to be null terminated. If it was not, it is an error.
|
||||||
if (Data.size() == Item.size())
|
if (Data.size() == Item.size())
|
||||||
return std::make_error_code(std::errc::illegal_byte_sequence);
|
return make_error<CodeViewError>(cv_error_code::corrupt_record,
|
||||||
|
"Expected null terminator!");
|
||||||
|
|
||||||
Data = ArrayRef<uint8_t>(Rest.bytes_begin(), Rest.bytes_end());
|
Data = ArrayRef<uint8_t>(Rest.bytes_begin(), Rest.bytes_end());
|
||||||
return std::error_code();
|
return Error::success();
|
||||||
}
|
}
|
||||||
|
|
|
@ -18,11 +18,11 @@ using namespace llvm::codeview;
|
||||||
// Type record deserialization
|
// Type record deserialization
|
||||||
//===----------------------------------------------------------------------===//
|
//===----------------------------------------------------------------------===//
|
||||||
|
|
||||||
ErrorOr<MemberPointerInfo>
|
Expected<MemberPointerInfo>
|
||||||
MemberPointerInfo::deserialize(ArrayRef<uint8_t> &Data) {
|
MemberPointerInfo::deserialize(ArrayRef<uint8_t> &Data) {
|
||||||
const Layout *L = nullptr;
|
const Layout *L = nullptr;
|
||||||
if (auto EC = consumeObject(Data, L))
|
if (auto EC = consumeObject(Data, L))
|
||||||
return EC;
|
return std::move(EC);
|
||||||
|
|
||||||
TypeIndex T = L->ClassType;
|
TypeIndex T = L->ClassType;
|
||||||
uint16_t R = L->Representation;
|
uint16_t R = L->Representation;
|
||||||
|
@ -31,11 +31,11 @@ MemberPointerInfo::deserialize(ArrayRef<uint8_t> &Data) {
|
||||||
return MemberPointerInfo(T, PMR);
|
return MemberPointerInfo(T, PMR);
|
||||||
}
|
}
|
||||||
|
|
||||||
ErrorOr<ModifierRecord> ModifierRecord::deserialize(TypeRecordKind Kind,
|
Expected<ModifierRecord> ModifierRecord::deserialize(TypeRecordKind Kind,
|
||||||
ArrayRef<uint8_t> &Data) {
|
ArrayRef<uint8_t> &Data) {
|
||||||
const Layout *L = nullptr;
|
const Layout *L = nullptr;
|
||||||
if (auto EC = consumeObject(Data, L))
|
if (auto EC = consumeObject(Data, L))
|
||||||
return EC;
|
return std::move(EC);
|
||||||
|
|
||||||
TypeIndex M = L->ModifiedType;
|
TypeIndex M = L->ModifiedType;
|
||||||
uint16_t O = L->Modifiers;
|
uint16_t O = L->Modifiers;
|
||||||
|
@ -43,16 +43,16 @@ ErrorOr<ModifierRecord> ModifierRecord::deserialize(TypeRecordKind Kind,
|
||||||
return ModifierRecord(M, MO);
|
return ModifierRecord(M, MO);
|
||||||
}
|
}
|
||||||
|
|
||||||
ErrorOr<ProcedureRecord> ProcedureRecord::deserialize(TypeRecordKind Kind,
|
Expected<ProcedureRecord>
|
||||||
ArrayRef<uint8_t> &Data) {
|
ProcedureRecord::deserialize(TypeRecordKind Kind, ArrayRef<uint8_t> &Data) {
|
||||||
const Layout *L = nullptr;
|
const Layout *L = nullptr;
|
||||||
if (auto EC = consumeObject(Data, L))
|
if (auto EC = consumeObject(Data, L))
|
||||||
return EC;
|
return std::move(EC);
|
||||||
return ProcedureRecord(L->ReturnType, L->CallConv, L->Options,
|
return ProcedureRecord(L->ReturnType, L->CallConv, L->Options,
|
||||||
L->NumParameters, L->ArgListType);
|
L->NumParameters, L->ArgListType);
|
||||||
}
|
}
|
||||||
|
|
||||||
ErrorOr<MemberFunctionRecord>
|
Expected<MemberFunctionRecord>
|
||||||
MemberFunctionRecord::deserialize(TypeRecordKind Kind,
|
MemberFunctionRecord::deserialize(TypeRecordKind Kind,
|
||||||
ArrayRef<uint8_t> &Data) {
|
ArrayRef<uint8_t> &Data) {
|
||||||
const Layout *L = nullptr;
|
const Layout *L = nullptr;
|
||||||
|
@ -62,7 +62,7 @@ MemberFunctionRecord::deserialize(TypeRecordKind Kind,
|
||||||
L->ArgListType, L->ThisAdjustment);
|
L->ArgListType, L->ThisAdjustment);
|
||||||
}
|
}
|
||||||
|
|
||||||
ErrorOr<MemberFuncIdRecord>
|
Expected<MemberFuncIdRecord>
|
||||||
MemberFuncIdRecord::deserialize(TypeRecordKind Kind, ArrayRef<uint8_t> &Data) {
|
MemberFuncIdRecord::deserialize(TypeRecordKind Kind, ArrayRef<uint8_t> &Data) {
|
||||||
const Layout *L = nullptr;
|
const Layout *L = nullptr;
|
||||||
StringRef Name;
|
StringRef Name;
|
||||||
|
@ -70,10 +70,12 @@ MemberFuncIdRecord::deserialize(TypeRecordKind Kind, ArrayRef<uint8_t> &Data) {
|
||||||
return MemberFuncIdRecord(L->ClassType, L->FunctionType, Name);
|
return MemberFuncIdRecord(L->ClassType, L->FunctionType, Name);
|
||||||
}
|
}
|
||||||
|
|
||||||
ErrorOr<ArgListRecord> ArgListRecord::deserialize(TypeRecordKind Kind,
|
Expected<ArgListRecord> ArgListRecord::deserialize(TypeRecordKind Kind,
|
||||||
ArrayRef<uint8_t> &Data) {
|
ArrayRef<uint8_t> &Data) {
|
||||||
if (Kind != TypeRecordKind::StringList && Kind != TypeRecordKind::ArgList)
|
if (Kind != TypeRecordKind::StringList && Kind != TypeRecordKind::ArgList)
|
||||||
return std::make_error_code(std::errc::illegal_byte_sequence);
|
return make_error<CodeViewError>(
|
||||||
|
cv_error_code::corrupt_record,
|
||||||
|
"ArgListRecord contains unexpected TypeRecordKind");
|
||||||
|
|
||||||
const Layout *L = nullptr;
|
const Layout *L = nullptr;
|
||||||
ArrayRef<TypeIndex> Indices;
|
ArrayRef<TypeIndex> Indices;
|
||||||
|
@ -81,11 +83,11 @@ ErrorOr<ArgListRecord> ArgListRecord::deserialize(TypeRecordKind Kind,
|
||||||
return ArgListRecord(Kind, Indices);
|
return ArgListRecord(Kind, Indices);
|
||||||
}
|
}
|
||||||
|
|
||||||
ErrorOr<PointerRecord> PointerRecord::deserialize(TypeRecordKind Kind,
|
Expected<PointerRecord> PointerRecord::deserialize(TypeRecordKind Kind,
|
||||||
ArrayRef<uint8_t> &Data) {
|
ArrayRef<uint8_t> &Data) {
|
||||||
const Layout *L = nullptr;
|
const Layout *L = nullptr;
|
||||||
if (auto EC = consumeObject(Data, L))
|
if (auto EC = consumeObject(Data, L))
|
||||||
return EC;
|
return std::move(EC);
|
||||||
|
|
||||||
PointerKind PtrKind = L->getPtrKind();
|
PointerKind PtrKind = L->getPtrKind();
|
||||||
PointerMode Mode = L->getPtrMode();
|
PointerMode Mode = L->getPtrMode();
|
||||||
|
@ -94,16 +96,17 @@ ErrorOr<PointerRecord> PointerRecord::deserialize(TypeRecordKind Kind,
|
||||||
uint8_t Size = L->getPtrSize();
|
uint8_t Size = L->getPtrSize();
|
||||||
|
|
||||||
if (L->isPointerToMember()) {
|
if (L->isPointerToMember()) {
|
||||||
auto E = MemberPointerInfo::deserialize(Data);
|
if (auto ExpectedMPI = MemberPointerInfo::deserialize(Data))
|
||||||
if (E.getError())
|
return PointerRecord(L->PointeeType, PtrKind, Mode, Options, Size,
|
||||||
return std::make_error_code(std::errc::illegal_byte_sequence);
|
*ExpectedMPI);
|
||||||
return PointerRecord(L->PointeeType, PtrKind, Mode, Options, Size, *E);
|
else
|
||||||
|
return ExpectedMPI.takeError();
|
||||||
}
|
}
|
||||||
|
|
||||||
return PointerRecord(L->PointeeType, PtrKind, Mode, Options, Size);
|
return PointerRecord(L->PointeeType, PtrKind, Mode, Options, Size);
|
||||||
}
|
}
|
||||||
|
|
||||||
ErrorOr<NestedTypeRecord>
|
Expected<NestedTypeRecord>
|
||||||
NestedTypeRecord::deserialize(TypeRecordKind Kind, ArrayRef<uint8_t> &Data) {
|
NestedTypeRecord::deserialize(TypeRecordKind Kind, ArrayRef<uint8_t> &Data) {
|
||||||
const Layout *L = nullptr;
|
const Layout *L = nullptr;
|
||||||
StringRef Name;
|
StringRef Name;
|
||||||
|
@ -111,7 +114,7 @@ NestedTypeRecord::deserialize(TypeRecordKind Kind, ArrayRef<uint8_t> &Data) {
|
||||||
return NestedTypeRecord(L->Type, Name);
|
return NestedTypeRecord(L->Type, Name);
|
||||||
}
|
}
|
||||||
|
|
||||||
ErrorOr<ArrayRecord> ArrayRecord::deserialize(TypeRecordKind Kind,
|
Expected<ArrayRecord> ArrayRecord::deserialize(TypeRecordKind Kind,
|
||||||
ArrayRef<uint8_t> &Data) {
|
ArrayRef<uint8_t> &Data) {
|
||||||
const Layout *L = nullptr;
|
const Layout *L = nullptr;
|
||||||
uint64_t Size;
|
uint64_t Size;
|
||||||
|
@ -120,7 +123,7 @@ ErrorOr<ArrayRecord> ArrayRecord::deserialize(TypeRecordKind Kind,
|
||||||
return ArrayRecord(L->ElementType, L->IndexType, Size, Name);
|
return ArrayRecord(L->ElementType, L->IndexType, Size, Name);
|
||||||
}
|
}
|
||||||
|
|
||||||
ErrorOr<ClassRecord> ClassRecord::deserialize(TypeRecordKind Kind,
|
Expected<ClassRecord> ClassRecord::deserialize(TypeRecordKind Kind,
|
||||||
ArrayRef<uint8_t> &Data) {
|
ArrayRef<uint8_t> &Data) {
|
||||||
uint64_t Size = 0;
|
uint64_t Size = 0;
|
||||||
StringRef Name;
|
StringRef Name;
|
||||||
|
@ -142,7 +145,7 @@ ErrorOr<ClassRecord> ClassRecord::deserialize(TypeRecordKind Kind,
|
||||||
L->DerivedFrom, L->VShape, Size, Name, UniqueName);
|
L->DerivedFrom, L->VShape, Size, Name, UniqueName);
|
||||||
}
|
}
|
||||||
|
|
||||||
ErrorOr<UnionRecord> UnionRecord::deserialize(TypeRecordKind Kind,
|
Expected<UnionRecord> UnionRecord::deserialize(TypeRecordKind Kind,
|
||||||
ArrayRef<uint8_t> &Data) {
|
ArrayRef<uint8_t> &Data) {
|
||||||
uint64_t Size = 0;
|
uint64_t Size = 0;
|
||||||
StringRef Name;
|
StringRef Name;
|
||||||
|
@ -162,7 +165,7 @@ ErrorOr<UnionRecord> UnionRecord::deserialize(TypeRecordKind Kind,
|
||||||
UniqueName);
|
UniqueName);
|
||||||
}
|
}
|
||||||
|
|
||||||
ErrorOr<EnumRecord> EnumRecord::deserialize(TypeRecordKind Kind,
|
Expected<EnumRecord> EnumRecord::deserialize(TypeRecordKind Kind,
|
||||||
ArrayRef<uint8_t> &Data) {
|
ArrayRef<uint8_t> &Data) {
|
||||||
const Layout *L = nullptr;
|
const Layout *L = nullptr;
|
||||||
StringRef Name;
|
StringRef Name;
|
||||||
|
@ -176,24 +179,25 @@ ErrorOr<EnumRecord> EnumRecord::deserialize(TypeRecordKind Kind,
|
||||||
UniqueName, L->UnderlyingType);
|
UniqueName, L->UnderlyingType);
|
||||||
}
|
}
|
||||||
|
|
||||||
ErrorOr<BitFieldRecord> BitFieldRecord::deserialize(TypeRecordKind Kind,
|
Expected<BitFieldRecord> BitFieldRecord::deserialize(TypeRecordKind Kind,
|
||||||
ArrayRef<uint8_t> &Data) {
|
ArrayRef<uint8_t> &Data) {
|
||||||
const Layout *L = nullptr;
|
const Layout *L = nullptr;
|
||||||
CV_DESERIALIZE(Data, L);
|
CV_DESERIALIZE(Data, L);
|
||||||
return BitFieldRecord(L->Type, L->BitSize, L->BitOffset);
|
return BitFieldRecord(L->Type, L->BitSize, L->BitOffset);
|
||||||
}
|
}
|
||||||
|
|
||||||
ErrorOr<VFTableShapeRecord>
|
Expected<VFTableShapeRecord>
|
||||||
VFTableShapeRecord::deserialize(TypeRecordKind Kind, ArrayRef<uint8_t> &Data) {
|
VFTableShapeRecord::deserialize(TypeRecordKind Kind, ArrayRef<uint8_t> &Data) {
|
||||||
const Layout *L = nullptr;
|
const Layout *L = nullptr;
|
||||||
if (auto EC = consumeObject(Data, L))
|
if (auto EC = consumeObject(Data, L))
|
||||||
return EC;
|
return std::move(EC);
|
||||||
|
|
||||||
std::vector<VFTableSlotKind> Slots;
|
std::vector<VFTableSlotKind> Slots;
|
||||||
uint16_t Count = L->VFEntryCount;
|
uint16_t Count = L->VFEntryCount;
|
||||||
while (Count > 0) {
|
while (Count > 0) {
|
||||||
if (Data.empty())
|
if (Data.empty())
|
||||||
return std::make_error_code(std::errc::illegal_byte_sequence);
|
return make_error<CodeViewError>(cv_error_code::corrupt_record,
|
||||||
|
"VTableShapeRecord contains no entries");
|
||||||
|
|
||||||
// Process up to 2 nibbles at a time (if there are at least 2 remaining)
|
// Process up to 2 nibbles at a time (if there are at least 2 remaining)
|
||||||
uint8_t Value = Data[0] & 0x0F;
|
uint8_t Value = Data[0] & 0x0F;
|
||||||
|
@ -209,7 +213,7 @@ VFTableShapeRecord::deserialize(TypeRecordKind Kind, ArrayRef<uint8_t> &Data) {
|
||||||
return VFTableShapeRecord(Slots);
|
return VFTableShapeRecord(Slots);
|
||||||
}
|
}
|
||||||
|
|
||||||
ErrorOr<TypeServer2Record>
|
Expected<TypeServer2Record>
|
||||||
TypeServer2Record::deserialize(TypeRecordKind Kind, ArrayRef<uint8_t> &Data) {
|
TypeServer2Record::deserialize(TypeRecordKind Kind, ArrayRef<uint8_t> &Data) {
|
||||||
const Layout *L = nullptr;
|
const Layout *L = nullptr;
|
||||||
StringRef Name;
|
StringRef Name;
|
||||||
|
@ -217,7 +221,7 @@ TypeServer2Record::deserialize(TypeRecordKind Kind, ArrayRef<uint8_t> &Data) {
|
||||||
return TypeServer2Record(StringRef(L->Guid, 16), L->Age, Name);
|
return TypeServer2Record(StringRef(L->Guid, 16), L->Age, Name);
|
||||||
}
|
}
|
||||||
|
|
||||||
ErrorOr<StringIdRecord> StringIdRecord::deserialize(TypeRecordKind Kind,
|
Expected<StringIdRecord> StringIdRecord::deserialize(TypeRecordKind Kind,
|
||||||
ArrayRef<uint8_t> &Data) {
|
ArrayRef<uint8_t> &Data) {
|
||||||
const Layout *L = nullptr;
|
const Layout *L = nullptr;
|
||||||
StringRef Name;
|
StringRef Name;
|
||||||
|
@ -225,7 +229,7 @@ ErrorOr<StringIdRecord> StringIdRecord::deserialize(TypeRecordKind Kind,
|
||||||
return StringIdRecord(L->id, Name);
|
return StringIdRecord(L->id, Name);
|
||||||
}
|
}
|
||||||
|
|
||||||
ErrorOr<FuncIdRecord> FuncIdRecord::deserialize(TypeRecordKind Kind,
|
Expected<FuncIdRecord> FuncIdRecord::deserialize(TypeRecordKind Kind,
|
||||||
ArrayRef<uint8_t> &Data) {
|
ArrayRef<uint8_t> &Data) {
|
||||||
const Layout *L = nullptr;
|
const Layout *L = nullptr;
|
||||||
StringRef Name;
|
StringRef Name;
|
||||||
|
@ -233,22 +237,22 @@ ErrorOr<FuncIdRecord> FuncIdRecord::deserialize(TypeRecordKind Kind,
|
||||||
return FuncIdRecord(L->ParentScope, L->FunctionType, Name);
|
return FuncIdRecord(L->ParentScope, L->FunctionType, Name);
|
||||||
}
|
}
|
||||||
|
|
||||||
ErrorOr<UdtSourceLineRecord>
|
Expected<UdtSourceLineRecord>
|
||||||
UdtSourceLineRecord::deserialize(TypeRecordKind Kind, ArrayRef<uint8_t> &Data) {
|
UdtSourceLineRecord::deserialize(TypeRecordKind Kind, ArrayRef<uint8_t> &Data) {
|
||||||
const Layout *L = nullptr;
|
const Layout *L = nullptr;
|
||||||
CV_DESERIALIZE(Data, L);
|
CV_DESERIALIZE(Data, L);
|
||||||
return UdtSourceLineRecord(L->UDT, L->SourceFile, L->LineNumber);
|
return UdtSourceLineRecord(L->UDT, L->SourceFile, L->LineNumber);
|
||||||
}
|
}
|
||||||
|
|
||||||
ErrorOr<BuildInfoRecord> BuildInfoRecord::deserialize(TypeRecordKind Kind,
|
Expected<BuildInfoRecord>
|
||||||
ArrayRef<uint8_t> &Data) {
|
BuildInfoRecord::deserialize(TypeRecordKind Kind, ArrayRef<uint8_t> &Data) {
|
||||||
const Layout *L = nullptr;
|
const Layout *L = nullptr;
|
||||||
ArrayRef<TypeIndex> Indices;
|
ArrayRef<TypeIndex> Indices;
|
||||||
CV_DESERIALIZE(Data, L, CV_ARRAY_FIELD_N(Indices, L->NumArgs));
|
CV_DESERIALIZE(Data, L, CV_ARRAY_FIELD_N(Indices, L->NumArgs));
|
||||||
return BuildInfoRecord(Indices);
|
return BuildInfoRecord(Indices);
|
||||||
}
|
}
|
||||||
|
|
||||||
ErrorOr<VFTableRecord> VFTableRecord::deserialize(TypeRecordKind Kind,
|
Expected<VFTableRecord> VFTableRecord::deserialize(TypeRecordKind Kind,
|
||||||
ArrayRef<uint8_t> &Data) {
|
ArrayRef<uint8_t> &Data) {
|
||||||
const Layout *L = nullptr;
|
const Layout *L = nullptr;
|
||||||
StringRef Name;
|
StringRef Name;
|
||||||
|
@ -258,8 +262,8 @@ ErrorOr<VFTableRecord> VFTableRecord::deserialize(TypeRecordKind Kind,
|
||||||
Name, Names);
|
Name, Names);
|
||||||
}
|
}
|
||||||
|
|
||||||
ErrorOr<OneMethodRecord> OneMethodRecord::deserialize(TypeRecordKind Kind,
|
Expected<OneMethodRecord>
|
||||||
ArrayRef<uint8_t> &Data) {
|
OneMethodRecord::deserialize(TypeRecordKind Kind, ArrayRef<uint8_t> &Data) {
|
||||||
const Layout *L = nullptr;
|
const Layout *L = nullptr;
|
||||||
StringRef Name;
|
StringRef Name;
|
||||||
int32_t VFTableOffset = -1;
|
int32_t VFTableOffset = -1;
|
||||||
|
@ -275,11 +279,12 @@ ErrorOr<OneMethodRecord> OneMethodRecord::deserialize(TypeRecordKind Kind,
|
||||||
Name);
|
Name);
|
||||||
// Validate the vftable offset.
|
// Validate the vftable offset.
|
||||||
if (Method.isIntroducingVirtual() && Method.getVFTableOffset() < 0)
|
if (Method.isIntroducingVirtual() && Method.getVFTableOffset() < 0)
|
||||||
return std::make_error_code(std::errc::illegal_byte_sequence);
|
return make_error<CodeViewError>(cv_error_code::corrupt_record,
|
||||||
|
"Invalid VFTableOffset");
|
||||||
return Method;
|
return Method;
|
||||||
}
|
}
|
||||||
|
|
||||||
ErrorOr<MethodOverloadListRecord>
|
Expected<MethodOverloadListRecord>
|
||||||
MethodOverloadListRecord::deserialize(TypeRecordKind Kind,
|
MethodOverloadListRecord::deserialize(TypeRecordKind Kind,
|
||||||
ArrayRef<uint8_t> &Data) {
|
ArrayRef<uint8_t> &Data) {
|
||||||
std::vector<OneMethodRecord> Methods;
|
std::vector<OneMethodRecord> Methods;
|
||||||
|
@ -299,12 +304,13 @@ MethodOverloadListRecord::deserialize(TypeRecordKind Kind,
|
||||||
// Validate the vftable offset.
|
// Validate the vftable offset.
|
||||||
auto &Method = Methods.back();
|
auto &Method = Methods.back();
|
||||||
if (Method.isIntroducingVirtual() && Method.getVFTableOffset() < 0)
|
if (Method.isIntroducingVirtual() && Method.getVFTableOffset() < 0)
|
||||||
return std::make_error_code(std::errc::illegal_byte_sequence);
|
return make_error<CodeViewError>(cv_error_code::corrupt_record,
|
||||||
|
"Invalid VFTableOffset");
|
||||||
}
|
}
|
||||||
return MethodOverloadListRecord(Methods);
|
return MethodOverloadListRecord(Methods);
|
||||||
}
|
}
|
||||||
|
|
||||||
ErrorOr<OverloadedMethodRecord>
|
Expected<OverloadedMethodRecord>
|
||||||
OverloadedMethodRecord::deserialize(TypeRecordKind Kind,
|
OverloadedMethodRecord::deserialize(TypeRecordKind Kind,
|
||||||
ArrayRef<uint8_t> &Data) {
|
ArrayRef<uint8_t> &Data) {
|
||||||
const Layout *L = nullptr;
|
const Layout *L = nullptr;
|
||||||
|
@ -313,7 +319,7 @@ OverloadedMethodRecord::deserialize(TypeRecordKind Kind,
|
||||||
return OverloadedMethodRecord(L->MethodCount, L->MethList, Name);
|
return OverloadedMethodRecord(L->MethodCount, L->MethList, Name);
|
||||||
}
|
}
|
||||||
|
|
||||||
ErrorOr<DataMemberRecord>
|
Expected<DataMemberRecord>
|
||||||
DataMemberRecord::deserialize(TypeRecordKind Kind, ArrayRef<uint8_t> &Data) {
|
DataMemberRecord::deserialize(TypeRecordKind Kind, ArrayRef<uint8_t> &Data) {
|
||||||
const Layout *L = nullptr;
|
const Layout *L = nullptr;
|
||||||
uint64_t Offset;
|
uint64_t Offset;
|
||||||
|
@ -322,7 +328,7 @@ DataMemberRecord::deserialize(TypeRecordKind Kind, ArrayRef<uint8_t> &Data) {
|
||||||
return DataMemberRecord(L->Attrs.getAccess(), L->Type, Offset, Name);
|
return DataMemberRecord(L->Attrs.getAccess(), L->Type, Offset, Name);
|
||||||
}
|
}
|
||||||
|
|
||||||
ErrorOr<StaticDataMemberRecord>
|
Expected<StaticDataMemberRecord>
|
||||||
StaticDataMemberRecord::deserialize(TypeRecordKind Kind,
|
StaticDataMemberRecord::deserialize(TypeRecordKind Kind,
|
||||||
ArrayRef<uint8_t> &Data) {
|
ArrayRef<uint8_t> &Data) {
|
||||||
const Layout *L = nullptr;
|
const Layout *L = nullptr;
|
||||||
|
@ -331,7 +337,7 @@ StaticDataMemberRecord::deserialize(TypeRecordKind Kind,
|
||||||
return StaticDataMemberRecord(L->Attrs.getAccess(), L->Type, Name);
|
return StaticDataMemberRecord(L->Attrs.getAccess(), L->Type, Name);
|
||||||
}
|
}
|
||||||
|
|
||||||
ErrorOr<EnumeratorRecord>
|
Expected<EnumeratorRecord>
|
||||||
EnumeratorRecord::deserialize(TypeRecordKind Kind, ArrayRef<uint8_t> &Data) {
|
EnumeratorRecord::deserialize(TypeRecordKind Kind, ArrayRef<uint8_t> &Data) {
|
||||||
const Layout *L = nullptr;
|
const Layout *L = nullptr;
|
||||||
APSInt Value;
|
APSInt Value;
|
||||||
|
@ -340,23 +346,23 @@ EnumeratorRecord::deserialize(TypeRecordKind Kind, ArrayRef<uint8_t> &Data) {
|
||||||
return EnumeratorRecord(L->Attrs.getAccess(), Value, Name);
|
return EnumeratorRecord(L->Attrs.getAccess(), Value, Name);
|
||||||
}
|
}
|
||||||
|
|
||||||
ErrorOr<VFPtrRecord> VFPtrRecord::deserialize(TypeRecordKind Kind,
|
Expected<VFPtrRecord> VFPtrRecord::deserialize(TypeRecordKind Kind,
|
||||||
ArrayRef<uint8_t> &Data) {
|
ArrayRef<uint8_t> &Data) {
|
||||||
const Layout *L = nullptr;
|
const Layout *L = nullptr;
|
||||||
if (auto EC = consumeObject(Data, L))
|
if (auto EC = consumeObject(Data, L))
|
||||||
return EC;
|
return std::move(EC);
|
||||||
return VFPtrRecord(L->Type);
|
return VFPtrRecord(L->Type);
|
||||||
}
|
}
|
||||||
|
|
||||||
ErrorOr<BaseClassRecord> BaseClassRecord::deserialize(TypeRecordKind Kind,
|
Expected<BaseClassRecord>
|
||||||
ArrayRef<uint8_t> &Data) {
|
BaseClassRecord::deserialize(TypeRecordKind Kind, ArrayRef<uint8_t> &Data) {
|
||||||
const Layout *L = nullptr;
|
const Layout *L = nullptr;
|
||||||
uint64_t Offset;
|
uint64_t Offset;
|
||||||
CV_DESERIALIZE(Data, L, CV_NUMERIC_FIELD(Offset));
|
CV_DESERIALIZE(Data, L, CV_NUMERIC_FIELD(Offset));
|
||||||
return BaseClassRecord(L->Attrs.getAccess(), L->BaseType, Offset);
|
return BaseClassRecord(L->Attrs.getAccess(), L->BaseType, Offset);
|
||||||
}
|
}
|
||||||
|
|
||||||
ErrorOr<VirtualBaseClassRecord>
|
Expected<VirtualBaseClassRecord>
|
||||||
VirtualBaseClassRecord::deserialize(TypeRecordKind Kind,
|
VirtualBaseClassRecord::deserialize(TypeRecordKind Kind,
|
||||||
ArrayRef<uint8_t> &Data) {
|
ArrayRef<uint8_t> &Data) {
|
||||||
const Layout *L = nullptr;
|
const Layout *L = nullptr;
|
||||||
|
@ -367,7 +373,7 @@ VirtualBaseClassRecord::deserialize(TypeRecordKind Kind,
|
||||||
Offset, Index);
|
Offset, Index);
|
||||||
}
|
}
|
||||||
|
|
||||||
ErrorOr<ListContinuationRecord>
|
Expected<ListContinuationRecord>
|
||||||
ListContinuationRecord::deserialize(TypeRecordKind Kind,
|
ListContinuationRecord::deserialize(TypeRecordKind Kind,
|
||||||
ArrayRef<uint8_t> &Data) {
|
ArrayRef<uint8_t> &Data) {
|
||||||
const Layout *L = nullptr;
|
const Layout *L = nullptr;
|
||||||
|
|
|
@ -272,6 +272,14 @@ LLVM_ATTRIBUTE_NORETURN void reportError(Twine Msg) {
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void error(llvm::Error EC) {
|
||||||
|
if (!EC)
|
||||||
|
return;
|
||||||
|
|
||||||
|
handleAllErrors(std::move(EC),
|
||||||
|
[&](ErrorInfoBase &EI) { reportError(EI.message()); });
|
||||||
|
}
|
||||||
|
|
||||||
void error(std::error_code EC) {
|
void error(std::error_code EC) {
|
||||||
if (!EC)
|
if (!EC)
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -24,6 +24,7 @@ namespace llvm {
|
||||||
// Various helper functions.
|
// Various helper functions.
|
||||||
LLVM_ATTRIBUTE_NORETURN void reportError(Twine Msg);
|
LLVM_ATTRIBUTE_NORETURN void reportError(Twine Msg);
|
||||||
void error(std::error_code ec);
|
void error(std::error_code ec);
|
||||||
|
void error(llvm::Error EC);
|
||||||
template <class T> T unwrapOrError(ErrorOr<T> EO) {
|
template <class T> T unwrapOrError(ErrorOr<T> EO) {
|
||||||
if (EO)
|
if (EO)
|
||||||
return *EO;
|
return *EO;
|
||||||
|
|
Loading…
Reference in New Issue