LLVM 22.0.0git
TypeDumpVisitor.h
Go to the documentation of this file.
1//===-- TypeDumpVisitor.h - CodeView type info dumper -----------*- 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//===----------------------------------------------------------------------===//
8
9#ifndef LLVM_DEBUGINFO_CODEVIEW_TYPEDUMPVISITOR_H
10#define LLVM_DEBUGINFO_CODEVIEW_TYPEDUMPVISITOR_H
11
12#include "llvm/ADT/StringRef.h"
17
18namespace llvm {
19class ScopedPrinter;
20
21namespace codeview {
22class TypeIndex;
23struct CVMemberRecord;
24struct MemberAttributes;
25
26class TypeCollection;
27
28/// Dumper for CodeView type streams found in COFF object files and PDB files.
30public:
32 bool PrintRecordBytes)
33 : W(W), PrintRecordBytes(PrintRecordBytes), TpiTypes(TpiTypes) {}
34
35 /// When dumping types from an IPI stream in a PDB, a type index may refer to
36 /// a type or an item ID. The dumper will lookup the "name" of the index in
37 /// the item database if appropriate. If ItemDB is null, it will use TypeDB,
38 /// which is correct when dumping types from an object file (/Z7).
39 void setIpiTypes(TypeCollection &Types) { IpiTypes = &Types; }
40
41 void printTypeIndex(StringRef FieldName, TypeIndex TI) const;
42
43 void printItemIndex(StringRef FieldName, TypeIndex TI) const;
44
45 /// Action to take on unknown types. By default, they are ignored.
46 Error visitUnknownType(CVType &Record) override;
47 Error visitUnknownMember(CVMemberRecord &Record) override;
48
49 /// Paired begin/end actions for all types. Receives all record data,
50 /// including the fixed-length record prefix.
51 Error visitTypeBegin(CVType &Record) override;
52 Error visitTypeBegin(CVType &Record, TypeIndex Index) override;
53 Error visitTypeEnd(CVType &Record) override;
54 Error visitMemberBegin(CVMemberRecord &Record) override;
55 Error visitMemberEnd(CVMemberRecord &Record) override;
56
57#define TYPE_RECORD(EnumName, EnumVal, Name) \
58 Error visitKnownRecord(CVType &CVR, Name##Record &Record) override;
59#define MEMBER_RECORD(EnumName, EnumVal, Name) \
60 Error visitKnownMember(CVMemberRecord &CVR, Name##Record &Record) override;
61#define TYPE_RECORD_ALIAS(EnumName, EnumVal, Name, AliasName)
62#define MEMBER_RECORD_ALIAS(EnumName, EnumVal, Name, AliasName)
63#include "llvm/DebugInfo/CodeView/CodeViewTypes.def"
64
65private:
66 void printMemberAttributes(MemberAttributes Attrs);
67 void printMemberAttributes(MemberAccess Access, MethodKind Kind,
68 MethodOptions Options);
69
70 /// Get the database of indices for the stream that we are dumping. If ItemDB
71 /// is set, then we must be dumping an item (IPI) stream. This will also
72 /// always get the appropriate DB for printing item names.
73 TypeCollection &getSourceTypes() const {
74 return IpiTypes ? *IpiTypes : TpiTypes;
75 }
76
77 ScopedPrinter *W;
78
79 bool PrintRecordBytes = false;
80
81 TypeCollection &TpiTypes;
82 TypeCollection *IpiTypes = nullptr;
83};
84
85} // end namespace codeview
86} // end namespace llvm
87
88#endif
#define LLVM_ABI
Definition: Compiler.h:213
DXIL Resource Access
uint32_t Index
static LVOptions Options
Definition: LVOptions.cpp:25
Lightweight error class with error context and mandatory checking.
Definition: Error.h:159
StringRef - Represent a constant reference to a string, i.e.
Definition: StringRef.h:55
Dumper for CodeView type streams found in COFF object files and PDB files.
TypeDumpVisitor(TypeCollection &TpiTypes, ScopedPrinter *W, bool PrintRecordBytes)
void setIpiTypes(TypeCollection &Types)
When dumping types from an IPI stream in a PDB, a type index may refer to a type or an item ID.
A 32-bit type reference.
Definition: TypeIndex.h:97
LLVM_ABI void printTypeIndex(ScopedPrinter &Printer, StringRef FieldName, TypeIndex TI, TypeCollection &Types)
Definition: TypeIndex.cpp:93
This is an optimization pass for GlobalISel generic memory operations.
Definition: AddressRanges.h:18