/Users/buildslave/jenkins/workspace/clang-stage2-coverage-R/llvm/lib/DebugInfo/CodeView/CVTypeVisitor.cpp
Line | Count | Source (jump to first uncovered line) |
1 | | //===- CVTypeVisitor.cpp ----------------------------------------*- C++ -*-===// |
2 | | // |
3 | | // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. |
4 | | // See https://llvm.org/LICENSE.txt for license information. |
5 | | // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception |
6 | | // |
7 | | //===----------------------------------------------------------------------===// |
8 | | |
9 | | #include "llvm/DebugInfo/CodeView/CVTypeVisitor.h" |
10 | | |
11 | | #include "llvm/DebugInfo/CodeView/CodeViewError.h" |
12 | | #include "llvm/DebugInfo/CodeView/TypeCollection.h" |
13 | | #include "llvm/DebugInfo/CodeView/TypeDeserializer.h" |
14 | | #include "llvm/DebugInfo/CodeView/TypeRecordMapping.h" |
15 | | #include "llvm/DebugInfo/CodeView/TypeVisitorCallbackPipeline.h" |
16 | | #include "llvm/Support/BinaryByteStream.h" |
17 | | #include "llvm/Support/BinaryStreamReader.h" |
18 | | |
19 | | using namespace llvm; |
20 | | using namespace llvm::codeview; |
21 | | |
22 | | |
23 | | template <typename T> |
24 | 17.1k | static Error visitKnownRecord(CVType &Record, TypeVisitorCallbacks &Callbacks) { |
25 | 17.1k | TypeRecordKind RK = static_cast<TypeRecordKind>(Record.kind()); |
26 | 17.1k | T KnownRecord(RK); |
27 | 17.1k | if (auto EC = Callbacks.visitKnownRecord(Record, KnownRecord)) |
28 | 0 | return EC; |
29 | 17.1k | return Error::success(); |
30 | 17.1k | } CVTypeVisitor.cpp:llvm::Error visitKnownRecord<llvm::codeview::PointerRecord>(llvm::codeview::CVRecord<llvm::codeview::TypeLeafKind>&, llvm::codeview::TypeVisitorCallbacks&) Line | Count | Source | 24 | 2.20k | static Error visitKnownRecord(CVType &Record, TypeVisitorCallbacks &Callbacks) { | 25 | 2.20k | TypeRecordKind RK = static_cast<TypeRecordKind>(Record.kind()); | 26 | 2.20k | T KnownRecord(RK); | 27 | 2.20k | if (auto EC = Callbacks.visitKnownRecord(Record, KnownRecord)) | 28 | 0 | return EC; | 29 | 2.20k | return Error::success(); | 30 | 2.20k | } |
CVTypeVisitor.cpp:llvm::Error visitKnownRecord<llvm::codeview::ModifierRecord>(llvm::codeview::CVRecord<llvm::codeview::TypeLeafKind>&, llvm::codeview::TypeVisitorCallbacks&) Line | Count | Source | 24 | 332 | static Error visitKnownRecord(CVType &Record, TypeVisitorCallbacks &Callbacks) { | 25 | 332 | TypeRecordKind RK = static_cast<TypeRecordKind>(Record.kind()); | 26 | 332 | T KnownRecord(RK); | 27 | 332 | if (auto EC = Callbacks.visitKnownRecord(Record, KnownRecord)) | 28 | 0 | return EC; | 29 | 332 | return Error::success(); | 30 | 332 | } |
CVTypeVisitor.cpp:llvm::Error visitKnownRecord<llvm::codeview::ProcedureRecord>(llvm::codeview::CVRecord<llvm::codeview::TypeLeafKind>&, llvm::codeview::TypeVisitorCallbacks&) Line | Count | Source | 24 | 903 | static Error visitKnownRecord(CVType &Record, TypeVisitorCallbacks &Callbacks) { | 25 | 903 | TypeRecordKind RK = static_cast<TypeRecordKind>(Record.kind()); | 26 | 903 | T KnownRecord(RK); | 27 | 903 | if (auto EC = Callbacks.visitKnownRecord(Record, KnownRecord)) | 28 | 0 | return EC; | 29 | 903 | return Error::success(); | 30 | 903 | } |
CVTypeVisitor.cpp:llvm::Error visitKnownRecord<llvm::codeview::MemberFunctionRecord>(llvm::codeview::CVRecord<llvm::codeview::TypeLeafKind>&, llvm::codeview::TypeVisitorCallbacks&) Line | Count | Source | 24 | 1.87k | static Error visitKnownRecord(CVType &Record, TypeVisitorCallbacks &Callbacks) { | 25 | 1.87k | TypeRecordKind RK = static_cast<TypeRecordKind>(Record.kind()); | 26 | 1.87k | T KnownRecord(RK); | 27 | 1.87k | if (auto EC = Callbacks.visitKnownRecord(Record, KnownRecord)) | 28 | 0 | return EC; | 29 | 1.87k | return Error::success(); | 30 | 1.87k | } |
CVTypeVisitor.cpp:llvm::Error visitKnownRecord<llvm::codeview::LabelRecord>(llvm::codeview::CVRecord<llvm::codeview::TypeLeafKind>&, llvm::codeview::TypeVisitorCallbacks&) Line | Count | Source | 24 | 1 | static Error visitKnownRecord(CVType &Record, TypeVisitorCallbacks &Callbacks) { | 25 | 1 | TypeRecordKind RK = static_cast<TypeRecordKind>(Record.kind()); | 26 | 1 | T KnownRecord(RK); | 27 | 1 | if (auto EC = Callbacks.visitKnownRecord(Record, KnownRecord)) | 28 | 0 | return EC; | 29 | 1 | return Error::success(); | 30 | 1 | } |
CVTypeVisitor.cpp:llvm::Error visitKnownRecord<llvm::codeview::ArgListRecord>(llvm::codeview::CVRecord<llvm::codeview::TypeLeafKind>&, llvm::codeview::TypeVisitorCallbacks&) Line | Count | Source | 24 | 1.33k | static Error visitKnownRecord(CVType &Record, TypeVisitorCallbacks &Callbacks) { | 25 | 1.33k | TypeRecordKind RK = static_cast<TypeRecordKind>(Record.kind()); | 26 | 1.33k | T KnownRecord(RK); | 27 | 1.33k | if (auto EC = Callbacks.visitKnownRecord(Record, KnownRecord)) | 28 | 0 | return EC; | 29 | 1.33k | return Error::success(); | 30 | 1.33k | } |
CVTypeVisitor.cpp:llvm::Error visitKnownRecord<llvm::codeview::FieldListRecord>(llvm::codeview::CVRecord<llvm::codeview::TypeLeafKind>&, llvm::codeview::TypeVisitorCallbacks&) Line | Count | Source | 24 | 1.88k | static Error visitKnownRecord(CVType &Record, TypeVisitorCallbacks &Callbacks) { | 25 | 1.88k | TypeRecordKind RK = static_cast<TypeRecordKind>(Record.kind()); | 26 | 1.88k | T KnownRecord(RK); | 27 | 1.88k | if (auto EC = Callbacks.visitKnownRecord(Record, KnownRecord)) | 28 | 0 | return EC; | 29 | 1.88k | return Error::success(); | 30 | 1.88k | } |
CVTypeVisitor.cpp:llvm::Error visitKnownRecord<llvm::codeview::ArrayRecord>(llvm::codeview::CVRecord<llvm::codeview::TypeLeafKind>&, llvm::codeview::TypeVisitorCallbacks&) Line | Count | Source | 24 | 147 | static Error visitKnownRecord(CVType &Record, TypeVisitorCallbacks &Callbacks) { | 25 | 147 | TypeRecordKind RK = static_cast<TypeRecordKind>(Record.kind()); | 26 | 147 | T KnownRecord(RK); | 27 | 147 | if (auto EC = Callbacks.visitKnownRecord(Record, KnownRecord)) | 28 | 0 | return EC; | 29 | 147 | return Error::success(); | 30 | 147 | } |
CVTypeVisitor.cpp:llvm::Error visitKnownRecord<llvm::codeview::ClassRecord>(llvm::codeview::CVRecord<llvm::codeview::TypeLeafKind>&, llvm::codeview::TypeVisitorCallbacks&) Line | Count | Source | 24 | 3.18k | static Error visitKnownRecord(CVType &Record, TypeVisitorCallbacks &Callbacks) { | 25 | 3.18k | TypeRecordKind RK = static_cast<TypeRecordKind>(Record.kind()); | 26 | 3.18k | T KnownRecord(RK); | 27 | 3.18k | if (auto EC = Callbacks.visitKnownRecord(Record, KnownRecord)) | 28 | 0 | return EC; | 29 | 3.18k | return Error::success(); | 30 | 3.18k | } |
CVTypeVisitor.cpp:llvm::Error visitKnownRecord<llvm::codeview::UnionRecord>(llvm::codeview::CVRecord<llvm::codeview::TypeLeafKind>&, llvm::codeview::TypeVisitorCallbacks&) Line | Count | Source | 24 | 151 | static Error visitKnownRecord(CVType &Record, TypeVisitorCallbacks &Callbacks) { | 25 | 151 | TypeRecordKind RK = static_cast<TypeRecordKind>(Record.kind()); | 26 | 151 | T KnownRecord(RK); | 27 | 151 | if (auto EC = Callbacks.visitKnownRecord(Record, KnownRecord)) | 28 | 0 | return EC; | 29 | 151 | return Error::success(); | 30 | 151 | } |
CVTypeVisitor.cpp:llvm::Error visitKnownRecord<llvm::codeview::EnumRecord>(llvm::codeview::CVRecord<llvm::codeview::TypeLeafKind>&, llvm::codeview::TypeVisitorCallbacks&) Line | Count | Source | 24 | 322 | static Error visitKnownRecord(CVType &Record, TypeVisitorCallbacks &Callbacks) { | 25 | 322 | TypeRecordKind RK = static_cast<TypeRecordKind>(Record.kind()); | 26 | 322 | T KnownRecord(RK); | 27 | 322 | if (auto EC = Callbacks.visitKnownRecord(Record, KnownRecord)) | 28 | 0 | return EC; | 29 | 322 | return Error::success(); | 30 | 322 | } |
Unexecuted instantiation: CVTypeVisitor.cpp:llvm::Error visitKnownRecord<llvm::codeview::TypeServer2Record>(llvm::codeview::CVRecord<llvm::codeview::TypeLeafKind>&, llvm::codeview::TypeVisitorCallbacks&) CVTypeVisitor.cpp:llvm::Error visitKnownRecord<llvm::codeview::VFTableRecord>(llvm::codeview::CVRecord<llvm::codeview::TypeLeafKind>&, llvm::codeview::TypeVisitorCallbacks&) Line | Count | Source | 24 | 11 | static Error visitKnownRecord(CVType &Record, TypeVisitorCallbacks &Callbacks) { | 25 | 11 | TypeRecordKind RK = static_cast<TypeRecordKind>(Record.kind()); | 26 | 11 | T KnownRecord(RK); | 27 | 11 | if (auto EC = Callbacks.visitKnownRecord(Record, KnownRecord)) | 28 | 0 | return EC; | 29 | 11 | return Error::success(); | 30 | 11 | } |
CVTypeVisitor.cpp:llvm::Error visitKnownRecord<llvm::codeview::VFTableShapeRecord>(llvm::codeview::CVRecord<llvm::codeview::TypeLeafKind>&, llvm::codeview::TypeVisitorCallbacks&) Line | Count | Source | 24 | 76 | static Error visitKnownRecord(CVType &Record, TypeVisitorCallbacks &Callbacks) { | 25 | 76 | TypeRecordKind RK = static_cast<TypeRecordKind>(Record.kind()); | 26 | 76 | T KnownRecord(RK); | 27 | 76 | if (auto EC = Callbacks.visitKnownRecord(Record, KnownRecord)) | 28 | 0 | return EC; | 29 | 76 | return Error::success(); | 30 | 76 | } |
CVTypeVisitor.cpp:llvm::Error visitKnownRecord<llvm::codeview::BitFieldRecord>(llvm::codeview::CVRecord<llvm::codeview::TypeLeafKind>&, llvm::codeview::TypeVisitorCallbacks&) Line | Count | Source | 24 | 23 | static Error visitKnownRecord(CVType &Record, TypeVisitorCallbacks &Callbacks) { | 25 | 23 | TypeRecordKind RK = static_cast<TypeRecordKind>(Record.kind()); | 26 | 23 | T KnownRecord(RK); | 27 | 23 | if (auto EC = Callbacks.visitKnownRecord(Record, KnownRecord)) | 28 | 0 | return EC; | 29 | 23 | return Error::success(); | 30 | 23 | } |
CVTypeVisitor.cpp:llvm::Error visitKnownRecord<llvm::codeview::FuncIdRecord>(llvm::codeview::CVRecord<llvm::codeview::TypeLeafKind>&, llvm::codeview::TypeVisitorCallbacks&) Line | Count | Source | 24 | 874 | static Error visitKnownRecord(CVType &Record, TypeVisitorCallbacks &Callbacks) { | 25 | 874 | TypeRecordKind RK = static_cast<TypeRecordKind>(Record.kind()); | 26 | 874 | T KnownRecord(RK); | 27 | 874 | if (auto EC = Callbacks.visitKnownRecord(Record, KnownRecord)) | 28 | 0 | return EC; | 29 | 874 | return Error::success(); | 30 | 874 | } |
CVTypeVisitor.cpp:llvm::Error visitKnownRecord<llvm::codeview::MemberFuncIdRecord>(llvm::codeview::CVRecord<llvm::codeview::TypeLeafKind>&, llvm::codeview::TypeVisitorCallbacks&) Line | Count | Source | 24 | 215 | static Error visitKnownRecord(CVType &Record, TypeVisitorCallbacks &Callbacks) { | 25 | 215 | TypeRecordKind RK = static_cast<TypeRecordKind>(Record.kind()); | 26 | 215 | T KnownRecord(RK); | 27 | 215 | if (auto EC = Callbacks.visitKnownRecord(Record, KnownRecord)) | 28 | 0 | return EC; | 29 | 215 | return Error::success(); | 30 | 215 | } |
CVTypeVisitor.cpp:llvm::Error visitKnownRecord<llvm::codeview::BuildInfoRecord>(llvm::codeview::CVRecord<llvm::codeview::TypeLeafKind>&, llvm::codeview::TypeVisitorCallbacks&) Line | Count | Source | 24 | 484 | static Error visitKnownRecord(CVType &Record, TypeVisitorCallbacks &Callbacks) { | 25 | 484 | TypeRecordKind RK = static_cast<TypeRecordKind>(Record.kind()); | 26 | 484 | T KnownRecord(RK); | 27 | 484 | if (auto EC = Callbacks.visitKnownRecord(Record, KnownRecord)) | 28 | 0 | return EC; | 29 | 484 | return Error::success(); | 30 | 484 | } |
CVTypeVisitor.cpp:llvm::Error visitKnownRecord<llvm::codeview::StringListRecord>(llvm::codeview::CVRecord<llvm::codeview::TypeLeafKind>&, llvm::codeview::TypeVisitorCallbacks&) Line | Count | Source | 24 | 48 | static Error visitKnownRecord(CVType &Record, TypeVisitorCallbacks &Callbacks) { | 25 | 48 | TypeRecordKind RK = static_cast<TypeRecordKind>(Record.kind()); | 26 | 48 | T KnownRecord(RK); | 27 | 48 | if (auto EC = Callbacks.visitKnownRecord(Record, KnownRecord)) | 28 | 0 | return EC; | 29 | 48 | return Error::success(); | 30 | 48 | } |
CVTypeVisitor.cpp:llvm::Error visitKnownRecord<llvm::codeview::StringIdRecord>(llvm::codeview::CVRecord<llvm::codeview::TypeLeafKind>&, llvm::codeview::TypeVisitorCallbacks&) Line | Count | Source | 24 | 1.78k | static Error visitKnownRecord(CVType &Record, TypeVisitorCallbacks &Callbacks) { | 25 | 1.78k | TypeRecordKind RK = static_cast<TypeRecordKind>(Record.kind()); | 26 | 1.78k | T KnownRecord(RK); | 27 | 1.78k | if (auto EC = Callbacks.visitKnownRecord(Record, KnownRecord)) | 28 | 0 | return EC; | 29 | 1.78k | return Error::success(); | 30 | 1.78k | } |
CVTypeVisitor.cpp:llvm::Error visitKnownRecord<llvm::codeview::UdtSourceLineRecord>(llvm::codeview::CVRecord<llvm::codeview::TypeLeafKind>&, llvm::codeview::TypeVisitorCallbacks&) Line | Count | Source | 24 | 899 | static Error visitKnownRecord(CVType &Record, TypeVisitorCallbacks &Callbacks) { | 25 | 899 | TypeRecordKind RK = static_cast<TypeRecordKind>(Record.kind()); | 26 | 899 | T KnownRecord(RK); | 27 | 899 | if (auto EC = Callbacks.visitKnownRecord(Record, KnownRecord)) | 28 | 0 | return EC; | 29 | 899 | return Error::success(); | 30 | 899 | } |
CVTypeVisitor.cpp:llvm::Error visitKnownRecord<llvm::codeview::UdtModSourceLineRecord>(llvm::codeview::CVRecord<llvm::codeview::TypeLeafKind>&, llvm::codeview::TypeVisitorCallbacks&) Line | Count | Source | 24 | 8 | static Error visitKnownRecord(CVType &Record, TypeVisitorCallbacks &Callbacks) { | 25 | 8 | TypeRecordKind RK = static_cast<TypeRecordKind>(Record.kind()); | 26 | 8 | T KnownRecord(RK); | 27 | 8 | if (auto EC = Callbacks.visitKnownRecord(Record, KnownRecord)) | 28 | 0 | return EC; | 29 | 8 | return Error::success(); | 30 | 8 | } |
CVTypeVisitor.cpp:llvm::Error visitKnownRecord<llvm::codeview::MethodOverloadListRecord>(llvm::codeview::CVRecord<llvm::codeview::TypeLeafKind>&, llvm::codeview::TypeVisitorCallbacks&) Line | Count | Source | 24 | 354 | static Error visitKnownRecord(CVType &Record, TypeVisitorCallbacks &Callbacks) { | 25 | 354 | TypeRecordKind RK = static_cast<TypeRecordKind>(Record.kind()); | 26 | 354 | T KnownRecord(RK); | 27 | 354 | if (auto EC = Callbacks.visitKnownRecord(Record, KnownRecord)) | 28 | 0 | return EC; | 29 | 354 | return Error::success(); | 30 | 354 | } |
CVTypeVisitor.cpp:llvm::Error visitKnownRecord<llvm::codeview::PrecompRecord>(llvm::codeview::CVRecord<llvm::codeview::TypeLeafKind>&, llvm::codeview::TypeVisitorCallbacks&) Line | Count | Source | 24 | 2 | static Error visitKnownRecord(CVType &Record, TypeVisitorCallbacks &Callbacks) { | 25 | 2 | TypeRecordKind RK = static_cast<TypeRecordKind>(Record.kind()); | 26 | 2 | T KnownRecord(RK); | 27 | 2 | if (auto EC = Callbacks.visitKnownRecord(Record, KnownRecord)) | 28 | 0 | return EC; | 29 | 2 | return Error::success(); | 30 | 2 | } |
CVTypeVisitor.cpp:llvm::Error visitKnownRecord<llvm::codeview::EndPrecompRecord>(llvm::codeview::CVRecord<llvm::codeview::TypeLeafKind>&, llvm::codeview::TypeVisitorCallbacks&) Line | Count | Source | 24 | 2 | static Error visitKnownRecord(CVType &Record, TypeVisitorCallbacks &Callbacks) { | 25 | 2 | TypeRecordKind RK = static_cast<TypeRecordKind>(Record.kind()); | 26 | 2 | T KnownRecord(RK); | 27 | 2 | if (auto EC = Callbacks.visitKnownRecord(Record, KnownRecord)) | 28 | 0 | return EC; | 29 | 2 | return Error::success(); | 30 | 2 | } |
|
31 | | |
32 | | template <typename T> |
33 | | static Error visitKnownMember(CVMemberRecord &Record, |
34 | 33.9k | TypeVisitorCallbacks &Callbacks) { |
35 | 33.9k | TypeRecordKind RK = static_cast<TypeRecordKind>(Record.Kind); |
36 | 33.9k | T KnownRecord(RK); |
37 | 33.9k | if (auto EC = Callbacks.visitKnownMember(Record, KnownRecord)) |
38 | 0 | return EC; |
39 | 33.9k | return Error::success(); |
40 | 33.9k | } CVTypeVisitor.cpp:llvm::Error visitKnownMember<llvm::codeview::BaseClassRecord>(llvm::codeview::CVMemberRecord&, llvm::codeview::TypeVisitorCallbacks&) Line | Count | Source | 34 | 86 | TypeVisitorCallbacks &Callbacks) { | 35 | 86 | TypeRecordKind RK = static_cast<TypeRecordKind>(Record.Kind); | 36 | 86 | T KnownRecord(RK); | 37 | 86 | if (auto EC = Callbacks.visitKnownMember(Record, KnownRecord)) | 38 | 0 | return EC; | 39 | 86 | return Error::success(); | 40 | 86 | } |
CVTypeVisitor.cpp:llvm::Error visitKnownMember<llvm::codeview::VirtualBaseClassRecord>(llvm::codeview::CVMemberRecord&, llvm::codeview::TypeVisitorCallbacks&) Line | Count | Source | 34 | 47 | TypeVisitorCallbacks &Callbacks) { | 35 | 47 | TypeRecordKind RK = static_cast<TypeRecordKind>(Record.Kind); | 36 | 47 | T KnownRecord(RK); | 37 | 47 | if (auto EC = Callbacks.visitKnownMember(Record, KnownRecord)) | 38 | 0 | return EC; | 39 | 47 | return Error::success(); | 40 | 47 | } |
CVTypeVisitor.cpp:llvm::Error visitKnownMember<llvm::codeview::VFPtrRecord>(llvm::codeview::CVMemberRecord&, llvm::codeview::TypeVisitorCallbacks&) Line | Count | Source | 34 | 61 | TypeVisitorCallbacks &Callbacks) { | 35 | 61 | TypeRecordKind RK = static_cast<TypeRecordKind>(Record.Kind); | 36 | 61 | T KnownRecord(RK); | 37 | 61 | if (auto EC = Callbacks.visitKnownMember(Record, KnownRecord)) | 38 | 0 | return EC; | 39 | 61 | return Error::success(); | 40 | 61 | } |
CVTypeVisitor.cpp:llvm::Error visitKnownMember<llvm::codeview::StaticDataMemberRecord>(llvm::codeview::CVMemberRecord&, llvm::codeview::TypeVisitorCallbacks&) Line | Count | Source | 34 | 225 | TypeVisitorCallbacks &Callbacks) { | 35 | 225 | TypeRecordKind RK = static_cast<TypeRecordKind>(Record.Kind); | 36 | 225 | T KnownRecord(RK); | 37 | 225 | if (auto EC = Callbacks.visitKnownMember(Record, KnownRecord)) | 38 | 0 | return EC; | 39 | 225 | return Error::success(); | 40 | 225 | } |
CVTypeVisitor.cpp:llvm::Error visitKnownMember<llvm::codeview::OverloadedMethodRecord>(llvm::codeview::CVMemberRecord&, llvm::codeview::TypeVisitorCallbacks&) Line | Count | Source | 34 | 340 | TypeVisitorCallbacks &Callbacks) { | 35 | 340 | TypeRecordKind RK = static_cast<TypeRecordKind>(Record.Kind); | 36 | 340 | T KnownRecord(RK); | 37 | 340 | if (auto EC = Callbacks.visitKnownMember(Record, KnownRecord)) | 38 | 0 | return EC; | 39 | 340 | return Error::success(); | 40 | 340 | } |
CVTypeVisitor.cpp:llvm::Error visitKnownMember<llvm::codeview::DataMemberRecord>(llvm::codeview::CVMemberRecord&, llvm::codeview::TypeVisitorCallbacks&) Line | Count | Source | 34 | 1.97k | TypeVisitorCallbacks &Callbacks) { | 35 | 1.97k | TypeRecordKind RK = static_cast<TypeRecordKind>(Record.Kind); | 36 | 1.97k | T KnownRecord(RK); | 37 | 1.97k | if (auto EC = Callbacks.visitKnownMember(Record, KnownRecord)) | 38 | 0 | return EC; | 39 | 1.97k | return Error::success(); | 40 | 1.97k | } |
CVTypeVisitor.cpp:llvm::Error visitKnownMember<llvm::codeview::NestedTypeRecord>(llvm::codeview::CVMemberRecord&, llvm::codeview::TypeVisitorCallbacks&) Line | Count | Source | 34 | 266 | TypeVisitorCallbacks &Callbacks) { | 35 | 266 | TypeRecordKind RK = static_cast<TypeRecordKind>(Record.Kind); | 36 | 266 | T KnownRecord(RK); | 37 | 266 | if (auto EC = Callbacks.visitKnownMember(Record, KnownRecord)) | 38 | 0 | return EC; | 39 | 266 | return Error::success(); | 40 | 266 | } |
CVTypeVisitor.cpp:llvm::Error visitKnownMember<llvm::codeview::OneMethodRecord>(llvm::codeview::CVMemberRecord&, llvm::codeview::TypeVisitorCallbacks&) Line | Count | Source | 34 | 860 | TypeVisitorCallbacks &Callbacks) { | 35 | 860 | TypeRecordKind RK = static_cast<TypeRecordKind>(Record.Kind); | 36 | 860 | T KnownRecord(RK); | 37 | 860 | if (auto EC = Callbacks.visitKnownMember(Record, KnownRecord)) | 38 | 0 | return EC; | 39 | 860 | return Error::success(); | 40 | 860 | } |
CVTypeVisitor.cpp:llvm::Error visitKnownMember<llvm::codeview::EnumeratorRecord>(llvm::codeview::CVMemberRecord&, llvm::codeview::TypeVisitorCallbacks&) Line | Count | Source | 34 | 30.0k | TypeVisitorCallbacks &Callbacks) { | 35 | 30.0k | TypeRecordKind RK = static_cast<TypeRecordKind>(Record.Kind); | 36 | 30.0k | T KnownRecord(RK); | 37 | 30.0k | if (auto EC = Callbacks.visitKnownMember(Record, KnownRecord)) | 38 | 0 | return EC; | 39 | 30.0k | return Error::success(); | 40 | 30.0k | } |
CVTypeVisitor.cpp:llvm::Error visitKnownMember<llvm::codeview::ListContinuationRecord>(llvm::codeview::CVMemberRecord&, llvm::codeview::TypeVisitorCallbacks&) Line | Count | Source | 34 | 20 | TypeVisitorCallbacks &Callbacks) { | 35 | 20 | TypeRecordKind RK = static_cast<TypeRecordKind>(Record.Kind); | 36 | 20 | T KnownRecord(RK); | 37 | 20 | if (auto EC = Callbacks.visitKnownMember(Record, KnownRecord)) | 38 | 0 | return EC; | 39 | 20 | return Error::success(); | 40 | 20 | } |
|
41 | | |
42 | | static Error visitMemberRecord(CVMemberRecord &Record, |
43 | 34.0k | TypeVisitorCallbacks &Callbacks) { |
44 | 34.0k | if (auto EC = Callbacks.visitMemberBegin(Record)) |
45 | 0 | return EC; |
46 | 34.0k | |
47 | 34.0k | switch (Record.Kind) { |
48 | 34.0k | default: |
49 | 90 | if (auto EC = Callbacks.visitUnknownMember(Record)) |
50 | 0 | return EC; |
51 | 90 | break; |
52 | 90 | #define MEMBER_RECORD(EnumName, EnumVal, Name) \ |
53 | 33.9k | case EnumName: { \ |
54 | 33.9k | if (auto EC = visitKnownMember<Name##Record>(Record, Callbacks)) \ |
55 | 33.9k | return EC0 ; \ |
56 | 33.9k | break20 ; \ |
57 | 33.9k | } |
58 | 90 | #define MEMBER_RECORD_ALIAS(EnumName, EnumVal, Name, AliasName) \ |
59 | 90 | MEMBER_RECORD10 (EnumVal, EnumVal, AliasName) |
60 | 90 | #define TYPE_RECORD(EnumName, EnumVal, Name) |
61 | 90 | #define TYPE_RECORD_ALIAS(EnumName, EnumVal, Name, AliasName) |
62 | 90 | #include "llvm/DebugInfo/CodeView/CodeViewTypes.def" |
63 | 34.0k | } |
64 | 34.0k | |
65 | 34.0k | if (auto EC = Callbacks.visitMemberEnd(Record)) |
66 | 0 | return EC; |
67 | 34.0k | |
68 | 34.0k | return Error::success(); |
69 | 34.0k | } |
70 | | |
71 | | namespace { |
72 | | |
73 | | class CVTypeVisitor { |
74 | | public: |
75 | | explicit CVTypeVisitor(TypeVisitorCallbacks &Callbacks); |
76 | | |
77 | | Error visitTypeRecord(CVType &Record, TypeIndex Index); |
78 | | Error visitTypeRecord(CVType &Record); |
79 | | |
80 | | /// Visits the type records in Data. Sets the error flag on parse failures. |
81 | | Error visitTypeStream(const CVTypeArray &Types); |
82 | | Error visitTypeStream(CVTypeRange Types); |
83 | | Error visitTypeStream(TypeCollection &Types); |
84 | | |
85 | | Error visitMemberRecord(CVMemberRecord Record); |
86 | | Error visitFieldListMemberStream(BinaryStreamReader &Stream); |
87 | | |
88 | | private: |
89 | | Error finishVisitation(CVType &Record); |
90 | | |
91 | | /// The interface to the class that gets notified of each visitation. |
92 | | TypeVisitorCallbacks &Callbacks; |
93 | | }; |
94 | | |
95 | | CVTypeVisitor::CVTypeVisitor(TypeVisitorCallbacks &Callbacks) |
96 | 10.6k | : Callbacks(Callbacks) {} |
97 | | |
98 | 17.1k | Error CVTypeVisitor::finishVisitation(CVType &Record) { |
99 | 17.1k | switch (Record.kind()) { |
100 | 17.1k | default: |
101 | 0 | if (auto EC = Callbacks.visitUnknownType(Record)) |
102 | 0 | return EC; |
103 | 0 | break; |
104 | 0 | #define TYPE_RECORD(EnumName, EnumVal, Name) \ |
105 | 17.1k | case EnumName: { \ |
106 | 17.1k | if (auto EC = visitKnownRecord<Name##Record>(Record, Callbacks)) \ |
107 | 17.1k | return EC0 ; \ |
108 | 17.1k | break2 ; \ |
109 | 17.1k | } |
110 | 0 | #define TYPE_RECORD_ALIAS(EnumName, EnumVal, Name, AliasName) \ |
111 | 2.84k | TYPE_RECORD(EnumVal, EnumVal, AliasName) |
112 | 0 | #define MEMBER_RECORD(EnumName, EnumVal, Name) |
113 | 0 | #define MEMBER_RECORD_ALIAS(EnumName, EnumVal, Name, AliasName) |
114 | 0 | #include "llvm/DebugInfo/CodeView/CodeViewTypes.def" |
115 | 17.1k | } |
116 | 17.1k | |
117 | 17.1k | if (auto EC = Callbacks.visitTypeEnd(Record)) |
118 | 0 | return EC; |
119 | 17.1k | |
120 | 17.1k | return Error::success(); |
121 | 17.1k | } |
122 | | |
123 | 17.1k | Error CVTypeVisitor::visitTypeRecord(CVType &Record, TypeIndex Index) { |
124 | 17.1k | if (auto EC = Callbacks.visitTypeBegin(Record, Index)) |
125 | 0 | return EC; |
126 | 17.1k | |
127 | 17.1k | return finishVisitation(Record); |
128 | 17.1k | } |
129 | | |
130 | 0 | Error CVTypeVisitor::visitTypeRecord(CVType &Record) { |
131 | 0 | if (auto EC = Callbacks.visitTypeBegin(Record)) |
132 | 0 | return EC; |
133 | 0 | |
134 | 0 | return finishVisitation(Record); |
135 | 0 | } |
136 | | |
137 | 0 | Error CVTypeVisitor::visitMemberRecord(CVMemberRecord Record) { |
138 | 0 | return ::visitMemberRecord(Record, Callbacks); |
139 | 0 | } |
140 | | |
141 | | /// Visits the type records in Data. Sets the error flag on parse failures. |
142 | 0 | Error CVTypeVisitor::visitTypeStream(const CVTypeArray &Types) { |
143 | 0 | for (auto I : Types) { |
144 | 0 | if (auto EC = visitTypeRecord(I)) |
145 | 0 | return EC; |
146 | 0 | } |
147 | 0 | return Error::success(); |
148 | 0 | } |
149 | | |
150 | 0 | Error CVTypeVisitor::visitTypeStream(CVTypeRange Types) { |
151 | 0 | for (auto I : Types) { |
152 | 0 | if (auto EC = visitTypeRecord(I)) |
153 | 0 | return EC; |
154 | 0 | } |
155 | 0 | return Error::success(); |
156 | 0 | } |
157 | | |
158 | 193 | Error CVTypeVisitor::visitTypeStream(TypeCollection &Types) { |
159 | 193 | Optional<TypeIndex> I = Types.getFirst(); |
160 | 8.53k | while (I) { |
161 | 8.34k | CVType Type = Types.getType(*I); |
162 | 8.34k | if (auto EC = visitTypeRecord(Type, *I)) |
163 | 0 | return EC; |
164 | 8.34k | I = Types.getNext(*I); |
165 | 8.34k | } |
166 | 193 | return Error::success(); |
167 | 193 | } |
168 | | |
169 | 1.70k | Error CVTypeVisitor::visitFieldListMemberStream(BinaryStreamReader &Reader) { |
170 | 1.70k | TypeLeafKind Leaf; |
171 | 35.7k | while (!Reader.empty()) { |
172 | 34.0k | if (auto EC = Reader.readEnum(Leaf)) |
173 | 0 | return EC; |
174 | 34.0k | |
175 | 34.0k | CVMemberRecord Record; |
176 | 34.0k | Record.Kind = Leaf; |
177 | 34.0k | if (auto EC = ::visitMemberRecord(Record, Callbacks)) |
178 | 0 | return EC; |
179 | 34.0k | } |
180 | 1.70k | |
181 | 1.70k | return Error::success(); |
182 | 1.70k | } |
183 | | |
184 | | struct FieldListVisitHelper { |
185 | | FieldListVisitHelper(TypeVisitorCallbacks &Callbacks, ArrayRef<uint8_t> Data, |
186 | | VisitorDataSource Source) |
187 | | : Stream(Data, llvm::support::little), Reader(Stream), |
188 | | Deserializer(Reader), |
189 | 1.70k | Visitor((Source == VDS_BytesPresent) ? Pipeline : Callbacks) { |
190 | 1.70k | if (Source == VDS_BytesPresent) { |
191 | 1.70k | Pipeline.addCallbackToPipeline(Deserializer); |
192 | 1.70k | Pipeline.addCallbackToPipeline(Callbacks); |
193 | 1.70k | } |
194 | 1.70k | } |
195 | | |
196 | | BinaryByteStream Stream; |
197 | | BinaryStreamReader Reader; |
198 | | FieldListDeserializer Deserializer; |
199 | | TypeVisitorCallbackPipeline Pipeline; |
200 | | CVTypeVisitor Visitor; |
201 | | }; |
202 | | |
203 | | struct VisitHelper { |
204 | | VisitHelper(TypeVisitorCallbacks &Callbacks, VisitorDataSource Source) |
205 | 5.85k | : Visitor((Source == VDS_BytesPresent) ? Pipeline : Callbacks) { |
206 | 5.85k | if (Source == VDS_BytesPresent) { |
207 | 5.85k | Pipeline.addCallbackToPipeline(Deserializer); |
208 | 5.85k | Pipeline.addCallbackToPipeline(Callbacks); |
209 | 5.85k | } |
210 | 5.85k | } |
211 | | |
212 | | VisitHelper(TypeVisitorCallbackPipeline &Callbacks, VisitorDataSource Source) |
213 | 3.11k | : Visitor((Source == VDS_BytesPresent) ? Pipeline : Callbacks) { |
214 | 3.11k | if (Source == VDS_BytesPresent) { |
215 | 3.11k | Pipeline = Callbacks; |
216 | 3.11k | Pipeline.addCallbackToPipelineFront(Deserializer); |
217 | 3.11k | } |
218 | 3.11k | } |
219 | | |
220 | | TypeDeserializer Deserializer; |
221 | | TypeVisitorCallbackPipeline Pipeline; |
222 | | CVTypeVisitor Visitor; |
223 | | }; |
224 | | } |
225 | | |
226 | | Error llvm::codeview::visitTypeRecord(CVType &Record, TypeIndex Index, |
227 | | TypeVisitorCallbacks &Callbacks, |
228 | 5.65k | VisitorDataSource Source) { |
229 | 5.65k | VisitHelper V(Callbacks, Source); |
230 | 5.65k | return V.Visitor.visitTypeRecord(Record, Index); |
231 | 5.65k | } |
232 | | |
233 | | Error llvm::codeview::visitTypeRecord(CVType &Record, TypeIndex Index, |
234 | | TypeVisitorCallbackPipeline &Callbacks, |
235 | 3.11k | VisitorDataSource Source) { |
236 | 3.11k | VisitHelper V(Callbacks, Source); |
237 | 3.11k | return V.Visitor.visitTypeRecord(Record, Index); |
238 | 3.11k | } |
239 | | |
240 | | Error llvm::codeview::visitTypeRecord(CVType &Record, |
241 | | TypeVisitorCallbacks &Callbacks, |
242 | 0 | VisitorDataSource Source) { |
243 | 0 | VisitHelper V(Callbacks, Source); |
244 | 0 | return V.Visitor.visitTypeRecord(Record); |
245 | 0 | } |
246 | | |
247 | | Error llvm::codeview::visitTypeStream(const CVTypeArray &Types, |
248 | | TypeVisitorCallbacks &Callbacks, |
249 | 0 | VisitorDataSource Source) { |
250 | 0 | VisitHelper V(Callbacks, Source); |
251 | 0 | return V.Visitor.visitTypeStream(Types); |
252 | 0 | } |
253 | | |
254 | | Error llvm::codeview::visitTypeStream(CVTypeRange Types, |
255 | 0 | TypeVisitorCallbacks &Callbacks) { |
256 | 0 | VisitHelper V(Callbacks, VDS_BytesPresent); |
257 | 0 | return V.Visitor.visitTypeStream(Types); |
258 | 0 | } |
259 | | |
260 | | Error llvm::codeview::visitTypeStream(TypeCollection &Types, |
261 | 193 | TypeVisitorCallbacks &Callbacks) { |
262 | 193 | // When the internal visitor calls Types.getType(Index) the interface is |
263 | 193 | // required to return a CVType with the bytes filled out. So we can assume |
264 | 193 | // that the bytes will be present when individual records are visited. |
265 | 193 | VisitHelper V(Callbacks, VDS_BytesPresent); |
266 | 193 | return V.Visitor.visitTypeStream(Types); |
267 | 193 | } |
268 | | |
269 | | Error llvm::codeview::visitMemberRecord(CVMemberRecord Record, |
270 | | TypeVisitorCallbacks &Callbacks, |
271 | 0 | VisitorDataSource Source) { |
272 | 0 | FieldListVisitHelper V(Callbacks, Record.Data, Source); |
273 | 0 | return V.Visitor.visitMemberRecord(Record); |
274 | 0 | } |
275 | | |
276 | | Error llvm::codeview::visitMemberRecord(TypeLeafKind Kind, |
277 | | ArrayRef<uint8_t> Record, |
278 | 0 | TypeVisitorCallbacks &Callbacks) { |
279 | 0 | CVMemberRecord R; |
280 | 0 | R.Data = Record; |
281 | 0 | R.Kind = Kind; |
282 | 0 | return visitMemberRecord(R, Callbacks, VDS_BytesPresent); |
283 | 0 | } |
284 | | |
285 | | Error llvm::codeview::visitMemberRecordStream(ArrayRef<uint8_t> FieldList, |
286 | 1.70k | TypeVisitorCallbacks &Callbacks) { |
287 | 1.70k | FieldListVisitHelper V(Callbacks, FieldList, VDS_BytesPresent); |
288 | 1.70k | return V.Visitor.visitFieldListMemberStream(V.Reader); |
289 | 1.70k | } |