150 return "GUID strings are 38 characters long";
152 return "GUID is not enclosed in {}";
156 if (
A.size() != 5 ||
Scalar[8] !=
'-' ||
Scalar[13] !=
'-' ||
158 return "GUID sections are not properly delineated with dashes";
170 return "GUID contains non hex digits";
171 G.Data4 = (D41 << 48) | D42;
172 ::memcpy(&S, &
G,
sizeof(
GUID));
200#define CV_TYPE(name, val) io.enumCase(Value, #name, name);
201#include "llvm/DebugInfo/CodeView/CodeViewTypes.def"
467 explicit MemberRecordConversionVisitor(std::vector<MemberRecord> &Records)
468 : Records(Records) {}
470#define TYPE_RECORD(EnumName, EnumVal, Name)
471#define MEMBER_RECORD(EnumName, EnumVal, Name) \
472 Error visitKnownMember(CVMemberRecord &CVR, Name##Record &Record) override { \
473 return visitKnownMemberImpl(Record); \
475#define TYPE_RECORD_ALIAS(EnumName, EnumVal, Name, AliasName)
476#define MEMBER_RECORD_ALIAS(EnumName, EnumVal, Name, AliasName)
477#include "llvm/DebugInfo/CodeView/CodeViewTypes.def"
479 template <
typename T>
Error visitKnownMemberImpl(
T &
Record) {
481 auto Impl = std::make_shared<MemberRecordImpl<T>>(K);
487 std::vector<MemberRecord> &Records;
493 MemberRecordConversionVisitor V(Members);
504 for (
const auto &Member : Members) {
505 Member.Member->writeTo(CRB);
681 auto Impl = std::make_shared<LeafRecordImpl<T>>(
Type.kind());
682 if (
auto EC = Impl->fromCodeViewRecord(
Type))
683 return std::move(
EC);
689#define TYPE_RECORD(EnumName, EnumVal, ClassName) \
691 return fromCodeViewRecordImpl<ClassName##Record>(Type);
692#define TYPE_RECORD_ALIAS(EnumName, EnumVal, AliasName, ClassName) \
693 TYPE_RECORD(EnumName, EnumVal, ClassName)
694#define MEMBER_RECORD(EnumName, EnumVal, ClassName)
695#define MEMBER_RECORD_ALIAS(EnumName, EnumVal, AliasName, ClassName)
696 switch (
Type.kind()) {
697#include "llvm/DebugInfo/CodeView/CodeViewTypes.def"
706 return Leaf->toCodeViewRecord(Serializer);
723template <
typename ConcreteType>
727 Obj.
Leaf = std::make_shared<LeafRecordImpl<ConcreteType>>(Kind);
729 if (Kind == LF_FIELDLIST)
735void MappingTraits<LeafRecord>::mapping(IO &IO, LeafRecord &Obj) {
741#define TYPE_RECORD(EnumName, EnumVal, ClassName) \
743 mapLeafRecordImpl<ClassName##Record>(IO, #ClassName, Kind, Obj); \
745#define TYPE_RECORD_ALIAS(EnumName, EnumVal, AliasName, ClassName) \
746 TYPE_RECORD(EnumName, EnumVal, ClassName)
747#define MEMBER_RECORD(EnumName, EnumVal, ClassName)
748#define MEMBER_RECORD_ALIAS(EnumName, EnumVal, AliasName, ClassName)
750#include "llvm/DebugInfo/CodeView/CodeViewTypes.def"
755template <
typename ConcreteType>
759 Obj.
Member = std::make_shared<MemberRecordImpl<ConcreteType>>(Kind);
764void MappingTraits<MemberRecord>::mapping(IO &IO, MemberRecord &Obj) {
770#define MEMBER_RECORD(EnumName, EnumVal, ClassName) \
772 mapMemberRecordImpl<ClassName##Record>(IO, #ClassName, Kind, Obj); \
774#define MEMBER_RECORD_ALIAS(EnumName, EnumVal, AliasName, ClassName) \
775 MEMBER_RECORD(EnumName, EnumVal, ClassName)
776#define TYPE_RECORD(EnumName, EnumVal, ClassName)
777#define TYPE_RECORD_ALIAS(EnumName, EnumVal, AliasName, ClassName)
779#include "llvm/DebugInfo/CodeView/CodeViewTypes.def"
784std::vector<LeafRecord>
794 "Invalid .debug$T or .debug$P section!");
796 std::vector<LeafRecord> Result;
798 for (
const auto &
T : Types) {
800 Result.push_back(CVT);
810 for (
const auto &Leaf : Leafs) {
811 CVType T = Leaf.Leaf->toCodeViewRecord(TS);
813 assert(
T.length() % 4 == 0 &&
"Improper type record alignment!");
821 for (
const auto &R : TS.
records()) {
assert(UImm &&(UImm !=~static_cast< T >(0)) &&"Invalid immediate!")
This file implements the APSInt class, which is a simple class that represents an arbitrary sized int...
This file defines the BumpPtrAllocator interface.
static GCRegistry::Add< ErlangGC > A("erlang", "erlang-compatible garbage collector")
static void mapLeafRecordImpl(IO &IO, const char *Class, TypeLeafKind Kind, LeafRecord &Obj)
static Expected< LeafRecord > fromCodeViewRecordImpl(CVType Type)
static void mapMemberRecordImpl(IO &IO, const char *Class, TypeLeafKind Kind, MemberRecord &Obj)
static cl::opt< RegAllocEvictionAdvisorAnalysisLegacy::AdvisorMode > Mode("regalloc-enable-advisor", cl::Hidden, cl::init(RegAllocEvictionAdvisorAnalysisLegacy::AdvisorMode::Default), cl::desc("Enable regalloc advisor mode"), cl::values(clEnumValN(RegAllocEvictionAdvisorAnalysisLegacy::AdvisorMode::Default, "default", "Default"), clEnumValN(RegAllocEvictionAdvisorAnalysisLegacy::AdvisorMode::Release, "release", "precompiled"), clEnumValN(RegAllocEvictionAdvisorAnalysisLegacy::AdvisorMode::Development, "development", "for training")))
#define LLVM_YAML_DECLARE_BITSET_TRAITS(Type)
#define LLVM_YAML_IS_SEQUENCE_VECTOR(type)
Utility for declaring that a std::vector of a particular type should be considered a YAML sequence.
#define LLVM_YAML_DECLARE_SCALAR_TRAITS(Type, MustQuote)
#define LLVM_YAML_IS_FLOW_SEQUENCE_VECTOR(type)
Utility for declaring that a std::vector of a particular type should be considered a YAML flow sequen...
#define LLVM_YAML_DECLARE_MAPPING_TRAITS(Type)
#define LLVM_YAML_DECLARE_ENUM_TRAITS(Type)
LLVM_ABI void print(raw_ostream &OS, bool isSigned) const
An arbitrary precision integer that knows its signedness.
ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory),...
Provides read only access to a subclass of BinaryStream.
Error readInteger(T &Dest)
Read an integer of the specified endianness into Dest and update the stream's offset.
uint64_t bytesRemaining() const
Error readArray(ArrayRef< T > &Array, uint32_t NumElements)
Get a reference to a NumElements element array of objects of type T from the underlying stream as if ...
Provides write only access to a subclass of WritableBinaryStream.
Error writeInteger(T Value)
Write the integer Value to the underlying stream in the specified endianness.
uint64_t bytesRemaining() const
LLVM_ABI Error writeBytes(ArrayRef< uint8_t > Buffer)
Write the bytes specified in Buffer to the underlying stream.
Lightweight error class with error context and mandatory checking.
static ErrorSuccess success()
Create a success value.
Helper for check-and-exit error handling.
Tagged union holding either a T or a Error.
MutableArrayRef - Represent a mutable reference to an array (0 or more elements consecutively in memo...
void push_back(const T &Elt)
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small.
StringRef - Represent a constant reference to a string, i.e.
The instances of the Type class are immutable: once they are created, they are never changed.
LLVM Value Representation.
TypeIndex insertRecord(ContinuationRecordBuilder &Builder)
ArrayRef< ArrayRef< uint8_t > > records() const
TypeIndex writeLeafType(T &Record)
LLVM_ABI void begin(ContinuationRecordKind RecordKind)
void writeMemberType(RecordType &Record)
PointerToMemberRepresentation Representation
static Error deserializeAs(CVType &CVT, T &Record)
void setIndex(uint32_t I)
uint32_t getIndex() const
This class implements an extremely fast bulk output stream that can only output to a stream.
void mapOptional(const char *Key, T &Val)
void bitSetCase(T &Val, const char *Str, const T ConstVal)
virtual bool outputting() const =0
void mapRequired(const char *Key, T &Val)
void enumCase(T &Val, const char *Str, const T ConstVal)
The Output class is used to generate a yaml document from in-memory structs and vectors.
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
LLVM_ABI std::vector< LeafRecord > fromDebugT(ArrayRef< uint8_t > DebugTorP, StringRef SectionName)
LLVM_ABI ArrayRef< uint8_t > toDebugT(ArrayRef< LeafRecord >, BumpPtrAllocator &Alloc, StringRef SectionName)
PointerMode
Equivalent to CV_ptrmode_e.
@ PointerToMemberFunction
PointerOptions
Equivalent to misc lfPointerAttr bitfields.
MethodKind
Part of member attribute flags. (CV_methodprop_e)
CVRecord< TypeLeafKind > CVType
PointerKind
Equivalent to CV_ptrtype_e.
VarStreamArray< CVType > CVTypeArray
@ HasConstructorOrDestructor
@ HasOverloadedAssignmentOperator
PointerToMemberRepresentation
Equivalent to CV_pmtype_e.
@ MultipleInheritanceData
@ SingleInheritanceFunction
@ VirtualInheritanceFunction
@ MultipleInheritanceFunction
LLVM_ABI Error visitMemberRecordStream(ArrayRef< uint8_t > FieldList, TypeVisitorCallbacks &Callbacks)
CallingConvention
These values correspond to the CV_call_e enumeration, and are documented at the following locations: ...
MethodOptions
Equivalent to CV_fldattr_t bitfield.
@ ConstructorWithVirtualBases
MemberAccess
Source-level access specifier. (CV_access_e)
TypeLeafKind
Duplicate copy of the above enum, but using the official CV names.
TypeRecordKind
Distinguishes individual records in .debug$T or .debug$P section or PDB type stream.
ModifierOptions
Equivalent to CV_modifier_t.
LabelType
Equivalent to CV_LABEL_TYPE_e.
detail::packed_endian_specific_integral< uint32_t, llvm::endianness::little, unaligned > ulittle32_t
detail::packed_endian_specific_integral< uint64_t, llvm::endianness::big, unaligned > ubig64_t
detail::packed_endian_specific_integral< uint16_t, llvm::endianness::little, unaligned > ulittle16_t
This is an optimization pass for GlobalISel generic memory operations.
BumpPtrAllocatorImpl BumpPtrAllocator
The standard BumpPtrAllocator which just uses the default template parameters.
Error make_error(ArgTs &&... Args)
Make a Error instance representing failure using the given error info type.
void cantFail(Error Err, const char *Msg=nullptr)
Report a fatal error if Err is a failure value.
bool to_integer(StringRef S, N &Num, unsigned Base=0)
Convert the string S to an integer of the specified type using the radix Base. If Base is 0,...
std::shared_ptr< detail::LeafRecordBase > Leaf
static LLVM_ABI Expected< LeafRecord > fromCodeViewRecord(codeview::CVType Type)
LLVM_ABI codeview::CVType toCodeViewRecord(codeview::AppendingTypeTableBuilder &Serializer) const
std::shared_ptr< detail::MemberRecordBase > Member
virtual CVType toCodeViewRecord(AppendingTypeTableBuilder &TS) const =0
virtual void map(yaml::IO &io)=0
LeafRecordBase(TypeLeafKind K)
virtual ~LeafRecordBase()=default
virtual Error fromCodeViewRecord(CVType Type)=0
CVType toCodeViewRecord(AppendingTypeTableBuilder &TS) const override
LeafRecordImpl(TypeLeafKind K)
Error fromCodeViewRecord(CVType Type) override
std::vector< MemberRecord > Members
Error fromCodeViewRecord(CVType Type) override
void map(yaml::IO &io) override
LeafRecordImpl(TypeLeafKind K)
CVType toCodeViewRecord(AppendingTypeTableBuilder &TS) const override
virtual void writeTo(ContinuationRecordBuilder &CRB)=0
virtual ~MemberRecordBase()=default
virtual void map(yaml::IO &io)=0
MemberRecordBase(TypeLeafKind K)
void map(yaml::IO &io) override
void writeTo(ContinuationRecordBuilder &CRB) override
MemberRecordImpl(TypeLeafKind K)
This represents the 'GUID' type from windows.h.
static void mapping(IO &io, LeafRecordBase &Record)
static void mapping(IO &io, MemberRecordBase &Record)
This class should be specialized by any type that needs to be converted to/from a YAML mapping.
This class should be specialized by any integer type that is a union of bit values and the YAML repre...
This class should be specialized by any integral type that converts to/from a YAML scalar where there...
This class should be specialized by type that requires custom conversion to/from a yaml scalar.