]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - contrib/llvm/tools/llvm-pdbutil/MinimalTypeDumper.h
Merge llvm, clang, lld, lldb, compiler-rt and libc++ r305575, and update
[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
24 class MinimalTypeDumpVisitor : public codeview::TypeVisitorCallbacks {
25 public:
26   MinimalTypeDumpVisitor(LinePrinter &P, uint32_t Width, bool RecordBytes,
27                          bool Hashes, codeview::LazyRandomTypeCollection &Types,
28                          FixedStreamArray<support::ulittle32_t> HashValues)
29       : P(P), Width(Width), RecordBytes(RecordBytes), Hashes(Hashes),
30         Types(Types), HashValues(HashValues) {}
31
32   Error visitTypeBegin(codeview::CVType &Record,
33                        codeview::TypeIndex Index) override;
34   Error visitTypeEnd(codeview::CVType &Record) override;
35   Error visitMemberBegin(codeview::CVMemberRecord &Record) override;
36   Error visitMemberEnd(codeview::CVMemberRecord &Record) override;
37
38 #define TYPE_RECORD(EnumName, EnumVal, Name)                                   \
39   Error visitKnownRecord(codeview::CVType &CVR,                                \
40                          codeview::Name##Record &Record) override;
41 #define MEMBER_RECORD(EnumName, EnumVal, Name)                                 \
42   Error visitKnownMember(codeview::CVMemberRecord &CVR,                        \
43                          codeview::Name##Record &Record) override;
44 #define TYPE_RECORD_ALIAS(EnumName, EnumVal, Name, AliasName)
45 #define MEMBER_RECORD_ALIAS(EnumName, EnumVal, Name, AliasName)
46 #include "llvm/DebugInfo/CodeView/CodeViewTypes.def"
47
48 private:
49   StringRef getTypeName(codeview::TypeIndex TI) const;
50
51   LinePrinter &P;
52   uint32_t Width;
53   bool RecordBytes = false;
54   bool Hashes = false;
55   codeview::LazyRandomTypeCollection &Types;
56   FixedStreamArray<support::ulittle32_t> HashValues;
57 };
58 } // namespace pdb
59 } // namespace llvm
60
61 #endif