1 //===- PDBSymbolCompiland.cpp - compiland details --------*- 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 "llvm/DebugInfo/PDB/IPDBEnumChildren.h"
11 #include "llvm/DebugInfo/PDB/IPDBSession.h"
12 #include "llvm/DebugInfo/PDB/IPDBSourceFile.h"
13 #include "llvm/DebugInfo/PDB/PDBExtras.h"
14 #include "llvm/DebugInfo/PDB/PDBSymbol.h"
15 #include "llvm/DebugInfo/PDB/PDBSymbolCompiland.h"
16 #include "llvm/DebugInfo/PDB/PDBSymbolCompilandDetails.h"
17 #include "llvm/DebugInfo/PDB/PDBSymbolCompilandEnv.h"
18 #include "llvm/Support/Path.h"
19 #include "llvm/Support/raw_ostream.h"
25 PDBSymbolCompiland::PDBSymbolCompiland(const IPDBSession &PDBSession,
26 std::unique_ptr<IPDBRawSymbol> Symbol)
27 : PDBSymbol(PDBSession, std::move(Symbol)) {}
29 void PDBSymbolCompiland::dump(raw_ostream &OS, int Indent,
30 PDB_DumpLevel Level) const {
31 if (Level == PDB_DumpLevel::Detailed) {
32 std::string FullName = getName();
33 StringRef Name = llvm::sys::path::filename(StringRef(FullName.c_str()));
36 OS << "Compiland: " << Name << "\n";
38 std::string Source = getSourceFileName();
39 std::string Library = getLibraryName();
41 OS << stream_indent(Indent + 2) << "Source: " << this->getSourceFileName()
44 OS << stream_indent(Indent + 2) << "Library: " << this->getLibraryName()
48 auto ChildrenEnum = getChildStats(Stats);
49 OS << stream_indent(Indent + 2) << "Children: " << Stats << "\n";
50 if (Level >= PDB_DumpLevel::Detailed) {
51 while (auto Child = ChildrenEnum->getNext()) {
52 if (llvm::isa<PDBSymbolCompilandDetails>(*Child))
54 if (llvm::isa<PDBSymbolCompilandEnv>(*Child))
56 PDB_DumpLevel ChildLevel = (Level == PDB_DumpLevel::Detailed)
57 ? PDB_DumpLevel::Normal
58 : PDB_DumpLevel::Compact;
59 Child->dump(OS, Indent + 4, ChildLevel);
64 auto DetailsEnum(findAllChildren<PDBSymbolCompilandDetails>());
65 if (auto CD = DetailsEnum->getNext()) {
68 CD->getFrontEndVersion(FE);
69 CD->getBackEndVersion(BE);
70 OS << stream_indent(Indent + 2) << "Compiler: " << CD->getCompilerName()
72 OS << stream_indent(Indent + 2) << "Version: " << FE << ", " << BE
75 OS << stream_indent(Indent + 2) << "Lang: " << CD->getLanguage() << "\n";
76 OS << stream_indent(Indent + 2) << "Attributes: ";
77 if (CD->hasDebugInfo())
79 if (CD->isDataAligned())
83 if (CD->hasSecurityChecks())
84 OS << "SecurityChecks ";
85 if (CD->isHotpatchable())
88 auto Files(Session.getSourceFilesForCompiland(*this));
90 OS << stream_indent(Indent + 2) << Files->getChildCount()
93 uint32_t Count = DetailsEnum->getChildCount();
96 OS << stream_indent(Indent + 2) << "(" << Count - 1 << " more omitted)";
99 std::string FullName = getName();
100 OS << stream_indent(Indent) << "Compiland: " << FullName;