llvm-pdbdump: Re-order header files according to LLVM style guide.
[oota-llvm.git] / lib / DebugInfo / PDB / PDBSymbolTypeVTable.cpp
1 //===- PDBSymbolTypeVTable.cpp - --------------------------------*- 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 #include "llvm/DebugInfo/PDB/PDBSymbolTypeVTable.h"
11
12 #include "llvm/DebugInfo/PDB/IPDBSession.h"
13 #include "llvm/DebugInfo/PDB/PDBSymbol.h"
14 #include "llvm/DebugInfo/PDB/PDBSymbolTypePointer.h"
15 #include "llvm/DebugInfo/PDB/PDBSymbolTypeVTableShape.h"
16
17 #include <utility>
18
19 using namespace llvm;
20
21 PDBSymbolTypeVTable::PDBSymbolTypeVTable(const IPDBSession &PDBSession,
22                                          std::unique_ptr<IPDBRawSymbol> Symbol)
23     : PDBSymbol(PDBSession, std::move(Symbol)) {}
24
25 void PDBSymbolTypeVTable::dump(raw_ostream &OS, int Indent,
26                                PDB_DumpLevel Level) const {
27   OS << stream_indent(Indent);
28   uint32_t ClassId = getClassParentId();
29   if (auto ClassParent = Session.getSymbolById(ClassId)) {
30     ClassParent->dump(OS, 0, PDB_DumpLevel::Compact);
31     OS << "::";
32   }
33   OS << "<vtbl> ";
34   if (auto VtblPointer =
35           Session.getConcreteSymbolById<PDBSymbolTypePointer>(getTypeId())) {
36     if (auto VtblShape =
37             Session.getConcreteSymbolById<PDBSymbolTypeVTableShape>(
38                 VtblPointer->getTypeId()))
39       OS << "(" << VtblShape->getCount() << " entries)";
40   }
41   OS.flush();
42 }