Recommit r369190 "[llvm-readobj/llvm-readelf] - Improve/cleanup the error reporting...
[llvm-complete.git] / tools / llvm-pdbutil / MinimalTypeDumper.h
blob6bc456d47ac4b5e7810a55d47cba553ea29a9419
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 //===----------------------------------------------------------------------===//
9 #ifndef LLVM_TOOLS_LLVMPDBUTIL_MINIMAL_TYPE_DUMPER_H
10 #define LLVM_TOOLS_LLVMPDBUTIL_MINIMAL_TYPE_DUMPER_H
12 #include "llvm/DebugInfo/CodeView/TypeVisitorCallbacks.h"
13 #include "llvm/Support/BinaryStreamArray.h"
15 namespace llvm {
16 namespace codeview {
17 class LazyRandomTypeCollection;
20 namespace pdb {
21 class LinePrinter;
22 class TpiStream;
23 class TypeReferenceTracker;
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) {}
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;
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"
53 private:
54 StringRef getTypeName(codeview::TypeIndex TI) const;
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;
67 } // namespace pdb
68 } // namespace llvm
70 #endif