Coverage Report

Created: 2019-07-24 05:18

/Users/buildslave/jenkins/workspace/clang-stage2-coverage-R/llvm/lib/DebugInfo/CodeView/SimpleTypeSerializer.cpp
Line
Count
Source
1
#include "llvm/DebugInfo/CodeView/SimpleTypeSerializer.h"
2
3
using namespace llvm;
4
using namespace llvm::codeview;
5
6
4.68k
static void addPadding(BinaryStreamWriter &Writer) {
7
4.68k
  uint32_t Align = Writer.getOffset() % 4;
8
4.68k
  if (Align == 0)
9
2.95k
    return;
10
1.73k
11
1.73k
  int PaddingBytes = 4 - Align;
12
5.26k
  while (PaddingBytes > 0) {
13
3.52k
    uint8_t Pad = static_cast<uint8_t>(LF_PAD0 + PaddingBytes);
14
3.52k
    cantFail(Writer.writeInteger(Pad));
15
3.52k
    --PaddingBytes;
16
3.52k
  }
17
1.73k
}
18
19
16.8k
SimpleTypeSerializer::SimpleTypeSerializer() : ScratchBuffer(MaxRecordLength) {}
20
21
16.8k
SimpleTypeSerializer::~SimpleTypeSerializer() {}
22
23
template <typename T>
24
4.68k
ArrayRef<uint8_t> SimpleTypeSerializer::serialize(T &Record) {
25
4.68k
  BinaryStreamWriter Writer(ScratchBuffer, support::little);
26
4.68k
  TypeRecordMapping Mapping(Writer);
27
4.68k
28
4.68k
  // Write the record prefix first with a dummy length but real kind.
29
4.68k
  RecordPrefix DummyPrefix(uint16_t(Record.getKind()));
30
4.68k
  cantFail(Writer.writeObject(DummyPrefix));
31
4.68k
32
4.68k
  RecordPrefix *Prefix = reinterpret_cast<RecordPrefix *>(ScratchBuffer.data());
33
4.68k
  CVType CVT(Prefix, sizeof(RecordPrefix));
34
4.68k
35
4.68k
  cantFail(Mapping.visitTypeBegin(CVT));
36
4.68k
  cantFail(Mapping.visitKnownRecord(CVT, Record));
37
4.68k
  cantFail(Mapping.visitTypeEnd(CVT));
38
4.68k
39
4.68k
  addPadding(Writer);
40
4.68k
41
4.68k
  // Update the size and kind after serialization.
42
4.68k
  Prefix->RecordKind = CVT.kind();
43
4.68k
  Prefix->RecordLen = Writer.getOffset() - sizeof(uint16_t);
44
4.68k
45
4.68k
  return {ScratchBuffer.data(), Writer.getOffset()};
46
4.68k
}
llvm::ArrayRef<unsigned char> llvm::codeview::SimpleTypeSerializer::serialize<llvm::codeview::PointerRecord>(llvm::codeview::PointerRecord&)
Line
Count
Source
24
517
ArrayRef<uint8_t> SimpleTypeSerializer::serialize(T &Record) {
25
517
  BinaryStreamWriter Writer(ScratchBuffer, support::little);
26
517
  TypeRecordMapping Mapping(Writer);
27
517
28
517
  // Write the record prefix first with a dummy length but real kind.
29
517
  RecordPrefix DummyPrefix(uint16_t(Record.getKind()));
30
517
  cantFail(Writer.writeObject(DummyPrefix));
31
517
32
517
  RecordPrefix *Prefix = reinterpret_cast<RecordPrefix *>(ScratchBuffer.data());
33
517
  CVType CVT(Prefix, sizeof(RecordPrefix));
34
517
35
517
  cantFail(Mapping.visitTypeBegin(CVT));
36
517
  cantFail(Mapping.visitKnownRecord(CVT, Record));
37
517
  cantFail(Mapping.visitTypeEnd(CVT));
38
517
39
517
  addPadding(Writer);
40
517
41
517
  // Update the size and kind after serialization.
42
517
  Prefix->RecordKind = CVT.kind();
43
517
  Prefix->RecordLen = Writer.getOffset() - sizeof(uint16_t);
44
517
45
517
  return {ScratchBuffer.data(), Writer.getOffset()};
46
517
}
llvm::ArrayRef<unsigned char> llvm::codeview::SimpleTypeSerializer::serialize<llvm::codeview::ModifierRecord>(llvm::codeview::ModifierRecord&)
Line
Count
Source
24
73
ArrayRef<uint8_t> SimpleTypeSerializer::serialize(T &Record) {
25
73
  BinaryStreamWriter Writer(ScratchBuffer, support::little);
26
73
  TypeRecordMapping Mapping(Writer);
27
73
28
73
  // Write the record prefix first with a dummy length but real kind.
29
73
  RecordPrefix DummyPrefix(uint16_t(Record.getKind()));
30
73
  cantFail(Writer.writeObject(DummyPrefix));
31
73
32
73
  RecordPrefix *Prefix = reinterpret_cast<RecordPrefix *>(ScratchBuffer.data());
33
73
  CVType CVT(Prefix, sizeof(RecordPrefix));
34
73
35
73
  cantFail(Mapping.visitTypeBegin(CVT));
36
73
  cantFail(Mapping.visitKnownRecord(CVT, Record));
37
73
  cantFail(Mapping.visitTypeEnd(CVT));
38
73
39
73
  addPadding(Writer);
40
73
41
73
  // Update the size and kind after serialization.
42
73
  Prefix->RecordKind = CVT.kind();
43
73
  Prefix->RecordLen = Writer.getOffset() - sizeof(uint16_t);
44
73
45
73
  return {ScratchBuffer.data(), Writer.getOffset()};
46
73
}
llvm::ArrayRef<unsigned char> llvm::codeview::SimpleTypeSerializer::serialize<llvm::codeview::ProcedureRecord>(llvm::codeview::ProcedureRecord&)
Line
Count
Source
24
344
ArrayRef<uint8_t> SimpleTypeSerializer::serialize(T &Record) {
25
344
  BinaryStreamWriter Writer(ScratchBuffer, support::little);
26
344
  TypeRecordMapping Mapping(Writer);
27
344
28
344
  // Write the record prefix first with a dummy length but real kind.
29
344
  RecordPrefix DummyPrefix(uint16_t(Record.getKind()));
30
344
  cantFail(Writer.writeObject(DummyPrefix));
31
344
32
344
  RecordPrefix *Prefix = reinterpret_cast<RecordPrefix *>(ScratchBuffer.data());
33
344
  CVType CVT(Prefix, sizeof(RecordPrefix));
34
344
35
344
  cantFail(Mapping.visitTypeBegin(CVT));
36
344
  cantFail(Mapping.visitKnownRecord(CVT, Record));
37
344
  cantFail(Mapping.visitTypeEnd(CVT));
38
344
39
344
  addPadding(Writer);
40
344
41
344
  // Update the size and kind after serialization.
42
344
  Prefix->RecordKind = CVT.kind();
43
344
  Prefix->RecordLen = Writer.getOffset() - sizeof(uint16_t);
44
344
45
344
  return {ScratchBuffer.data(), Writer.getOffset()};
46
344
}
llvm::ArrayRef<unsigned char> llvm::codeview::SimpleTypeSerializer::serialize<llvm::codeview::MemberFunctionRecord>(llvm::codeview::MemberFunctionRecord&)
Line
Count
Source
24
337
ArrayRef<uint8_t> SimpleTypeSerializer::serialize(T &Record) {
25
337
  BinaryStreamWriter Writer(ScratchBuffer, support::little);
26
337
  TypeRecordMapping Mapping(Writer);
27
337
28
337
  // Write the record prefix first with a dummy length but real kind.
29
337
  RecordPrefix DummyPrefix(uint16_t(Record.getKind()));
30
337
  cantFail(Writer.writeObject(DummyPrefix));
31
337
32
337
  RecordPrefix *Prefix = reinterpret_cast<RecordPrefix *>(ScratchBuffer.data());
33
337
  CVType CVT(Prefix, sizeof(RecordPrefix));
34
337
35
337
  cantFail(Mapping.visitTypeBegin(CVT));
36
337
  cantFail(Mapping.visitKnownRecord(CVT, Record));
37
337
  cantFail(Mapping.visitTypeEnd(CVT));
38
337
39
337
  addPadding(Writer);
40
337
41
337
  // Update the size and kind after serialization.
42
337
  Prefix->RecordKind = CVT.kind();
43
337
  Prefix->RecordLen = Writer.getOffset() - sizeof(uint16_t);
44
337
45
337
  return {ScratchBuffer.data(), Writer.getOffset()};
46
337
}
Unexecuted instantiation: llvm::ArrayRef<unsigned char> llvm::codeview::SimpleTypeSerializer::serialize<llvm::codeview::LabelRecord>(llvm::codeview::LabelRecord&)
llvm::ArrayRef<unsigned char> llvm::codeview::SimpleTypeSerializer::serialize<llvm::codeview::ArgListRecord>(llvm::codeview::ArgListRecord&)
Line
Count
Source
24
617
ArrayRef<uint8_t> SimpleTypeSerializer::serialize(T &Record) {
25
617
  BinaryStreamWriter Writer(ScratchBuffer, support::little);
26
617
  TypeRecordMapping Mapping(Writer);
27
617
28
617
  // Write the record prefix first with a dummy length but real kind.
29
617
  RecordPrefix DummyPrefix(uint16_t(Record.getKind()));
30
617
  cantFail(Writer.writeObject(DummyPrefix));
31
617
32
617
  RecordPrefix *Prefix = reinterpret_cast<RecordPrefix *>(ScratchBuffer.data());
33
617
  CVType CVT(Prefix, sizeof(RecordPrefix));
34
617
35
617
  cantFail(Mapping.visitTypeBegin(CVT));
36
617
  cantFail(Mapping.visitKnownRecord(CVT, Record));
37
617
  cantFail(Mapping.visitTypeEnd(CVT));
38
617
39
617
  addPadding(Writer);
40
617
41
617
  // Update the size and kind after serialization.
42
617
  Prefix->RecordKind = CVT.kind();
43
617
  Prefix->RecordLen = Writer.getOffset() - sizeof(uint16_t);
44
617
45
617
  return {ScratchBuffer.data(), Writer.getOffset()};
46
617
}
Unexecuted instantiation: llvm::ArrayRef<unsigned char> llvm::codeview::SimpleTypeSerializer::serialize<llvm::codeview::FieldListRecord>(llvm::codeview::FieldListRecord&)
llvm::ArrayRef<unsigned char> llvm::codeview::SimpleTypeSerializer::serialize<llvm::codeview::ArrayRecord>(llvm::codeview::ArrayRecord&)
Line
Count
Source
24
101
ArrayRef<uint8_t> SimpleTypeSerializer::serialize(T &Record) {
25
101
  BinaryStreamWriter Writer(ScratchBuffer, support::little);
26
101
  TypeRecordMapping Mapping(Writer);
27
101
28
101
  // Write the record prefix first with a dummy length but real kind.
29
101
  RecordPrefix DummyPrefix(uint16_t(Record.getKind()));
30
101
  cantFail(Writer.writeObject(DummyPrefix));
31
101
32
101
  RecordPrefix *Prefix = reinterpret_cast<RecordPrefix *>(ScratchBuffer.data());
33
101
  CVType CVT(Prefix, sizeof(RecordPrefix));
34
101
35
101
  cantFail(Mapping.visitTypeBegin(CVT));
36
101
  cantFail(Mapping.visitKnownRecord(CVT, Record));
37
101
  cantFail(Mapping.visitTypeEnd(CVT));
38
101
39
101
  addPadding(Writer);
40
101
41
101
  // Update the size and kind after serialization.
42
101
  Prefix->RecordKind = CVT.kind();
43
101
  Prefix->RecordLen = Writer.getOffset() - sizeof(uint16_t);
44
101
45
101
  return {ScratchBuffer.data(), Writer.getOffset()};
46
101
}
llvm::ArrayRef<unsigned char> llvm::codeview::SimpleTypeSerializer::serialize<llvm::codeview::ClassRecord>(llvm::codeview::ClassRecord&)
Line
Count
Source
24
541
ArrayRef<uint8_t> SimpleTypeSerializer::serialize(T &Record) {
25
541
  BinaryStreamWriter Writer(ScratchBuffer, support::little);
26
541
  TypeRecordMapping Mapping(Writer);
27
541
28
541
  // Write the record prefix first with a dummy length but real kind.
29
541
  RecordPrefix DummyPrefix(uint16_t(Record.getKind()));
30
541
  cantFail(Writer.writeObject(DummyPrefix));
31
541
32
541
  RecordPrefix *Prefix = reinterpret_cast<RecordPrefix *>(ScratchBuffer.data());
33
541
  CVType CVT(Prefix, sizeof(RecordPrefix));
34
541
35
541
  cantFail(Mapping.visitTypeBegin(CVT));
36
541
  cantFail(Mapping.visitKnownRecord(CVT, Record));
37
541
  cantFail(Mapping.visitTypeEnd(CVT));
38
541
39
541
  addPadding(Writer);
40
541
41
541
  // Update the size and kind after serialization.
42
541
  Prefix->RecordKind = CVT.kind();
43
541
  Prefix->RecordLen = Writer.getOffset() - sizeof(uint16_t);
44
541
45
541
  return {ScratchBuffer.data(), Writer.getOffset()};
46
541
}
llvm::ArrayRef<unsigned char> llvm::codeview::SimpleTypeSerializer::serialize<llvm::codeview::UnionRecord>(llvm::codeview::UnionRecord&)
Line
Count
Source
24
48
ArrayRef<uint8_t> SimpleTypeSerializer::serialize(T &Record) {
25
48
  BinaryStreamWriter Writer(ScratchBuffer, support::little);
26
48
  TypeRecordMapping Mapping(Writer);
27
48
28
48
  // Write the record prefix first with a dummy length but real kind.
29
48
  RecordPrefix DummyPrefix(uint16_t(Record.getKind()));
30
48
  cantFail(Writer.writeObject(DummyPrefix));
31
48
32
48
  RecordPrefix *Prefix = reinterpret_cast<RecordPrefix *>(ScratchBuffer.data());
33
48
  CVType CVT(Prefix, sizeof(RecordPrefix));
34
48
35
48
  cantFail(Mapping.visitTypeBegin(CVT));
36
48
  cantFail(Mapping.visitKnownRecord(CVT, Record));
37
48
  cantFail(Mapping.visitTypeEnd(CVT));
38
48
39
48
  addPadding(Writer);
40
48
41
48
  // Update the size and kind after serialization.
42
48
  Prefix->RecordKind = CVT.kind();
43
48
  Prefix->RecordLen = Writer.getOffset() - sizeof(uint16_t);
44
48
45
48
  return {ScratchBuffer.data(), Writer.getOffset()};
46
48
}
llvm::ArrayRef<unsigned char> llvm::codeview::SimpleTypeSerializer::serialize<llvm::codeview::EnumRecord>(llvm::codeview::EnumRecord&)
Line
Count
Source
24
79
ArrayRef<uint8_t> SimpleTypeSerializer::serialize(T &Record) {
25
79
  BinaryStreamWriter Writer(ScratchBuffer, support::little);
26
79
  TypeRecordMapping Mapping(Writer);
27
79
28
79
  // Write the record prefix first with a dummy length but real kind.
29
79
  RecordPrefix DummyPrefix(uint16_t(Record.getKind()));
30
79
  cantFail(Writer.writeObject(DummyPrefix));
31
79
32
79
  RecordPrefix *Prefix = reinterpret_cast<RecordPrefix *>(ScratchBuffer.data());
33
79
  CVType CVT(Prefix, sizeof(RecordPrefix));
34
79
35
79
  cantFail(Mapping.visitTypeBegin(CVT));
36
79
  cantFail(Mapping.visitKnownRecord(CVT, Record));
37
79
  cantFail(Mapping.visitTypeEnd(CVT));
38
79
39
79
  addPadding(Writer);
40
79
41
79
  // Update the size and kind after serialization.
42
79
  Prefix->RecordKind = CVT.kind();
43
79
  Prefix->RecordLen = Writer.getOffset() - sizeof(uint16_t);
44
79
45
79
  return {ScratchBuffer.data(), Writer.getOffset()};
46
79
}
llvm::ArrayRef<unsigned char> llvm::codeview::SimpleTypeSerializer::serialize<llvm::codeview::TypeServer2Record>(llvm::codeview::TypeServer2Record&)
Line
Count
Source
24
11
ArrayRef<uint8_t> SimpleTypeSerializer::serialize(T &Record) {
25
11
  BinaryStreamWriter Writer(ScratchBuffer, support::little);
26
11
  TypeRecordMapping Mapping(Writer);
27
11
28
11
  // Write the record prefix first with a dummy length but real kind.
29
11
  RecordPrefix DummyPrefix(uint16_t(Record.getKind()));
30
11
  cantFail(Writer.writeObject(DummyPrefix));
31
11
32
11
  RecordPrefix *Prefix = reinterpret_cast<RecordPrefix *>(ScratchBuffer.data());
33
11
  CVType CVT(Prefix, sizeof(RecordPrefix));
34
11
35
11
  cantFail(Mapping.visitTypeBegin(CVT));
36
11
  cantFail(Mapping.visitKnownRecord(CVT, Record));
37
11
  cantFail(Mapping.visitTypeEnd(CVT));
38
11
39
11
  addPadding(Writer);
40
11
41
11
  // Update the size and kind after serialization.
42
11
  Prefix->RecordKind = CVT.kind();
43
11
  Prefix->RecordLen = Writer.getOffset() - sizeof(uint16_t);
44
11
45
11
  return {ScratchBuffer.data(), Writer.getOffset()};
46
11
}
llvm::ArrayRef<unsigned char> llvm::codeview::SimpleTypeSerializer::serialize<llvm::codeview::VFTableRecord>(llvm::codeview::VFTableRecord&)
Line
Count
Source
24
6
ArrayRef<uint8_t> SimpleTypeSerializer::serialize(T &Record) {
25
6
  BinaryStreamWriter Writer(ScratchBuffer, support::little);
26
6
  TypeRecordMapping Mapping(Writer);
27
6
28
6
  // Write the record prefix first with a dummy length but real kind.
29
6
  RecordPrefix DummyPrefix(uint16_t(Record.getKind()));
30
6
  cantFail(Writer.writeObject(DummyPrefix));
31
6
32
6
  RecordPrefix *Prefix = reinterpret_cast<RecordPrefix *>(ScratchBuffer.data());
33
6
  CVType CVT(Prefix, sizeof(RecordPrefix));
34
6
35
6
  cantFail(Mapping.visitTypeBegin(CVT));
36
6
  cantFail(Mapping.visitKnownRecord(CVT, Record));
37
6
  cantFail(Mapping.visitTypeEnd(CVT));
38
6
39
6
  addPadding(Writer);
40
6
41
6
  // Update the size and kind after serialization.
42
6
  Prefix->RecordKind = CVT.kind();
43
6
  Prefix->RecordLen = Writer.getOffset() - sizeof(uint16_t);
44
6
45
6
  return {ScratchBuffer.data(), Writer.getOffset()};
46
6
}
llvm::ArrayRef<unsigned char> llvm::codeview::SimpleTypeSerializer::serialize<llvm::codeview::VFTableShapeRecord>(llvm::codeview::VFTableShapeRecord&)
Line
Count
Source
24
25
ArrayRef<uint8_t> SimpleTypeSerializer::serialize(T &Record) {
25
25
  BinaryStreamWriter Writer(ScratchBuffer, support::little);
26
25
  TypeRecordMapping Mapping(Writer);
27
25
28
25
  // Write the record prefix first with a dummy length but real kind.
29
25
  RecordPrefix DummyPrefix(uint16_t(Record.getKind()));
30
25
  cantFail(Writer.writeObject(DummyPrefix));
31
25
32
25
  RecordPrefix *Prefix = reinterpret_cast<RecordPrefix *>(ScratchBuffer.data());
33
25
  CVType CVT(Prefix, sizeof(RecordPrefix));
34
25
35
25
  cantFail(Mapping.visitTypeBegin(CVT));
36
25
  cantFail(Mapping.visitKnownRecord(CVT, Record));
37
25
  cantFail(Mapping.visitTypeEnd(CVT));
38
25
39
25
  addPadding(Writer);
40
25
41
25
  // Update the size and kind after serialization.
42
25
  Prefix->RecordKind = CVT.kind();
43
25
  Prefix->RecordLen = Writer.getOffset() - sizeof(uint16_t);
44
25
45
25
  return {ScratchBuffer.data(), Writer.getOffset()};
46
25
}
llvm::ArrayRef<unsigned char> llvm::codeview::SimpleTypeSerializer::serialize<llvm::codeview::BitFieldRecord>(llvm::codeview::BitFieldRecord&)
Line
Count
Source
24
12
ArrayRef<uint8_t> SimpleTypeSerializer::serialize(T &Record) {
25
12
  BinaryStreamWriter Writer(ScratchBuffer, support::little);
26
12
  TypeRecordMapping Mapping(Writer);
27
12
28
12
  // Write the record prefix first with a dummy length but real kind.
29
12
  RecordPrefix DummyPrefix(uint16_t(Record.getKind()));
30
12
  cantFail(Writer.writeObject(DummyPrefix));
31
12
32
12
  RecordPrefix *Prefix = reinterpret_cast<RecordPrefix *>(ScratchBuffer.data());
33
12
  CVType CVT(Prefix, sizeof(RecordPrefix));
34
12
35
12
  cantFail(Mapping.visitTypeBegin(CVT));
36
12
  cantFail(Mapping.visitKnownRecord(CVT, Record));
37
12
  cantFail(Mapping.visitTypeEnd(CVT));
38
12
39
12
  addPadding(Writer);
40
12
41
12
  // Update the size and kind after serialization.
42
12
  Prefix->RecordKind = CVT.kind();
43
12
  Prefix->RecordLen = Writer.getOffset() - sizeof(uint16_t);
44
12
45
12
  return {ScratchBuffer.data(), Writer.getOffset()};
46
12
}
llvm::ArrayRef<unsigned char> llvm::codeview::SimpleTypeSerializer::serialize<llvm::codeview::FuncIdRecord>(llvm::codeview::FuncIdRecord&)
Line
Count
Source
24
395
ArrayRef<uint8_t> SimpleTypeSerializer::serialize(T &Record) {
25
395
  BinaryStreamWriter Writer(ScratchBuffer, support::little);
26
395
  TypeRecordMapping Mapping(Writer);
27
395
28
395
  // Write the record prefix first with a dummy length but real kind.
29
395
  RecordPrefix DummyPrefix(uint16_t(Record.getKind()));
30
395
  cantFail(Writer.writeObject(DummyPrefix));
31
395
32
395
  RecordPrefix *Prefix = reinterpret_cast<RecordPrefix *>(ScratchBuffer.data());
33
395
  CVType CVT(Prefix, sizeof(RecordPrefix));
34
395
35
395
  cantFail(Mapping.visitTypeBegin(CVT));
36
395
  cantFail(Mapping.visitKnownRecord(CVT, Record));
37
395
  cantFail(Mapping.visitTypeEnd(CVT));
38
395
39
395
  addPadding(Writer);
40
395
41
395
  // Update the size and kind after serialization.
42
395
  Prefix->RecordKind = CVT.kind();
43
395
  Prefix->RecordLen = Writer.getOffset() - sizeof(uint16_t);
44
395
45
395
  return {ScratchBuffer.data(), Writer.getOffset()};
46
395
}
llvm::ArrayRef<unsigned char> llvm::codeview::SimpleTypeSerializer::serialize<llvm::codeview::MemberFuncIdRecord>(llvm::codeview::MemberFuncIdRecord&)
Line
Count
Source
24
86
ArrayRef<uint8_t> SimpleTypeSerializer::serialize(T &Record) {
25
86
  BinaryStreamWriter Writer(ScratchBuffer, support::little);
26
86
  TypeRecordMapping Mapping(Writer);
27
86
28
86
  // Write the record prefix first with a dummy length but real kind.
29
86
  RecordPrefix DummyPrefix(uint16_t(Record.getKind()));
30
86
  cantFail(Writer.writeObject(DummyPrefix));
31
86
32
86
  RecordPrefix *Prefix = reinterpret_cast<RecordPrefix *>(ScratchBuffer.data());
33
86
  CVType CVT(Prefix, sizeof(RecordPrefix));
34
86
35
86
  cantFail(Mapping.visitTypeBegin(CVT));
36
86
  cantFail(Mapping.visitKnownRecord(CVT, Record));
37
86
  cantFail(Mapping.visitTypeEnd(CVT));
38
86
39
86
  addPadding(Writer);
40
86
41
86
  // Update the size and kind after serialization.
42
86
  Prefix->RecordKind = CVT.kind();
43
86
  Prefix->RecordLen = Writer.getOffset() - sizeof(uint16_t);
44
86
45
86
  return {ScratchBuffer.data(), Writer.getOffset()};
46
86
}
llvm::ArrayRef<unsigned char> llvm::codeview::SimpleTypeSerializer::serialize<llvm::codeview::BuildInfoRecord>(llvm::codeview::BuildInfoRecord&)
Line
Count
Source
24
226
ArrayRef<uint8_t> SimpleTypeSerializer::serialize(T &Record) {
25
226
  BinaryStreamWriter Writer(ScratchBuffer, support::little);
26
226
  TypeRecordMapping Mapping(Writer);
27
226
28
226
  // Write the record prefix first with a dummy length but real kind.
29
226
  RecordPrefix DummyPrefix(uint16_t(Record.getKind()));
30
226
  cantFail(Writer.writeObject(DummyPrefix));
31
226
32
226
  RecordPrefix *Prefix = reinterpret_cast<RecordPrefix *>(ScratchBuffer.data());
33
226
  CVType CVT(Prefix, sizeof(RecordPrefix));
34
226
35
226
  cantFail(Mapping.visitTypeBegin(CVT));
36
226
  cantFail(Mapping.visitKnownRecord(CVT, Record));
37
226
  cantFail(Mapping.visitTypeEnd(CVT));
38
226
39
226
  addPadding(Writer);
40
226
41
226
  // Update the size and kind after serialization.
42
226
  Prefix->RecordKind = CVT.kind();
43
226
  Prefix->RecordLen = Writer.getOffset() - sizeof(uint16_t);
44
226
45
226
  return {ScratchBuffer.data(), Writer.getOffset()};
46
226
}
llvm::ArrayRef<unsigned char> llvm::codeview::SimpleTypeSerializer::serialize<llvm::codeview::StringListRecord>(llvm::codeview::StringListRecord&)
Line
Count
Source
24
37
ArrayRef<uint8_t> SimpleTypeSerializer::serialize(T &Record) {
25
37
  BinaryStreamWriter Writer(ScratchBuffer, support::little);
26
37
  TypeRecordMapping Mapping(Writer);
27
37
28
37
  // Write the record prefix first with a dummy length but real kind.
29
37
  RecordPrefix DummyPrefix(uint16_t(Record.getKind()));
30
37
  cantFail(Writer.writeObject(DummyPrefix));
31
37
32
37
  RecordPrefix *Prefix = reinterpret_cast<RecordPrefix *>(ScratchBuffer.data());
33
37
  CVType CVT(Prefix, sizeof(RecordPrefix));
34
37
35
37
  cantFail(Mapping.visitTypeBegin(CVT));
36
37
  cantFail(Mapping.visitKnownRecord(CVT, Record));
37
37
  cantFail(Mapping.visitTypeEnd(CVT));
38
37
39
37
  addPadding(Writer);
40
37
41
37
  // Update the size and kind after serialization.
42
37
  Prefix->RecordKind = CVT.kind();
43
37
  Prefix->RecordLen = Writer.getOffset() - sizeof(uint16_t);
44
37
45
37
  return {ScratchBuffer.data(), Writer.getOffset()};
46
37
}
llvm::ArrayRef<unsigned char> llvm::codeview::SimpleTypeSerializer::serialize<llvm::codeview::StringIdRecord>(llvm::codeview::StringIdRecord&)
Line
Count
Source
24
848
ArrayRef<uint8_t> SimpleTypeSerializer::serialize(T &Record) {
25
848
  BinaryStreamWriter Writer(ScratchBuffer, support::little);
26
848
  TypeRecordMapping Mapping(Writer);
27
848
28
848
  // Write the record prefix first with a dummy length but real kind.
29
848
  RecordPrefix DummyPrefix(uint16_t(Record.getKind()));
30
848
  cantFail(Writer.writeObject(DummyPrefix));
31
848
32
848
  RecordPrefix *Prefix = reinterpret_cast<RecordPrefix *>(ScratchBuffer.data());
33
848
  CVType CVT(Prefix, sizeof(RecordPrefix));
34
848
35
848
  cantFail(Mapping.visitTypeBegin(CVT));
36
848
  cantFail(Mapping.visitKnownRecord(CVT, Record));
37
848
  cantFail(Mapping.visitTypeEnd(CVT));
38
848
39
848
  addPadding(Writer);
40
848
41
848
  // Update the size and kind after serialization.
42
848
  Prefix->RecordKind = CVT.kind();
43
848
  Prefix->RecordLen = Writer.getOffset() - sizeof(uint16_t);
44
848
45
848
  return {ScratchBuffer.data(), Writer.getOffset()};
46
848
}
llvm::ArrayRef<unsigned char> llvm::codeview::SimpleTypeSerializer::serialize<llvm::codeview::UdtSourceLineRecord>(llvm::codeview::UdtSourceLineRecord&)
Line
Count
Source
24
310
ArrayRef<uint8_t> SimpleTypeSerializer::serialize(T &Record) {
25
310
  BinaryStreamWriter Writer(ScratchBuffer, support::little);
26
310
  TypeRecordMapping Mapping(Writer);
27
310
28
310
  // Write the record prefix first with a dummy length but real kind.
29
310
  RecordPrefix DummyPrefix(uint16_t(Record.getKind()));
30
310
  cantFail(Writer.writeObject(DummyPrefix));
31
310
32
310
  RecordPrefix *Prefix = reinterpret_cast<RecordPrefix *>(ScratchBuffer.data());
33
310
  CVType CVT(Prefix, sizeof(RecordPrefix));
34
310
35
310
  cantFail(Mapping.visitTypeBegin(CVT));
36
310
  cantFail(Mapping.visitKnownRecord(CVT, Record));
37
310
  cantFail(Mapping.visitTypeEnd(CVT));
38
310
39
310
  addPadding(Writer);
40
310
41
310
  // Update the size and kind after serialization.
42
310
  Prefix->RecordKind = CVT.kind();
43
310
  Prefix->RecordLen = Writer.getOffset() - sizeof(uint16_t);
44
310
45
310
  return {ScratchBuffer.data(), Writer.getOffset()};
46
310
}
llvm::ArrayRef<unsigned char> llvm::codeview::SimpleTypeSerializer::serialize<llvm::codeview::UdtModSourceLineRecord>(llvm::codeview::UdtModSourceLineRecord&)
Line
Count
Source
24
17
ArrayRef<uint8_t> SimpleTypeSerializer::serialize(T &Record) {
25
17
  BinaryStreamWriter Writer(ScratchBuffer, support::little);
26
17
  TypeRecordMapping Mapping(Writer);
27
17
28
17
  // Write the record prefix first with a dummy length but real kind.
29
17
  RecordPrefix DummyPrefix(uint16_t(Record.getKind()));
30
17
  cantFail(Writer.writeObject(DummyPrefix));
31
17
32
17
  RecordPrefix *Prefix = reinterpret_cast<RecordPrefix *>(ScratchBuffer.data());
33
17
  CVType CVT(Prefix, sizeof(RecordPrefix));
34
17
35
17
  cantFail(Mapping.visitTypeBegin(CVT));
36
17
  cantFail(Mapping.visitKnownRecord(CVT, Record));
37
17
  cantFail(Mapping.visitTypeEnd(CVT));
38
17
39
17
  addPadding(Writer);
40
17
41
17
  // Update the size and kind after serialization.
42
17
  Prefix->RecordKind = CVT.kind();
43
17
  Prefix->RecordLen = Writer.getOffset() - sizeof(uint16_t);
44
17
45
17
  return {ScratchBuffer.data(), Writer.getOffset()};
46
17
}
llvm::ArrayRef<unsigned char> llvm::codeview::SimpleTypeSerializer::serialize<llvm::codeview::MethodOverloadListRecord>(llvm::codeview::MethodOverloadListRecord&)
Line
Count
Source
24
57
ArrayRef<uint8_t> SimpleTypeSerializer::serialize(T &Record) {
25
57
  BinaryStreamWriter Writer(ScratchBuffer, support::little);
26
57
  TypeRecordMapping Mapping(Writer);
27
57
28
57
  // Write the record prefix first with a dummy length but real kind.
29
57
  RecordPrefix DummyPrefix(uint16_t(Record.getKind()));
30
57
  cantFail(Writer.writeObject(DummyPrefix));
31
57
32
57
  RecordPrefix *Prefix = reinterpret_cast<RecordPrefix *>(ScratchBuffer.data());
33
57
  CVType CVT(Prefix, sizeof(RecordPrefix));
34
57
35
57
  cantFail(Mapping.visitTypeBegin(CVT));
36
57
  cantFail(Mapping.visitKnownRecord(CVT, Record));
37
57
  cantFail(Mapping.visitTypeEnd(CVT));
38
57
39
57
  addPadding(Writer);
40
57
41
57
  // Update the size and kind after serialization.
42
57
  Prefix->RecordKind = CVT.kind();
43
57
  Prefix->RecordLen = Writer.getOffset() - sizeof(uint16_t);
44
57
45
57
  return {ScratchBuffer.data(), Writer.getOffset()};
46
57
}
llvm::ArrayRef<unsigned char> llvm::codeview::SimpleTypeSerializer::serialize<llvm::codeview::PrecompRecord>(llvm::codeview::PrecompRecord&)
Line
Count
Source
24
1
ArrayRef<uint8_t> SimpleTypeSerializer::serialize(T &Record) {
25
1
  BinaryStreamWriter Writer(ScratchBuffer, support::little);
26
1
  TypeRecordMapping Mapping(Writer);
27
1
28
1
  // Write the record prefix first with a dummy length but real kind.
29
1
  RecordPrefix DummyPrefix(uint16_t(Record.getKind()));
30
1
  cantFail(Writer.writeObject(DummyPrefix));
31
1
32
1
  RecordPrefix *Prefix = reinterpret_cast<RecordPrefix *>(ScratchBuffer.data());
33
1
  CVType CVT(Prefix, sizeof(RecordPrefix));
34
1
35
1
  cantFail(Mapping.visitTypeBegin(CVT));
36
1
  cantFail(Mapping.visitKnownRecord(CVT, Record));
37
1
  cantFail(Mapping.visitTypeEnd(CVT));
38
1
39
1
  addPadding(Writer);
40
1
41
1
  // Update the size and kind after serialization.
42
1
  Prefix->RecordKind = CVT.kind();
43
1
  Prefix->RecordLen = Writer.getOffset() - sizeof(uint16_t);
44
1
45
1
  return {ScratchBuffer.data(), Writer.getOffset()};
46
1
}
llvm::ArrayRef<unsigned char> llvm::codeview::SimpleTypeSerializer::serialize<llvm::codeview::EndPrecompRecord>(llvm::codeview::EndPrecompRecord&)
Line
Count
Source
24
1
ArrayRef<uint8_t> SimpleTypeSerializer::serialize(T &Record) {
25
1
  BinaryStreamWriter Writer(ScratchBuffer, support::little);
26
1
  TypeRecordMapping Mapping(Writer);
27
1
28
1
  // Write the record prefix first with a dummy length but real kind.
29
1
  RecordPrefix DummyPrefix(uint16_t(Record.getKind()));
30
1
  cantFail(Writer.writeObject(DummyPrefix));
31
1
32
1
  RecordPrefix *Prefix = reinterpret_cast<RecordPrefix *>(ScratchBuffer.data());
33
1
  CVType CVT(Prefix, sizeof(RecordPrefix));
34
1
35
1
  cantFail(Mapping.visitTypeBegin(CVT));
36
1
  cantFail(Mapping.visitKnownRecord(CVT, Record));
37
1
  cantFail(Mapping.visitTypeEnd(CVT));
38
1
39
1
  addPadding(Writer);
40
1
41
1
  // Update the size and kind after serialization.
42
1
  Prefix->RecordKind = CVT.kind();
43
1
  Prefix->RecordLen = Writer.getOffset() - sizeof(uint16_t);
44
1
45
1
  return {ScratchBuffer.data(), Writer.getOffset()};
46
1
}
47
48
// Explicitly instantiate the member function for each known type so that we can
49
// implement this in the cpp file.
50
#define TYPE_RECORD(EnumName, EnumVal, Name)                                   \
51
  template ArrayRef<uint8_t> llvm::codeview::SimpleTypeSerializer::serialize(  \
52
      Name##Record &Record);
53
#define TYPE_RECORD_ALIAS(EnumName, EnumVal, Name, AliasName)
54
#define MEMBER_RECORD(EnumName, EnumVal, Name)
55
#define MEMBER_RECORD_ALIAS(EnumName, EnumVal, Name, AliasName)
56
#include "llvm/DebugInfo/CodeView/CodeViewTypes.def"