]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - contrib/llvm/include/llvm/DebugInfo/CodeView/TypeDumpVisitor.h
MFV r315875:
[FreeBSD/FreeBSD.git] / contrib / llvm / include / llvm / DebugInfo / CodeView / TypeDumpVisitor.h
1 //===-- TypeDumpVisitor.h - CodeView type info dumper -----------*- C++ -*-===//
2 //
3 //                     The LLVM Compiler Infrastructure
4 //
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9
10 #ifndef LLVM_DEBUGINFO_CODEVIEW_TYPEDUMPVISITOR_H
11 #define LLVM_DEBUGINFO_CODEVIEW_TYPEDUMPVISITOR_H
12
13 #include "llvm/ADT/ArrayRef.h"
14 #include "llvm/ADT/StringSet.h"
15 #include "llvm/DebugInfo/CodeView/TypeDatabase.h"
16 #include "llvm/DebugInfo/CodeView/TypeIndex.h"
17 #include "llvm/DebugInfo/CodeView/TypeRecord.h"
18 #include "llvm/DebugInfo/CodeView/TypeVisitorCallbacks.h"
19
20 namespace llvm {
21 class ScopedPrinter;
22
23 namespace codeview {
24
25 /// Dumper for CodeView type streams found in COFF object files and PDB files.
26 class TypeDumpVisitor : public TypeVisitorCallbacks {
27 public:
28   TypeDumpVisitor(TypeDatabase &TypeDB, ScopedPrinter *W, bool PrintRecordBytes)
29       : W(W), PrintRecordBytes(PrintRecordBytes), TypeDB(TypeDB) {}
30
31   void printTypeIndex(StringRef FieldName, TypeIndex TI) const;
32
33   /// Action to take on unknown types. By default, they are ignored.
34   Error visitUnknownType(CVType &Record) override;
35   Error visitUnknownMember(CVMemberRecord &Record) override;
36
37   /// Paired begin/end actions for all types. Receives all record data,
38   /// including the fixed-length record prefix.
39   Error visitTypeBegin(CVType &Record) override;
40   Error visitTypeEnd(CVType &Record) override;
41   Error visitMemberBegin(CVMemberRecord &Record) override;
42   Error visitMemberEnd(CVMemberRecord &Record) override;
43
44 #define TYPE_RECORD(EnumName, EnumVal, Name)                                   \
45   Error visitKnownRecord(CVType &CVR, Name##Record &Record) override;
46 #define MEMBER_RECORD(EnumName, EnumVal, Name)                                 \
47   Error visitKnownMember(CVMemberRecord &CVR, Name##Record &Record) override;
48 #define TYPE_RECORD_ALIAS(EnumName, EnumVal, Name, AliasName)
49 #define MEMBER_RECORD_ALIAS(EnumName, EnumVal, Name, AliasName)
50 #include "TypeRecords.def"
51
52 private:
53   void printMemberAttributes(MemberAttributes Attrs);
54   void printMemberAttributes(MemberAccess Access, MethodKind Kind,
55                              MethodOptions Options);
56
57   ScopedPrinter *W;
58
59   bool PrintRecordBytes = false;
60
61   TypeDatabase &TypeDB;
62 };
63
64 } // end namespace codeview
65 } // end namespace llvm
66
67 #endif