[InstCombine] Signed saturation tests. NFC
[llvm-complete.git] / tools / llvm-pdbutil / MinimalSymbolDumper.h
blobcdc75c1cfba0ea78ec94548985ea5fb9e1839303
1 //===- MinimalSymbolDumper.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_LLVMPDBUTIL_MINIMAL_SYMBOL_DUMPER_H
10 #define LLVM_TOOLS_LLVMPDBUTIL_MINIMAL_SYMBOL_DUMPER_H
12 #include "llvm/DebugInfo/CodeView/SymbolVisitorCallbacks.h"
14 namespace llvm {
15 namespace codeview {
16 class LazyRandomTypeCollection;
19 namespace pdb {
20 class LinePrinter;
21 class SymbolGroup;
23 class MinimalSymbolDumper : public codeview::SymbolVisitorCallbacks {
24 public:
25 MinimalSymbolDumper(LinePrinter &P, bool RecordBytes,
26 codeview::LazyRandomTypeCollection &Ids,
27 codeview::LazyRandomTypeCollection &Types)
28 : P(P), RecordBytes(RecordBytes), Ids(Ids), Types(Types) {}
29 MinimalSymbolDumper(LinePrinter &P, bool RecordBytes,
30 const SymbolGroup &SymGroup,
31 codeview::LazyRandomTypeCollection &Ids,
32 codeview::LazyRandomTypeCollection &Types)
33 : P(P), RecordBytes(RecordBytes), SymGroup(&SymGroup), Ids(Ids),
34 Types(Types) {}
36 Error visitSymbolBegin(codeview::CVSymbol &Record) override;
37 Error visitSymbolBegin(codeview::CVSymbol &Record, uint32_t Offset) override;
38 Error visitSymbolEnd(codeview::CVSymbol &Record) override;
40 void setSymbolGroup(const SymbolGroup *Group) { SymGroup = Group; }
42 #define SYMBOL_RECORD(EnumName, EnumVal, Name) \
43 virtual Error visitKnownRecord(codeview::CVSymbol &CVR, \
44 codeview::Name &Record) override;
45 #define SYMBOL_RECORD_ALIAS(EnumName, EnumVal, Name, AliasName)
46 #include "llvm/DebugInfo/CodeView/CodeViewSymbols.def"
48 private:
49 std::string typeOrIdIndex(codeview::TypeIndex TI, bool IsType) const;
51 std::string typeIndex(codeview::TypeIndex TI) const;
52 std::string idIndex(codeview::TypeIndex TI) const;
54 LinePrinter &P;
56 /// Dumping certain records requires knowing what machine this is. The
57 /// S_COMPILE3 record will tell us, but if we don't see one, default to X64.
58 codeview::CPUType CompilationCPU = codeview::CPUType::X64;
60 bool RecordBytes;
61 const SymbolGroup *SymGroup = nullptr;
62 codeview::LazyRandomTypeCollection &Ids;
63 codeview::LazyRandomTypeCollection &Types;
65 } // namespace pdb
66 } // namespace llvm
68 #endif