diff options
Diffstat (limited to 'llvm/tools/llvm-pdbdump/PrettyClassDefinitionDumper.cpp')
-rw-r--r-- | llvm/tools/llvm-pdbdump/PrettyClassDefinitionDumper.cpp | 41 |
1 files changed, 15 insertions, 26 deletions
diff --git a/llvm/tools/llvm-pdbdump/PrettyClassDefinitionDumper.cpp b/llvm/tools/llvm-pdbdump/PrettyClassDefinitionDumper.cpp index 9f213a4b4d9..81ef26167a2 100644 --- a/llvm/tools/llvm-pdbdump/PrettyClassDefinitionDumper.cpp +++ b/llvm/tools/llvm-pdbdump/PrettyClassDefinitionDumper.cpp @@ -58,25 +58,11 @@ void ClassDefinitionDumper::start(const ClassLayout &Layout) { prettyPrintClassOutro(Layout); } -static void printBase(LinePrinter &Printer, const PDBSymbolTypeBaseClass &Base, - uint32_t &CurIndex, uint32_t TotalBaseCount, - bool IsVirtual) { - Printer << " "; - WithColor(Printer, PDB_ColorItem::Keyword).get() << Base.getAccess(); - if (IsVirtual) - WithColor(Printer, PDB_ColorItem::Keyword).get() << " virtual"; - WithColor(Printer, PDB_ColorItem::Type).get() << " " << Base.getName(); - if (++CurIndex < TotalBaseCount) { - Printer.NewLine(); - Printer << ","; - } -} - void ClassDefinitionDumper::prettyPrintClassIntro(const ClassLayout &Layout) { DumpedAnything = false; Printer.NewLine(); - uint32_t Size = Layout.getClassSize(); + uint32_t Size = Layout.getSize(); const PDBSymbolTypeUDT &Class = Layout.getClass(); WithColor(Printer, PDB_ColorItem::Keyword).get() << Class.getUdtKind() << " "; @@ -84,19 +70,22 @@ void ClassDefinitionDumper::prettyPrintClassIntro(const ClassLayout &Layout) { WithColor(Printer, PDB_ColorItem::Comment).get() << " [sizeof = " << Size << "]"; uint32_t BaseCount = Layout.bases().size(); - uint32_t VBaseCount = Layout.vbases().size(); - uint32_t TotalBaseCount = BaseCount + VBaseCount; - if (TotalBaseCount > 0) { + if (BaseCount > 0) { Printer.Indent(); - Printer.NewLine(); - Printer << ":"; - uint32_t BaseIndex = 0; + char NextSeparator = ':'; for (auto BC : Layout.bases()) { const auto &Base = BC->getBase(); - printBase(Printer, Base, BaseIndex, TotalBaseCount, false); - } - for (auto &BC : Layout.vbases()) { - printBase(Printer, *BC, BaseIndex, TotalBaseCount, true); + if (Base.isIndirectVirtualBaseClass()) + continue; + + Printer.NewLine(); + Printer << NextSeparator << " "; + WithColor(Printer, PDB_ColorItem::Keyword).get() << Base.getAccess(); + if (BC->isVirtualBase()) + WithColor(Printer, PDB_ColorItem::Keyword).get() << " virtual"; + + WithColor(Printer, PDB_ColorItem::Type).get() << " " << Base.getName(); + NextSeparator = ','; } Printer.Unindent(); @@ -114,7 +103,7 @@ void ClassDefinitionDumper::prettyPrintClassOutro(const ClassLayout &Layout) { Printer.NewLine(); if (Layout.deepPaddingSize() > 0) { APFloat Pct(100.0 * (double)Layout.deepPaddingSize() / - (double)Layout.getClassSize()); + (double)Layout.getSize()); SmallString<8> PctStr; Pct.toString(PctStr, 4); WithColor(Printer, PDB_ColorItem::Padding).get() |