X-Git-Url: http://plrg.eecs.uci.edu/git/?a=blobdiff_plain;f=lib%2FDebugInfo%2FPDB%2FPDBSymbolCompiland.cpp;h=03ebe2b4d4b933c68eb2f88c5aeb6830bdc14d74;hb=eb95a535aa521ee8ecf4e8979eb529a82c5d640f;hp=13f6cccd0a2df92f7f3d320aa91fe47b3ccea69a;hpb=1e708541480f90958ee18273a540e70edda2e3d3;p=oota-llvm.git diff --git a/lib/DebugInfo/PDB/PDBSymbolCompiland.cpp b/lib/DebugInfo/PDB/PDBSymbolCompiland.cpp index 13f6cccd0a2..03ebe2b4d4b 100644 --- a/lib/DebugInfo/PDB/PDBSymbolCompiland.cpp +++ b/lib/DebugInfo/PDB/PDBSymbolCompiland.cpp @@ -19,6 +19,7 @@ #include "llvm/DebugInfo/PDB/PDBSymbolCompilandDetails.h" #include "llvm/DebugInfo/PDB/PDBSymbolCompilandEnv.h" #include "llvm/Support/raw_ostream.h" +#include "llvm/Support/Path.h" using namespace llvm; @@ -28,71 +29,75 @@ PDBSymbolCompiland::PDBSymbolCompiland(const IPDBSession &PDBSession, void PDBSymbolCompiland::dump(raw_ostream &OS, int Indent, PDB_DumpLevel Level) const { - std::string Name = getName(); - OS << "---- [IDX: " << getSymIndexId() << "] Compiland: " << Name - << " ----\n"; + if (Level == PDB_DumpLevel::Detailed) { + std::string FullName = getName(); + StringRef Name = llvm::sys::path::filename(StringRef(FullName.c_str())); - std::string Source = getSourceFileName(); - std::string Library = getLibraryName(); - if (!Source.empty()) - OS << stream_indent(Indent + 2) << "Source: " << this->getSourceFileName() - << "\n"; - if (!Library.empty()) - OS << stream_indent(Indent + 2) << "Library: " << this->getLibraryName() - << "\n"; + OS.indent(Indent); + OS << "Compiland: " << Name << "\n"; - TagStats Stats; - auto ChildrenEnum = getChildStats(Stats); - OS << stream_indent(Indent + 2) << "Children: " << Stats << "\n"; - if (Level >= PDB_DumpLevel::Normal) { - while (auto Child = ChildrenEnum->getNext()) { - if (llvm::isa(*Child)) - continue; - if (llvm::isa(*Child)) - continue; - Child->dump(OS, Indent + 4, PDB_DumpLevel::Compact); + std::string Source = getSourceFileName(); + std::string Library = getLibraryName(); + if (!Source.empty()) + OS << stream_indent(Indent + 2) << "Source: " << this->getSourceFileName() + << "\n"; + if (!Library.empty()) + OS << stream_indent(Indent + 2) << "Library: " << this->getLibraryName() + << "\n"; + + TagStats Stats; + auto ChildrenEnum = getChildStats(Stats); + OS << stream_indent(Indent + 2) << "Children: " << Stats << "\n"; + if (Level >= PDB_DumpLevel::Detailed) { + while (auto Child = ChildrenEnum->getNext()) { + if (llvm::isa(*Child)) + continue; + if (llvm::isa(*Child)) + continue; + PDB_DumpLevel ChildLevel = (Level == PDB_DumpLevel::Detailed) + ? PDB_DumpLevel::Normal + : PDB_DumpLevel::Compact; + Child->dump(OS, Indent + 4, ChildLevel); + OS << "\n"; + } } - } - std::unique_ptr DetailsEnum( - findChildren(PDB_SymType::CompilandDetails)); - if (auto DetailsPtr = DetailsEnum->getNext()) { - const auto *CD = dyn_cast(DetailsPtr.get()); - assert(CD && "We only asked for compilands, but got something else!"); - VersionInfo FE; - VersionInfo BE; - CD->getFrontEndVersion(FE); - CD->getBackEndVersion(BE); - OS << stream_indent(Indent + 2) << "Compiler: " << CD->getCompilerName() - << "\n"; - OS << stream_indent(Indent + 2) << "Version: " << FE << ", " << BE << "\n"; + auto DetailsEnum(findAllChildren()); + if (auto CD = DetailsEnum->getNext()) { + VersionInfo FE; + VersionInfo BE; + CD->getFrontEndVersion(FE); + CD->getBackEndVersion(BE); + OS << stream_indent(Indent + 2) << "Compiler: " << CD->getCompilerName() + << "\n"; + OS << stream_indent(Indent + 2) << "Version: " << FE << ", " << BE + << "\n"; - OS << stream_indent(Indent + 2) << "Lang: " << CD->getLanguage() << "\n"; - OS << stream_indent(Indent + 2) << "Attributes: "; - if (CD->hasDebugInfo()) - OS << "DebugInfo "; - if (CD->isDataAligned()) - OS << "DataAligned "; - if (CD->isLTCG()) - OS << "LTCG "; - if (CD->hasSecurityChecks()) - OS << "SecurityChecks "; - if (CD->isHotpatchable()) - OS << "HotPatchable"; + OS << stream_indent(Indent + 2) << "Lang: " << CD->getLanguage() << "\n"; + OS << stream_indent(Indent + 2) << "Attributes: "; + if (CD->hasDebugInfo()) + OS << "DebugInfo "; + if (CD->isDataAligned()) + OS << "DataAligned "; + if (CD->isLTCG()) + OS << "LTCG "; + if (CD->hasSecurityChecks()) + OS << "SecurityChecks "; + if (CD->isHotpatchable()) + OS << "HotPatchable"; - OS << "\n"; - auto Files(Session.getSourceFilesForCompiland(*this)); - if (Level >= PDB_DumpLevel::Detailed) { - OS << stream_indent(Indent + 2) << Files->getChildCount() - << " source files:\n"; - while (auto File = Files->getNext()) - File->dump(OS, Indent + 4, PDB_DumpLevel::Compact); - } else { + auto Files(Session.getSourceFilesForCompiland(*this)); + OS << "\n"; OS << stream_indent(Indent + 2) << Files->getChildCount() - << " source files\n"; + << " source files"; + } + uint32_t Count = DetailsEnum->getChildCount(); + if (Count > 1) { + OS << "\n"; + OS << stream_indent(Indent + 2) << "(" << Count - 1 << " more omitted)"; } + } else { + std::string FullName = getName(); + OS << stream_indent(Indent) << "Compiland: " << FullName; } - uint32_t Count = DetailsEnum->getChildCount(); - if (Count > 1) - OS << stream_indent(Indent + 2) << "(" << Count - 1 << " more omitted)\n"; }