LLVM 24.0.0git
CodeViewYAMLTypes.cpp
Go to the documentation of this file.
1//===- CodeViewYAMLTypes.cpp - CodeView YAMLIO types implementation -------===//
2//
3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4// See https://llvm.org/LICENSE.txt for license information.
5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6//
7//===----------------------------------------------------------------------===//
8//
9// This file defines classes for handling the YAML representation of CodeView
10// Debug Info.
11//
12//===----------------------------------------------------------------------===//
13
15#include "llvm/ADT/APSInt.h"
16#include "llvm/ADT/ArrayRef.h"
17#include "llvm/ADT/StringRef.h"
30#include "llvm/Support/Endian.h"
31#include "llvm/Support/Error.h"
35#include <algorithm>
36#include <cassert>
37#include <cstdint>
38#include <vector>
39
40using namespace llvm;
41using namespace llvm::codeview;
42using namespace llvm::CodeViewYAML;
43using namespace llvm::CodeViewYAML::detail;
44using namespace llvm::yaml;
45
49
52
64
70
73
74namespace llvm {
75namespace CodeViewYAML {
76namespace detail {
77
80
81 explicit LeafRecordBase(TypeLeafKind K) : Kind(K) {}
82 virtual ~LeafRecordBase() = default;
83
84 virtual void map(yaml::IO &io) = 0;
87};
88
91
92 void map(yaml::IO &IO) override;
93
95 RecordPrefix Prefix;
96 uint32_t TotalLen = sizeof(RecordPrefix) + Data.size();
97 Prefix.RecordKind = Kind;
98 Prefix.RecordLen = TotalLen - 2;
99 uint8_t *Buffer = TS.getAllocator().Allocate<uint8_t>(TotalLen);
100 ::memcpy(Buffer, &Prefix, sizeof(RecordPrefix));
101 ::memcpy(Buffer + sizeof(RecordPrefix), Data.data(), Data.size());
102 return CVType(ArrayRef<uint8_t>(Buffer, TotalLen));
103 }
104
106 this->Kind = Type.kind();
107 Data = Type.content();
108 return Error::success();
109 }
110
111 std::vector<uint8_t> Data;
112};
113
114template <typename T> struct LeafRecordImpl : public LeafRecordBase {
116 : LeafRecordBase(K), Record(static_cast<TypeRecordKind>(K)) {}
117
118 void map(yaml::IO &io) override;
119
123
126 return CVType(TS.records().back());
127 }
128
129 mutable T Record;
130};
131
132template <> struct LeafRecordImpl<FieldListRecord> : public LeafRecordBase {
134
135 void map(yaml::IO &io) override;
138
139 std::vector<MemberRecord> Members;
140};
141
144
146 virtual ~MemberRecordBase() = default;
147
148 virtual void map(yaml::IO &io) = 0;
149 virtual void writeTo(ContinuationRecordBuilder &CRB) = 0;
150};
151
152template <typename T> struct MemberRecordImpl : public MemberRecordBase {
154 : MemberRecordBase(K), Record(static_cast<TypeRecordKind>(K)) {}
155
156 void map(yaml::IO &io) override;
157
158 void writeTo(ContinuationRecordBuilder &CRB) override {
160 }
161
162 mutable T Record;
163};
164
165} // end namespace detail
166} // end namespace CodeViewYAML
167} // end namespace llvm
168
169void ScalarTraits<GUID>::output(const GUID &G, void *, llvm::raw_ostream &OS) {
170 OS << G;
171}
172
174 if (Scalar.size() != 38)
175 return "GUID strings are 38 characters long";
176 if (Scalar.front() != '{' || Scalar.back() != '}')
177 return "GUID is not enclosed in {}";
178 Scalar = Scalar.substr(1, Scalar.size() - 2);
180 Scalar.split(A, '-', 5);
181 if (A.size() != 5 || Scalar[8] != '-' || Scalar[13] != '-' ||
182 Scalar[18] != '-' || Scalar[23] != '-')
183 return "GUID sections are not properly delineated with dashes";
184 struct MSGuid {
188 support::ubig64_t Data4;
189 };
190 MSGuid G = {};
191 uint64_t D41{}, D42{};
192 if (!to_integer(A[0], G.Data1, 16) || !to_integer(A[1], G.Data2, 16) ||
193 !to_integer(A[2], G.Data3, 16) || !to_integer(A[3], D41, 16) ||
194 !to_integer(A[4], D42, 16))
195 return "GUID contains non hex digits";
196 G.Data4 = (D41 << 48) | D42;
197 ::memcpy(&S, &G, sizeof(GUID));
198 return "";
199}
200
201void ScalarTraits<TypeIndex>::output(const TypeIndex &S, void *,
202 raw_ostream &OS) {
203 OS << S.getIndex();
204}
205
207 TypeIndex &S) {
208 uint32_t I;
210 S.setIndex(I);
211 return Result;
212}
213
214void ScalarTraits<APSInt>::output(const APSInt &S, void *, raw_ostream &OS) {
215 S.print(OS, S.isSigned());
216}
217
219 S = APSInt(Scalar);
220 return "";
221}
222
225#define CV_TYPE(name, val) io.enumCase(Value, #name, name);
226#include "llvm/DebugInfo/CodeView/CodeViewTypes.def"
227#undef CV_TYPE
228 io.enumFallback<Hex16>(Value);
229}
230
234 IO.enumCase(Value, "SingleInheritanceData",
236 IO.enumCase(Value, "MultipleInheritanceData",
238 IO.enumCase(Value, "VirtualInheritanceData",
241 IO.enumCase(Value, "SingleInheritanceFunction",
243 IO.enumCase(Value, "MultipleInheritanceFunction",
245 IO.enumCase(Value, "VirtualInheritanceFunction",
247 IO.enumCase(Value, "GeneralFunction",
249}
250
252 IO &IO, VFTableSlotKind &Kind) {
253 IO.enumCase(Kind, "Near16", VFTableSlotKind::Near16);
254 IO.enumCase(Kind, "Far16", VFTableSlotKind::Far16);
255 IO.enumCase(Kind, "This", VFTableSlotKind::This);
256 IO.enumCase(Kind, "Outer", VFTableSlotKind::Outer);
257 IO.enumCase(Kind, "Meta", VFTableSlotKind::Meta);
258 IO.enumCase(Kind, "Near", VFTableSlotKind::Near);
259 IO.enumCase(Kind, "Far", VFTableSlotKind::Far);
260}
261
289}
290
292 PointerKind &Kind) {
293 IO.enumCase(Kind, "Near16", PointerKind::Near16);
294 IO.enumCase(Kind, "Far16", PointerKind::Far16);
295 IO.enumCase(Kind, "Huge16", PointerKind::Huge16);
296 IO.enumCase(Kind, "BasedOnSegment", PointerKind::BasedOnSegment);
297 IO.enumCase(Kind, "BasedOnValue", PointerKind::BasedOnValue);
298 IO.enumCase(Kind, "BasedOnSegmentValue", PointerKind::BasedOnSegmentValue);
299 IO.enumCase(Kind, "BasedOnAddress", PointerKind::BasedOnAddress);
300 IO.enumCase(Kind, "BasedOnSegmentAddress",
302 IO.enumCase(Kind, "BasedOnType", PointerKind::BasedOnType);
303 IO.enumCase(Kind, "BasedOnSelf", PointerKind::BasedOnSelf);
304 IO.enumCase(Kind, "Near32", PointerKind::Near32);
305 IO.enumCase(Kind, "Far32", PointerKind::Far32);
306 IO.enumCase(Kind, "Near64", PointerKind::Near64);
307}
308
310 PointerMode &Mode) {
312 IO.enumCase(Mode, "LValueReference", PointerMode::LValueReference);
313 IO.enumCase(Mode, "PointerToDataMember", PointerMode::PointerToDataMember);
314 IO.enumCase(Mode, "PointerToMemberFunction",
316 IO.enumCase(Mode, "RValueReference", PointerMode::RValueReference);
317}
318
320 IO.enumCase(Value, "None", HfaKind::None);
321 IO.enumCase(Value, "Float", HfaKind::Float);
322 IO.enumCase(Value, "Double", HfaKind::Double);
323 IO.enumCase(Value, "Other", HfaKind::Other);
324}
325
332}
333
335 MethodKind &Kind) {
336 IO.enumCase(Kind, "Vanilla", MethodKind::Vanilla);
337 IO.enumCase(Kind, "Virtual", MethodKind::Virtual);
338 IO.enumCase(Kind, "Static", MethodKind::Static);
339 IO.enumCase(Kind, "Friend", MethodKind::Friend);
340 IO.enumCase(Kind, "IntroducingVirtual", MethodKind::IntroducingVirtual);
341 IO.enumCase(Kind, "PureVirtual", MethodKind::PureVirtual);
342 IO.enumCase(Kind, "PureIntroducingVirtual",
344}
345
352}
353
357}
358
367 IO.bitSetCase(Options, "WinRTSmartPointer",
369}
370
377}
378
384 IO.bitSetCase(Options, "ConstructorWithVirtualBases",
386}
387
390 IO.bitSetCase(Options, "HasConstructorOrDestructor",
392 IO.bitSetCase(Options, "HasOverloadedOperator",
395 IO.bitSetCase(Options, "ContainsNestedClass",
397 IO.bitSetCase(Options, "HasOverloadedAssignmentOperator",
399 IO.bitSetCase(Options, "HasConversionOperator",
406}
407
415}
416
418 IO.mapRequired("ContainingType", MPI.ContainingType);
419 IO.mapRequired("Representation", MPI.Representation);
420}
421
422namespace llvm {
423namespace CodeViewYAML {
424namespace detail {
425
427 yaml::BinaryRef Binary;
428 if (IO.outputting())
429 Binary = yaml::BinaryRef(Data);
430 IO.mapRequired("Data", Binary);
431 if (!IO.outputting()) {
432 std::string Str;
433 raw_string_ostream OS(Str);
434 Binary.writeAsBinary(OS);
435 Data.assign(Str.begin(), Str.end());
436 }
437}
438
440 IO.mapRequired("ModifiedType", Record.ModifiedType);
441 IO.mapRequired("Modifiers", Record.Modifiers);
442}
443
445 IO.mapRequired("ReturnType", Record.ReturnType);
446 IO.mapRequired("CallConv", Record.CallConv);
447 IO.mapRequired("Options", Record.Options);
448 IO.mapRequired("ParameterCount", Record.ParameterCount);
449 IO.mapRequired("ArgumentList", Record.ArgumentList);
450}
451
453 IO.mapRequired("ReturnType", Record.ReturnType);
454 IO.mapRequired("ClassType", Record.ClassType);
455 IO.mapRequired("ThisType", Record.ThisType);
456 IO.mapRequired("CallConv", Record.CallConv);
457 IO.mapRequired("Options", Record.Options);
458 IO.mapRequired("ParameterCount", Record.ParameterCount);
459 IO.mapRequired("ArgumentList", Record.ArgumentList);
460 IO.mapRequired("ThisPointerAdjustment", Record.ThisPointerAdjustment);
461}
462
464 IO.mapRequired("Mode", Record.Mode);
465}
466
468 IO.mapRequired("ClassType", Record.ClassType);
469 IO.mapRequired("FunctionType", Record.FunctionType);
470 IO.mapRequired("Name", Record.Name);
471}
472
474 IO.mapRequired("ArgIndices", Record.ArgIndices);
475}
476
478 IO.mapRequired("StringIndices", Record.StringIndices);
479}
480
482 IO.mapRequired("ReferentType", Record.ReferentType);
483 IO.mapRequired("Attrs", Record.Attrs);
484 IO.mapOptional("MemberInfo", Record.MemberInfo);
485}
486
488 IO.mapRequired("ElementType", Record.ElementType);
489 IO.mapRequired("IndexType", Record.IndexType);
490 IO.mapRequired("Size", Record.Size);
491 IO.mapRequired("Name", Record.Name);
492}
493
497
498} // end namespace detail
499} // end namespace CodeViewYAML
500} // end namespace llvm
501
502namespace {
503
504class MemberRecordConversionVisitor : public TypeVisitorCallbacks {
505public:
506 explicit MemberRecordConversionVisitor(std::vector<MemberRecord> &Records)
507 : Records(Records) {}
508
509#define TYPE_RECORD(EnumName, EnumVal, Name)
510#define MEMBER_RECORD(EnumName, EnumVal, Name) \
511 Error visitKnownMember(CVMemberRecord &CVR, Name##Record &Record) override { \
512 return visitKnownMemberImpl(Record); \
513 }
514#define TYPE_RECORD_ALIAS(EnumName, EnumVal, Name, AliasName)
515#define MEMBER_RECORD_ALIAS(EnumName, EnumVal, Name, AliasName)
516#include "llvm/DebugInfo/CodeView/CodeViewTypes.def"
517private:
518 template <typename T> Error visitKnownMemberImpl(T &Record) {
519 TypeLeafKind K = static_cast<TypeLeafKind>(Record.getKind());
520 auto Impl = std::make_shared<MemberRecordImpl<T>>(K);
521 Impl->Record = Record;
522 Records.push_back(MemberRecord{Impl});
523 return Error::success();
524 }
525
526 std::vector<MemberRecord> &Records;
527};
528
529} // end anonymous namespace
530
532 MemberRecordConversionVisitor V(Members);
535 FieldList));
536 return visitMemberRecordStream(FieldList.Data, V);
537}
538
540 AppendingTypeTableBuilder &TS) const {
543 for (const auto &Member : Members) {
544 Member.Member->writeTo(CRB);
545 }
546 TS.insertRecord(CRB);
547 return CVType(TS.records().back());
548}
549
551 io.mapRequired("Type", Record.Type);
552 io.mapRequired("Attrs", Record.Attrs.Attrs);
553 io.mapRequired("VFTableOffset", Record.VFTableOffset);
554 io.mapRequired("Name", Record.Name);
555}
556
557namespace llvm {
558namespace CodeViewYAML {
559namespace detail {
560
562 IO.mapRequired("MemberCount", Record.MemberCount);
563 IO.mapRequired("Options", Record.Options);
564 IO.mapRequired("FieldList", Record.FieldList);
565 IO.mapRequired("Name", Record.Name);
566 IO.mapRequired("UniqueName", Record.UniqueName);
567 IO.mapRequired("DerivationList", Record.DerivationList);
568 IO.mapRequired("VTableShape", Record.VTableShape);
569 IO.mapRequired("Size", Record.Size);
570}
571
573 IO.mapRequired("MemberCount", Record.MemberCount);
574 IO.mapRequired("Options", Record.Options);
575 IO.mapRequired("FieldList", Record.FieldList);
576 IO.mapRequired("Name", Record.Name);
577 IO.mapRequired("UniqueName", Record.UniqueName);
578 IO.mapRequired("Size", Record.Size);
579}
580
582 IO.mapRequired("NumEnumerators", Record.MemberCount);
583 IO.mapRequired("Options", Record.Options);
584 IO.mapRequired("FieldList", Record.FieldList);
585 IO.mapRequired("Name", Record.Name);
586 IO.mapRequired("UniqueName", Record.UniqueName);
587 IO.mapRequired("UnderlyingType", Record.UnderlyingType);
588}
589
591 IO.mapRequired("Type", Record.Type);
592 IO.mapRequired("BitSize", Record.BitSize);
593 IO.mapRequired("BitOffset", Record.BitOffset);
594}
595
597 IO.mapRequired("Slots", Record.Slots);
598}
599
601 IO.mapRequired("Guid", Record.Guid);
602 IO.mapRequired("Age", Record.Age);
603 IO.mapRequired("Name", Record.Name);
604}
605
607 IO.mapRequired("Id", Record.Id);
608 IO.mapRequired("String", Record.String);
609}
610
612 IO.mapRequired("ParentScope", Record.ParentScope);
613 IO.mapRequired("FunctionType", Record.FunctionType);
614 IO.mapRequired("Name", Record.Name);
615}
616
618 IO.mapRequired("UDT", Record.UDT);
619 IO.mapRequired("SourceFile", Record.SourceFile);
620 IO.mapRequired("LineNumber", Record.LineNumber);
621}
622
624 IO.mapRequired("UDT", Record.UDT);
625 IO.mapRequired("SourceFile", Record.SourceFile);
626 IO.mapRequired("LineNumber", Record.LineNumber);
627 IO.mapRequired("Module", Record.Module);
628}
629
631 IO.mapRequired("ArgIndices", Record.ArgIndices);
632}
633
635 IO.mapRequired("CompleteClass", Record.CompleteClass);
636 IO.mapRequired("OverriddenVFTable", Record.OverriddenVFTable);
637 IO.mapRequired("VFPtrOffset", Record.VFPtrOffset);
638 IO.mapRequired("MethodNames", Record.MethodNames);
639}
640
642 IO.mapRequired("Methods", Record.Methods);
643}
644
646 IO.mapRequired("StartTypeIndex", Record.StartTypeIndex);
647 IO.mapRequired("TypesCount", Record.TypesCount);
648 IO.mapRequired("Signature", Record.Signature);
649 IO.mapRequired("PrecompFilePath", Record.PrecompFilePath);
650}
651
653 IO.mapRequired("Signature", Record.Signature);
654}
655
659
661 IO.mapRequired("NumOverloads", Record.NumOverloads);
662 IO.mapRequired("MethodList", Record.MethodList);
663 IO.mapRequired("Name", Record.Name);
664}
665
667 IO.mapRequired("Type", Record.Type);
668 IO.mapRequired("Name", Record.Name);
669}
670
672 IO.mapRequired("Attrs", Record.Attrs.Attrs);
673 IO.mapRequired("Type", Record.Type);
674 IO.mapRequired("FieldOffset", Record.FieldOffset);
675 IO.mapRequired("Name", Record.Name);
676}
677
679 IO.mapRequired("Attrs", Record.Attrs.Attrs);
680 IO.mapRequired("Type", Record.Type);
681 IO.mapRequired("Name", Record.Name);
682}
683
685 IO.mapRequired("Attrs", Record.Attrs.Attrs);
686 IO.mapRequired("Value", Record.Value);
687 IO.mapRequired("Name", Record.Name);
688}
689
691 IO.mapRequired("Type", Record.Type);
692}
693
695 IO.mapRequired("Attrs", Record.Attrs.Attrs);
696 IO.mapRequired("Type", Record.Type);
697 IO.mapRequired("Offset", Record.Offset);
698}
699
701 IO.mapRequired("Attrs", Record.Attrs.Attrs);
702 IO.mapRequired("BaseType", Record.BaseType);
703 IO.mapRequired("VBPtrType", Record.VBPtrType);
704 IO.mapRequired("VBPtrOffset", Record.VBPtrOffset);
705 IO.mapRequired("VTableIndex", Record.VTableIndex);
706}
707
709 IO.mapRequired("ContinuationIndex", Record.ContinuationIndex);
710}
711
712} // end namespace detail
713} // end namespace CodeViewYAML
714} // end namespace llvm
715
716template <typename T>
718 LeafRecord Result;
719
720 auto Impl = std::make_shared<T>(Type.kind());
721 if (auto EC = Impl->fromCodeViewRecord(Type))
722 return std::move(EC);
723 Result.Leaf = std::move(Impl);
724 return Result;
725}
726
728#define TYPE_RECORD(EnumName, EnumVal, ClassName) \
729 case EnumName: \
730 return fromCodeViewRecordImpl<LeafRecordImpl<ClassName##Record>>(Type);
731#define TYPE_RECORD_ALIAS(EnumName, EnumVal, AliasName, ClassName) \
732 TYPE_RECORD(EnumName, EnumVal, ClassName)
733#define MEMBER_RECORD(EnumName, EnumVal, ClassName)
734#define MEMBER_RECORD_ALIAS(EnumName, EnumVal, AliasName, ClassName)
735 switch (Type.kind()) {
736#include "llvm/DebugInfo/CodeView/CodeViewTypes.def"
737 default:
739 }
740}
741
742CVType
744 return Leaf->toCodeViewRecord(Serializer);
745}
746
747namespace llvm {
748namespace yaml {
749
750template <> struct MappingTraits<LeafRecordBase> {
751 static void mapping(IO &io, LeafRecordBase &Record) { Record.map(io); }
752};
753
754template <> struct MappingTraits<MemberRecordBase> {
755 static void mapping(IO &io, MemberRecordBase &Record) { Record.map(io); }
756};
757
758} // end namespace yaml
759} // end namespace llvm
760
761template <typename ConcreteType>
762static void mapLeafRecordImpl(IO &IO, const char *Class, TypeLeafKind Kind,
763 LeafRecord &Obj) {
764 if (!IO.outputting())
765 Obj.Leaf = std::make_shared<ConcreteType>(Kind);
766
767 if (Kind == LF_FIELDLIST)
768 Obj.Leaf->map(IO);
769 else
770 IO.mapRequired(Class, *Obj.Leaf);
771}
772
773void MappingTraits<LeafRecord>::mapping(IO &IO, LeafRecord &Obj) {
775 if (IO.outputting())
776 Kind = Obj.Leaf->Kind;
777 IO.mapRequired("Kind", Kind);
778
779#define TYPE_RECORD(EnumName, EnumVal, ClassName) \
780 case EnumName: \
781 mapLeafRecordImpl<LeafRecordImpl<ClassName##Record>>(IO, #ClassName, Kind, \
782 Obj); \
783 break;
784#define TYPE_RECORD_ALIAS(EnumName, EnumVal, AliasName, ClassName) \
785 TYPE_RECORD(EnumName, EnumVal, ClassName)
786#define MEMBER_RECORD(EnumName, EnumVal, ClassName)
787#define MEMBER_RECORD_ALIAS(EnumName, EnumVal, AliasName, ClassName)
788 switch (Kind) {
789#include "llvm/DebugInfo/CodeView/CodeViewTypes.def"
790 default:
791 mapLeafRecordImpl<UnknownLeafRecord>(IO, "UnknownLeaf", Kind, Obj);
792 }
793}
794
795template <typename ConcreteType>
796static void mapMemberRecordImpl(IO &IO, const char *Class, TypeLeafKind Kind,
797 MemberRecord &Obj) {
798 if (!IO.outputting())
799 Obj.Member = std::make_shared<MemberRecordImpl<ConcreteType>>(Kind);
800
801 IO.mapRequired(Class, *Obj.Member);
802}
803
804void MappingTraits<MemberRecord>::mapping(IO &IO, MemberRecord &Obj) {
806 if (IO.outputting())
807 Kind = Obj.Member->Kind;
808 IO.mapRequired("Kind", Kind);
809
810#define MEMBER_RECORD(EnumName, EnumVal, ClassName) \
811 case EnumName: \
812 mapMemberRecordImpl<ClassName##Record>(IO, #ClassName, Kind, Obj); \
813 break;
814#define MEMBER_RECORD_ALIAS(EnumName, EnumVal, AliasName, ClassName) \
815 MEMBER_RECORD(EnumName, EnumVal, ClassName)
816#define TYPE_RECORD(EnumName, EnumVal, ClassName)
817#define TYPE_RECORD_ALIAS(EnumName, EnumVal, AliasName, ClassName)
818 switch (Kind) {
819#include "llvm/DebugInfo/CodeView/CodeViewTypes.def"
820 default: { llvm_unreachable("Unknown member kind!"); }
821 }
822}
823
824std::vector<LeafRecord>
827 ExitOnError Err("Invalid " + std::string(SectionName) + " section!");
829 CVTypeArray Types;
830 uint32_t Magic;
831
832 Err(Reader.readInteger(Magic));
834 "Invalid .debug$T or .debug$P section!");
835
836 std::vector<LeafRecord> Result;
837 Err(Reader.readArray(Types, Reader.bytesRemaining()));
838 for (const auto &T : Types) {
839 auto CVT = Err(LeafRecord::fromCodeViewRecord(T));
840 Result.push_back(CVT);
841 }
842 return Result;
843}
844
849 uint32_t Size = sizeof(uint32_t);
850 for (const auto &Leaf : Leafs) {
851 CVType T = Leaf.Leaf->toCodeViewRecord(TS);
852 Size += T.length();
853 assert(T.length() % 4 == 0 && "Improper type record alignment!");
854 }
855 uint8_t *ResultBuffer = Alloc.Allocate<uint8_t>(Size);
856 MutableArrayRef<uint8_t> Output(ResultBuffer, Size);
858 ExitOnError Err("Error writing type record to " + std::string(SectionName) +
859 " section");
861 for (const auto &R : TS.records()) {
862 Err(Writer.writeBytes(R));
863 }
864 assert(Writer.bytesRemaining() == 0 && "Didn't write all type record bytes!");
865 return Output;
866}
assert(UImm &&(UImm !=~static_cast< T >(0)) &&"Invalid immediate!")
unsigned uint64_t
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)
DXIL Resource Access
static LVOptions Options
Definition LVOptions.cpp:25
#define I(x, y, z)
Definition MD5.cpp:57
#define G(x, y, z)
Definition MD5.cpp:55
#define T
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
Definition APInt.cpp:2343
An arbitrary precision integer that knows its signedness.
Definition APSInt.h:24
bool isSigned() const
Definition APSInt.h:78
Represent a constant reference to an array (0 or more elements consecutively in memory),...
Definition ArrayRef.h:40
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.
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.
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.
Definition Error.h:159
static ErrorSuccess success()
Create a success value.
Definition Error.h:336
Helper for check-and-exit error handling.
Definition Error.h:1460
Tagged union holding either a T or a Error.
Definition Error.h:485
Represent a mutable reference to an array (0 or more elements consecutively in memory),...
Definition ArrayRef.h:294
void push_back(const T &Elt)
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small.
Represent a constant reference to a string, i.e.
Definition StringRef.h:56
The instances of the Type class are immutable: once they are created, they are never changed.
Definition Type.h:46
LLVM Value Representation.
Definition Value.h:75
TypeIndex insertRecord(ContinuationRecordBuilder &Builder)
ArrayRef< ArrayRef< uint8_t > > records() const
LLVM_ABI void begin(ContinuationRecordKind RecordKind)
PointerToMemberRepresentation Representation
Definition TypeRecord.h:114
static Error deserializeAs(CVType &CVT, T &Record)
A 32-bit type reference.
Definition TypeIndex.h:97
void setIndex(uint32_t I)
Definition TypeIndex.h:113
uint32_t getIndex() const
Definition TypeIndex.h:112
This class implements an extremely fast bulk output stream that can only output to a stream.
Definition raw_ostream.h:53
A raw_ostream that writes to an std::string.
Specialized YAMLIO scalar type for representing a binary blob.
Definition YAML.h:64
void bitSetCase(T &Val, StringRef Str, const T ConstVal)
Definition YAMLTraits.h:760
virtual bool outputting() const =0
void enumCase(T &Val, StringRef Str, const T ConstVal)
Definition YAMLTraits.h:735
void mapOptional(StringRef Key, T &Val)
Definition YAMLTraits.h:800
void enumFallback(T &Val)
Definition YAMLTraits.h:749
void mapRequired(StringRef Key, T &Val)
Definition YAMLTraits.h:790
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.
@ DEBUG_SECTION_MAGIC
Definition COFF.h:839
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.
Definition CodeView.h:335
PointerOptions
Equivalent to misc lfPointerAttr bitfields.
Definition CodeView.h:344
MethodKind
Part of member attribute flags. (CV_methodprop_e)
Definition CodeView.h:252
CVRecord< TypeLeafKind > CVType
Definition CVRecord.h:64
PointerKind
Equivalent to CV_ptrtype_e.
Definition CodeView.h:318
VarStreamArray< CVType > CVTypeArray
Definition CVRecord.h:127
PointerToMemberRepresentation
Equivalent to CV_pmtype_e.
Definition CodeView.h:358
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: ...
Definition CodeView.h:156
MethodOptions
Equivalent to CV_fldattr_t bitfield.
Definition CodeView.h:263
MemberAccess
Source-level access specifier. (CV_access_e)
Definition CodeView.h:244
TypeLeafKind
Duplicate copy of the above enum, but using the official CV names.
Definition CodeView.h:34
TypeRecordKind
Distinguishes individual records in .debug$T or .debug$P section or PDB type stream.
Definition CodeView.h:27
ModifierOptions
Equivalent to CV_modifier_t.
Definition CodeView.h:283
LabelType
Equivalent to CV_LABEL_TYPE_e.
Definition CodeView.h:276
detail::packed_endian_specific_integral< uint32_t, llvm::endianness::little, unaligned > ulittle32_t
Definition Endian.h:270
detail::packed_endian_specific_integral< uint64_t, llvm::endianness::big, unaligned > ubig64_t
Definition Endian.h:313
detail::packed_endian_specific_integral< uint16_t, llvm::endianness::little, unaligned > ulittle16_t
Definition Endian.h:267
This is an optimization pass for GlobalISel generic memory operations.
void cantFail(Error Err, const char *Msg=nullptr)
Report a fatal error if Err is a failure value.
Definition Error.h:769
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,...
BumpPtrAllocatorImpl<> BumpPtrAllocator
The standard BumpPtrAllocator which just uses the default template parameters.
Definition Allocator.h:390
std::shared_ptr< detail::LeafRecordBase > Leaf
static LLVM_ABI Expected< LeafRecord > fromCodeViewRecord(codeview::CVType Type)
LLVM_ABI codeview::CVType toCodeViewRecord(codeview::AppendingTypeTableBuilder &Serializer) const
virtual CVType toCodeViewRecord(AppendingTypeTableBuilder &TS) const =0
virtual void map(yaml::IO &io)=0
virtual Error fromCodeViewRecord(CVType Type)=0
CVType toCodeViewRecord(AppendingTypeTableBuilder &TS) const override
CVType toCodeViewRecord(AppendingTypeTableBuilder &TS) const override
virtual void writeTo(ContinuationRecordBuilder &CRB)=0
void writeTo(ContinuationRecordBuilder &CRB) override
CVType toCodeViewRecord(AppendingTypeTableBuilder &TS) const override
This represents the 'GUID' type from windows.h.
Definition GUID.h:22
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.
Definition YAMLTraits.h:63
This class should be specialized by any integer type that is a union of bit values and the YAML repre...
Definition YAMLTraits.h:124
This class should be specialized by any integral type that converts to/from a YAML scalar where there...
Definition YAMLTraits.h:108
This class should be specialized by type that requires custom conversion to/from a yaml scalar.
Definition YAMLTraits.h:150