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 //===----------------------------------------------------------------------===//
13 #include "llvm/DebugInfo/PDB/IPDBEnumChildren.h"
14 #include "llvm/DebugInfo/PDB/IPDBSession.h"
15 #include "llvm/DebugInfo/PDB/IPDBSourceFile.h"
16 #include "llvm/DebugInfo/PDB/PDBExtras.h"
17 #include "llvm/DebugInfo/PDB/PDBSymbol.h"
18 #include "llvm/DebugInfo/PDB/PDBSymbolCompiland.h"
19 #include "llvm/DebugInfo/PDB/PDBSymbolCompilandDetails.h"
20 #include "llvm/DebugInfo/PDB/PDBSymbolCompilandEnv.h"
21 #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 std::string Name = getName();
32 OS << "---- [IDX: " << getSymIndexId() << "] Compiland: " << Name
35 std::string Source = getSourceFileName();
36 std::string Library = getLibraryName();
38 OS << stream_indent(Indent + 2) << "Source: " << this->getSourceFileName()
41 OS << stream_indent(Indent + 2) << "Library: " << this->getLibraryName()
45 auto ChildrenEnum = getChildStats(Stats);
46 OS << stream_indent(Indent + 2) << "Children: " << Stats << "\n";
47 if (Level >= PDB_DumpLevel::Normal) {
48 while (auto Child = ChildrenEnum->getNext()) {
49 if (llvm::isa<PDBSymbolCompilandDetails>(*Child))
51 if (llvm::isa<PDBSymbolCompilandEnv>(*Child))
53 Child->dump(OS, Indent + 4, PDB_DumpLevel::Compact);
57 std::unique_ptr<IPDBEnumSymbols> DetailsEnum(
58 findChildren(PDB_SymType::CompilandDetails));
59 if (auto DetailsPtr = DetailsEnum->getNext()) {
60 const auto *CD = dyn_cast<PDBSymbolCompilandDetails>(DetailsPtr.get());
61 assert(CD && "We only asked for compilands, but got something else!");
64 CD->getFrontEndVersion(FE);
65 CD->getBackEndVersion(BE);
66 OS << stream_indent(Indent + 2) << "Compiler: " << CD->getCompilerName()
68 OS << stream_indent(Indent + 2) << "Version: " << FE << ", " << BE << "\n";
70 OS << stream_indent(Indent + 2) << "Lang: " << CD->getLanguage() << "\n";
71 OS << stream_indent(Indent + 2) << "Attributes: ";
72 if (CD->hasDebugInfo())
74 if (CD->isDataAligned())
78 if (CD->hasSecurityChecks())
79 OS << "SecurityChecks ";
80 if (CD->isHotpatchable())
84 auto Files(Session.getSourceFilesForCompiland(*this));
85 if (Level >= PDB_DumpLevel::Detailed) {
86 OS << stream_indent(Indent + 2) << Files->getChildCount()
87 << " source files:\n";
88 while (auto File = Files->getNext())
89 File->dump(OS, Indent + 4, PDB_DumpLevel::Compact);
91 OS << stream_indent(Indent + 2) << Files->getChildCount()
95 uint32_t Count = DetailsEnum->getChildCount();
97 OS << stream_indent(Indent + 2) << "(" << Count - 1 << " more omitted)\n";