Coverage Report

Created: 2017-10-03 07:32

/Users/buildslave/jenkins/sharedspace/clang-stage2-coverage-R@2/llvm/include/llvm/DebugInfo/CodeView/TypeSerializer.h
Line
Count
Source (jump to first uncovered line)
1
//===- TypeSerializer.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_TYPESERIALIZER_H
11
#define LLVM_DEBUGINFO_CODEVIEW_TYPESERIALIZER_H
12
13
#include "llvm/ADT/ArrayRef.h"
14
#include "llvm/ADT/Optional.h"
15
#include "llvm/ADT/SmallVector.h"
16
#include "llvm/DebugInfo/CodeView/CodeView.h"
17
#include "llvm/DebugInfo/CodeView/RecordSerialization.h"
18
#include "llvm/DebugInfo/CodeView/TypeIndex.h"
19
#include "llvm/DebugInfo/CodeView/TypeRecord.h"
20
#include "llvm/DebugInfo/CodeView/TypeRecordMapping.h"
21
#include "llvm/DebugInfo/CodeView/TypeVisitorCallbacks.h"
22
#include "llvm/Support/Allocator.h"
23
#include "llvm/Support/BinaryByteStream.h"
24
#include "llvm/Support/BinaryStreamWriter.h"
25
#include "llvm/Support/Error.h"
26
#include <cassert>
27
#include <cstdint>
28
#include <memory>
29
#include <vector>
30
31
namespace llvm {
32
namespace codeview {
33
34
class TypeHasher;
35
36
class TypeSerializer : public TypeVisitorCallbacks {
37
  struct SubRecord {
38
6.18k
    SubRecord(TypeLeafKind K, uint32_t S) : Kind(K), Size(S) {}
39
40
    TypeLeafKind Kind;
41
    uint32_t Size = 0;
42
  };
43
  struct RecordSegment {
44
    SmallVector<SubRecord, 16> SubRecords;
45
46
12.3k
    uint32_t length() const {
47
12.3k
      uint32_t L = sizeof(RecordPrefix);
48
7.47M
      for (const auto &R : SubRecords) {
49
7.47M
        L += R.Size;
50
7.47M
      }
51
12.3k
      return L;
52
12.3k
    }
53
  };
54
55
  using MutableRecordList = SmallVector<MutableArrayRef<uint8_t>, 2>;
56
57
  static constexpr uint8_t ContinuationLength = 8;
58
  BumpPtrAllocator &RecordStorage;
59
  RecordSegment CurrentSegment;
60
  MutableRecordList FieldListSegments;
61
62
  Optional<TypeLeafKind> TypeKind;
63
  Optional<TypeLeafKind> MemberKind;
64
  std::vector<uint8_t> RecordBuffer;
65
  MutableBinaryByteStream Stream;
66
  BinaryStreamWriter Writer;
67
  TypeRecordMapping Mapping;
68
69
  /// Private type record hashing implementation details are handled here.
70
  std::unique_ptr<TypeHasher> Hasher;
71
72
  /// Contains a list of all records indexed by TypeIndex.toArrayIndex().
73
  SmallVector<ArrayRef<uint8_t>, 2> SeenRecords;
74
75
  /// Temporary storage that we use to copy a record's data while re-writing
76
  /// its type indices.
77
  SmallVector<uint8_t, 256> RemapStorage;
78
79
  TypeIndex nextTypeIndex() const;
80
81
  bool isInFieldList() const;
82
  MutableArrayRef<uint8_t> getCurrentSubRecordData();
83
  MutableArrayRef<uint8_t> getCurrentRecordData();
84
  Error writeRecordPrefix(TypeLeafKind Kind);
85
86
  Expected<MutableArrayRef<uint8_t>>
87
  addPadding(MutableArrayRef<uint8_t> Record);
88
89
public:
90
  explicit TypeSerializer(BumpPtrAllocator &Storage, bool Hash = true);
91
  ~TypeSerializer() override;
92
93
  void reset();
94
95
0
  BumpPtrAllocator &getAllocator() { return RecordStorage; }
96
97
  ArrayRef<ArrayRef<uint8_t>> records() const;
98
  TypeIndex insertRecordBytes(ArrayRef<uint8_t> &Record);
99
  TypeIndex insertRecord(const RemappedType &Record);
100
  Expected<TypeIndex> visitTypeEndGetIndex(CVType &Record);
101
102
  using TypeVisitorCallbacks::visitTypeBegin;
103
  Error visitTypeBegin(CVType &Record) override;
104
  Error visitTypeEnd(CVType &Record) override;
105
  Error visitMemberBegin(CVMemberRecord &Record) override;
106
  Error visitMemberEnd(CVMemberRecord &Record) override;
107
108
#define TYPE_RECORD(EnumName, EnumVal, Name)                                   \
109
1.64k
  virtual Error visitKnownRecord(CVType &CVR, Name##Record &Record) override { \
110
1.64k
    return visitKnownRecordImpl(CVR, Record);                                  \
111
1.64k
  }
llvm::codeview::TypeSerializer::visitKnownRecord(llvm::codeview::CVRecord<llvm::codeview::TypeLeafKind>&, llvm::codeview::MemberFuncIdRecord&)
Line
Count
Source
109
26
  virtual Error visitKnownRecord(CVType &CVR, Name##Record &Record) override { \
110
26
    return visitKnownRecordImpl(CVR, Record);                                  \
111
26
  }
llvm::codeview::TypeSerializer::visitKnownRecord(llvm::codeview::CVRecord<llvm::codeview::TypeLeafKind>&, llvm::codeview::ProcedureRecord&)
Line
Count
Source
109
154
  virtual Error visitKnownRecord(CVType &CVR, Name##Record &Record) override { \
110
154
    return visitKnownRecordImpl(CVR, Record);                                  \
111
154
  }
llvm::codeview::TypeSerializer::visitKnownRecord(llvm::codeview::CVRecord<llvm::codeview::TypeLeafKind>&, llvm::codeview::ArgListRecord&)
Line
Count
Source
109
246
  virtual Error visitKnownRecord(CVType &CVR, Name##Record &Record) override { \
110
246
    return visitKnownRecordImpl(CVR, Record);                                  \
111
246
  }
Unexecuted instantiation: llvm::codeview::TypeSerializer::visitKnownRecord(llvm::codeview::CVRecord<llvm::codeview::TypeLeafKind>&, llvm::codeview::LabelRecord&)
llvm::codeview::TypeSerializer::visitKnownRecord(llvm::codeview::CVRecord<llvm::codeview::TypeLeafKind>&, llvm::codeview::ArrayRecord&)
Line
Count
Source
109
84
  virtual Error visitKnownRecord(CVType &CVR, Name##Record &Record) override { \
110
84
    return visitKnownRecordImpl(CVR, Record);                                  \
111
84
  }
Unexecuted instantiation: llvm::codeview::TypeSerializer::visitKnownRecord(llvm::codeview::CVRecord<llvm::codeview::TypeLeafKind>&, llvm::codeview::FieldListRecord&)
llvm::codeview::TypeSerializer::visitKnownRecord(llvm::codeview::CVRecord<llvm::codeview::TypeLeafKind>&, llvm::codeview::UnionRecord&)
Line
Count
Source
109
9
  virtual Error visitKnownRecord(CVType &CVR, Name##Record &Record) override { \
110
9
    return visitKnownRecordImpl(CVR, Record);                                  \
111
9
  }
llvm::codeview::TypeSerializer::visitKnownRecord(llvm::codeview::CVRecord<llvm::codeview::TypeLeafKind>&, llvm::codeview::ClassRecord&)
Line
Count
Source
109
202
  virtual Error visitKnownRecord(CVType &CVR, Name##Record &Record) override { \
110
202
    return visitKnownRecordImpl(CVR, Record);                                  \
111
202
  }
llvm::codeview::TypeSerializer::visitKnownRecord(llvm::codeview::CVRecord<llvm::codeview::TypeLeafKind>&, llvm::codeview::ModifierRecord&)
Line
Count
Source
109
29
  virtual Error visitKnownRecord(CVType &CVR, Name##Record &Record) override { \
110
29
    return visitKnownRecordImpl(CVR, Record);                                  \
111
29
  }
llvm::codeview::TypeSerializer::visitKnownRecord(llvm::codeview::CVRecord<llvm::codeview::TypeLeafKind>&, llvm::codeview::PointerRecord&)
Line
Count
Source
109
160
  virtual Error visitKnownRecord(CVType &CVR, Name##Record &Record) override { \
110
160
    return visitKnownRecordImpl(CVR, Record);                                  \
111
160
  }
llvm::codeview::TypeSerializer::visitKnownRecord(llvm::codeview::CVRecord<llvm::codeview::TypeLeafKind>&, llvm::codeview::MethodOverloadListRecord&)
Line
Count
Source
109
24
  virtual Error visitKnownRecord(CVType &CVR, Name##Record &Record) override { \
110
24
    return visitKnownRecordImpl(CVR, Record);                                  \
111
24
  }
llvm::codeview::TypeSerializer::visitKnownRecord(llvm::codeview::CVRecord<llvm::codeview::TypeLeafKind>&, llvm::codeview::UdtModSourceLineRecord&)
Line
Count
Source
109
17
  virtual Error visitKnownRecord(CVType &CVR, Name##Record &Record) override { \
110
17
    return visitKnownRecordImpl(CVR, Record);                                  \
111
17
  }
llvm::codeview::TypeSerializer::visitKnownRecord(llvm::codeview::CVRecord<llvm::codeview::TypeLeafKind>&, llvm::codeview::UdtSourceLineRecord&)
Line
Count
Source
109
71
  virtual Error visitKnownRecord(CVType &CVR, Name##Record &Record) override { \
110
71
    return visitKnownRecordImpl(CVR, Record);                                  \
111
71
  }
llvm::codeview::TypeSerializer::visitKnownRecord(llvm::codeview::CVRecord<llvm::codeview::TypeLeafKind>&, llvm::codeview::StringIdRecord&)
Line
Count
Source
109
212
  virtual Error visitKnownRecord(CVType &CVR, Name##Record &Record) override { \
110
212
    return visitKnownRecordImpl(CVR, Record);                                  \
111
212
  }
llvm::codeview::TypeSerializer::visitKnownRecord(llvm::codeview::CVRecord<llvm::codeview::TypeLeafKind>&, llvm::codeview::StringListRecord&)
Line
Count
Source
109
25
  virtual Error visitKnownRecord(CVType &CVR, Name##Record &Record) override { \
110
25
    return visitKnownRecordImpl(CVR, Record);                                  \
111
25
  }
llvm::codeview::TypeSerializer::visitKnownRecord(llvm::codeview::CVRecord<llvm::codeview::TypeLeafKind>&, llvm::codeview::BuildInfoRecord&)
Line
Count
Source
109
24
  virtual Error visitKnownRecord(CVType &CVR, Name##Record &Record) override { \
110
24
    return visitKnownRecordImpl(CVR, Record);                                  \
111
24
  }
llvm::codeview::TypeSerializer::visitKnownRecord(llvm::codeview::CVRecord<llvm::codeview::TypeLeafKind>&, llvm::codeview::MemberFunctionRecord&)
Line
Count
Source
109
122
  virtual Error visitKnownRecord(CVType &CVR, Name##Record &Record) override { \
110
122
    return visitKnownRecordImpl(CVR, Record);                                  \
111
122
  }
llvm::codeview::TypeSerializer::visitKnownRecord(llvm::codeview::CVRecord<llvm::codeview::TypeLeafKind>&, llvm::codeview::BitFieldRecord&)
Line
Count
Source
109
10
  virtual Error visitKnownRecord(CVType &CVR, Name##Record &Record) override { \
110
10
    return visitKnownRecordImpl(CVR, Record);                                  \
111
10
  }
llvm::codeview::TypeSerializer::visitKnownRecord(llvm::codeview::CVRecord<llvm::codeview::TypeLeafKind>&, llvm::codeview::VFTableRecord&)
Line
Count
Source
109
2
  virtual Error visitKnownRecord(CVType &CVR, Name##Record &Record) override { \
110
2
    return visitKnownRecordImpl(CVR, Record);                                  \
111
2
  }
llvm::codeview::TypeSerializer::visitKnownRecord(llvm::codeview::CVRecord<llvm::codeview::TypeLeafKind>&, llvm::codeview::VFTableShapeRecord&)
Line
Count
Source
109
9
  virtual Error visitKnownRecord(CVType &CVR, Name##Record &Record) override { \
110
9
    return visitKnownRecordImpl(CVR, Record);                                  \
111
9
  }
llvm::codeview::TypeSerializer::visitKnownRecord(llvm::codeview::CVRecord<llvm::codeview::TypeLeafKind>&, llvm::codeview::EnumRecord&)
Line
Count
Source
109
31
  virtual Error visitKnownRecord(CVType &CVR, Name##Record &Record) override { \
110
31
    return visitKnownRecordImpl(CVR, Record);                                  \
111
31
  }
llvm::codeview::TypeSerializer::visitKnownRecord(llvm::codeview::CVRecord<llvm::codeview::TypeLeafKind>&, llvm::codeview::TypeServer2Record&)
Line
Count
Source
109
4
  virtual Error visitKnownRecord(CVType &CVR, Name##Record &Record) override { \
110
4
    return visitKnownRecordImpl(CVR, Record);                                  \
111
4
  }
llvm::codeview::TypeSerializer::visitKnownRecord(llvm::codeview::CVRecord<llvm::codeview::TypeLeafKind>&, llvm::codeview::FuncIdRecord&)
Line
Count
Source
109
181
  virtual Error visitKnownRecord(CVType &CVR, Name##Record &Record) override { \
110
181
    return visitKnownRecordImpl(CVR, Record);                                  \
111
181
  }
112
#define TYPE_RECORD_ALIAS(EnumName, EnumVal, Name, AliasName)
113
#define MEMBER_RECORD(EnumName, EnumVal, Name)                                 \
114
6.18k
  Error visitKnownMember(CVMemberRecord &CVR, Name##Record &Record) override { \
115
6.18k
    return visitKnownMemberImpl<Name##Record>(CVR, Record);                    \
116
6.18k
  }
llvm::codeview::TypeSerializer::visitKnownMember(llvm::codeview::CVMemberRecord&, llvm::codeview::OverloadedMethodRecord&)
Line
Count
Source
114
24
  Error visitKnownMember(CVMemberRecord &CVR, Name##Record &Record) override { \
115
24
    return visitKnownMemberImpl<Name##Record>(CVR, Record);                    \
116
24
  }
llvm::codeview::TypeSerializer::visitKnownMember(llvm::codeview::CVMemberRecord&, llvm::codeview::StaticDataMemberRecord&)
Line
Count
Source
114
6
  Error visitKnownMember(CVMemberRecord &CVR, Name##Record &Record) override { \
115
6
    return visitKnownMemberImpl<Name##Record>(CVR, Record);                    \
116
6
  }
llvm::codeview::TypeSerializer::visitKnownMember(llvm::codeview::CVMemberRecord&, llvm::codeview::NestedTypeRecord&)
Line
Count
Source
114
35
  Error visitKnownMember(CVMemberRecord &CVR, Name##Record &Record) override { \
115
35
    return visitKnownMemberImpl<Name##Record>(CVR, Record);                    \
116
35
  }
llvm::codeview::TypeSerializer::visitKnownMember(llvm::codeview::CVMemberRecord&, llvm::codeview::DataMemberRecord&)
Line
Count
Source
114
164
  Error visitKnownMember(CVMemberRecord &CVR, Name##Record &Record) override { \
115
164
    return visitKnownMemberImpl<Name##Record>(CVR, Record);                    \
116
164
  }
llvm::codeview::TypeSerializer::visitKnownMember(llvm::codeview::CVMemberRecord&, llvm::codeview::EnumeratorRecord&)
Line
Count
Source
114
5.86k
  Error visitKnownMember(CVMemberRecord &CVR, Name##Record &Record) override { \
115
5.86k
    return visitKnownMemberImpl<Name##Record>(CVR, Record);                    \
116
5.86k
  }
llvm::codeview::TypeSerializer::visitKnownMember(llvm::codeview::CVMemberRecord&, llvm::codeview::OneMethodRecord&)
Line
Count
Source
114
57
  Error visitKnownMember(CVMemberRecord &CVR, Name##Record &Record) override { \
115
57
    return visitKnownMemberImpl<Name##Record>(CVR, Record);                    \
116
57
  }
llvm::codeview::TypeSerializer::visitKnownMember(llvm::codeview::CVMemberRecord&, llvm::codeview::ListContinuationRecord&)
Line
Count
Source
114
2
  Error visitKnownMember(CVMemberRecord &CVR, Name##Record &Record) override { \
115
2
    return visitKnownMemberImpl<Name##Record>(CVR, Record);                    \
116
2
  }
llvm::codeview::TypeSerializer::visitKnownMember(llvm::codeview::CVMemberRecord&, llvm::codeview::BaseClassRecord&)
Line
Count
Source
114
16
  Error visitKnownMember(CVMemberRecord &CVR, Name##Record &Record) override { \
115
16
    return visitKnownMemberImpl<Name##Record>(CVR, Record);                    \
116
16
  }
llvm::codeview::TypeSerializer::visitKnownMember(llvm::codeview::CVMemberRecord&, llvm::codeview::VFPtrRecord&)
Line
Count
Source
114
11
  Error visitKnownMember(CVMemberRecord &CVR, Name##Record &Record) override { \
115
11
    return visitKnownMemberImpl<Name##Record>(CVR, Record);                    \
116
11
  }
llvm::codeview::TypeSerializer::visitKnownMember(llvm::codeview::CVMemberRecord&, llvm::codeview::VirtualBaseClassRecord&)
Line
Count
Source
114
9
  Error visitKnownMember(CVMemberRecord &CVR, Name##Record &Record) override { \
115
9
    return visitKnownMemberImpl<Name##Record>(CVR, Record);                    \
116
9
  }
117
#define MEMBER_RECORD_ALIAS(EnumName, EnumVal, Name, AliasName)
118
#include "llvm/DebugInfo/CodeView/CodeViewTypes.def"
119
120
private:
121
  template <typename RecordKind>
122
1.64k
  Error visitKnownRecordImpl(CVType &CVR, RecordKind &Record) {
123
1.64k
    return Mapping.visitKnownRecord(CVR, Record);
124
1.64k
  }
llvm::Error llvm::codeview::TypeSerializer::visitKnownRecordImpl<llvm::codeview::ClassRecord>(llvm::codeview::CVRecord<llvm::codeview::TypeLeafKind>&, llvm::codeview::ClassRecord&)
Line
Count
Source
122
202
  Error visitKnownRecordImpl(CVType &CVR, RecordKind &Record) {
123
202
    return Mapping.visitKnownRecord(CVR, Record);
124
202
  }
llvm::Error llvm::codeview::TypeSerializer::visitKnownRecordImpl<llvm::codeview::StringIdRecord>(llvm::codeview::CVRecord<llvm::codeview::TypeLeafKind>&, llvm::codeview::StringIdRecord&)
Line
Count
Source
122
212
  Error visitKnownRecordImpl(CVType &CVR, RecordKind &Record) {
123
212
    return Mapping.visitKnownRecord(CVR, Record);
124
212
  }
llvm::Error llvm::codeview::TypeSerializer::visitKnownRecordImpl<llvm::codeview::ArrayRecord>(llvm::codeview::CVRecord<llvm::codeview::TypeLeafKind>&, llvm::codeview::ArrayRecord&)
Line
Count
Source
122
84
  Error visitKnownRecordImpl(CVType &CVR, RecordKind &Record) {
123
84
    return Mapping.visitKnownRecord(CVR, Record);
124
84
  }
llvm::Error llvm::codeview::TypeSerializer::visitKnownRecordImpl<llvm::codeview::UnionRecord>(llvm::codeview::CVRecord<llvm::codeview::TypeLeafKind>&, llvm::codeview::UnionRecord&)
Line
Count
Source
122
9
  Error visitKnownRecordImpl(CVType &CVR, RecordKind &Record) {
123
9
    return Mapping.visitKnownRecord(CVR, Record);
124
9
  }
llvm::Error llvm::codeview::TypeSerializer::visitKnownRecordImpl<llvm::codeview::TypeServer2Record>(llvm::codeview::CVRecord<llvm::codeview::TypeLeafKind>&, llvm::codeview::TypeServer2Record&)
Line
Count
Source
122
4
  Error visitKnownRecordImpl(CVType &CVR, RecordKind &Record) {
123
4
    return Mapping.visitKnownRecord(CVR, Record);
124
4
  }
llvm::Error llvm::codeview::TypeSerializer::visitKnownRecordImpl<llvm::codeview::EnumRecord>(llvm::codeview::CVRecord<llvm::codeview::TypeLeafKind>&, llvm::codeview::EnumRecord&)
Line
Count
Source
122
31
  Error visitKnownRecordImpl(CVType &CVR, RecordKind &Record) {
123
31
    return Mapping.visitKnownRecord(CVR, Record);
124
31
  }
llvm::Error llvm::codeview::TypeSerializer::visitKnownRecordImpl<llvm::codeview::VFTableRecord>(llvm::codeview::CVRecord<llvm::codeview::TypeLeafKind>&, llvm::codeview::VFTableRecord&)
Line
Count
Source
122
2
  Error visitKnownRecordImpl(CVType &CVR, RecordKind &Record) {
123
2
    return Mapping.visitKnownRecord(CVR, Record);
124
2
  }
llvm::Error llvm::codeview::TypeSerializer::visitKnownRecordImpl<llvm::codeview::VFTableShapeRecord>(llvm::codeview::CVRecord<llvm::codeview::TypeLeafKind>&, llvm::codeview::VFTableShapeRecord&)
Line
Count
Source
122
9
  Error visitKnownRecordImpl(CVType &CVR, RecordKind &Record) {
123
9
    return Mapping.visitKnownRecord(CVR, Record);
124
9
  }
llvm::Error llvm::codeview::TypeSerializer::visitKnownRecordImpl<llvm::codeview::BitFieldRecord>(llvm::codeview::CVRecord<llvm::codeview::TypeLeafKind>&, llvm::codeview::BitFieldRecord&)
Line
Count
Source
122
10
  Error visitKnownRecordImpl(CVType &CVR, RecordKind &Record) {
123
10
    return Mapping.visitKnownRecord(CVR, Record);
124
10
  }
llvm::Error llvm::codeview::TypeSerializer::visitKnownRecordImpl<llvm::codeview::ModifierRecord>(llvm::codeview::CVRecord<llvm::codeview::TypeLeafKind>&, llvm::codeview::ModifierRecord&)
Line
Count
Source
122
29
  Error visitKnownRecordImpl(CVType &CVR, RecordKind &Record) {
123
29
    return Mapping.visitKnownRecord(CVR, Record);
124
29
  }
llvm::Error llvm::codeview::TypeSerializer::visitKnownRecordImpl<llvm::codeview::StringListRecord>(llvm::codeview::CVRecord<llvm::codeview::TypeLeafKind>&, llvm::codeview::StringListRecord&)
Line
Count
Source
122
25
  Error visitKnownRecordImpl(CVType &CVR, RecordKind &Record) {
123
25
    return Mapping.visitKnownRecord(CVR, Record);
124
25
  }
llvm::Error llvm::codeview::TypeSerializer::visitKnownRecordImpl<llvm::codeview::BuildInfoRecord>(llvm::codeview::CVRecord<llvm::codeview::TypeLeafKind>&, llvm::codeview::BuildInfoRecord&)
Line
Count
Source
122
24
  Error visitKnownRecordImpl(CVType &CVR, RecordKind &Record) {
123
24
    return Mapping.visitKnownRecord(CVR, Record);
124
24
  }
llvm::Error llvm::codeview::TypeSerializer::visitKnownRecordImpl<llvm::codeview::MemberFuncIdRecord>(llvm::codeview::CVRecord<llvm::codeview::TypeLeafKind>&, llvm::codeview::MemberFuncIdRecord&)
Line
Count
Source
122
26
  Error visitKnownRecordImpl(CVType &CVR, RecordKind &Record) {
123
26
    return Mapping.visitKnownRecord(CVR, Record);
124
26
  }
llvm::Error llvm::codeview::TypeSerializer::visitKnownRecordImpl<llvm::codeview::FuncIdRecord>(llvm::codeview::CVRecord<llvm::codeview::TypeLeafKind>&, llvm::codeview::FuncIdRecord&)
Line
Count
Source
122
181
  Error visitKnownRecordImpl(CVType &CVR, RecordKind &Record) {
123
181
    return Mapping.visitKnownRecord(CVR, Record);
124
181
  }
llvm::Error llvm::codeview::TypeSerializer::visitKnownRecordImpl<llvm::codeview::MethodOverloadListRecord>(llvm::codeview::CVRecord<llvm::codeview::TypeLeafKind>&, llvm::codeview::MethodOverloadListRecord&)
Line
Count
Source
122
24
  Error visitKnownRecordImpl(CVType &CVR, RecordKind &Record) {
123
24
    return Mapping.visitKnownRecord(CVR, Record);
124
24
  }
llvm::Error llvm::codeview::TypeSerializer::visitKnownRecordImpl<llvm::codeview::UdtModSourceLineRecord>(llvm::codeview::CVRecord<llvm::codeview::TypeLeafKind>&, llvm::codeview::UdtModSourceLineRecord&)
Line
Count
Source
122
17
  Error visitKnownRecordImpl(CVType &CVR, RecordKind &Record) {
123
17
    return Mapping.visitKnownRecord(CVR, Record);
124
17
  }
llvm::Error llvm::codeview::TypeSerializer::visitKnownRecordImpl<llvm::codeview::UdtSourceLineRecord>(llvm::codeview::CVRecord<llvm::codeview::TypeLeafKind>&, llvm::codeview::UdtSourceLineRecord&)
Line
Count
Source
122
71
  Error visitKnownRecordImpl(CVType &CVR, RecordKind &Record) {
123
71
    return Mapping.visitKnownRecord(CVR, Record);
124
71
  }
llvm::Error llvm::codeview::TypeSerializer::visitKnownRecordImpl<llvm::codeview::PointerRecord>(llvm::codeview::CVRecord<llvm::codeview::TypeLeafKind>&, llvm::codeview::PointerRecord&)
Line
Count
Source
122
160
  Error visitKnownRecordImpl(CVType &CVR, RecordKind &Record) {
123
160
    return Mapping.visitKnownRecord(CVR, Record);
124
160
  }
Unexecuted instantiation: llvm::Error llvm::codeview::TypeSerializer::visitKnownRecordImpl<llvm::codeview::FieldListRecord>(llvm::codeview::CVRecord<llvm::codeview::TypeLeafKind>&, llvm::codeview::FieldListRecord&)
llvm::Error llvm::codeview::TypeSerializer::visitKnownRecordImpl<llvm::codeview::ArgListRecord>(llvm::codeview::CVRecord<llvm::codeview::TypeLeafKind>&, llvm::codeview::ArgListRecord&)
Line
Count
Source
122
246
  Error visitKnownRecordImpl(CVType &CVR, RecordKind &Record) {
123
246
    return Mapping.visitKnownRecord(CVR, Record);
124
246
  }
llvm::Error llvm::codeview::TypeSerializer::visitKnownRecordImpl<llvm::codeview::MemberFunctionRecord>(llvm::codeview::CVRecord<llvm::codeview::TypeLeafKind>&, llvm::codeview::MemberFunctionRecord&)
Line
Count
Source
122
122
  Error visitKnownRecordImpl(CVType &CVR, RecordKind &Record) {
123
122
    return Mapping.visitKnownRecord(CVR, Record);
124
122
  }
Unexecuted instantiation: llvm::Error llvm::codeview::TypeSerializer::visitKnownRecordImpl<llvm::codeview::LabelRecord>(llvm::codeview::CVRecord<llvm::codeview::TypeLeafKind>&, llvm::codeview::LabelRecord&)
llvm::Error llvm::codeview::TypeSerializer::visitKnownRecordImpl<llvm::codeview::ProcedureRecord>(llvm::codeview::CVRecord<llvm::codeview::TypeLeafKind>&, llvm::codeview::ProcedureRecord&)
Line
Count
Source
122
154
  Error visitKnownRecordImpl(CVType &CVR, RecordKind &Record) {
123
154
    return Mapping.visitKnownRecord(CVR, Record);
124
154
  }
125
126
  template <typename RecordType>
127
6.18k
  Error visitKnownMemberImpl(CVMemberRecord &CVR, RecordType &Record) {
128
6.18k
    assert(CVR.Kind == static_cast<TypeLeafKind>(Record.getKind()));
129
6.18k
130
6.18k
    if (auto EC = Writer.writeEnum(CVR.Kind))
131
0
      return EC;
132
6.18k
133
6.18k
    
if (auto 6.18k
EC6.18k
= Mapping.visitKnownMember(CVR, Record))
134
0
      return EC;
135
6.18k
136
6.18k
    // Get all the data that was just written and is yet to be committed to
137
6.18k
    // the current segment.  Then pad it to 4 bytes.
138
6.18k
    MutableArrayRef<uint8_t> ThisRecord = getCurrentSubRecordData();
139
6.18k
    auto ExpectedRecord = addPadding(ThisRecord);
140
6.18k
    if (!ExpectedRecord)
141
0
      return ExpectedRecord.takeError();
142
6.18k
    ThisRecord = *ExpectedRecord;
143
6.18k
144
6.18k
    CurrentSegment.SubRecords.emplace_back(CVR.Kind, ThisRecord.size());
145
6.18k
    CVR.Data = ThisRecord;
146
6.18k
147
6.18k
    // Both the last subrecord and the total length of this segment should be
148
6.18k
    // multiples of 4.
149
6.18k
    assert(ThisRecord.size() % 4 == 0);
150
6.18k
    assert(CurrentSegment.length() % 4 == 0);
151
6.18k
152
6.18k
    return Error::success();
153
6.18k
  }
llvm::Error llvm::codeview::TypeSerializer::visitKnownMemberImpl<llvm::codeview::EnumeratorRecord>(llvm::codeview::CVMemberRecord&, llvm::codeview::EnumeratorRecord&)
Line
Count
Source
127
5.86k
  Error visitKnownMemberImpl(CVMemberRecord &CVR, RecordType &Record) {
128
5.86k
    assert(CVR.Kind == static_cast<TypeLeafKind>(Record.getKind()));
129
5.86k
130
5.86k
    if (auto EC = Writer.writeEnum(CVR.Kind))
131
0
      return EC;
132
5.86k
133
5.86k
    
if (auto 5.86k
EC5.86k
= Mapping.visitKnownMember(CVR, Record))
134
0
      return EC;
135
5.86k
136
5.86k
    // Get all the data that was just written and is yet to be committed to
137
5.86k
    // the current segment.  Then pad it to 4 bytes.
138
5.86k
    MutableArrayRef<uint8_t> ThisRecord = getCurrentSubRecordData();
139
5.86k
    auto ExpectedRecord = addPadding(ThisRecord);
140
5.86k
    if (!ExpectedRecord)
141
0
      return ExpectedRecord.takeError();
142
5.86k
    ThisRecord = *ExpectedRecord;
143
5.86k
144
5.86k
    CurrentSegment.SubRecords.emplace_back(CVR.Kind, ThisRecord.size());
145
5.86k
    CVR.Data = ThisRecord;
146
5.86k
147
5.86k
    // Both the last subrecord and the total length of this segment should be
148
5.86k
    // multiples of 4.
149
5.86k
    assert(ThisRecord.size() % 4 == 0);
150
5.86k
    assert(CurrentSegment.length() % 4 == 0);
151
5.86k
152
5.86k
    return Error::success();
153
5.86k
  }
llvm::Error llvm::codeview::TypeSerializer::visitKnownMemberImpl<llvm::codeview::BaseClassRecord>(llvm::codeview::CVMemberRecord&, llvm::codeview::BaseClassRecord&)
Line
Count
Source
127
16
  Error visitKnownMemberImpl(CVMemberRecord &CVR, RecordType &Record) {
128
16
    assert(CVR.Kind == static_cast<TypeLeafKind>(Record.getKind()));
129
16
130
16
    if (auto EC = Writer.writeEnum(CVR.Kind))
131
0
      return EC;
132
16
133
16
    
if (auto 16
EC16
= Mapping.visitKnownMember(CVR, Record))
134
0
      return EC;
135
16
136
16
    // Get all the data that was just written and is yet to be committed to
137
16
    // the current segment.  Then pad it to 4 bytes.
138
16
    MutableArrayRef<uint8_t> ThisRecord = getCurrentSubRecordData();
139
16
    auto ExpectedRecord = addPadding(ThisRecord);
140
16
    if (!ExpectedRecord)
141
0
      return ExpectedRecord.takeError();
142
16
    ThisRecord = *ExpectedRecord;
143
16
144
16
    CurrentSegment.SubRecords.emplace_back(CVR.Kind, ThisRecord.size());
145
16
    CVR.Data = ThisRecord;
146
16
147
16
    // Both the last subrecord and the total length of this segment should be
148
16
    // multiples of 4.
149
16
    assert(ThisRecord.size() % 4 == 0);
150
16
    assert(CurrentSegment.length() % 4 == 0);
151
16
152
16
    return Error::success();
153
16
  }
llvm::Error llvm::codeview::TypeSerializer::visitKnownMemberImpl<llvm::codeview::VirtualBaseClassRecord>(llvm::codeview::CVMemberRecord&, llvm::codeview::VirtualBaseClassRecord&)
Line
Count
Source
127
9
  Error visitKnownMemberImpl(CVMemberRecord &CVR, RecordType &Record) {
128
9
    assert(CVR.Kind == static_cast<TypeLeafKind>(Record.getKind()));
129
9
130
9
    if (auto EC = Writer.writeEnum(CVR.Kind))
131
0
      return EC;
132
9
133
9
    
if (auto 9
EC9
= Mapping.visitKnownMember(CVR, Record))
134
0
      return EC;
135
9
136
9
    // Get all the data that was just written and is yet to be committed to
137
9
    // the current segment.  Then pad it to 4 bytes.
138
9
    MutableArrayRef<uint8_t> ThisRecord = getCurrentSubRecordData();
139
9
    auto ExpectedRecord = addPadding(ThisRecord);
140
9
    if (!ExpectedRecord)
141
0
      return ExpectedRecord.takeError();
142
9
    ThisRecord = *ExpectedRecord;
143
9
144
9
    CurrentSegment.SubRecords.emplace_back(CVR.Kind, ThisRecord.size());
145
9
    CVR.Data = ThisRecord;
146
9
147
9
    // Both the last subrecord and the total length of this segment should be
148
9
    // multiples of 4.
149
9
    assert(ThisRecord.size() % 4 == 0);
150
9
    assert(CurrentSegment.length() % 4 == 0);
151
9
152
9
    return Error::success();
153
9
  }
llvm::Error llvm::codeview::TypeSerializer::visitKnownMemberImpl<llvm::codeview::VFPtrRecord>(llvm::codeview::CVMemberRecord&, llvm::codeview::VFPtrRecord&)
Line
Count
Source
127
11
  Error visitKnownMemberImpl(CVMemberRecord &CVR, RecordType &Record) {
128
11
    assert(CVR.Kind == static_cast<TypeLeafKind>(Record.getKind()));
129
11
130
11
    if (auto EC = Writer.writeEnum(CVR.Kind))
131
0
      return EC;
132
11
133
11
    
if (auto 11
EC11
= Mapping.visitKnownMember(CVR, Record))
134
0
      return EC;
135
11
136
11
    // Get all the data that was just written and is yet to be committed to
137
11
    // the current segment.  Then pad it to 4 bytes.
138
11
    MutableArrayRef<uint8_t> ThisRecord = getCurrentSubRecordData();
139
11
    auto ExpectedRecord = addPadding(ThisRecord);
140
11
    if (!ExpectedRecord)
141
0
      return ExpectedRecord.takeError();
142
11
    ThisRecord = *ExpectedRecord;
143
11
144
11
    CurrentSegment.SubRecords.emplace_back(CVR.Kind, ThisRecord.size());
145
11
    CVR.Data = ThisRecord;
146
11
147
11
    // Both the last subrecord and the total length of this segment should be
148
11
    // multiples of 4.
149
11
    assert(ThisRecord.size() % 4 == 0);
150
11
    assert(CurrentSegment.length() % 4 == 0);
151
11
152
11
    return Error::success();
153
11
  }
llvm::Error llvm::codeview::TypeSerializer::visitKnownMemberImpl<llvm::codeview::StaticDataMemberRecord>(llvm::codeview::CVMemberRecord&, llvm::codeview::StaticDataMemberRecord&)
Line
Count
Source
127
6
  Error visitKnownMemberImpl(CVMemberRecord &CVR, RecordType &Record) {
128
6
    assert(CVR.Kind == static_cast<TypeLeafKind>(Record.getKind()));
129
6
130
6
    if (auto EC = Writer.writeEnum(CVR.Kind))
131
0
      return EC;
132
6
133
6
    
if (auto 6
EC6
= Mapping.visitKnownMember(CVR, Record))
134
0
      return EC;
135
6
136
6
    // Get all the data that was just written and is yet to be committed to
137
6
    // the current segment.  Then pad it to 4 bytes.
138
6
    MutableArrayRef<uint8_t> ThisRecord = getCurrentSubRecordData();
139
6
    auto ExpectedRecord = addPadding(ThisRecord);
140
6
    if (!ExpectedRecord)
141
0
      return ExpectedRecord.takeError();
142
6
    ThisRecord = *ExpectedRecord;
143
6
144
6
    CurrentSegment.SubRecords.emplace_back(CVR.Kind, ThisRecord.size());
145
6
    CVR.Data = ThisRecord;
146
6
147
6
    // Both the last subrecord and the total length of this segment should be
148
6
    // multiples of 4.
149
6
    assert(ThisRecord.size() % 4 == 0);
150
6
    assert(CurrentSegment.length() % 4 == 0);
151
6
152
6
    return Error::success();
153
6
  }
llvm::Error llvm::codeview::TypeSerializer::visitKnownMemberImpl<llvm::codeview::OverloadedMethodRecord>(llvm::codeview::CVMemberRecord&, llvm::codeview::OverloadedMethodRecord&)
Line
Count
Source
127
24
  Error visitKnownMemberImpl(CVMemberRecord &CVR, RecordType &Record) {
128
24
    assert(CVR.Kind == static_cast<TypeLeafKind>(Record.getKind()));
129
24
130
24
    if (auto EC = Writer.writeEnum(CVR.Kind))
131
0
      return EC;
132
24
133
24
    
if (auto 24
EC24
= Mapping.visitKnownMember(CVR, Record))
134
0
      return EC;
135
24
136
24
    // Get all the data that was just written and is yet to be committed to
137
24
    // the current segment.  Then pad it to 4 bytes.
138
24
    MutableArrayRef<uint8_t> ThisRecord = getCurrentSubRecordData();
139
24
    auto ExpectedRecord = addPadding(ThisRecord);
140
24
    if (!ExpectedRecord)
141
0
      return ExpectedRecord.takeError();
142
24
    ThisRecord = *ExpectedRecord;
143
24
144
24
    CurrentSegment.SubRecords.emplace_back(CVR.Kind, ThisRecord.size());
145
24
    CVR.Data = ThisRecord;
146
24
147
24
    // Both the last subrecord and the total length of this segment should be
148
24
    // multiples of 4.
149
24
    assert(ThisRecord.size() % 4 == 0);
150
24
    assert(CurrentSegment.length() % 4 == 0);
151
24
152
24
    return Error::success();
153
24
  }
llvm::Error llvm::codeview::TypeSerializer::visitKnownMemberImpl<llvm::codeview::DataMemberRecord>(llvm::codeview::CVMemberRecord&, llvm::codeview::DataMemberRecord&)
Line
Count
Source
127
164
  Error visitKnownMemberImpl(CVMemberRecord &CVR, RecordType &Record) {
128
164
    assert(CVR.Kind == static_cast<TypeLeafKind>(Record.getKind()));
129
164
130
164
    if (auto EC = Writer.writeEnum(CVR.Kind))
131
0
      return EC;
132
164
133
164
    
if (auto 164
EC164
= Mapping.visitKnownMember(CVR, Record))
134
0
      return EC;
135
164
136
164
    // Get all the data that was just written and is yet to be committed to
137
164
    // the current segment.  Then pad it to 4 bytes.
138
164
    MutableArrayRef<uint8_t> ThisRecord = getCurrentSubRecordData();
139
164
    auto ExpectedRecord = addPadding(ThisRecord);
140
164
    if (!ExpectedRecord)
141
0
      return ExpectedRecord.takeError();
142
164
    ThisRecord = *ExpectedRecord;
143
164
144
164
    CurrentSegment.SubRecords.emplace_back(CVR.Kind, ThisRecord.size());
145
164
    CVR.Data = ThisRecord;
146
164
147
164
    // Both the last subrecord and the total length of this segment should be
148
164
    // multiples of 4.
149
164
    assert(ThisRecord.size() % 4 == 0);
150
164
    assert(CurrentSegment.length() % 4 == 0);
151
164
152
164
    return Error::success();
153
164
  }
llvm::Error llvm::codeview::TypeSerializer::visitKnownMemberImpl<llvm::codeview::NestedTypeRecord>(llvm::codeview::CVMemberRecord&, llvm::codeview::NestedTypeRecord&)
Line
Count
Source
127
35
  Error visitKnownMemberImpl(CVMemberRecord &CVR, RecordType &Record) {
128
35
    assert(CVR.Kind == static_cast<TypeLeafKind>(Record.getKind()));
129
35
130
35
    if (auto EC = Writer.writeEnum(CVR.Kind))
131
0
      return EC;
132
35
133
35
    
if (auto 35
EC35
= Mapping.visitKnownMember(CVR, Record))
134
0
      return EC;
135
35
136
35
    // Get all the data that was just written and is yet to be committed to
137
35
    // the current segment.  Then pad it to 4 bytes.
138
35
    MutableArrayRef<uint8_t> ThisRecord = getCurrentSubRecordData();
139
35
    auto ExpectedRecord = addPadding(ThisRecord);
140
35
    if (!ExpectedRecord)
141
0
      return ExpectedRecord.takeError();
142
35
    ThisRecord = *ExpectedRecord;
143
35
144
35
    CurrentSegment.SubRecords.emplace_back(CVR.Kind, ThisRecord.size());
145
35
    CVR.Data = ThisRecord;
146
35
147
35
    // Both the last subrecord and the total length of this segment should be
148
35
    // multiples of 4.
149
35
    assert(ThisRecord.size() % 4 == 0);
150
35
    assert(CurrentSegment.length() % 4 == 0);
151
35
152
35
    return Error::success();
153
35
  }
llvm::Error llvm::codeview::TypeSerializer::visitKnownMemberImpl<llvm::codeview::OneMethodRecord>(llvm::codeview::CVMemberRecord&, llvm::codeview::OneMethodRecord&)
Line
Count
Source
127
57
  Error visitKnownMemberImpl(CVMemberRecord &CVR, RecordType &Record) {
128
57
    assert(CVR.Kind == static_cast<TypeLeafKind>(Record.getKind()));
129
57
130
57
    if (auto EC = Writer.writeEnum(CVR.Kind))
131
0
      return EC;
132
57
133
57
    
if (auto 57
EC57
= Mapping.visitKnownMember(CVR, Record))
134
0
      return EC;
135
57
136
57
    // Get all the data that was just written and is yet to be committed to
137
57
    // the current segment.  Then pad it to 4 bytes.
138
57
    MutableArrayRef<uint8_t> ThisRecord = getCurrentSubRecordData();
139
57
    auto ExpectedRecord = addPadding(ThisRecord);
140
57
    if (!ExpectedRecord)
141
0
      return ExpectedRecord.takeError();
142
57
    ThisRecord = *ExpectedRecord;
143
57
144
57
    CurrentSegment.SubRecords.emplace_back(CVR.Kind, ThisRecord.size());
145
57
    CVR.Data = ThisRecord;
146
57
147
57
    // Both the last subrecord and the total length of this segment should be
148
57
    // multiples of 4.
149
57
    assert(ThisRecord.size() % 4 == 0);
150
57
    assert(CurrentSegment.length() % 4 == 0);
151
57
152
57
    return Error::success();
153
57
  }
llvm::Error llvm::codeview::TypeSerializer::visitKnownMemberImpl<llvm::codeview::ListContinuationRecord>(llvm::codeview::CVMemberRecord&, llvm::codeview::ListContinuationRecord&)
Line
Count
Source
127
2
  Error visitKnownMemberImpl(CVMemberRecord &CVR, RecordType &Record) {
128
2
    assert(CVR.Kind == static_cast<TypeLeafKind>(Record.getKind()));
129
2
130
2
    if (auto EC = Writer.writeEnum(CVR.Kind))
131
0
      return EC;
132
2
133
2
    
if (auto 2
EC2
= Mapping.visitKnownMember(CVR, Record))
134
0
      return EC;
135
2
136
2
    // Get all the data that was just written and is yet to be committed to
137
2
    // the current segment.  Then pad it to 4 bytes.
138
2
    MutableArrayRef<uint8_t> ThisRecord = getCurrentSubRecordData();
139
2
    auto ExpectedRecord = addPadding(ThisRecord);
140
2
    if (!ExpectedRecord)
141
0
      return ExpectedRecord.takeError();
142
2
    ThisRecord = *ExpectedRecord;
143
2
144
2
    CurrentSegment.SubRecords.emplace_back(CVR.Kind, ThisRecord.size());
145
2
    CVR.Data = ThisRecord;
146
2
147
2
    // Both the last subrecord and the total length of this segment should be
148
2
    // multiples of 4.
149
2
    assert(ThisRecord.size() % 4 == 0);
150
2
    assert(CurrentSegment.length() % 4 == 0);
151
2
152
2
    return Error::success();
153
2
  }
154
};
155
156
} // end namespace codeview
157
} // end namespace llvm
158
159
#endif // LLVM_DEBUGINFO_CODEVIEW_TYPESERIALIZER_H