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 
23 class LinePrinter;
24 
25 class ClassDefinitionDumper : public PDBSymDumper {
26 public:
27   ClassDefinitionDumper(LinePrinter &P);
28 
29   void start(const PDBSymbolTypeUDT &Exe);
30 
31   void dump(const PDBSymbolTypeBaseClass &Symbol) override;
32   void dump(const PDBSymbolData &Symbol) override;
33   void dump(const PDBSymbolTypeEnum &Symbol) override;
34   void dump(const PDBSymbolFunc &Symbol) override;
35   void dump(const PDBSymbolTypeTypedef &Symbol) override;
36   void dump(const PDBSymbolTypeUDT &Symbol) override;
37   void dump(const PDBSymbolTypeVTable &Symbol) override;
38 
39 private:
40   LinePrinter &Printer;
41 
42   struct SymbolGroup {
SymbolGroupSymbolGroup43     SymbolGroup() {}
SymbolGroupSymbolGroup44     SymbolGroup(SymbolGroup &&Other) {
45       Functions = std::move(Other.Functions);
46       Data = std::move(Other.Data);
47       Unknown = std::move(Other.Unknown);
48     }
49 
50     std::list<std::unique_ptr<PDBSymbolFunc>> Functions;
51     std::list<std::unique_ptr<PDBSymbolData>> Data;
52     std::list<std::unique_ptr<PDBSymbol>> Unknown;
53     SymbolGroup(const SymbolGroup &other) = delete;
54     SymbolGroup &operator=(const SymbolGroup &other) = delete;
55   };
56   typedef std::unordered_map<int, SymbolGroup> SymbolGroupByAccess;
57 
58   int dumpAccessGroup(PDB_MemberAccess Access, const SymbolGroup &Group);
59 };
60 }
61 
62 #endif
63