• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 //===- PrettyClassLayoutGraphicalDumper.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_LLVMPDBDUMP_PRETTYCLASSLAYOUTGRAPHICALDUMPER_H
10 #define LLVM_TOOLS_LLVMPDBDUMP_PRETTYCLASSLAYOUTGRAPHICALDUMPER_H
11 
12 #include "llvm/ADT/BitVector.h"
13 
14 #include "llvm/DebugInfo/PDB/PDBSymDumper.h"
15 
16 namespace llvm {
17 
18 namespace pdb {
19 
20 class UDTLayoutBase;
21 class LayoutItemBase;
22 class LinePrinter;
23 
24 class PrettyClassLayoutGraphicalDumper : public PDBSymDumper {
25 public:
26   PrettyClassLayoutGraphicalDumper(LinePrinter &P, uint32_t RecurseLevel,
27                                    uint32_t InitialOffset);
28 
29   bool start(const UDTLayoutBase &Layout);
30 
31   // Layout based symbol types.
32   void dump(const PDBSymbolTypeBaseClass &Symbol) override;
33   void dump(const PDBSymbolData &Symbol) override;
34   void dump(const PDBSymbolTypeVTable &Symbol) override;
35 
36   // Non layout-based symbol types.
37   void dump(const PDBSymbolTypeEnum &Symbol) override;
38   void dump(const PDBSymbolFunc &Symbol) override;
39   void dump(const PDBSymbolTypeTypedef &Symbol) override;
40   void dump(const PDBSymbolTypeUDT &Symbol) override;
41   void dump(const PDBSymbolTypeBuiltin &Symbol) override;
42 
43 private:
44   bool shouldRecurse() const;
45   void printPaddingRow(uint32_t Amount);
46 
47   LinePrinter &Printer;
48 
49   LayoutItemBase *CurrentItem = nullptr;
50   uint32_t RecursionLevel = 0;
51   uint32_t ClassOffsetZero = 0;
52   uint32_t CurrentAbsoluteOffset = 0;
53   bool DumpedAnything = false;
54 };
55 }
56 }
57 #endif
58