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