• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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:
MinimalTypeDumpVisitor(LinePrinter & P,uint32_t Width,bool RecordBytes,bool Hashes,codeview::LazyRandomTypeCollection & Types,uint32_t NumHashBuckets,FixedStreamArray<support::ulittle32_t> HashValues)26   MinimalTypeDumpVisitor(LinePrinter &P, uint32_t Width, bool RecordBytes,
27                          bool Hashes, codeview::LazyRandomTypeCollection &Types,
28                          uint32_t NumHashBuckets,
29                          FixedStreamArray<support::ulittle32_t> HashValues)
30       : P(P), Width(Width), RecordBytes(RecordBytes), Hashes(Hashes),
31         Types(Types), NumHashBuckets(NumHashBuckets), HashValues(HashValues) {}
32 
33   Error visitTypeBegin(codeview::CVType &Record,
34                        codeview::TypeIndex Index) override;
35   Error visitTypeEnd(codeview::CVType &Record) override;
36   Error visitMemberBegin(codeview::CVMemberRecord &Record) override;
37   Error visitMemberEnd(codeview::CVMemberRecord &Record) override;
38 
39 #define TYPE_RECORD(EnumName, EnumVal, Name)                                   \
40   Error visitKnownRecord(codeview::CVType &CVR,                                \
41                          codeview::Name##Record &Record) override;
42 #define MEMBER_RECORD(EnumName, EnumVal, Name)                                 \
43   Error visitKnownMember(codeview::CVMemberRecord &CVR,                        \
44                          codeview::Name##Record &Record) override;
45 #define TYPE_RECORD_ALIAS(EnumName, EnumVal, Name, AliasName)
46 #define MEMBER_RECORD_ALIAS(EnumName, EnumVal, Name, AliasName)
47 #include "llvm/DebugInfo/CodeView/CodeViewTypes.def"
48 
49 private:
50   StringRef getTypeName(codeview::TypeIndex TI) const;
51 
52   LinePrinter &P;
53   uint32_t Width;
54   bool RecordBytes = false;
55   bool Hashes = false;
56   codeview::LazyRandomTypeCollection &Types;
57   uint32_t NumHashBuckets;
58   FixedStreamArray<support::ulittle32_t> HashValues;
59 };
60 } // namespace pdb
61 } // namespace llvm
62 
63 #endif
64