1 //===- TypeDumper.cpp - PDBSymDumper implementation for types *----- C++ *-===//
3 // The LLVM Compiler Infrastructure
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
10 #include "TypeDumper.h"
12 #include "FunctionDumper.h"
13 #include "llvm-pdbdump.h"
14 #include "TypedefDumper.h"
16 #include "llvm/DebugInfo/PDB/IPDBSession.h"
17 #include "llvm/DebugInfo/PDB/PDBSymbolExe.h"
18 #include "llvm/DebugInfo/PDB/PDBSymbolTypeEnum.h"
19 #include "llvm/DebugInfo/PDB/PDBSymbolTypeFunctionSig.h"
20 #include "llvm/DebugInfo/PDB/PDBSymbolTypeTypedef.h"
24 TypeDumper::TypeDumper() : PDBSymDumper(true) {}
26 void TypeDumper::start(const PDBSymbolExe &Exe, raw_ostream &OS, int Indent) {
27 auto Enums = Exe.findAllChildren<PDBSymbolTypeEnum>();
28 OS << newline(Indent) << "Enums: (" << Enums->getChildCount() << " items)";
29 while (auto Enum = Enums->getNext())
30 Enum->dump(OS, Indent + 2, *this);
32 auto FuncSigs = Exe.findAllChildren<PDBSymbolTypeFunctionSig>();
33 OS << newline(Indent);
34 OS << "Function Signatures: (" << FuncSigs->getChildCount() << " items)";
35 while (auto Sig = FuncSigs->getNext())
36 Sig->dump(OS, Indent + 2, *this);
38 auto Typedefs = Exe.findAllChildren<PDBSymbolTypeTypedef>();
39 OS << newline(Indent) << "Typedefs: (" << Typedefs->getChildCount()
41 while (auto Typedef = Typedefs->getNext())
42 Typedef->dump(OS, Indent + 2, *this);
45 void TypeDumper::dump(const PDBSymbolTypeEnum &Symbol, raw_ostream &OS,
47 OS << newline(Indent) << "enum " << Symbol.getName();
50 void TypeDumper::dump(const PDBSymbolTypeFunctionSig &Symbol, raw_ostream &OS,
52 OS << newline(Indent);
53 FunctionDumper Dumper;
54 Dumper.start(Symbol, FunctionDumper::PointerType::None, OS);
57 void TypeDumper::dump(const PDBSymbolTypeTypedef &Symbol, raw_ostream &OS,
59 OS << newline(Indent);
61 Dumper.start(Symbol, OS, Indent);