diff options
author | Stephen Hines <srhines@google.com> | 2015-03-23 12:10:34 -0700 |
---|---|---|
committer | Stephen Hines <srhines@google.com> | 2015-03-23 12:10:34 -0700 |
commit | ebe69fe11e48d322045d5949c83283927a0d790b (patch) | |
tree | c92f1907a6b8006628a4b01615f38264d29834ea /tools/llvm-pdbdump/TypeDumper.cpp | |
parent | b7d2e72b02a4cb8034f32f8247a2558d2434e121 (diff) | |
download | external_llvm-ebe69fe11e48d322045d5949c83283927a0d790b.zip external_llvm-ebe69fe11e48d322045d5949c83283927a0d790b.tar.gz external_llvm-ebe69fe11e48d322045d5949c83283927a0d790b.tar.bz2 |
Update aosp/master LLVM for rebase to r230699.
Change-Id: I2b5be30509658cb8266be782de0ab24f9099f9b9
Diffstat (limited to 'tools/llvm-pdbdump/TypeDumper.cpp')
-rw-r--r-- | tools/llvm-pdbdump/TypeDumper.cpp | 96 |
1 files changed, 96 insertions, 0 deletions
diff --git a/tools/llvm-pdbdump/TypeDumper.cpp b/tools/llvm-pdbdump/TypeDumper.cpp new file mode 100644 index 0000000..3131e9f --- /dev/null +++ b/tools/llvm-pdbdump/TypeDumper.cpp @@ -0,0 +1,96 @@ +//===- TypeDumper.cpp - PDBSymDumper implementation for types *----- C++ *-===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +#include "TypeDumper.h" + +#include "ClassDefinitionDumper.h" +#include "FunctionDumper.h" +#include "llvm-pdbdump.h" +#include "TypedefDumper.h" + +#include "llvm/DebugInfo/PDB/IPDBSession.h" +#include "llvm/DebugInfo/PDB/PDBSymbolExe.h" +#include "llvm/DebugInfo/PDB/PDBSymbolTypeEnum.h" +#include "llvm/DebugInfo/PDB/PDBSymbolTypeFunctionSig.h" +#include "llvm/DebugInfo/PDB/PDBSymbolTypeTypedef.h" +#include "llvm/DebugInfo/PDB/PDBSymbolTypeUDT.h" + +using namespace llvm; + +TypeDumper::TypeDumper(bool Inline, bool ClassDefs) + : PDBSymDumper(true), InlineDump(Inline), FullClassDefs(ClassDefs) {} + +void TypeDumper::start(const PDBSymbolExe &Exe, raw_ostream &OS, int Indent) { + auto Enums = Exe.findAllChildren<PDBSymbolTypeEnum>(); + OS << newline(Indent) << "Enums: (" << Enums->getChildCount() << " items)"; + while (auto Enum = Enums->getNext()) + Enum->dump(OS, Indent + 2, *this); + + auto FuncSigs = Exe.findAllChildren<PDBSymbolTypeFunctionSig>(); + OS << newline(Indent); + OS << "Function Signatures: (" << FuncSigs->getChildCount() << " items)"; + while (auto Sig = FuncSigs->getNext()) + Sig->dump(OS, Indent + 2, *this); + + auto Typedefs = Exe.findAllChildren<PDBSymbolTypeTypedef>(); + OS << newline(Indent) << "Typedefs: (" << Typedefs->getChildCount() + << " items)"; + while (auto Typedef = Typedefs->getNext()) + Typedef->dump(OS, Indent + 2, *this); + + auto Classes = Exe.findAllChildren<PDBSymbolTypeUDT>(); + OS << newline(Indent) << "Classes: (" << Classes->getChildCount() + << " items)"; + while (auto Class = Classes->getNext()) + Class->dump(OS, Indent + 2, *this); +} + +void TypeDumper::dump(const PDBSymbolTypeEnum &Symbol, raw_ostream &OS, + int Indent) { + if (Symbol.getUnmodifiedTypeId() != 0) + return; + + if (!InlineDump) + OS << newline(Indent); + + OS << "enum " << Symbol.getName(); +} + +void TypeDumper::dump(const PDBSymbolTypeFunctionSig &Symbol, raw_ostream &OS, + int Indent) { + if (!InlineDump) + OS << newline(Indent); + + FunctionDumper Dumper; + Dumper.start(Symbol, FunctionDumper::PointerType::None, OS); +} + +void TypeDumper::dump(const PDBSymbolTypeTypedef &Symbol, raw_ostream &OS, + int Indent) { + if (!InlineDump) + OS << newline(Indent); + + TypedefDumper Dumper; + Dumper.start(Symbol, OS, Indent); +} + +void TypeDumper::dump(const PDBSymbolTypeUDT &Symbol, raw_ostream &OS, + int Indent) { + if (Symbol.getUnmodifiedTypeId() != 0) + return; + if (!InlineDump) + OS << newline(Indent); + + if (FullClassDefs) { + ClassDefinitionDumper Dumper; + Dumper.start(Symbol, OS, Indent); + } else { + OS << "class " << Symbol.getName(); + } +} |