1 //===- ClassDefinitionDumper.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_LLVMPDBDUMP_CLASSDEFINITIONDUMPER_H
11 #define LLVM_TOOLS_LLVMPDBDUMP_CLASSDEFINITIONDUMPER_H
12 
13 #include "llvm/DebugInfo/PDB/PDBSymDumper.h"
14 #include "llvm/DebugInfo/PDB/PDBSymbolFunc.h"
15 #include "llvm/DebugInfo/PDB/PDBSymbolData.h"
16 
17 #include <list>
18 #include <memory>
19 #include <unordered_map>
20 
21 namespace llvm {
22 namespace pdb {
23 
24 class LinePrinter;
25 
26 class ClassDefinitionDumper : public PDBSymDumper {
27 public:
28   ClassDefinitionDumper(LinePrinter &P);
29 
30   void start(const PDBSymbolTypeUDT &Exe);
31 
32   void dump(const PDBSymbolTypeBaseClass &Symbol) override;
33   void dump(const PDBSymbolData &Symbol) override;
34   void dump(const PDBSymbolTypeEnum &Symbol) override;
35   void dump(const PDBSymbolFunc &Symbol) override;
36   void dump(const PDBSymbolTypeTypedef &Symbol) override;
37   void dump(const PDBSymbolTypeUDT &Symbol) override;
38   void dump(const PDBSymbolTypeVTable &Symbol) override;
39 
40 private:
41   LinePrinter &Printer;
42 
43   struct SymbolGroup {
SymbolGroupSymbolGroup44     SymbolGroup() {}
SymbolGroupSymbolGroup45     SymbolGroup(SymbolGroup &&Other) {
46       Functions = std::move(Other.Functions);
47       Data = std::move(Other.Data);
48       Unknown = std::move(Other.Unknown);
49     }
50 
51     std::list<std::unique_ptr<PDBSymbolFunc>> Functions;
52     std::list<std::unique_ptr<PDBSymbolData>> Data;
53     std::list<std::unique_ptr<PDBSymbol>> Unknown;
54     SymbolGroup(const SymbolGroup &other) = delete;
55     SymbolGroup &operator=(const SymbolGroup &other) = delete;
56   };
57   typedef std::unordered_map<int, SymbolGroup> SymbolGroupByAccess;
58 
59   int dumpAccessGroup(PDB_MemberAccess Access, const SymbolGroup &Group);
60 };
61 }
62 }
63 #endif
64