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/PDBSymbolCompiland.h"
12 #include "llvm/DebugInfo/PDB/IPDBEnumChildren.h"
13 #include "llvm/DebugInfo/PDB/IPDBSession.h"
14 #include "llvm/DebugInfo/PDB/IPDBSourceFile.h"
15 #include "llvm/DebugInfo/PDB/PDBExtras.h"
16 #include "llvm/DebugInfo/PDB/PDBSymbol.h"
17 #include "llvm/DebugInfo/PDB/PDBSymbolCompilandDetails.h"
18 #include "llvm/DebugInfo/PDB/PDBSymbolCompilandEnv.h"
19 #include "llvm/Support/Path.h"
20 #include "llvm/Support/raw_ostream.h"
27 PDBSymbolCompiland::PDBSymbolCompiland(const IPDBSession &PDBSession,
28 std::unique_ptr<IPDBRawSymbol> Symbol)
29 : PDBSymbol(PDBSession, std::move(Symbol)) {}
31 void PDBSymbolCompiland::dump(raw_ostream &OS, int Indent,
32 PDB_DumpLevel Level) const {
33 if (Level == PDB_DumpLevel::Detailed) {
34 std::string FullName = getName();
35 StringRef Name = llvm::sys::path::filename(StringRef(FullName.c_str()));
38 OS << "Compiland: " << Name << "\n";
40 std::string Source = getSourceFileName();
41 std::string Library = getLibraryName();
43 OS << stream_indent(Indent + 2) << "Source: " << this->getSourceFileName()
46 OS << stream_indent(Indent + 2) << "Library: " << this->getLibraryName()
50 auto ChildrenEnum = getChildStats(Stats);
51 OS << stream_indent(Indent + 2) << "Children: " << Stats << "\n";
52 if (Level >= PDB_DumpLevel::Detailed) {
53 while (auto Child = ChildrenEnum->getNext()) {
54 if (llvm::isa<PDBSymbolCompilandDetails>(*Child))
56 if (llvm::isa<PDBSymbolCompilandEnv>(*Child))
58 PDB_DumpLevel ChildLevel = (Level == PDB_DumpLevel::Detailed)
59 ? PDB_DumpLevel::Normal
60 : PDB_DumpLevel::Compact;
61 Child->dump(OS, Indent + 4, ChildLevel);
66 auto DetailsEnum(findAllChildren<PDBSymbolCompilandDetails>());
67 if (auto CD = DetailsEnum->getNext()) {
70 CD->getFrontEndVersion(FE);
71 CD->getBackEndVersion(BE);
72 OS << stream_indent(Indent + 2) << "Compiler: " << CD->getCompilerName()
74 OS << stream_indent(Indent + 2) << "Version: " << FE << ", " << BE
77 OS << stream_indent(Indent + 2) << "Lang: " << CD->getLanguage() << "\n";
78 OS << stream_indent(Indent + 2) << "Attributes: ";
79 if (CD->hasDebugInfo())
81 if (CD->isDataAligned())
85 if (CD->hasSecurityChecks())
86 OS << "SecurityChecks ";
87 if (CD->isHotpatchable())
90 auto Files(Session.getSourceFilesForCompiland(*this));
92 OS << stream_indent(Indent + 2) << Files->getChildCount()
95 uint32_t Count = DetailsEnum->getChildCount();
98 OS << stream_indent(Indent + 2) << "(" << Count - 1 << " more omitted)";
101 std::string FullName = getName();
102 OS << stream_indent(Indent) << "Compiland: " << FullName;