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"
22 #include "llvm/Support/Path.h"
26 PDBSymbolCompiland::PDBSymbolCompiland(const IPDBSession &PDBSession,
27 std::unique_ptr<IPDBRawSymbol> Symbol)
28 : PDBSymbol(PDBSession, std::move(Symbol)) {}
30 void PDBSymbolCompiland::dump(raw_ostream &OS, int Indent,
31 PDB_DumpLevel Level) const {
32 if (Level == PDB_DumpLevel::Detailed) {
33 std::string FullName = getName();
34 StringRef Name = llvm::sys::path::filename(StringRef(FullName.c_str()));
37 OS << "Compiland: " << Name << "\n";
39 std::string Source = getSourceFileName();
40 std::string Library = getLibraryName();
42 OS << stream_indent(Indent + 2) << "Source: " << this->getSourceFileName()
45 OS << stream_indent(Indent + 2) << "Library: " << this->getLibraryName()
49 auto ChildrenEnum = getChildStats(Stats);
50 OS << stream_indent(Indent + 2) << "Children: " << Stats << "\n";
51 if (Level >= PDB_DumpLevel::Detailed) {
52 while (auto Child = ChildrenEnum->getNext()) {
53 if (llvm::isa<PDBSymbolCompilandDetails>(*Child))
55 if (llvm::isa<PDBSymbolCompilandEnv>(*Child))
57 PDB_DumpLevel ChildLevel = (Level == PDB_DumpLevel::Detailed)
58 ? PDB_DumpLevel::Normal
59 : PDB_DumpLevel::Compact;
60 Child->dump(OS, Indent + 4, ChildLevel);
65 auto DetailsEnum(findAllChildren<PDBSymbolCompilandDetails>());
66 if (auto CD = DetailsEnum->getNext()) {
69 CD->getFrontEndVersion(FE);
70 CD->getBackEndVersion(BE);
71 OS << stream_indent(Indent + 2) << "Compiler: " << CD->getCompilerName()
73 OS << stream_indent(Indent + 2) << "Version: " << FE << ", " << BE
76 OS << stream_indent(Indent + 2) << "Lang: " << CD->getLanguage() << "\n";
77 OS << stream_indent(Indent + 2) << "Attributes: ";
78 if (CD->hasDebugInfo())
80 if (CD->isDataAligned())
84 if (CD->hasSecurityChecks())
85 OS << "SecurityChecks ";
86 if (CD->isHotpatchable())
89 auto Files(Session.getSourceFilesForCompiland(*this));
91 OS << stream_indent(Indent + 2) << Files->getChildCount()
94 uint32_t Count = DetailsEnum->getChildCount();
97 OS << stream_indent(Indent + 2) << "(" << Count - 1 << " more omitted)";
100 std::string FullName = getName();
101 OS << stream_indent(Indent) << "Compiland: " << FullName;