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