/Users/buildslave/jenkins/sharedspace/clang-stage2-coverage-R@2/llvm/include/llvm/DebugInfo/CodeView/TypeTableBuilder.h
Line | Count | Source (jump to first uncovered line) |
1 | | //===- TypeTableBuilder.h ---------------------------------------*- C++ -*-===// |
2 | | // |
3 | | // The LLVM Compiler Infrastructure |
4 | | // |
5 | | // This file is distributed under the University of Illinois Open Source |
6 | | // License. See LICENSE.TXT for details. |
7 | | // |
8 | | //===----------------------------------------------------------------------===// |
9 | | |
10 | | #ifndef LLVM_DEBUGINFO_CODEVIEW_TYPETABLEBUILDER_H |
11 | | #define LLVM_DEBUGINFO_CODEVIEW_TYPETABLEBUILDER_H |
12 | | |
13 | | #include "llvm/ADT/ArrayRef.h" |
14 | | #include "llvm/DebugInfo/CodeView/CodeView.h" |
15 | | #include "llvm/DebugInfo/CodeView/TypeIndex.h" |
16 | | #include "llvm/DebugInfo/CodeView/TypeRecord.h" |
17 | | #include "llvm/DebugInfo/CodeView/TypeSerializer.h" |
18 | | #include "llvm/Support/Allocator.h" |
19 | | #include "llvm/Support/Error.h" |
20 | | #include <algorithm> |
21 | | #include <cassert> |
22 | | #include <cstdint> |
23 | | #include <type_traits> |
24 | | |
25 | | namespace llvm { |
26 | | namespace codeview { |
27 | | |
28 | | class TypeTableBuilder { |
29 | | private: |
30 | 0 | TypeIndex handleError(Error EC) const { |
31 | 0 | assert(false && "Couldn't write Type!"); |
32 | 0 | consumeError(std::move(EC)); |
33 | 0 | return TypeIndex(); |
34 | 0 | } |
35 | | |
36 | | BumpPtrAllocator &Allocator; |
37 | | TypeSerializer Serializer; |
38 | | |
39 | | public: |
40 | | explicit TypeTableBuilder(BumpPtrAllocator &Allocator, |
41 | | bool WriteUnique = true) |
42 | 4.99k | : Allocator(Allocator), Serializer(Allocator, WriteUnique) {} |
43 | | TypeTableBuilder(const TypeTableBuilder &) = delete; |
44 | | TypeTableBuilder &operator=(const TypeTableBuilder &) = delete; |
45 | | |
46 | 96 | bool empty() const { return Serializer.records().empty(); } |
47 | | |
48 | 0 | BumpPtrAllocator &getAllocator() const { return Allocator; } |
49 | | |
50 | 1.57k | template <typename T> TypeIndex writeKnownType(T &Record) { |
51 | 1.57k | static_assert(!std::is_same<T, FieldListRecord>::value, |
52 | 1.57k | "Can't serialize FieldList!"); |
53 | 1.57k | |
54 | 1.57k | CVType Type; |
55 | 1.57k | Type.Type = static_cast<TypeLeafKind>(Record.getKind()); |
56 | 1.57k | if (auto EC = Serializer.visitTypeBegin(Type)) |
57 | 0 | return handleError(std::move(EC)); |
58 | 1.57k | if (auto 1.57k EC1.57k = Serializer.visitKnownRecord(Type, Record)) |
59 | 0 | return handleError(std::move(EC)); |
60 | 1.57k | |
61 | 1.57k | auto ExpectedIndex = Serializer.visitTypeEndGetIndex(Type); |
62 | 1.57k | if (!ExpectedIndex) |
63 | 0 | return handleError(ExpectedIndex.takeError()); |
64 | 1.57k | |
65 | 1.57k | return *ExpectedIndex; |
66 | 1.57k | } llvm::codeview::TypeIndex llvm::codeview::TypeTableBuilder::writeKnownType<llvm::codeview::StringIdRecord>(llvm::codeview::StringIdRecord&) Line | Count | Source | 50 | 212 | template <typename T> TypeIndex writeKnownType(T &Record) { | 51 | 212 | static_assert(!std::is_same<T, FieldListRecord>::value, | 52 | 212 | "Can't serialize FieldList!"); | 53 | 212 | | 54 | 212 | CVType Type; | 55 | 212 | Type.Type = static_cast<TypeLeafKind>(Record.getKind()); | 56 | 212 | if (auto EC = Serializer.visitTypeBegin(Type)) | 57 | 0 | return handleError(std::move(EC)); | 58 | 212 | if (auto 212 EC212 = Serializer.visitKnownRecord(Type, Record)) | 59 | 0 | return handleError(std::move(EC)); | 60 | 212 | | 61 | 212 | auto ExpectedIndex = Serializer.visitTypeEndGetIndex(Type); | 62 | 212 | if (!ExpectedIndex) | 63 | 0 | return handleError(ExpectedIndex.takeError()); | 64 | 212 | | 65 | 212 | return *ExpectedIndex; | 66 | 212 | } |
llvm::codeview::TypeIndex llvm::codeview::TypeTableBuilder::writeKnownType<llvm::codeview::MemberFuncIdRecord>(llvm::codeview::MemberFuncIdRecord&) Line | Count | Source | 50 | 26 | template <typename T> TypeIndex writeKnownType(T &Record) { | 51 | 26 | static_assert(!std::is_same<T, FieldListRecord>::value, | 52 | 26 | "Can't serialize FieldList!"); | 53 | 26 | | 54 | 26 | CVType Type; | 55 | 26 | Type.Type = static_cast<TypeLeafKind>(Record.getKind()); | 56 | 26 | if (auto EC = Serializer.visitTypeBegin(Type)) | 57 | 0 | return handleError(std::move(EC)); | 58 | 26 | if (auto 26 EC26 = Serializer.visitKnownRecord(Type, Record)) | 59 | 0 | return handleError(std::move(EC)); | 60 | 26 | | 61 | 26 | auto ExpectedIndex = Serializer.visitTypeEndGetIndex(Type); | 62 | 26 | if (!ExpectedIndex) | 63 | 0 | return handleError(ExpectedIndex.takeError()); | 64 | 26 | | 65 | 26 | return *ExpectedIndex; | 66 | 26 | } |
llvm::codeview::TypeIndex llvm::codeview::TypeTableBuilder::writeKnownType<llvm::codeview::FuncIdRecord>(llvm::codeview::FuncIdRecord&) Line | Count | Source | 50 | 181 | template <typename T> TypeIndex writeKnownType(T &Record) { | 51 | 181 | static_assert(!std::is_same<T, FieldListRecord>::value, | 52 | 181 | "Can't serialize FieldList!"); | 53 | 181 | | 54 | 181 | CVType Type; | 55 | 181 | Type.Type = static_cast<TypeLeafKind>(Record.getKind()); | 56 | 181 | if (auto EC = Serializer.visitTypeBegin(Type)) | 57 | 0 | return handleError(std::move(EC)); | 58 | 181 | if (auto 181 EC181 = Serializer.visitKnownRecord(Type, Record)) | 59 | 0 | return handleError(std::move(EC)); | 60 | 181 | | 61 | 181 | auto ExpectedIndex = Serializer.visitTypeEndGetIndex(Type); | 62 | 181 | if (!ExpectedIndex) | 63 | 0 | return handleError(ExpectedIndex.takeError()); | 64 | 181 | | 65 | 181 | return *ExpectedIndex; | 66 | 181 | } |
llvm::codeview::TypeIndex llvm::codeview::TypeTableBuilder::writeKnownType<llvm::codeview::ArrayRecord>(llvm::codeview::ArrayRecord&) Line | Count | Source | 50 | 84 | template <typename T> TypeIndex writeKnownType(T &Record) { | 51 | 84 | static_assert(!std::is_same<T, FieldListRecord>::value, | 52 | 84 | "Can't serialize FieldList!"); | 53 | 84 | | 54 | 84 | CVType Type; | 55 | 84 | Type.Type = static_cast<TypeLeafKind>(Record.getKind()); | 56 | 84 | if (auto EC = Serializer.visitTypeBegin(Type)) | 57 | 0 | return handleError(std::move(EC)); | 58 | 84 | if (auto 84 EC84 = Serializer.visitKnownRecord(Type, Record)) | 59 | 0 | return handleError(std::move(EC)); | 60 | 84 | | 61 | 84 | auto ExpectedIndex = Serializer.visitTypeEndGetIndex(Type); | 62 | 84 | if (!ExpectedIndex) | 63 | 0 | return handleError(ExpectedIndex.takeError()); | 64 | 84 | | 65 | 84 | return *ExpectedIndex; | 66 | 84 | } |
llvm::codeview::TypeIndex llvm::codeview::TypeTableBuilder::writeKnownType<llvm::codeview::PointerRecord>(llvm::codeview::PointerRecord&) Line | Count | Source | 50 | 160 | template <typename T> TypeIndex writeKnownType(T &Record) { | 51 | 160 | static_assert(!std::is_same<T, FieldListRecord>::value, | 52 | 160 | "Can't serialize FieldList!"); | 53 | 160 | | 54 | 160 | CVType Type; | 55 | 160 | Type.Type = static_cast<TypeLeafKind>(Record.getKind()); | 56 | 160 | if (auto EC = Serializer.visitTypeBegin(Type)) | 57 | 0 | return handleError(std::move(EC)); | 58 | 160 | if (auto 160 EC160 = Serializer.visitKnownRecord(Type, Record)) | 59 | 0 | return handleError(std::move(EC)); | 60 | 160 | | 61 | 160 | auto ExpectedIndex = Serializer.visitTypeEndGetIndex(Type); | 62 | 160 | if (!ExpectedIndex) | 63 | 0 | return handleError(ExpectedIndex.takeError()); | 64 | 160 | | 65 | 160 | return *ExpectedIndex; | 66 | 160 | } |
llvm::codeview::TypeIndex llvm::codeview::TypeTableBuilder::writeKnownType<llvm::codeview::ModifierRecord>(llvm::codeview::ModifierRecord&) Line | Count | Source | 50 | 29 | template <typename T> TypeIndex writeKnownType(T &Record) { | 51 | 29 | static_assert(!std::is_same<T, FieldListRecord>::value, | 52 | 29 | "Can't serialize FieldList!"); | 53 | 29 | | 54 | 29 | CVType Type; | 55 | 29 | Type.Type = static_cast<TypeLeafKind>(Record.getKind()); | 56 | 29 | if (auto EC = Serializer.visitTypeBegin(Type)) | 57 | 0 | return handleError(std::move(EC)); | 58 | 29 | if (auto 29 EC29 = Serializer.visitKnownRecord(Type, Record)) | 59 | 0 | return handleError(std::move(EC)); | 60 | 29 | | 61 | 29 | auto ExpectedIndex = Serializer.visitTypeEndGetIndex(Type); | 62 | 29 | if (!ExpectedIndex) | 63 | 0 | return handleError(ExpectedIndex.takeError()); | 64 | 29 | | 65 | 29 | return *ExpectedIndex; | 66 | 29 | } |
llvm::codeview::TypeIndex llvm::codeview::TypeTableBuilder::writeKnownType<llvm::codeview::ArgListRecord>(llvm::codeview::ArgListRecord&) Line | Count | Source | 50 | 246 | template <typename T> TypeIndex writeKnownType(T &Record) { | 51 | 246 | static_assert(!std::is_same<T, FieldListRecord>::value, | 52 | 246 | "Can't serialize FieldList!"); | 53 | 246 | | 54 | 246 | CVType Type; | 55 | 246 | Type.Type = static_cast<TypeLeafKind>(Record.getKind()); | 56 | 246 | if (auto EC = Serializer.visitTypeBegin(Type)) | 57 | 0 | return handleError(std::move(EC)); | 58 | 246 | if (auto 246 EC246 = Serializer.visitKnownRecord(Type, Record)) | 59 | 0 | return handleError(std::move(EC)); | 60 | 246 | | 61 | 246 | auto ExpectedIndex = Serializer.visitTypeEndGetIndex(Type); | 62 | 246 | if (!ExpectedIndex) | 63 | 0 | return handleError(ExpectedIndex.takeError()); | 64 | 246 | | 65 | 246 | return *ExpectedIndex; | 66 | 246 | } |
llvm::codeview::TypeIndex llvm::codeview::TypeTableBuilder::writeKnownType<llvm::codeview::ProcedureRecord>(llvm::codeview::ProcedureRecord&) Line | Count | Source | 50 | 154 | template <typename T> TypeIndex writeKnownType(T &Record) { | 51 | 154 | static_assert(!std::is_same<T, FieldListRecord>::value, | 52 | 154 | "Can't serialize FieldList!"); | 53 | 154 | | 54 | 154 | CVType Type; | 55 | 154 | Type.Type = static_cast<TypeLeafKind>(Record.getKind()); | 56 | 154 | if (auto EC = Serializer.visitTypeBegin(Type)) | 57 | 0 | return handleError(std::move(EC)); | 58 | 154 | if (auto 154 EC154 = Serializer.visitKnownRecord(Type, Record)) | 59 | 0 | return handleError(std::move(EC)); | 60 | 154 | | 61 | 154 | auto ExpectedIndex = Serializer.visitTypeEndGetIndex(Type); | 62 | 154 | if (!ExpectedIndex) | 63 | 0 | return handleError(ExpectedIndex.takeError()); | 64 | 154 | | 65 | 154 | return *ExpectedIndex; | 66 | 154 | } |
llvm::codeview::TypeIndex llvm::codeview::TypeTableBuilder::writeKnownType<llvm::codeview::MemberFunctionRecord>(llvm::codeview::MemberFunctionRecord&) Line | Count | Source | 50 | 122 | template <typename T> TypeIndex writeKnownType(T &Record) { | 51 | 122 | static_assert(!std::is_same<T, FieldListRecord>::value, | 52 | 122 | "Can't serialize FieldList!"); | 53 | 122 | | 54 | 122 | CVType Type; | 55 | 122 | Type.Type = static_cast<TypeLeafKind>(Record.getKind()); | 56 | 122 | if (auto EC = Serializer.visitTypeBegin(Type)) | 57 | 0 | return handleError(std::move(EC)); | 58 | 122 | if (auto 122 EC122 = Serializer.visitKnownRecord(Type, Record)) | 59 | 0 | return handleError(std::move(EC)); | 60 | 122 | | 61 | 122 | auto ExpectedIndex = Serializer.visitTypeEndGetIndex(Type); | 62 | 122 | if (!ExpectedIndex) | 63 | 0 | return handleError(ExpectedIndex.takeError()); | 64 | 122 | | 65 | 122 | return *ExpectedIndex; | 66 | 122 | } |
llvm::codeview::TypeIndex llvm::codeview::TypeTableBuilder::writeKnownType<llvm::codeview::VFTableShapeRecord>(llvm::codeview::VFTableShapeRecord&) Line | Count | Source | 50 | 9 | template <typename T> TypeIndex writeKnownType(T &Record) { | 51 | 9 | static_assert(!std::is_same<T, FieldListRecord>::value, | 52 | 9 | "Can't serialize FieldList!"); | 53 | 9 | | 54 | 9 | CVType Type; | 55 | 9 | Type.Type = static_cast<TypeLeafKind>(Record.getKind()); | 56 | 9 | if (auto EC = Serializer.visitTypeBegin(Type)) | 57 | 0 | return handleError(std::move(EC)); | 58 | 9 | if (auto 9 EC9 = Serializer.visitKnownRecord(Type, Record)) | 59 | 0 | return handleError(std::move(EC)); | 60 | 9 | | 61 | 9 | auto ExpectedIndex = Serializer.visitTypeEndGetIndex(Type); | 62 | 9 | if (!ExpectedIndex) | 63 | 0 | return handleError(ExpectedIndex.takeError()); | 64 | 9 | | 65 | 9 | return *ExpectedIndex; | 66 | 9 | } |
llvm::codeview::TypeIndex llvm::codeview::TypeTableBuilder::writeKnownType<llvm::codeview::EnumRecord>(llvm::codeview::EnumRecord&) Line | Count | Source | 50 | 31 | template <typename T> TypeIndex writeKnownType(T &Record) { | 51 | 31 | static_assert(!std::is_same<T, FieldListRecord>::value, | 52 | 31 | "Can't serialize FieldList!"); | 53 | 31 | | 54 | 31 | CVType Type; | 55 | 31 | Type.Type = static_cast<TypeLeafKind>(Record.getKind()); | 56 | 31 | if (auto EC = Serializer.visitTypeBegin(Type)) | 57 | 0 | return handleError(std::move(EC)); | 58 | 31 | if (auto 31 EC31 = Serializer.visitKnownRecord(Type, Record)) | 59 | 0 | return handleError(std::move(EC)); | 60 | 31 | | 61 | 31 | auto ExpectedIndex = Serializer.visitTypeEndGetIndex(Type); | 62 | 31 | if (!ExpectedIndex) | 63 | 0 | return handleError(ExpectedIndex.takeError()); | 64 | 31 | | 65 | 31 | return *ExpectedIndex; | 66 | 31 | } |
llvm::codeview::TypeIndex llvm::codeview::TypeTableBuilder::writeKnownType<llvm::codeview::ClassRecord>(llvm::codeview::ClassRecord&) Line | Count | Source | 50 | 202 | template <typename T> TypeIndex writeKnownType(T &Record) { | 51 | 202 | static_assert(!std::is_same<T, FieldListRecord>::value, | 52 | 202 | "Can't serialize FieldList!"); | 53 | 202 | | 54 | 202 | CVType Type; | 55 | 202 | Type.Type = static_cast<TypeLeafKind>(Record.getKind()); | 56 | 202 | if (auto EC = Serializer.visitTypeBegin(Type)) | 57 | 0 | return handleError(std::move(EC)); | 58 | 202 | if (auto 202 EC202 = Serializer.visitKnownRecord(Type, Record)) | 59 | 0 | return handleError(std::move(EC)); | 60 | 202 | | 61 | 202 | auto ExpectedIndex = Serializer.visitTypeEndGetIndex(Type); | 62 | 202 | if (!ExpectedIndex) | 63 | 0 | return handleError(ExpectedIndex.takeError()); | 64 | 202 | | 65 | 202 | return *ExpectedIndex; | 66 | 202 | } |
llvm::codeview::TypeIndex llvm::codeview::TypeTableBuilder::writeKnownType<llvm::codeview::UdtSourceLineRecord>(llvm::codeview::UdtSourceLineRecord&) Line | Count | Source | 50 | 71 | template <typename T> TypeIndex writeKnownType(T &Record) { | 51 | 71 | static_assert(!std::is_same<T, FieldListRecord>::value, | 52 | 71 | "Can't serialize FieldList!"); | 53 | 71 | | 54 | 71 | CVType Type; | 55 | 71 | Type.Type = static_cast<TypeLeafKind>(Record.getKind()); | 56 | 71 | if (auto EC = Serializer.visitTypeBegin(Type)) | 57 | 0 | return handleError(std::move(EC)); | 58 | 71 | if (auto 71 EC71 = Serializer.visitKnownRecord(Type, Record)) | 59 | 0 | return handleError(std::move(EC)); | 60 | 71 | | 61 | 71 | auto ExpectedIndex = Serializer.visitTypeEndGetIndex(Type); | 62 | 71 | if (!ExpectedIndex) | 63 | 0 | return handleError(ExpectedIndex.takeError()); | 64 | 71 | | 65 | 71 | return *ExpectedIndex; | 66 | 71 | } |
llvm::codeview::TypeIndex llvm::codeview::TypeTableBuilder::writeKnownType<llvm::codeview::UnionRecord>(llvm::codeview::UnionRecord&) Line | Count | Source | 50 | 9 | template <typename T> TypeIndex writeKnownType(T &Record) { | 51 | 9 | static_assert(!std::is_same<T, FieldListRecord>::value, | 52 | 9 | "Can't serialize FieldList!"); | 53 | 9 | | 54 | 9 | CVType Type; | 55 | 9 | Type.Type = static_cast<TypeLeafKind>(Record.getKind()); | 56 | 9 | if (auto EC = Serializer.visitTypeBegin(Type)) | 57 | 0 | return handleError(std::move(EC)); | 58 | 9 | if (auto 9 EC9 = Serializer.visitKnownRecord(Type, Record)) | 59 | 0 | return handleError(std::move(EC)); | 60 | 9 | | 61 | 9 | auto ExpectedIndex = Serializer.visitTypeEndGetIndex(Type); | 62 | 9 | if (!ExpectedIndex) | 63 | 0 | return handleError(ExpectedIndex.takeError()); | 64 | 9 | | 65 | 9 | return *ExpectedIndex; | 66 | 9 | } |
llvm::codeview::TypeIndex llvm::codeview::TypeTableBuilder::writeKnownType<llvm::codeview::BitFieldRecord>(llvm::codeview::BitFieldRecord&) Line | Count | Source | 50 | 10 | template <typename T> TypeIndex writeKnownType(T &Record) { | 51 | 10 | static_assert(!std::is_same<T, FieldListRecord>::value, | 52 | 10 | "Can't serialize FieldList!"); | 53 | 10 | | 54 | 10 | CVType Type; | 55 | 10 | Type.Type = static_cast<TypeLeafKind>(Record.getKind()); | 56 | 10 | if (auto EC = Serializer.visitTypeBegin(Type)) | 57 | 0 | return handleError(std::move(EC)); | 58 | 10 | if (auto 10 EC10 = Serializer.visitKnownRecord(Type, Record)) | 59 | 0 | return handleError(std::move(EC)); | 60 | 10 | | 61 | 10 | auto ExpectedIndex = Serializer.visitTypeEndGetIndex(Type); | 62 | 10 | if (!ExpectedIndex) | 63 | 0 | return handleError(ExpectedIndex.takeError()); | 64 | 10 | | 65 | 10 | return *ExpectedIndex; | 66 | 10 | } |
llvm::codeview::TypeIndex llvm::codeview::TypeTableBuilder::writeKnownType<llvm::codeview::MethodOverloadListRecord>(llvm::codeview::MethodOverloadListRecord&) Line | Count | Source | 50 | 24 | template <typename T> TypeIndex writeKnownType(T &Record) { | 51 | 24 | static_assert(!std::is_same<T, FieldListRecord>::value, | 52 | 24 | "Can't serialize FieldList!"); | 53 | 24 | | 54 | 24 | CVType Type; | 55 | 24 | Type.Type = static_cast<TypeLeafKind>(Record.getKind()); | 56 | 24 | if (auto EC = Serializer.visitTypeBegin(Type)) | 57 | 0 | return handleError(std::move(EC)); | 58 | 24 | if (auto 24 EC24 = Serializer.visitKnownRecord(Type, Record)) | 59 | 0 | return handleError(std::move(EC)); | 60 | 24 | | 61 | 24 | auto ExpectedIndex = Serializer.visitTypeEndGetIndex(Type); | 62 | 24 | if (!ExpectedIndex) | 63 | 0 | return handleError(ExpectedIndex.takeError()); | 64 | 24 | | 65 | 24 | return *ExpectedIndex; | 66 | 24 | } |
|
67 | | |
68 | 140 | TypeIndex writeSerializedRecord(ArrayRef<uint8_t> Record) { |
69 | 140 | return Serializer.insertRecordBytes(Record); |
70 | 140 | } |
71 | | |
72 | 0 | TypeIndex writeSerializedRecord(const RemappedType &Record) { |
73 | 0 | return Serializer.insertRecord(Record); |
74 | 0 | } |
75 | | |
76 | | template <typename TFunc> void ForEachRecord(TFunc Func) { |
77 | | uint32_t Index = TypeIndex::FirstNonSimpleIndex; |
78 | | |
79 | | for (auto Record : Serializer.records()) { |
80 | | Func(TypeIndex(Index), Record); |
81 | | ++Index; |
82 | | } |
83 | | } |
84 | | |
85 | 1.17k | ArrayRef<ArrayRef<uint8_t>> records() const { return Serializer.records(); } |
86 | | }; |
87 | | |
88 | | class FieldListRecordBuilder { |
89 | | TypeTableBuilder &TypeTable; |
90 | | BumpPtrAllocator Allocator; |
91 | | TypeSerializer TempSerializer; |
92 | | CVType Type; |
93 | | |
94 | | public: |
95 | | explicit FieldListRecordBuilder(TypeTableBuilder &TypeTable) |
96 | 162 | : TypeTable(TypeTable), TempSerializer(Allocator, false) { |
97 | 162 | Type.Type = TypeLeafKind::LF_FIELDLIST; |
98 | 162 | } |
99 | | |
100 | 136 | void begin() { |
101 | 136 | TempSerializer.reset(); |
102 | 136 | |
103 | 136 | if (auto EC = TempSerializer.visitTypeBegin(Type)) |
104 | 0 | consumeError(std::move(EC)); |
105 | 136 | } |
106 | | |
107 | 6.18k | template <typename T> void writeMemberType(T &Record) { |
108 | 6.18k | CVMemberRecord CVMR; |
109 | 6.18k | CVMR.Kind = static_cast<TypeLeafKind>(Record.getKind()); |
110 | 6.18k | if (auto EC = TempSerializer.visitMemberBegin(CVMR)) |
111 | 0 | consumeError(std::move(EC)); |
112 | 6.18k | if (auto EC = TempSerializer.visitKnownMember(CVMR, Record)) |
113 | 0 | consumeError(std::move(EC)); |
114 | 6.18k | if (auto EC = TempSerializer.visitMemberEnd(CVMR)) |
115 | 0 | consumeError(std::move(EC)); |
116 | 6.18k | } void llvm::codeview::FieldListRecordBuilder::writeMemberType<llvm::codeview::EnumeratorRecord>(llvm::codeview::EnumeratorRecord&) Line | Count | Source | 107 | 5.86k | template <typename T> void writeMemberType(T &Record) { | 108 | 5.86k | CVMemberRecord CVMR; | 109 | 5.86k | CVMR.Kind = static_cast<TypeLeafKind>(Record.getKind()); | 110 | 5.86k | if (auto EC = TempSerializer.visitMemberBegin(CVMR)) | 111 | 0 | consumeError(std::move(EC)); | 112 | 5.86k | if (auto EC = TempSerializer.visitKnownMember(CVMR, Record)) | 113 | 0 | consumeError(std::move(EC)); | 114 | 5.86k | if (auto EC = TempSerializer.visitMemberEnd(CVMR)) | 115 | 0 | consumeError(std::move(EC)); | 116 | 5.86k | } |
void llvm::codeview::FieldListRecordBuilder::writeMemberType<llvm::codeview::VirtualBaseClassRecord>(llvm::codeview::VirtualBaseClassRecord&) Line | Count | Source | 107 | 9 | template <typename T> void writeMemberType(T &Record) { | 108 | 9 | CVMemberRecord CVMR; | 109 | 9 | CVMR.Kind = static_cast<TypeLeafKind>(Record.getKind()); | 110 | 9 | if (auto EC = TempSerializer.visitMemberBegin(CVMR)) | 111 | 0 | consumeError(std::move(EC)); | 112 | 9 | if (auto EC = TempSerializer.visitKnownMember(CVMR, Record)) | 113 | 0 | consumeError(std::move(EC)); | 114 | 9 | if (auto EC = TempSerializer.visitMemberEnd(CVMR)) | 115 | 0 | consumeError(std::move(EC)); | 116 | 9 | } |
void llvm::codeview::FieldListRecordBuilder::writeMemberType<llvm::codeview::BaseClassRecord>(llvm::codeview::BaseClassRecord&) Line | Count | Source | 107 | 16 | template <typename T> void writeMemberType(T &Record) { | 108 | 16 | CVMemberRecord CVMR; | 109 | 16 | CVMR.Kind = static_cast<TypeLeafKind>(Record.getKind()); | 110 | 16 | if (auto EC = TempSerializer.visitMemberBegin(CVMR)) | 111 | 0 | consumeError(std::move(EC)); | 112 | 16 | if (auto EC = TempSerializer.visitKnownMember(CVMR, Record)) | 113 | 0 | consumeError(std::move(EC)); | 114 | 16 | if (auto EC = TempSerializer.visitMemberEnd(CVMR)) | 115 | 0 | consumeError(std::move(EC)); | 116 | 16 | } |
void llvm::codeview::FieldListRecordBuilder::writeMemberType<llvm::codeview::StaticDataMemberRecord>(llvm::codeview::StaticDataMemberRecord&) Line | Count | Source | 107 | 6 | template <typename T> void writeMemberType(T &Record) { | 108 | 6 | CVMemberRecord CVMR; | 109 | 6 | CVMR.Kind = static_cast<TypeLeafKind>(Record.getKind()); | 110 | 6 | if (auto EC = TempSerializer.visitMemberBegin(CVMR)) | 111 | 0 | consumeError(std::move(EC)); | 112 | 6 | if (auto EC = TempSerializer.visitKnownMember(CVMR, Record)) | 113 | 0 | consumeError(std::move(EC)); | 114 | 6 | if (auto EC = TempSerializer.visitMemberEnd(CVMR)) | 115 | 0 | consumeError(std::move(EC)); | 116 | 6 | } |
void llvm::codeview::FieldListRecordBuilder::writeMemberType<llvm::codeview::VFPtrRecord>(llvm::codeview::VFPtrRecord&) Line | Count | Source | 107 | 11 | template <typename T> void writeMemberType(T &Record) { | 108 | 11 | CVMemberRecord CVMR; | 109 | 11 | CVMR.Kind = static_cast<TypeLeafKind>(Record.getKind()); | 110 | 11 | if (auto EC = TempSerializer.visitMemberBegin(CVMR)) | 111 | 0 | consumeError(std::move(EC)); | 112 | 11 | if (auto EC = TempSerializer.visitKnownMember(CVMR, Record)) | 113 | 0 | consumeError(std::move(EC)); | 114 | 11 | if (auto EC = TempSerializer.visitMemberEnd(CVMR)) | 115 | 0 | consumeError(std::move(EC)); | 116 | 11 | } |
void llvm::codeview::FieldListRecordBuilder::writeMemberType<llvm::codeview::DataMemberRecord>(llvm::codeview::DataMemberRecord&) Line | Count | Source | 107 | 164 | template <typename T> void writeMemberType(T &Record) { | 108 | 164 | CVMemberRecord CVMR; | 109 | 164 | CVMR.Kind = static_cast<TypeLeafKind>(Record.getKind()); | 110 | 164 | if (auto EC = TempSerializer.visitMemberBegin(CVMR)) | 111 | 0 | consumeError(std::move(EC)); | 112 | 164 | if (auto EC = TempSerializer.visitKnownMember(CVMR, Record)) | 113 | 0 | consumeError(std::move(EC)); | 114 | 164 | if (auto EC = TempSerializer.visitMemberEnd(CVMR)) | 115 | 0 | consumeError(std::move(EC)); | 116 | 164 | } |
void llvm::codeview::FieldListRecordBuilder::writeMemberType<llvm::codeview::OneMethodRecord>(llvm::codeview::OneMethodRecord&) Line | Count | Source | 107 | 57 | template <typename T> void writeMemberType(T &Record) { | 108 | 57 | CVMemberRecord CVMR; | 109 | 57 | CVMR.Kind = static_cast<TypeLeafKind>(Record.getKind()); | 110 | 57 | if (auto EC = TempSerializer.visitMemberBegin(CVMR)) | 111 | 0 | consumeError(std::move(EC)); | 112 | 57 | if (auto EC = TempSerializer.visitKnownMember(CVMR, Record)) | 113 | 0 | consumeError(std::move(EC)); | 114 | 57 | if (auto EC = TempSerializer.visitMemberEnd(CVMR)) | 115 | 0 | consumeError(std::move(EC)); | 116 | 57 | } |
void llvm::codeview::FieldListRecordBuilder::writeMemberType<llvm::codeview::OverloadedMethodRecord>(llvm::codeview::OverloadedMethodRecord&) Line | Count | Source | 107 | 24 | template <typename T> void writeMemberType(T &Record) { | 108 | 24 | CVMemberRecord CVMR; | 109 | 24 | CVMR.Kind = static_cast<TypeLeafKind>(Record.getKind()); | 110 | 24 | if (auto EC = TempSerializer.visitMemberBegin(CVMR)) | 111 | 0 | consumeError(std::move(EC)); | 112 | 24 | if (auto EC = TempSerializer.visitKnownMember(CVMR, Record)) | 113 | 0 | consumeError(std::move(EC)); | 114 | 24 | if (auto EC = TempSerializer.visitMemberEnd(CVMR)) | 115 | 0 | consumeError(std::move(EC)); | 116 | 24 | } |
void llvm::codeview::FieldListRecordBuilder::writeMemberType<llvm::codeview::NestedTypeRecord>(llvm::codeview::NestedTypeRecord&) Line | Count | Source | 107 | 35 | template <typename T> void writeMemberType(T &Record) { | 108 | 35 | CVMemberRecord CVMR; | 109 | 35 | CVMR.Kind = static_cast<TypeLeafKind>(Record.getKind()); | 110 | 35 | if (auto EC = TempSerializer.visitMemberBegin(CVMR)) | 111 | 0 | consumeError(std::move(EC)); | 112 | 35 | if (auto EC = TempSerializer.visitKnownMember(CVMR, Record)) | 113 | 0 | consumeError(std::move(EC)); | 114 | 35 | if (auto EC = TempSerializer.visitMemberEnd(CVMR)) | 115 | 0 | consumeError(std::move(EC)); | 116 | 35 | } |
|
117 | | |
118 | 136 | TypeIndex end(bool Write) { |
119 | 136 | TypeIndex Index; |
120 | 136 | if (auto EC136 = TempSerializer.visitTypeEnd(Type)) { |
121 | 0 | consumeError(std::move(EC)); |
122 | 0 | return TypeIndex(); |
123 | 0 | } |
124 | 136 | |
125 | 136 | if (136 Write136 ) { |
126 | 136 | for (auto Record : TempSerializer.records()) |
127 | 140 | Index = TypeTable.writeSerializedRecord(Record); |
128 | 136 | } |
129 | 136 | |
130 | 136 | return Index; |
131 | 136 | } |
132 | | }; |
133 | | |
134 | | } // end namespace codeview |
135 | | } // end namespace llvm |
136 | | |
137 | | #endif // LLVM_DEBUGINFO_CODEVIEW_TYPETABLEBUILDER_H |