LLVM 23.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"
31#include "llvm/Support/Endian.h"
32#include "llvm/Support/Error.h"
36#include <algorithm>
37#include <cassert>
38#include <cstdint>
39#include <vector>
40
41using namespace llvm;
42using namespace llvm::codeview;
43using namespace llvm::CodeViewYAML;
44using namespace llvm::CodeViewYAML::detail;
45using namespace llvm::yaml;
46
50
53
65
71
74
75namespace llvm {
76namespace CodeViewYAML {
77namespace detail {
78
81
82 explicit LeafRecordBase(TypeLeafKind K) : Kind(K) {}
83 virtual ~LeafRecordBase() = default;
84
85 virtual void map(yaml::IO &io) = 0;
88};
89
92
93 void map(yaml::IO &IO) override;
94
96 RecordPrefix Prefix;
97 uint32_t TotalLen = sizeof(RecordPrefix) + Data.size();
98 Prefix.RecordKind = Kind;
99 Prefix.RecordLen = TotalLen - 2;
100 uint8_t *Buffer = TS.getAllocator().Allocate<uint8_t>(TotalLen);
101 ::memcpy(Buffer, &Prefix, sizeof(RecordPrefix));
102 ::memcpy(Buffer + sizeof(RecordPrefix), Data.data(), Data.size());
103 return CVType(ArrayRef<uint8_t>(Buffer, TotalLen));
104 }
105
107 this->Kind = Type.kind();
108 Data = Type.content();
109 return Error::success();
110 }
111
112 std::vector<uint8_t> Data;
113};
114
115template <typename T> struct LeafRecordImpl : public LeafRecordBase {
117 : LeafRecordBase(K), Record(static_cast<TypeRecordKind>(K)) {}
118
119 void map(yaml::IO &io) override;
120
124
127 return CVType(TS.records().back());
128 }
129
130 mutable T Record;
131};
132
133template <> struct LeafRecordImpl<FieldListRecord> : public LeafRecordBase {
135
136 void map(yaml::IO &io) override;
139
140 std::vector<MemberRecord> Members;
141};
142
145
147 virtual ~MemberRecordBase() = default;
148
149 virtual void map(yaml::IO &io) = 0;
150 virtual void writeTo(ContinuationRecordBuilder &CRB) = 0;
151};
152
153template <typename T> struct MemberRecordImpl : public MemberRecordBase {
155 : MemberRecordBase(K), Record(static_cast<TypeRecordKind>(K)) {}
156
157 void map(yaml::IO &io) override;
158
159 void writeTo(ContinuationRecordBuilder &CRB) override {
161 }
162
163 mutable T Record;
164};
165
166} // end namespace detail
167} // end namespace CodeViewYAML
168} // end namespace llvm
169
170void ScalarTraits<GUID>::output(const GUID &G, void *, llvm::raw_ostream &OS) {
171 OS << G;
172}
173
175 if (Scalar.size() != 38)
176 return "GUID strings are 38 characters long";
177 if (Scalar.front() != '{' || Scalar.back() != '}')
178 return "GUID is not enclosed in {}";
179 Scalar = Scalar.substr(1, Scalar.size() - 2);
181 Scalar.split(A, '-', 5);
182 if (A.size() != 5 || Scalar[8] != '-' || Scalar[13] != '-' ||
183 Scalar[18] != '-' || Scalar[23] != '-')
184 return "GUID sections are not properly delineated with dashes";
185 struct MSGuid {
189 support::ubig64_t Data4;
190 };
191 MSGuid G = {};
192 uint64_t D41{}, D42{};
193 if (!to_integer(A[0], G.Data1, 16) || !to_integer(A[1], G.Data2, 16) ||
194 !to_integer(A[2], G.Data3, 16) || !to_integer(A[3], D41, 16) ||
195 !to_integer(A[4], D42, 16))
196 return "GUID contains non hex digits";
197 G.Data4 = (D41 << 48) | D42;
198 ::memcpy(&S, &G, sizeof(GUID));
199 return "";
200}
201
202void ScalarTraits<TypeIndex>::output(const TypeIndex &S, void *,
203 raw_ostream &OS) {
204 OS << S.getIndex();
205}
206
208 TypeIndex &S) {
209 uint32_t I;
211 S.setIndex(I);
212 return Result;
213}
214
215void ScalarTraits<APSInt>::output(const APSInt &S, void *, raw_ostream &OS) {
216 S.print(OS, S.isSigned());
217}
218
220 S = APSInt(Scalar);
221 return "";
222}
223
226#define CV_TYPE(name, val) io.enumCase(Value, #name, name);
227#include "llvm/DebugInfo/CodeView/CodeViewTypes.def"
228#undef CV_TYPE
229 io.enumFallback<Hex16>(Value);
230}
231
235 IO.enumCase(Value, "SingleInheritanceData",
237 IO.enumCase(Value, "MultipleInheritanceData",
239 IO.enumCase(Value, "VirtualInheritanceData",
242 IO.enumCase(Value, "SingleInheritanceFunction",
244 IO.enumCase(Value, "MultipleInheritanceFunction",
246 IO.enumCase(Value, "VirtualInheritanceFunction",
248 IO.enumCase(Value, "GeneralFunction",
250}
251
253 IO &IO, VFTableSlotKind &Kind) {
254 IO.enumCase(Kind, "Near16", VFTableSlotKind::Near16);
255 IO.enumCase(Kind, "Far16", VFTableSlotKind::Far16);
256 IO.enumCase(Kind, "This", VFTableSlotKind::This);
257 IO.enumCase(Kind, "Outer", VFTableSlotKind::Outer);
258 IO.enumCase(Kind, "Meta", VFTableSlotKind::Meta);
259 IO.enumCase(Kind, "Near", VFTableSlotKind::Near);
260 IO.enumCase(Kind, "Far", VFTableSlotKind::Far);
261}
262
290}
291
293 PointerKind &Kind) {
294 IO.enumCase(Kind, "Near16", PointerKind::Near16);
295 IO.enumCase(Kind, "Far16", PointerKind::Far16);
296 IO.enumCase(Kind, "Huge16", PointerKind::Huge16);
297 IO.enumCase(Kind, "BasedOnSegment", PointerKind::BasedOnSegment);
298 IO.enumCase(Kind, "BasedOnValue", PointerKind::BasedOnValue);
299 IO.enumCase(Kind, "BasedOnSegmentValue", PointerKind::BasedOnSegmentValue);
300 IO.enumCase(Kind, "BasedOnAddress", PointerKind::BasedOnAddress);
301 IO.enumCase(Kind, "BasedOnSegmentAddress",
303 IO.enumCase(Kind, "BasedOnType", PointerKind::BasedOnType);
304 IO.enumCase(Kind, "BasedOnSelf", PointerKind::BasedOnSelf);
305 IO.enumCase(Kind, "Near32", PointerKind::Near32);
306 IO.enumCase(Kind, "Far32", PointerKind::Far32);
307 IO.enumCase(Kind, "Near64", PointerKind::Near64);
308}
309
311 PointerMode &Mode) {
313 IO.enumCase(Mode, "LValueReference", PointerMode::LValueReference);
314 IO.enumCase(Mode, "PointerToDataMember", PointerMode::PointerToDataMember);
315 IO.enumCase(Mode, "PointerToMemberFunction",
317 IO.enumCase(Mode, "RValueReference", PointerMode::RValueReference);
318}
319
321 IO.enumCase(Value, "None", HfaKind::None);
322 IO.enumCase(Value, "Float", HfaKind::Float);
323 IO.enumCase(Value, "Double", HfaKind::Double);
324 IO.enumCase(Value, "Other", HfaKind::Other);
325}
326
333}
334
336 MethodKind &Kind) {
337 IO.enumCase(Kind, "Vanilla", MethodKind::Vanilla);
338 IO.enumCase(Kind, "Virtual", MethodKind::Virtual);
339 IO.enumCase(Kind, "Static", MethodKind::Static);
340 IO.enumCase(Kind, "Friend", MethodKind::Friend);
341 IO.enumCase(Kind, "IntroducingVirtual", MethodKind::IntroducingVirtual);
342 IO.enumCase(Kind, "PureVirtual", MethodKind::PureVirtual);
343 IO.enumCase(Kind, "PureIntroducingVirtual",
345}
346
353}
354
358}
359
368 IO.bitSetCase(Options, "WinRTSmartPointer",
370}
371
378}
379
385 IO.bitSetCase(Options, "ConstructorWithVirtualBases",
387}
388
391 IO.bitSetCase(Options, "HasConstructorOrDestructor",
393 IO.bitSetCase(Options, "HasOverloadedOperator",
396 IO.bitSetCase(Options, "ContainsNestedClass",
398 IO.bitSetCase(Options, "HasOverloadedAssignmentOperator",
400 IO.bitSetCase(Options, "HasConversionOperator",
407}
408
416}
417
419 IO.mapRequired("ContainingType", MPI.ContainingType);
420 IO.mapRequired("Representation", MPI.Representation);
421}
422
423namespace llvm {
424namespace CodeViewYAML {
425namespace detail {
426
428 yaml::BinaryRef Binary;
429 if (IO.outputting())
430 Binary = yaml::BinaryRef(Data);
431 IO.mapRequired("Data", Binary);
432 if (!IO.outputting()) {
433 std::string Str;
434 raw_string_ostream OS(Str);
435 Binary.writeAsBinary(OS);
436 Data.assign(Str.begin(), Str.end());
437 }
438}
439
441 IO.mapRequired("ModifiedType", Record.ModifiedType);
442 IO.mapRequired("Modifiers", Record.Modifiers);
443}
444
446 IO.mapRequired("ReturnType", Record.ReturnType);
447 IO.mapRequired("CallConv", Record.CallConv);
448 IO.mapRequired("Options", Record.Options);
449 IO.mapRequired("ParameterCount", Record.ParameterCount);
450 IO.mapRequired("ArgumentList", Record.ArgumentList);
451}
452
454 IO.mapRequired("ReturnType", Record.ReturnType);
455 IO.mapRequired("ClassType", Record.ClassType);
456 IO.mapRequired("ThisType", Record.ThisType);
457 IO.mapRequired("CallConv", Record.CallConv);
458 IO.mapRequired("Options", Record.Options);
459 IO.mapRequired("ParameterCount", Record.ParameterCount);
460 IO.mapRequired("ArgumentList", Record.ArgumentList);
461 IO.mapRequired("ThisPointerAdjustment", Record.ThisPointerAdjustment);
462}
463
465 IO.mapRequired("Mode", Record.Mode);
466}
467
469 IO.mapRequired("ClassType", Record.ClassType);
470 IO.mapRequired("FunctionType", Record.FunctionType);
471 IO.mapRequired("Name", Record.Name);
472}
473
475 IO.mapRequired("ArgIndices", Record.ArgIndices);
476}
477
479 IO.mapRequired("StringIndices", Record.StringIndices);
480}
481
483 IO.mapRequired("ReferentType", Record.ReferentType);
484 IO.mapRequired("Attrs", Record.Attrs);
485 IO.mapOptional("MemberInfo", Record.MemberInfo);
486}
487
489 IO.mapRequired("ElementType", Record.ElementType);
490 IO.mapRequired("IndexType", Record.IndexType);
491 IO.mapRequired("Size", Record.Size);
492 IO.mapRequired("Name", Record.Name);
493}
494
498
499} // end namespace detail
500} // end namespace CodeViewYAML
501} // end namespace llvm
502
503namespace {
504
505class MemberRecordConversionVisitor : public TypeVisitorCallbacks {
506public:
507 explicit MemberRecordConversionVisitor(std::vector<MemberRecord> &Records)
508 : Records(Records) {}
509
510#define TYPE_RECORD(EnumName, EnumVal, Name)
511#define MEMBER_RECORD(EnumName, EnumVal, Name) \
512 Error visitKnownMember(CVMemberRecord &CVR, Name##Record &Record) override { \
513 return visitKnownMemberImpl(Record); \
514 }
515#define TYPE_RECORD_ALIAS(EnumName, EnumVal, Name, AliasName)
516#define MEMBER_RECORD_ALIAS(EnumName, EnumVal, Name, AliasName)
517#include "llvm/DebugInfo/CodeView/CodeViewTypes.def"
518private:
519 template <typename T> Error visitKnownMemberImpl(T &Record) {
520 TypeLeafKind K = static_cast<TypeLeafKind>(Record.getKind());
521 auto Impl = std::make_shared<MemberRecordImpl<T>>(K);
522 Impl->Record = Record;
523 Records.push_back(MemberRecord{Impl});
524 return Error::success();
525 }
526
527 std::vector<MemberRecord> &Records;
528};
529
530} // end anonymous namespace
531
533 MemberRecordConversionVisitor V(Members);
536 FieldList));
537 return visitMemberRecordStream(FieldList.Data, V);
538}
539
541 AppendingTypeTableBuilder &TS) const {
544 for (const auto &Member : Members) {
545 Member.Member->writeTo(CRB);
546 }
547 TS.insertRecord(CRB);
548 return CVType(TS.records().back());
549}
550
552 io.mapRequired("Type", Record.Type);
553 io.mapRequired("Attrs", Record.Attrs.Attrs);
554 io.mapRequired("VFTableOffset", Record.VFTableOffset);
555 io.mapRequired("Name", Record.Name);
556}
557
558namespace llvm {
559namespace CodeViewYAML {
560namespace detail {
561
563 IO.mapRequired("MemberCount", Record.MemberCount);
564 IO.mapRequired("Options", Record.Options);
565 IO.mapRequired("FieldList", Record.FieldList);
566 IO.mapRequired("Name", Record.Name);
567 IO.mapRequired("UniqueName", Record.UniqueName);
568 IO.mapRequired("DerivationList", Record.DerivationList);
569 IO.mapRequired("VTableShape", Record.VTableShape);
570 IO.mapRequired("Size", Record.Size);
571}
572
574 IO.mapRequired("MemberCount", Record.MemberCount);
575 IO.mapRequired("Options", Record.Options);
576 IO.mapRequired("FieldList", Record.FieldList);
577 IO.mapRequired("Name", Record.Name);
578 IO.mapRequired("UniqueName", Record.UniqueName);
579 IO.mapRequired("Size", Record.Size);
580}
581
583 IO.mapRequired("NumEnumerators", Record.MemberCount);
584 IO.mapRequired("Options", Record.Options);
585 IO.mapRequired("FieldList", Record.FieldList);
586 IO.mapRequired("Name", Record.Name);
587 IO.mapRequired("UniqueName", Record.UniqueName);
588 IO.mapRequired("UnderlyingType", Record.UnderlyingType);
589}
590
592 IO.mapRequired("Type", Record.Type);
593 IO.mapRequired("BitSize", Record.BitSize);
594 IO.mapRequired("BitOffset", Record.BitOffset);
595}
596
598 IO.mapRequired("Slots", Record.Slots);
599}
600
602 IO.mapRequired("Guid", Record.Guid);
603 IO.mapRequired("Age", Record.Age);
604 IO.mapRequired("Name", Record.Name);
605}
606
608 IO.mapRequired("Id", Record.Id);
609 IO.mapRequired("String", Record.String);
610}
611
613 IO.mapRequired("ParentScope", Record.ParentScope);
614 IO.mapRequired("FunctionType", Record.FunctionType);
615 IO.mapRequired("Name", Record.Name);
616}
617
619 IO.mapRequired("UDT", Record.UDT);
620 IO.mapRequired("SourceFile", Record.SourceFile);
621 IO.mapRequired("LineNumber", Record.LineNumber);
622}
623
625 IO.mapRequired("UDT", Record.UDT);
626 IO.mapRequired("SourceFile", Record.SourceFile);
627 IO.mapRequired("LineNumber", Record.LineNumber);
628 IO.mapRequired("Module", Record.Module);
629}
630
632 IO.mapRequired("ArgIndices", Record.ArgIndices);
633}
634
636 IO.mapRequired("CompleteClass", Record.CompleteClass);
637 IO.mapRequired("OverriddenVFTable", Record.OverriddenVFTable);
638 IO.mapRequired("VFPtrOffset", Record.VFPtrOffset);
639 IO.mapRequired("MethodNames", Record.MethodNames);
640}
641
643 IO.mapRequired("Methods", Record.Methods);
644}
645
647 IO.mapRequired("StartTypeIndex", Record.StartTypeIndex);
648 IO.mapRequired("TypesCount", Record.TypesCount);
649 IO.mapRequired("Signature", Record.Signature);
650 IO.mapRequired("PrecompFilePath", Record.PrecompFilePath);
651}
652
654 IO.mapRequired("Signature", Record.Signature);
655}
656
660
662 IO.mapRequired("NumOverloads", Record.NumOverloads);
663 IO.mapRequired("MethodList", Record.MethodList);
664 IO.mapRequired("Name", Record.Name);
665}
666
668 IO.mapRequired("Type", Record.Type);
669 IO.mapRequired("Name", Record.Name);
670}
671
673 IO.mapRequired("Attrs", Record.Attrs.Attrs);
674 IO.mapRequired("Type", Record.Type);
675 IO.mapRequired("FieldOffset", Record.FieldOffset);
676 IO.mapRequired("Name", Record.Name);
677}
678
680 IO.mapRequired("Attrs", Record.Attrs.Attrs);
681 IO.mapRequired("Type", Record.Type);
682 IO.mapRequired("Name", Record.Name);
683}
684
686 IO.mapRequired("Attrs", Record.Attrs.Attrs);
687 IO.mapRequired("Value", Record.Value);
688 IO.mapRequired("Name", Record.Name);
689}
690
692 IO.mapRequired("Type", Record.Type);
693}
694
696 IO.mapRequired("Attrs", Record.Attrs.Attrs);
697 IO.mapRequired("Type", Record.Type);
698 IO.mapRequired("Offset", Record.Offset);
699}
700
702 IO.mapRequired("Attrs", Record.Attrs.Attrs);
703 IO.mapRequired("BaseType", Record.BaseType);
704 IO.mapRequired("VBPtrType", Record.VBPtrType);
705 IO.mapRequired("VBPtrOffset", Record.VBPtrOffset);
706 IO.mapRequired("VTableIndex", Record.VTableIndex);
707}
708
710 IO.mapRequired("ContinuationIndex", Record.ContinuationIndex);
711}
712
713} // end namespace detail
714} // end namespace CodeViewYAML
715} // end namespace llvm
716
717template <typename T>
719 LeafRecord Result;
720
721 auto Impl = std::make_shared<T>(Type.kind());
722 if (auto EC = Impl->fromCodeViewRecord(Type))
723 return std::move(EC);
724 Result.Leaf = std::move(Impl);
725 return Result;
726}
727
729#define TYPE_RECORD(EnumName, EnumVal, ClassName) \
730 case EnumName: \
731 return fromCodeViewRecordImpl<LeafRecordImpl<ClassName##Record>>(Type);
732#define TYPE_RECORD_ALIAS(EnumName, EnumVal, AliasName, ClassName) \
733 TYPE_RECORD(EnumName, EnumVal, ClassName)
734#define MEMBER_RECORD(EnumName, EnumVal, ClassName)
735#define MEMBER_RECORD_ALIAS(EnumName, EnumVal, AliasName, ClassName)
736 switch (Type.kind()) {
737#include "llvm/DebugInfo/CodeView/CodeViewTypes.def"
738 default:
740 }
741}
742
743CVType
745 return Leaf->toCodeViewRecord(Serializer);
746}
747
748namespace llvm {
749namespace yaml {
750
751template <> struct MappingTraits<LeafRecordBase> {
752 static void mapping(IO &io, LeafRecordBase &Record) { Record.map(io); }
753};
754
755template <> struct MappingTraits<MemberRecordBase> {
756 static void mapping(IO &io, MemberRecordBase &Record) { Record.map(io); }
757};
758
759} // end namespace yaml
760} // end namespace llvm
761
762template <typename ConcreteType>
763static void mapLeafRecordImpl(IO &IO, const char *Class, TypeLeafKind Kind,
764 LeafRecord &Obj) {
765 if (!IO.outputting())
766 Obj.Leaf = std::make_shared<ConcreteType>(Kind);
767
768 if (Kind == LF_FIELDLIST)
769 Obj.Leaf->map(IO);
770 else
771 IO.mapRequired(Class, *Obj.Leaf);
772}
773
774void MappingTraits<LeafRecord>::mapping(IO &IO, LeafRecord &Obj) {
776 if (IO.outputting())
777 Kind = Obj.Leaf->Kind;
778 IO.mapRequired("Kind", Kind);
779
780#define TYPE_RECORD(EnumName, EnumVal, ClassName) \
781 case EnumName: \
782 mapLeafRecordImpl<LeafRecordImpl<ClassName##Record>>(IO, #ClassName, Kind, \
783 Obj); \
784 break;
785#define TYPE_RECORD_ALIAS(EnumName, EnumVal, AliasName, ClassName) \
786 TYPE_RECORD(EnumName, EnumVal, ClassName)
787#define MEMBER_RECORD(EnumName, EnumVal, ClassName)
788#define MEMBER_RECORD_ALIAS(EnumName, EnumVal, AliasName, ClassName)
789 switch (Kind) {
790#include "llvm/DebugInfo/CodeView/CodeViewTypes.def"
791 default:
792 mapLeafRecordImpl<UnknownLeafRecord>(IO, "UnknownLeaf", Kind, Obj);
793 }
794}
795
796template <typename ConcreteType>
797static void mapMemberRecordImpl(IO &IO, const char *Class, TypeLeafKind Kind,
798 MemberRecord &Obj) {
799 if (!IO.outputting())
800 Obj.Member = std::make_shared<MemberRecordImpl<ConcreteType>>(Kind);
801
802 IO.mapRequired(Class, *Obj.Member);
803}
804
805void MappingTraits<MemberRecord>::mapping(IO &IO, MemberRecord &Obj) {
807 if (IO.outputting())
808 Kind = Obj.Member->Kind;
809 IO.mapRequired("Kind", Kind);
810
811#define MEMBER_RECORD(EnumName, EnumVal, ClassName) \
812 case EnumName: \
813 mapMemberRecordImpl<ClassName##Record>(IO, #ClassName, Kind, Obj); \
814 break;
815#define MEMBER_RECORD_ALIAS(EnumName, EnumVal, AliasName, ClassName) \
816 MEMBER_RECORD(EnumName, EnumVal, ClassName)
817#define TYPE_RECORD(EnumName, EnumVal, ClassName)
818#define TYPE_RECORD_ALIAS(EnumName, EnumVal, AliasName, ClassName)
819 switch (Kind) {
820#include "llvm/DebugInfo/CodeView/CodeViewTypes.def"
821 default: { llvm_unreachable("Unknown member kind!"); }
822 }
823}
824
825std::vector<LeafRecord>
828 ExitOnError Err("Invalid " + std::string(SectionName) + " section!");
830 CVTypeArray Types;
831 uint32_t Magic;
832
833 Err(Reader.readInteger(Magic));
835 "Invalid .debug$T or .debug$P section!");
836
837 std::vector<LeafRecord> Result;
838 Err(Reader.readArray(Types, Reader.bytesRemaining()));
839 for (const auto &T : Types) {
840 auto CVT = Err(LeafRecord::fromCodeViewRecord(T));
841 Result.push_back(CVT);
842 }
843 return Result;
844}
845
850 uint32_t Size = sizeof(uint32_t);
851 for (const auto &Leaf : Leafs) {
852 CVType T = Leaf.Leaf->toCodeViewRecord(TS);
853 Size += T.length();
854 assert(T.length() % 4 == 0 && "Improper type record alignment!");
855 }
856 uint8_t *ResultBuffer = Alloc.Allocate<uint8_t>(Size);
857 MutableArrayRef<uint8_t> Output(ResultBuffer, Size);
859 ExitOnError Err("Error writing type record to " + std::string(SectionName) +
860 " section");
862 for (const auto &R : TS.records()) {
863 Err(Writer.writeBytes(R));
864 }
865 assert(Writer.bytesRemaining() == 0 && "Didn't write all type record bytes!");
866 return Output;
867}
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)
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:2318
An arbitrary precision integer that knows its signedness.
Definition APSInt.h:24
bool isSigned() const
Definition APSInt.h:78
ArrayRef - 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:1444
Tagged union holding either a T or a Error.
Definition Error.h:485
MutableArrayRef - Represent a mutable reference to an array (0 or more elements consecutively in memo...
Definition ArrayRef.h:298
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.
Definition StringRef.h:55
The instances of the Type class are immutable: once they are created, they are never changed.
Definition Type.h:45
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:759
virtual bool outputting() const =0
void enumCase(T &Val, StringRef Str, const T ConstVal)
Definition YAMLTraits.h:734
void mapOptional(StringRef Key, T &Val)
Definition YAMLTraits.h:799
void enumFallback(T &Val)
Definition YAMLTraits.h:748
void mapRequired(StringRef Key, T &Val)
Definition YAMLTraits.h:789
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:290
detail::packed_endian_specific_integral< uint64_t, llvm::endianness::big, unaligned > ubig64_t
Definition Endian.h:333
detail::packed_endian_specific_integral< uint16_t, llvm::endianness::little, unaligned > ulittle16_t
Definition Endian.h:287
This is an optimization pass for GlobalISel generic memory operations.
Definition Types.h:26
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:383
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:62
This class should be specialized by any integer type that is a union of bit values and the YAML repre...
Definition YAMLTraits.h:123
This class should be specialized by any integral type that converts to/from a YAML scalar where there...
Definition YAMLTraits.h:107
This class should be specialized by type that requires custom conversion to/from a yaml scalar.
Definition YAMLTraits.h:149