]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - contrib/llvm-project/llvm/tools/llvm-pdbutil/MinimalTypeDumper.h
MFC r355940:
[FreeBSD/FreeBSD.git] / contrib / llvm-project / llvm / tools / llvm-pdbutil / MinimalTypeDumper.h
1 //===- MinimalTypeDumper.h ------------------------------------ *- 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 #ifndef LLVM_TOOLS_LLVMPDBUTIL_MINIMAL_TYPE_DUMPER_H
10 #define LLVM_TOOLS_LLVMPDBUTIL_MINIMAL_TYPE_DUMPER_H
11
12 #include "llvm/DebugInfo/CodeView/TypeVisitorCallbacks.h"
13 #include "llvm/Support/BinaryStreamArray.h"
14
15 namespace llvm {
16 namespace codeview {
17 class LazyRandomTypeCollection;
18 }
19
20 namespace pdb {
21 class LinePrinter;
22 class TpiStream;
23 class TypeReferenceTracker;
24
25 class MinimalTypeDumpVisitor : public codeview::TypeVisitorCallbacks {
26 public:
27   MinimalTypeDumpVisitor(LinePrinter &P, uint32_t Width, bool RecordBytes,
28                          bool Hashes, codeview::LazyRandomTypeCollection &Types,
29                          TypeReferenceTracker *RefTracker,
30                          uint32_t NumHashBuckets,
31                          FixedStreamArray<support::ulittle32_t> HashValues,
32                          pdb::TpiStream *Stream)
33       : P(P), Width(Width), RecordBytes(RecordBytes), Hashes(Hashes),
34         Types(Types), RefTracker(RefTracker), NumHashBuckets(NumHashBuckets),
35         HashValues(HashValues), Stream(Stream) {}
36
37   Error visitTypeBegin(codeview::CVType &Record,
38                        codeview::TypeIndex Index) override;
39   Error visitTypeEnd(codeview::CVType &Record) override;
40   Error visitMemberBegin(codeview::CVMemberRecord &Record) override;
41   Error visitMemberEnd(codeview::CVMemberRecord &Record) override;
42
43 #define TYPE_RECORD(EnumName, EnumVal, Name)                                   \
44   Error visitKnownRecord(codeview::CVType &CVR,                                \
45                          codeview::Name##Record &Record) override;
46 #define MEMBER_RECORD(EnumName, EnumVal, Name)                                 \
47   Error visitKnownMember(codeview::CVMemberRecord &CVR,                        \
48                          codeview::Name##Record &Record) override;
49 #define TYPE_RECORD_ALIAS(EnumName, EnumVal, Name, AliasName)
50 #define MEMBER_RECORD_ALIAS(EnumName, EnumVal, Name, AliasName)
51 #include "llvm/DebugInfo/CodeView/CodeViewTypes.def"
52
53 private:
54   StringRef getTypeName(codeview::TypeIndex TI) const;
55
56   LinePrinter &P;
57   uint32_t Width;
58   bool RecordBytes = false;
59   bool Hashes = false;
60   codeview::LazyRandomTypeCollection &Types;
61   pdb::TypeReferenceTracker *RefTracker = nullptr;
62   uint32_t NumHashBuckets;
63   codeview::TypeIndex CurrentTypeIndex;
64   FixedStreamArray<support::ulittle32_t> HashValues;
65   pdb::TpiStream *Stream = nullptr;
66 };
67 } // namespace pdb
68 } // namespace llvm
69
70 #endif