Coverage Report

Created: 2018-11-16 02:38

/Users/buildslave/jenkins/workspace/clang-stage2-coverage-R/llvm/include/llvm/DebugInfo/CodeView/TypeDeserializer.h
Line
Count
Source (jump to first uncovered line)
1
//===- TypeDeserializer.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_TYPEDESERIALIZER_H
11
#define LLVM_DEBUGINFO_CODEVIEW_TYPEDESERIALIZER_H
12
13
#include "llvm/ADT/ArrayRef.h"
14
#include "llvm/ADT/STLExtras.h"
15
#include "llvm/DebugInfo/CodeView/CodeView.h"
16
#include "llvm/DebugInfo/CodeView/TypeRecord.h"
17
#include "llvm/DebugInfo/CodeView/TypeRecordMapping.h"
18
#include "llvm/DebugInfo/CodeView/TypeVisitorCallbacks.h"
19
#include "llvm/Support/BinaryByteStream.h"
20
#include "llvm/Support/BinaryStreamReader.h"
21
#include "llvm/Support/Error.h"
22
#include <cassert>
23
#include <cstdint>
24
#include <memory>
25
26
namespace llvm {
27
namespace codeview {
28
29
class TypeDeserializer : public TypeVisitorCallbacks {
30
  struct MappingInfo {
31
    explicit MappingInfo(ArrayRef<uint8_t> RecordData)
32
        : Stream(RecordData, llvm::support::little), Reader(Stream),
33
16.2k
          Mapping(Reader) {}
34
35
    BinaryByteStream Stream;
36
    BinaryStreamReader Reader;
37
    TypeRecordMapping Mapping;
38
  };
39
40
public:
41
4.48k
  TypeDeserializer() = default;
42
43
  template <typename T> static Error deserializeAs(CVType &CVT, T &Record) {
44
    Record.Kind = static_cast<TypeRecordKind>(CVT.kind());
45
    MappingInfo I(CVT.content());
46
    if (auto EC = I.Mapping.visitTypeBegin(CVT))
47
      return EC;
48
    if (auto EC = I.Mapping.visitKnownRecord(CVT, Record))
49
      return EC;
50
    if (auto EC = I.Mapping.visitTypeEnd(CVT))
51
      return EC;
52
    return Error::success();
53
  }
54
55
  template <typename T>
56
  static Expected<T> deserializeAs(ArrayRef<uint8_t> Data) {
57
    const RecordPrefix *Prefix =
58
        reinterpret_cast<const RecordPrefix *>(Data.data());
59
    TypeRecordKind K =
60
        static_cast<TypeRecordKind>(uint16_t(Prefix->RecordKind));
61
    T Record(K);
62
    CVType CVT(static_cast<TypeLeafKind>(K), Data);
63
    if (auto EC = deserializeAs<T>(CVT, Record))
64
      return std::move(EC);
65
    return Record;
66
  }
67
68
11.2k
  Error visitTypeBegin(CVType &Record) override {
69
11.2k
    assert(!Mapping && "Already in a type mapping!");
70
11.2k
    Mapping = llvm::make_unique<MappingInfo>(Record.content());
71
11.2k
    return Mapping->Mapping.visitTypeBegin(Record);
72
11.2k
  }
73
74
11.2k
  Error visitTypeBegin(CVType &Record, TypeIndex Index) override {
75
11.2k
    return visitTypeBegin(Record);
76
11.2k
  }
77
78
11.2k
  Error visitTypeEnd(CVType &Record) override {
79
11.2k
    assert(Mapping && "Not in a type mapping!");
80
11.2k
    auto EC = Mapping->Mapping.visitTypeEnd(Record);
81
11.2k
    Mapping.reset();
82
11.2k
    return EC;
83
11.2k
  }
84
85
#define TYPE_RECORD(EnumName, EnumVal, Name)                                   \
86
11.2k
  Error visitKnownRecord(CVType &CVR, Name##Record &Record) override {         \
87
11.2k
    return visitKnownRecordImpl<Name##Record>(CVR, Record);                    \
88
11.2k
  }
llvm::codeview::TypeDeserializer::visitKnownRecord(llvm::codeview::CVRecord<llvm::codeview::TypeLeafKind>&, llvm::codeview::PointerRecord&)
Line
Count
Source
86
1.38k
  Error visitKnownRecord(CVType &CVR, Name##Record &Record) override {         \
87
1.38k
    return visitKnownRecordImpl<Name##Record>(CVR, Record);                    \
88
1.38k
  }
llvm::codeview::TypeDeserializer::visitKnownRecord(llvm::codeview::CVRecord<llvm::codeview::TypeLeafKind>&, llvm::codeview::ModifierRecord&)
Line
Count
Source
86
223
  Error visitKnownRecord(CVType &CVR, Name##Record &Record) override {         \
87
223
    return visitKnownRecordImpl<Name##Record>(CVR, Record);                    \
88
223
  }
llvm::codeview::TypeDeserializer::visitKnownRecord(llvm::codeview::CVRecord<llvm::codeview::TypeLeafKind>&, llvm::codeview::ProcedureRecord&)
Line
Count
Source
86
471
  Error visitKnownRecord(CVType &CVR, Name##Record &Record) override {         \
87
471
    return visitKnownRecordImpl<Name##Record>(CVR, Record);                    \
88
471
  }
llvm::codeview::TypeDeserializer::visitKnownRecord(llvm::codeview::CVRecord<llvm::codeview::TypeLeafKind>&, llvm::codeview::MemberFunctionRecord&)
Line
Count
Source
86
1.52k
  Error visitKnownRecord(CVType &CVR, Name##Record &Record) override {         \
87
1.52k
    return visitKnownRecordImpl<Name##Record>(CVR, Record);                    \
88
1.52k
  }
llvm::codeview::TypeDeserializer::visitKnownRecord(llvm::codeview::CVRecord<llvm::codeview::TypeLeafKind>&, llvm::codeview::LabelRecord&)
Line
Count
Source
86
1
  Error visitKnownRecord(CVType &CVR, Name##Record &Record) override {         \
87
1
    return visitKnownRecordImpl<Name##Record>(CVR, Record);                    \
88
1
  }
llvm::codeview::TypeDeserializer::visitKnownRecord(llvm::codeview::CVRecord<llvm::codeview::TypeLeafKind>&, llvm::codeview::ArgListRecord&)
Line
Count
Source
86
837
  Error visitKnownRecord(CVType &CVR, Name##Record &Record) override {         \
87
837
    return visitKnownRecordImpl<Name##Record>(CVR, Record);                    \
88
837
  }
llvm::codeview::TypeDeserializer::visitKnownRecord(llvm::codeview::CVRecord<llvm::codeview::TypeLeafKind>&, llvm::codeview::FieldListRecord&)
Line
Count
Source
86
1.31k
  Error visitKnownRecord(CVType &CVR, Name##Record &Record) override {         \
87
1.31k
    return visitKnownRecordImpl<Name##Record>(CVR, Record);                    \
88
1.31k
  }
llvm::codeview::TypeDeserializer::visitKnownRecord(llvm::codeview::CVRecord<llvm::codeview::TypeLeafKind>&, llvm::codeview::ArrayRecord&)
Line
Count
Source
86
92
  Error visitKnownRecord(CVType &CVR, Name##Record &Record) override {         \
87
92
    return visitKnownRecordImpl<Name##Record>(CVR, Record);                    \
88
92
  }
llvm::codeview::TypeDeserializer::visitKnownRecord(llvm::codeview::CVRecord<llvm::codeview::TypeLeafKind>&, llvm::codeview::ClassRecord&)
Line
Count
Source
86
2.23k
  Error visitKnownRecord(CVType &CVR, Name##Record &Record) override {         \
87
2.23k
    return visitKnownRecordImpl<Name##Record>(CVR, Record);                    \
88
2.23k
  }
llvm::codeview::TypeDeserializer::visitKnownRecord(llvm::codeview::CVRecord<llvm::codeview::TypeLeafKind>&, llvm::codeview::UnionRecord&)
Line
Count
Source
86
39
  Error visitKnownRecord(CVType &CVR, Name##Record &Record) override {         \
87
39
    return visitKnownRecordImpl<Name##Record>(CVR, Record);                    \
88
39
  }
llvm::codeview::TypeDeserializer::visitKnownRecord(llvm::codeview::CVRecord<llvm::codeview::TypeLeafKind>&, llvm::codeview::EnumRecord&)
Line
Count
Source
86
256
  Error visitKnownRecord(CVType &CVR, Name##Record &Record) override {         \
87
256
    return visitKnownRecordImpl<Name##Record>(CVR, Record);                    \
88
256
  }
Unexecuted instantiation: llvm::codeview::TypeDeserializer::visitKnownRecord(llvm::codeview::CVRecord<llvm::codeview::TypeLeafKind>&, llvm::codeview::TypeServer2Record&)
llvm::codeview::TypeDeserializer::visitKnownRecord(llvm::codeview::CVRecord<llvm::codeview::TypeLeafKind>&, llvm::codeview::VFTableRecord&)
Line
Count
Source
86
11
  Error visitKnownRecord(CVType &CVR, Name##Record &Record) override {         \
87
11
    return visitKnownRecordImpl<Name##Record>(CVR, Record);                    \
88
11
  }
llvm::codeview::TypeDeserializer::visitKnownRecord(llvm::codeview::CVRecord<llvm::codeview::TypeLeafKind>&, llvm::codeview::VFTableShapeRecord&)
Line
Count
Source
86
38
  Error visitKnownRecord(CVType &CVR, Name##Record &Record) override {         \
87
38
    return visitKnownRecordImpl<Name##Record>(CVR, Record);                    \
88
38
  }
llvm::codeview::TypeDeserializer::visitKnownRecord(llvm::codeview::CVRecord<llvm::codeview::TypeLeafKind>&, llvm::codeview::BitFieldRecord&)
Line
Count
Source
86
18
  Error visitKnownRecord(CVType &CVR, Name##Record &Record) override {         \
87
18
    return visitKnownRecordImpl<Name##Record>(CVR, Record);                    \
88
18
  }
llvm::codeview::TypeDeserializer::visitKnownRecord(llvm::codeview::CVRecord<llvm::codeview::TypeLeafKind>&, llvm::codeview::FuncIdRecord&)
Line
Count
Source
86
474
  Error visitKnownRecord(CVType &CVR, Name##Record &Record) override {         \
87
474
    return visitKnownRecordImpl<Name##Record>(CVR, Record);                    \
88
474
  }
llvm::codeview::TypeDeserializer::visitKnownRecord(llvm::codeview::CVRecord<llvm::codeview::TypeLeafKind>&, llvm::codeview::MemberFuncIdRecord&)
Line
Count
Source
86
106
  Error visitKnownRecord(CVType &CVR, Name##Record &Record) override {         \
87
106
    return visitKnownRecordImpl<Name##Record>(CVR, Record);                    \
88
106
  }
llvm::codeview::TypeDeserializer::visitKnownRecord(llvm::codeview::CVRecord<llvm::codeview::TypeLeafKind>&, llvm::codeview::BuildInfoRecord&)
Line
Count
Source
86
266
  Error visitKnownRecord(CVType &CVR, Name##Record &Record) override {         \
87
266
    return visitKnownRecordImpl<Name##Record>(CVR, Record);                    \
88
266
  }
llvm::codeview::TypeDeserializer::visitKnownRecord(llvm::codeview::CVRecord<llvm::codeview::TypeLeafKind>&, llvm::codeview::StringListRecord&)
Line
Count
Source
86
48
  Error visitKnownRecord(CVType &CVR, Name##Record &Record) override {         \
87
48
    return visitKnownRecordImpl<Name##Record>(CVR, Record);                    \
88
48
  }
llvm::codeview::TypeDeserializer::visitKnownRecord(llvm::codeview::CVRecord<llvm::codeview::TypeLeafKind>&, llvm::codeview::StringIdRecord&)
Line
Count
Source
86
1.05k
  Error visitKnownRecord(CVType &CVR, Name##Record &Record) override {         \
87
1.05k
    return visitKnownRecordImpl<Name##Record>(CVR, Record);                    \
88
1.05k
  }
llvm::codeview::TypeDeserializer::visitKnownRecord(llvm::codeview::CVRecord<llvm::codeview::TypeLeafKind>&, llvm::codeview::UdtSourceLineRecord&)
Line
Count
Source
86
555
  Error visitKnownRecord(CVType &CVR, Name##Record &Record) override {         \
87
555
    return visitKnownRecordImpl<Name##Record>(CVR, Record);                    \
88
555
  }
llvm::codeview::TypeDeserializer::visitKnownRecord(llvm::codeview::CVRecord<llvm::codeview::TypeLeafKind>&, llvm::codeview::UdtModSourceLineRecord&)
Line
Count
Source
86
8
  Error visitKnownRecord(CVType &CVR, Name##Record &Record) override {         \
87
8
    return visitKnownRecordImpl<Name##Record>(CVR, Record);                    \
88
8
  }
llvm::codeview::TypeDeserializer::visitKnownRecord(llvm::codeview::CVRecord<llvm::codeview::TypeLeafKind>&, llvm::codeview::MethodOverloadListRecord&)
Line
Count
Source
86
325
  Error visitKnownRecord(CVType &CVR, Name##Record &Record) override {         \
87
325
    return visitKnownRecordImpl<Name##Record>(CVR, Record);                    \
88
325
  }
llvm::codeview::TypeDeserializer::visitKnownRecord(llvm::codeview::CVRecord<llvm::codeview::TypeLeafKind>&, llvm::codeview::PrecompRecord&)
Line
Count
Source
86
2
  Error visitKnownRecord(CVType &CVR, Name##Record &Record) override {         \
87
2
    return visitKnownRecordImpl<Name##Record>(CVR, Record);                    \
88
2
  }
llvm::codeview::TypeDeserializer::visitKnownRecord(llvm::codeview::CVRecord<llvm::codeview::TypeLeafKind>&, llvm::codeview::EndPrecompRecord&)
Line
Count
Source
86
2
  Error visitKnownRecord(CVType &CVR, Name##Record &Record) override {         \
87
2
    return visitKnownRecordImpl<Name##Record>(CVR, Record);                    \
88
2
  }
89
#define MEMBER_RECORD(EnumName, EnumVal, Name)
90
#define TYPE_RECORD_ALIAS(EnumName, EnumVal, Name, AliasName)
91
#define MEMBER_RECORD_ALIAS(EnumName, EnumVal, Name, AliasName)
92
#include "llvm/DebugInfo/CodeView/CodeViewTypes.def"
93
94
private:
95
  template <typename RecordType>
96
11.2k
  Error visitKnownRecordImpl(CVType &CVR, RecordType &Record) {
97
11.2k
    return Mapping->Mapping.visitKnownRecord(CVR, Record);
98
11.2k
  }
llvm::Error llvm::codeview::TypeDeserializer::visitKnownRecordImpl<llvm::codeview::PointerRecord>(llvm::codeview::CVRecord<llvm::codeview::TypeLeafKind>&, llvm::codeview::PointerRecord&)
Line
Count
Source
96
1.38k
  Error visitKnownRecordImpl(CVType &CVR, RecordType &Record) {
97
1.38k
    return Mapping->Mapping.visitKnownRecord(CVR, Record);
98
1.38k
  }
llvm::Error llvm::codeview::TypeDeserializer::visitKnownRecordImpl<llvm::codeview::ModifierRecord>(llvm::codeview::CVRecord<llvm::codeview::TypeLeafKind>&, llvm::codeview::ModifierRecord&)
Line
Count
Source
96
223
  Error visitKnownRecordImpl(CVType &CVR, RecordType &Record) {
97
223
    return Mapping->Mapping.visitKnownRecord(CVR, Record);
98
223
  }
llvm::Error llvm::codeview::TypeDeserializer::visitKnownRecordImpl<llvm::codeview::ProcedureRecord>(llvm::codeview::CVRecord<llvm::codeview::TypeLeafKind>&, llvm::codeview::ProcedureRecord&)
Line
Count
Source
96
471
  Error visitKnownRecordImpl(CVType &CVR, RecordType &Record) {
97
471
    return Mapping->Mapping.visitKnownRecord(CVR, Record);
98
471
  }
llvm::Error llvm::codeview::TypeDeserializer::visitKnownRecordImpl<llvm::codeview::MemberFunctionRecord>(llvm::codeview::CVRecord<llvm::codeview::TypeLeafKind>&, llvm::codeview::MemberFunctionRecord&)
Line
Count
Source
96
1.52k
  Error visitKnownRecordImpl(CVType &CVR, RecordType &Record) {
97
1.52k
    return Mapping->Mapping.visitKnownRecord(CVR, Record);
98
1.52k
  }
llvm::Error llvm::codeview::TypeDeserializer::visitKnownRecordImpl<llvm::codeview::LabelRecord>(llvm::codeview::CVRecord<llvm::codeview::TypeLeafKind>&, llvm::codeview::LabelRecord&)
Line
Count
Source
96
1
  Error visitKnownRecordImpl(CVType &CVR, RecordType &Record) {
97
1
    return Mapping->Mapping.visitKnownRecord(CVR, Record);
98
1
  }
llvm::Error llvm::codeview::TypeDeserializer::visitKnownRecordImpl<llvm::codeview::ArgListRecord>(llvm::codeview::CVRecord<llvm::codeview::TypeLeafKind>&, llvm::codeview::ArgListRecord&)
Line
Count
Source
96
837
  Error visitKnownRecordImpl(CVType &CVR, RecordType &Record) {
97
837
    return Mapping->Mapping.visitKnownRecord(CVR, Record);
98
837
  }
llvm::Error llvm::codeview::TypeDeserializer::visitKnownRecordImpl<llvm::codeview::FieldListRecord>(llvm::codeview::CVRecord<llvm::codeview::TypeLeafKind>&, llvm::codeview::FieldListRecord&)
Line
Count
Source
96
1.31k
  Error visitKnownRecordImpl(CVType &CVR, RecordType &Record) {
97
1.31k
    return Mapping->Mapping.visitKnownRecord(CVR, Record);
98
1.31k
  }
llvm::Error llvm::codeview::TypeDeserializer::visitKnownRecordImpl<llvm::codeview::ArrayRecord>(llvm::codeview::CVRecord<llvm::codeview::TypeLeafKind>&, llvm::codeview::ArrayRecord&)
Line
Count
Source
96
92
  Error visitKnownRecordImpl(CVType &CVR, RecordType &Record) {
97
92
    return Mapping->Mapping.visitKnownRecord(CVR, Record);
98
92
  }
llvm::Error llvm::codeview::TypeDeserializer::visitKnownRecordImpl<llvm::codeview::ClassRecord>(llvm::codeview::CVRecord<llvm::codeview::TypeLeafKind>&, llvm::codeview::ClassRecord&)
Line
Count
Source
96
2.23k
  Error visitKnownRecordImpl(CVType &CVR, RecordType &Record) {
97
2.23k
    return Mapping->Mapping.visitKnownRecord(CVR, Record);
98
2.23k
  }
llvm::Error llvm::codeview::TypeDeserializer::visitKnownRecordImpl<llvm::codeview::UnionRecord>(llvm::codeview::CVRecord<llvm::codeview::TypeLeafKind>&, llvm::codeview::UnionRecord&)
Line
Count
Source
96
39
  Error visitKnownRecordImpl(CVType &CVR, RecordType &Record) {
97
39
    return Mapping->Mapping.visitKnownRecord(CVR, Record);
98
39
  }
llvm::Error llvm::codeview::TypeDeserializer::visitKnownRecordImpl<llvm::codeview::EnumRecord>(llvm::codeview::CVRecord<llvm::codeview::TypeLeafKind>&, llvm::codeview::EnumRecord&)
Line
Count
Source
96
256
  Error visitKnownRecordImpl(CVType &CVR, RecordType &Record) {
97
256
    return Mapping->Mapping.visitKnownRecord(CVR, Record);
98
256
  }
Unexecuted instantiation: llvm::Error llvm::codeview::TypeDeserializer::visitKnownRecordImpl<llvm::codeview::TypeServer2Record>(llvm::codeview::CVRecord<llvm::codeview::TypeLeafKind>&, llvm::codeview::TypeServer2Record&)
llvm::Error llvm::codeview::TypeDeserializer::visitKnownRecordImpl<llvm::codeview::VFTableRecord>(llvm::codeview::CVRecord<llvm::codeview::TypeLeafKind>&, llvm::codeview::VFTableRecord&)
Line
Count
Source
96
11
  Error visitKnownRecordImpl(CVType &CVR, RecordType &Record) {
97
11
    return Mapping->Mapping.visitKnownRecord(CVR, Record);
98
11
  }
llvm::Error llvm::codeview::TypeDeserializer::visitKnownRecordImpl<llvm::codeview::VFTableShapeRecord>(llvm::codeview::CVRecord<llvm::codeview::TypeLeafKind>&, llvm::codeview::VFTableShapeRecord&)
Line
Count
Source
96
38
  Error visitKnownRecordImpl(CVType &CVR, RecordType &Record) {
97
38
    return Mapping->Mapping.visitKnownRecord(CVR, Record);
98
38
  }
llvm::Error llvm::codeview::TypeDeserializer::visitKnownRecordImpl<llvm::codeview::BitFieldRecord>(llvm::codeview::CVRecord<llvm::codeview::TypeLeafKind>&, llvm::codeview::BitFieldRecord&)
Line
Count
Source
96
18
  Error visitKnownRecordImpl(CVType &CVR, RecordType &Record) {
97
18
    return Mapping->Mapping.visitKnownRecord(CVR, Record);
98
18
  }
llvm::Error llvm::codeview::TypeDeserializer::visitKnownRecordImpl<llvm::codeview::FuncIdRecord>(llvm::codeview::CVRecord<llvm::codeview::TypeLeafKind>&, llvm::codeview::FuncIdRecord&)
Line
Count
Source
96
474
  Error visitKnownRecordImpl(CVType &CVR, RecordType &Record) {
97
474
    return Mapping->Mapping.visitKnownRecord(CVR, Record);
98
474
  }
llvm::Error llvm::codeview::TypeDeserializer::visitKnownRecordImpl<llvm::codeview::MemberFuncIdRecord>(llvm::codeview::CVRecord<llvm::codeview::TypeLeafKind>&, llvm::codeview::MemberFuncIdRecord&)
Line
Count
Source
96
106
  Error visitKnownRecordImpl(CVType &CVR, RecordType &Record) {
97
106
    return Mapping->Mapping.visitKnownRecord(CVR, Record);
98
106
  }
llvm::Error llvm::codeview::TypeDeserializer::visitKnownRecordImpl<llvm::codeview::BuildInfoRecord>(llvm::codeview::CVRecord<llvm::codeview::TypeLeafKind>&, llvm::codeview::BuildInfoRecord&)
Line
Count
Source
96
266
  Error visitKnownRecordImpl(CVType &CVR, RecordType &Record) {
97
266
    return Mapping->Mapping.visitKnownRecord(CVR, Record);
98
266
  }
llvm::Error llvm::codeview::TypeDeserializer::visitKnownRecordImpl<llvm::codeview::StringListRecord>(llvm::codeview::CVRecord<llvm::codeview::TypeLeafKind>&, llvm::codeview::StringListRecord&)
Line
Count
Source
96
48
  Error visitKnownRecordImpl(CVType &CVR, RecordType &Record) {
97
48
    return Mapping->Mapping.visitKnownRecord(CVR, Record);
98
48
  }
llvm::Error llvm::codeview::TypeDeserializer::visitKnownRecordImpl<llvm::codeview::StringIdRecord>(llvm::codeview::CVRecord<llvm::codeview::TypeLeafKind>&, llvm::codeview::StringIdRecord&)
Line
Count
Source
96
1.05k
  Error visitKnownRecordImpl(CVType &CVR, RecordType &Record) {
97
1.05k
    return Mapping->Mapping.visitKnownRecord(CVR, Record);
98
1.05k
  }
llvm::Error llvm::codeview::TypeDeserializer::visitKnownRecordImpl<llvm::codeview::UdtSourceLineRecord>(llvm::codeview::CVRecord<llvm::codeview::TypeLeafKind>&, llvm::codeview::UdtSourceLineRecord&)
Line
Count
Source
96
555
  Error visitKnownRecordImpl(CVType &CVR, RecordType &Record) {
97
555
    return Mapping->Mapping.visitKnownRecord(CVR, Record);
98
555
  }
llvm::Error llvm::codeview::TypeDeserializer::visitKnownRecordImpl<llvm::codeview::UdtModSourceLineRecord>(llvm::codeview::CVRecord<llvm::codeview::TypeLeafKind>&, llvm::codeview::UdtModSourceLineRecord&)
Line
Count
Source
96
8
  Error visitKnownRecordImpl(CVType &CVR, RecordType &Record) {
97
8
    return Mapping->Mapping.visitKnownRecord(CVR, Record);
98
8
  }
llvm::Error llvm::codeview::TypeDeserializer::visitKnownRecordImpl<llvm::codeview::MethodOverloadListRecord>(llvm::codeview::CVRecord<llvm::codeview::TypeLeafKind>&, llvm::codeview::MethodOverloadListRecord&)
Line
Count
Source
96
325
  Error visitKnownRecordImpl(CVType &CVR, RecordType &Record) {
97
325
    return Mapping->Mapping.visitKnownRecord(CVR, Record);
98
325
  }
llvm::Error llvm::codeview::TypeDeserializer::visitKnownRecordImpl<llvm::codeview::PrecompRecord>(llvm::codeview::CVRecord<llvm::codeview::TypeLeafKind>&, llvm::codeview::PrecompRecord&)
Line
Count
Source
96
2
  Error visitKnownRecordImpl(CVType &CVR, RecordType &Record) {
97
2
    return Mapping->Mapping.visitKnownRecord(CVR, Record);
98
2
  }
llvm::Error llvm::codeview::TypeDeserializer::visitKnownRecordImpl<llvm::codeview::EndPrecompRecord>(llvm::codeview::CVRecord<llvm::codeview::TypeLeafKind>&, llvm::codeview::EndPrecompRecord&)
Line
Count
Source
96
2
  Error visitKnownRecordImpl(CVType &CVR, RecordType &Record) {
97
2
    return Mapping->Mapping.visitKnownRecord(CVR, Record);
98
2
  }
99
100
  std::unique_ptr<MappingInfo> Mapping;
101
};
102
103
class FieldListDeserializer : public TypeVisitorCallbacks {
104
  struct MappingInfo {
105
    explicit MappingInfo(BinaryStreamReader &R)
106
1.22k
        : Reader(R), Mapping(Reader), StartOffset(0) {}
107
108
    BinaryStreamReader &Reader;
109
    TypeRecordMapping Mapping;
110
    uint32_t StartOffset;
111
  };
112
113
public:
114
1.22k
  explicit FieldListDeserializer(BinaryStreamReader &Reader) : Mapping(Reader) {
115
1.22k
    CVType FieldList;
116
1.22k
    FieldList.Type = TypeLeafKind::LF_FIELDLIST;
117
1.22k
    consumeError(Mapping.Mapping.visitTypeBegin(FieldList));
118
1.22k
  }
119
120
1.22k
  ~FieldListDeserializer() override {
121
1.22k
    CVType FieldList;
122
1.22k
    FieldList.Type = TypeLeafKind::LF_FIELDLIST;
123
1.22k
    consumeError(Mapping.Mapping.visitTypeEnd(FieldList));
124
1.22k
  }
125
126
10.2k
  Error visitMemberBegin(CVMemberRecord &Record) override {
127
10.2k
    Mapping.StartOffset = Mapping.Reader.getOffset();
128
10.2k
    return Mapping.Mapping.visitMemberBegin(Record);
129
10.2k
  }
130
131
10.2k
  Error visitMemberEnd(CVMemberRecord &Record) override {
132
10.2k
    if (auto EC = Mapping.Mapping.visitMemberEnd(Record))
133
0
      return EC;
134
10.2k
    return Error::success();
135
10.2k
  }
136
137
#define TYPE_RECORD(EnumName, EnumVal, Name)
138
#define MEMBER_RECORD(EnumName, EnumVal, Name)                                 \
139
10.2k
  Error visitKnownMember(CVMemberRecord &CVR, Name##Record &Record) override { \
140
10.2k
    return visitKnownMemberImpl<Name##Record>(CVR, Record);                    \
141
10.2k
  }
llvm::codeview::FieldListDeserializer::visitKnownMember(llvm::codeview::CVMemberRecord&, llvm::codeview::BaseClassRecord&)
Line
Count
Source
139
27
  Error visitKnownMember(CVMemberRecord &CVR, Name##Record &Record) override { \
140
27
    return visitKnownMemberImpl<Name##Record>(CVR, Record);                    \
141
27
  }
llvm::codeview::FieldListDeserializer::visitKnownMember(llvm::codeview::CVMemberRecord&, llvm::codeview::VirtualBaseClassRecord&)
Line
Count
Source
139
21
  Error visitKnownMember(CVMemberRecord &CVR, Name##Record &Record) override { \
140
21
    return visitKnownMemberImpl<Name##Record>(CVR, Record);                    \
141
21
  }
llvm::codeview::FieldListDeserializer::visitKnownMember(llvm::codeview::CVMemberRecord&, llvm::codeview::VFPtrRecord&)
Line
Count
Source
139
19
  Error visitKnownMember(CVMemberRecord &CVR, Name##Record &Record) override { \
140
19
    return visitKnownMemberImpl<Name##Record>(CVR, Record);                    \
141
19
  }
llvm::codeview::FieldListDeserializer::visitKnownMember(llvm::codeview::CVMemberRecord&, llvm::codeview::StaticDataMemberRecord&)
Line
Count
Source
139
194
  Error visitKnownMember(CVMemberRecord &CVR, Name##Record &Record) override { \
140
194
    return visitKnownMemberImpl<Name##Record>(CVR, Record);                    \
141
194
  }
llvm::codeview::FieldListDeserializer::visitKnownMember(llvm::codeview::CVMemberRecord&, llvm::codeview::OverloadedMethodRecord&)
Line
Count
Source
139
317
  Error visitKnownMember(CVMemberRecord &CVR, Name##Record &Record) override { \
140
317
    return visitKnownMemberImpl<Name##Record>(CVR, Record);                    \
141
317
  }
llvm::codeview::FieldListDeserializer::visitKnownMember(llvm::codeview::CVMemberRecord&, llvm::codeview::DataMemberRecord&)
Line
Count
Source
139
1.64k
  Error visitKnownMember(CVMemberRecord &CVR, Name##Record &Record) override { \
140
1.64k
    return visitKnownMemberImpl<Name##Record>(CVR, Record);                    \
141
1.64k
  }
llvm::codeview::FieldListDeserializer::visitKnownMember(llvm::codeview::CVMemberRecord&, llvm::codeview::NestedTypeRecord&)
Line
Count
Source
139
207
  Error visitKnownMember(CVMemberRecord &CVR, Name##Record &Record) override { \
140
207
    return visitKnownMemberImpl<Name##Record>(CVR, Record);                    \
141
207
  }
llvm::codeview::FieldListDeserializer::visitKnownMember(llvm::codeview::CVMemberRecord&, llvm::codeview::OneMethodRecord&)
Line
Count
Source
139
609
  Error visitKnownMember(CVMemberRecord &CVR, Name##Record &Record) override { \
140
609
    return visitKnownMemberImpl<Name##Record>(CVR, Record);                    \
141
609
  }
llvm::codeview::FieldListDeserializer::visitKnownMember(llvm::codeview::CVMemberRecord&, llvm::codeview::EnumeratorRecord&)
Line
Count
Source
139
7.15k
  Error visitKnownMember(CVMemberRecord &CVR, Name##Record &Record) override { \
140
7.15k
    return visitKnownMemberImpl<Name##Record>(CVR, Record);                    \
141
7.15k
  }
llvm::codeview::FieldListDeserializer::visitKnownMember(llvm::codeview::CVMemberRecord&, llvm::codeview::ListContinuationRecord&)
Line
Count
Source
139
4
  Error visitKnownMember(CVMemberRecord &CVR, Name##Record &Record) override { \
140
4
    return visitKnownMemberImpl<Name##Record>(CVR, Record);                    \
141
4
  }
142
#define TYPE_RECORD_ALIAS(EnumName, EnumVal, Name, AliasName)
143
#define MEMBER_RECORD_ALIAS(EnumName, EnumVal, Name, AliasName)
144
#include "llvm/DebugInfo/CodeView/CodeViewTypes.def"
145
146
private:
147
  template <typename RecordType>
148
10.2k
  Error visitKnownMemberImpl(CVMemberRecord &CVR, RecordType &Record) {
149
10.2k
    if (auto EC = Mapping.Mapping.visitKnownMember(CVR, Record))
150
0
      return EC;
151
10.2k
152
10.2k
    uint32_t EndOffset = Mapping.Reader.getOffset();
153
10.2k
    uint32_t RecordLength = EndOffset - Mapping.StartOffset;
154
10.2k
    Mapping.Reader.setOffset(Mapping.StartOffset);
155
10.2k
    if (auto EC = Mapping.Reader.readBytes(CVR.Data, RecordLength))
156
0
      return EC;
157
10.2k
    assert(Mapping.Reader.getOffset() == EndOffset);
158
10.2k
    return Error::success();
159
10.2k
  }
llvm::Error llvm::codeview::FieldListDeserializer::visitKnownMemberImpl<llvm::codeview::BaseClassRecord>(llvm::codeview::CVMemberRecord&, llvm::codeview::BaseClassRecord&)
Line
Count
Source
148
27
  Error visitKnownMemberImpl(CVMemberRecord &CVR, RecordType &Record) {
149
27
    if (auto EC = Mapping.Mapping.visitKnownMember(CVR, Record))
150
0
      return EC;
151
27
152
27
    uint32_t EndOffset = Mapping.Reader.getOffset();
153
27
    uint32_t RecordLength = EndOffset - Mapping.StartOffset;
154
27
    Mapping.Reader.setOffset(Mapping.StartOffset);
155
27
    if (auto EC = Mapping.Reader.readBytes(CVR.Data, RecordLength))
156
0
      return EC;
157
27
    assert(Mapping.Reader.getOffset() == EndOffset);
158
27
    return Error::success();
159
27
  }
llvm::Error llvm::codeview::FieldListDeserializer::visitKnownMemberImpl<llvm::codeview::VirtualBaseClassRecord>(llvm::codeview::CVMemberRecord&, llvm::codeview::VirtualBaseClassRecord&)
Line
Count
Source
148
21
  Error visitKnownMemberImpl(CVMemberRecord &CVR, RecordType &Record) {
149
21
    if (auto EC = Mapping.Mapping.visitKnownMember(CVR, Record))
150
0
      return EC;
151
21
152
21
    uint32_t EndOffset = Mapping.Reader.getOffset();
153
21
    uint32_t RecordLength = EndOffset - Mapping.StartOffset;
154
21
    Mapping.Reader.setOffset(Mapping.StartOffset);
155
21
    if (auto EC = Mapping.Reader.readBytes(CVR.Data, RecordLength))
156
0
      return EC;
157
21
    assert(Mapping.Reader.getOffset() == EndOffset);
158
21
    return Error::success();
159
21
  }
llvm::Error llvm::codeview::FieldListDeserializer::visitKnownMemberImpl<llvm::codeview::VFPtrRecord>(llvm::codeview::CVMemberRecord&, llvm::codeview::VFPtrRecord&)
Line
Count
Source
148
19
  Error visitKnownMemberImpl(CVMemberRecord &CVR, RecordType &Record) {
149
19
    if (auto EC = Mapping.Mapping.visitKnownMember(CVR, Record))
150
0
      return EC;
151
19
152
19
    uint32_t EndOffset = Mapping.Reader.getOffset();
153
19
    uint32_t RecordLength = EndOffset - Mapping.StartOffset;
154
19
    Mapping.Reader.setOffset(Mapping.StartOffset);
155
19
    if (auto EC = Mapping.Reader.readBytes(CVR.Data, RecordLength))
156
0
      return EC;
157
19
    assert(Mapping.Reader.getOffset() == EndOffset);
158
19
    return Error::success();
159
19
  }
llvm::Error llvm::codeview::FieldListDeserializer::visitKnownMemberImpl<llvm::codeview::StaticDataMemberRecord>(llvm::codeview::CVMemberRecord&, llvm::codeview::StaticDataMemberRecord&)
Line
Count
Source
148
194
  Error visitKnownMemberImpl(CVMemberRecord &CVR, RecordType &Record) {
149
194
    if (auto EC = Mapping.Mapping.visitKnownMember(CVR, Record))
150
0
      return EC;
151
194
152
194
    uint32_t EndOffset = Mapping.Reader.getOffset();
153
194
    uint32_t RecordLength = EndOffset - Mapping.StartOffset;
154
194
    Mapping.Reader.setOffset(Mapping.StartOffset);
155
194
    if (auto EC = Mapping.Reader.readBytes(CVR.Data, RecordLength))
156
0
      return EC;
157
194
    assert(Mapping.Reader.getOffset() == EndOffset);
158
194
    return Error::success();
159
194
  }
llvm::Error llvm::codeview::FieldListDeserializer::visitKnownMemberImpl<llvm::codeview::OverloadedMethodRecord>(llvm::codeview::CVMemberRecord&, llvm::codeview::OverloadedMethodRecord&)
Line
Count
Source
148
317
  Error visitKnownMemberImpl(CVMemberRecord &CVR, RecordType &Record) {
149
317
    if (auto EC = Mapping.Mapping.visitKnownMember(CVR, Record))
150
0
      return EC;
151
317
152
317
    uint32_t EndOffset = Mapping.Reader.getOffset();
153
317
    uint32_t RecordLength = EndOffset - Mapping.StartOffset;
154
317
    Mapping.Reader.setOffset(Mapping.StartOffset);
155
317
    if (auto EC = Mapping.Reader.readBytes(CVR.Data, RecordLength))
156
0
      return EC;
157
317
    assert(Mapping.Reader.getOffset() == EndOffset);
158
317
    return Error::success();
159
317
  }
llvm::Error llvm::codeview::FieldListDeserializer::visitKnownMemberImpl<llvm::codeview::DataMemberRecord>(llvm::codeview::CVMemberRecord&, llvm::codeview::DataMemberRecord&)
Line
Count
Source
148
1.64k
  Error visitKnownMemberImpl(CVMemberRecord &CVR, RecordType &Record) {
149
1.64k
    if (auto EC = Mapping.Mapping.visitKnownMember(CVR, Record))
150
0
      return EC;
151
1.64k
152
1.64k
    uint32_t EndOffset = Mapping.Reader.getOffset();
153
1.64k
    uint32_t RecordLength = EndOffset - Mapping.StartOffset;
154
1.64k
    Mapping.Reader.setOffset(Mapping.StartOffset);
155
1.64k
    if (auto EC = Mapping.Reader.readBytes(CVR.Data, RecordLength))
156
0
      return EC;
157
1.64k
    assert(Mapping.Reader.getOffset() == EndOffset);
158
1.64k
    return Error::success();
159
1.64k
  }
llvm::Error llvm::codeview::FieldListDeserializer::visitKnownMemberImpl<llvm::codeview::NestedTypeRecord>(llvm::codeview::CVMemberRecord&, llvm::codeview::NestedTypeRecord&)
Line
Count
Source
148
207
  Error visitKnownMemberImpl(CVMemberRecord &CVR, RecordType &Record) {
149
207
    if (auto EC = Mapping.Mapping.visitKnownMember(CVR, Record))
150
0
      return EC;
151
207
152
207
    uint32_t EndOffset = Mapping.Reader.getOffset();
153
207
    uint32_t RecordLength = EndOffset - Mapping.StartOffset;
154
207
    Mapping.Reader.setOffset(Mapping.StartOffset);
155
207
    if (auto EC = Mapping.Reader.readBytes(CVR.Data, RecordLength))
156
0
      return EC;
157
207
    assert(Mapping.Reader.getOffset() == EndOffset);
158
207
    return Error::success();
159
207
  }
llvm::Error llvm::codeview::FieldListDeserializer::visitKnownMemberImpl<llvm::codeview::OneMethodRecord>(llvm::codeview::CVMemberRecord&, llvm::codeview::OneMethodRecord&)
Line
Count
Source
148
609
  Error visitKnownMemberImpl(CVMemberRecord &CVR, RecordType &Record) {
149
609
    if (auto EC = Mapping.Mapping.visitKnownMember(CVR, Record))
150
0
      return EC;
151
609
152
609
    uint32_t EndOffset = Mapping.Reader.getOffset();
153
609
    uint32_t RecordLength = EndOffset - Mapping.StartOffset;
154
609
    Mapping.Reader.setOffset(Mapping.StartOffset);
155
609
    if (auto EC = Mapping.Reader.readBytes(CVR.Data, RecordLength))
156
0
      return EC;
157
609
    assert(Mapping.Reader.getOffset() == EndOffset);
158
609
    return Error::success();
159
609
  }
llvm::Error llvm::codeview::FieldListDeserializer::visitKnownMemberImpl<llvm::codeview::EnumeratorRecord>(llvm::codeview::CVMemberRecord&, llvm::codeview::EnumeratorRecord&)
Line
Count
Source
148
7.15k
  Error visitKnownMemberImpl(CVMemberRecord &CVR, RecordType &Record) {
149
7.15k
    if (auto EC = Mapping.Mapping.visitKnownMember(CVR, Record))
150
0
      return EC;
151
7.15k
152
7.15k
    uint32_t EndOffset = Mapping.Reader.getOffset();
153
7.15k
    uint32_t RecordLength = EndOffset - Mapping.StartOffset;
154
7.15k
    Mapping.Reader.setOffset(Mapping.StartOffset);
155
7.15k
    if (auto EC = Mapping.Reader.readBytes(CVR.Data, RecordLength))
156
0
      return EC;
157
7.15k
    assert(Mapping.Reader.getOffset() == EndOffset);
158
7.15k
    return Error::success();
159
7.15k
  }
llvm::Error llvm::codeview::FieldListDeserializer::visitKnownMemberImpl<llvm::codeview::ListContinuationRecord>(llvm::codeview::CVMemberRecord&, llvm::codeview::ListContinuationRecord&)
Line
Count
Source
148
4
  Error visitKnownMemberImpl(CVMemberRecord &CVR, RecordType &Record) {
149
4
    if (auto EC = Mapping.Mapping.visitKnownMember(CVR, Record))
150
0
      return EC;
151
4
152
4
    uint32_t EndOffset = Mapping.Reader.getOffset();
153
4
    uint32_t RecordLength = EndOffset - Mapping.StartOffset;
154
4
    Mapping.Reader.setOffset(Mapping.StartOffset);
155
4
    if (auto EC = Mapping.Reader.readBytes(CVR.Data, RecordLength))
156
0
      return EC;
157
4
    assert(Mapping.Reader.getOffset() == EndOffset);
158
4
    return Error::success();
159
4
  }
160
  MappingInfo Mapping;
161
};
162
163
} // end namespace codeview
164
} // end namespace llvm
165
166
#endif // LLVM_DEBUGINFO_CODEVIEW_TYPEDESERIALIZER_H