1 //===- TypeVisitorCallbacks.h -----------------------------------*- C++ -*-===//
3 // The LLVM Compiler Infrastructure
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
10 #ifndef LLVM_DEBUGINFO_CODEVIEW_TYPEVISITORCALLBACKS_H
11 #define LLVM_DEBUGINFO_CODEVIEW_TYPEVISITORCALLBACKS_H
13 #include "llvm/DebugInfo/CodeView/TypeRecord.h"
14 #include "llvm/Support/Error.h"
19 class TypeVisitorCallbacks {
20 friend class CVTypeVisitor;
23 virtual ~TypeVisitorCallbacks() = default;
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();
38 virtual Error visitTypeEnd(CVType &Record) { return Error::success(); }
40 virtual Error visitUnknownMember(CVMemberRecord &Record) {
41 return Error::success();
44 virtual Error visitMemberBegin(CVMemberRecord &Record) {
45 return Error::success();
48 virtual Error visitMemberEnd(CVMemberRecord &Record) {
49 return Error::success();
52 #define TYPE_RECORD(EnumName, EnumVal, Name) \
53 virtual Error visitKnownRecord(CVType &CVR, Name##Record &Record) { \
54 return Error::success(); \
56 #define MEMBER_RECORD(EnumName, EnumVal, Name) \
57 virtual Error visitKnownMember(CVMemberRecord &CVM, Name##Record &Record) { \
58 return Error::success(); \
61 #define TYPE_RECORD_ALIAS(EnumName, EnumVal, Name, AliasName)
62 #define MEMBER_RECORD_ALIAS(EnumName, EnumVal, Name, AliasName)
63 #include "TypeRecords.def"
66 } // end namespace codeview
67 } // end namespace llvm
69 #endif // LLVM_DEBUGINFO_CODEVIEW_TYPEVISITORCALLBACKS_H