Fix test failures introduced by PR #113697 (#116941)
[llvm-project.git] / llvm / tools / llvm-pdbutil / DumpOutputStyle.h
blob6714a6aa59f17518e3290ec5f516d316b1648bc1
1 //===- DumpOutputStyle.h -------------------------------------- *- C++ --*-===//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
9 #ifndef LLVM_TOOLS_LLVMPDBDUMP_DUMPOUTPUTSTYLE_H
10 #define LLVM_TOOLS_LLVMPDBDUMP_DUMPOUTPUTSTYLE_H
12 #include "OutputStyle.h"
13 #include "StreamUtil.h"
15 #include "llvm/ADT/DenseMap.h"
16 #include "llvm/ADT/SmallVector.h"
17 #include "llvm/DebugInfo/PDB/Native/LinePrinter.h"
18 #include "llvm/DebugInfo/PDB/Native/RawConstants.h"
20 namespace llvm {
21 namespace object {
22 class COFFObjectFile;
25 namespace pdb {
26 class GSIHashTable;
27 class InputFile;
28 class TypeReferenceTracker;
30 struct StatCollection {
31 struct Stat {
32 Stat() {}
33 Stat(uint32_t Count, uint32_t Size) : Count(Count), Size(Size) {}
34 uint32_t Count = 0;
35 uint32_t Size = 0;
37 void update(uint32_t RecordSize) {
38 ++Count;
39 Size += RecordSize;
43 using KindAndStat = std::pair<uint32_t, Stat>;
45 void update(uint32_t Kind, uint32_t RecordSize) {
46 Totals.update(RecordSize);
47 auto Iter = Individual.try_emplace(Kind, 1, RecordSize);
48 if (!Iter.second)
49 Iter.first->second.update(RecordSize);
51 Stat Totals;
52 DenseMap<uint32_t, Stat> Individual;
54 std::vector<KindAndStat> getStatsSortedBySize() const;
57 class DumpOutputStyle : public OutputStyle {
59 public:
60 DumpOutputStyle(InputFile &File);
61 ~DumpOutputStyle() override;
63 Error dump() override;
65 private:
66 PDBFile &getPdb();
67 object::COFFObjectFile &getObj();
69 void printStreamNotValidForObj();
70 void printStreamNotPresent(StringRef StreamName);
72 Error dumpFileSummary();
73 Error dumpStreamSummary();
74 Error dumpSymbolStats();
75 Error dumpUdtStats();
76 Error dumpTypeStats();
77 Error dumpNamedStreams();
78 Error dumpStringTable();
79 Error dumpStringTableFromPdb();
80 Error dumpStringTableFromObj();
81 Error dumpLines();
82 Error dumpInlineeLines();
83 Error dumpXmi();
84 Error dumpXme();
85 Error dumpFpo();
86 Error dumpOldFpo(PDBFile &File);
87 Error dumpNewFpo(PDBFile &File);
88 Error dumpTpiStream(uint32_t StreamIdx);
89 Error dumpTypesFromObjectFile();
90 Error dumpTypeRefStats();
91 Error dumpModules();
92 Error dumpModuleFiles();
93 Error dumpModuleSymsForPdb();
94 Error dumpModuleSymsForObj();
95 Error dumpGSIRecords();
96 Error dumpGlobals();
97 Error dumpPublics();
98 Error dumpSymbolsFromGSI(const GSIHashTable &Table, bool HashExtras);
99 Error dumpSectionHeaders();
100 Error dumpSectionContribs();
101 Error dumpSectionMap();
103 void dumpSectionHeaders(StringRef Label, DbgHeaderType Type);
105 InputFile &File;
106 std::unique_ptr<TypeReferenceTracker> RefTracker;
107 LinePrinter P;
108 SmallVector<StreamInfo, 32> StreamPurposes;
110 } // namespace pdb
111 } // namespace llvm
113 #endif