[Alignment][NFC] Convert StoreInst to MaybeAlign
[llvm-complete.git] / tools / llvm-pdbutil / DumpOutputStyle.h
blob796cd7a10c362e44d8a289292c7e151fd0ba0bf8
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 "LinePrinter.h"
13 #include "OutputStyle.h"
14 #include "StreamUtil.h"
16 #include "llvm/ADT/DenseMap.h"
17 #include "llvm/ADT/Optional.h"
18 #include "llvm/ADT/SmallVector.h"
19 #include "llvm/DebugInfo/PDB/Native/RawConstants.h"
21 #include <string>
23 namespace llvm {
24 class BitVector;
26 namespace codeview {
27 class LazyRandomTypeCollection;
30 namespace object {
31 class COFFObjectFile;
34 namespace pdb {
35 class GSIHashTable;
36 class InputFile;
37 class TypeReferenceTracker;
39 struct StatCollection {
40 struct Stat {
41 Stat() {}
42 Stat(uint32_t Count, uint32_t Size) : Count(Count), Size(Size) {}
43 uint32_t Count = 0;
44 uint32_t Size = 0;
46 void update(uint32_t RecordSize) {
47 ++Count;
48 Size += RecordSize;
52 using KindAndStat = std::pair<uint32_t, Stat>;
54 void update(uint32_t Kind, uint32_t RecordSize) {
55 Totals.update(RecordSize);
56 auto Iter = Individual.try_emplace(Kind, 1, RecordSize);
57 if (!Iter.second)
58 Iter.first->second.update(RecordSize);
60 Stat Totals;
61 DenseMap<uint32_t, Stat> Individual;
63 std::vector<KindAndStat> getStatsSortedBySize() const;
66 class DumpOutputStyle : public OutputStyle {
68 public:
69 DumpOutputStyle(InputFile &File);
70 ~DumpOutputStyle() override;
72 Error dump() override;
74 private:
75 PDBFile &getPdb();
76 object::COFFObjectFile &getObj();
78 void printStreamNotValidForObj();
79 void printStreamNotPresent(StringRef StreamName);
81 Error dumpFileSummary();
82 Error dumpStreamSummary();
83 Error dumpSymbolStats();
84 Error dumpUdtStats();
85 Error dumpTypeStats();
86 Error dumpNamedStreams();
87 Error dumpStringTable();
88 Error dumpStringTableFromPdb();
89 Error dumpStringTableFromObj();
90 Error dumpLines();
91 Error dumpInlineeLines();
92 Error dumpXmi();
93 Error dumpXme();
94 Error dumpFpo();
95 Error dumpOldFpo(PDBFile &File);
96 Error dumpNewFpo(PDBFile &File);
97 Error dumpTpiStream(uint32_t StreamIdx);
98 Error dumpTypesFromObjectFile();
99 Error dumpTypeRefStats();
100 Error dumpModules();
101 Error dumpModuleFiles();
102 Error dumpModuleSymsForPdb();
103 Error dumpModuleSymsForObj();
104 Error dumpGSIRecords();
105 Error dumpGlobals();
106 Error dumpPublics();
107 Error dumpSymbolsFromGSI(const GSIHashTable &Table, bool HashExtras);
108 Error dumpSectionHeaders();
109 Error dumpSectionContribs();
110 Error dumpSectionMap();
112 void dumpSectionHeaders(StringRef Label, DbgHeaderType Type);
114 InputFile &File;
115 std::unique_ptr<TypeReferenceTracker> RefTracker;
116 LinePrinter P;
117 SmallVector<StreamInfo, 32> StreamPurposes;
119 } // namespace pdb
120 } // namespace llvm
122 #endif