]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - contrib/llvm/include/llvm/DebugInfo/CodeView/TypeVisitorCallbacks.h
Merge llvm, clang, lld, lldb, compiler-rt and libc++ r303291, and update
[FreeBSD/FreeBSD.git] / contrib / llvm / include / llvm / DebugInfo / CodeView / TypeVisitorCallbacks.h
1 //===- TypeVisitorCallbacks.h -----------------------------------*- 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_TYPEVISITORCALLBACKS_H
11 #define LLVM_DEBUGINFO_CODEVIEW_TYPEVISITORCALLBACKS_H
12
13 #include "llvm/DebugInfo/CodeView/TypeRecord.h"
14 #include "llvm/Support/Error.h"
15
16 namespace llvm {
17 namespace codeview {
18
19 class TypeVisitorCallbacks {
20   friend class CVTypeVisitor;
21
22 public:
23   virtual ~TypeVisitorCallbacks() = default;
24
25   /// Action to take on unknown types. By default, they are ignored.
26   virtual Error visitUnknownType(CVType &Record) { return Error::success(); }
27   /// Paired begin/end actions for all types. Receives all record data,
28   /// including the fixed-length record prefix.  visitTypeBegin() should return
29   /// the type of the Record, or an error if it cannot be determined.  Exactly
30   /// one of the two visitTypeBegin methods will be called, depending on whether
31   /// records are being visited sequentially or randomly.  An implementation
32   /// should be prepared to handle both (or assert if it can't handle random
33   /// access visitation).
34   virtual Error visitTypeBegin(CVType &Record) { return Error::success(); }
35   virtual Error visitTypeBegin(CVType &Record, TypeIndex Index) {
36     return Error::success();
37   }
38   virtual Error visitTypeEnd(CVType &Record) { return Error::success(); }
39
40   virtual Error visitUnknownMember(CVMemberRecord &Record) {
41     return Error::success();
42   }
43
44   virtual Error visitMemberBegin(CVMemberRecord &Record) {
45     return Error::success();
46   }
47
48   virtual Error visitMemberEnd(CVMemberRecord &Record) {
49     return Error::success();
50   }
51
52 #define TYPE_RECORD(EnumName, EnumVal, Name)                                   \
53   virtual Error visitKnownRecord(CVType &CVR, Name##Record &Record) {          \
54     return Error::success();                                                   \
55   }
56 #define MEMBER_RECORD(EnumName, EnumVal, Name)                                 \
57   virtual Error visitKnownMember(CVMemberRecord &CVM, Name##Record &Record) {  \
58     return Error::success();                                                   \
59   }
60
61 #define TYPE_RECORD_ALIAS(EnumName, EnumVal, Name, AliasName)
62 #define MEMBER_RECORD_ALIAS(EnumName, EnumVal, Name, AliasName)
63 #include "TypeRecords.def"
64 };
65
66 } // end namespace codeview
67 } // end namespace llvm
68
69 #endif // LLVM_DEBUGINFO_CODEVIEW_TYPEVISITORCALLBACKS_H