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. 30 virtual Error visitTypeBegin(CVType &Record) { return Error::success(); } 31 virtual Error visitTypeEnd(CVType &Record) { return Error::success(); } 32 33 virtual Error visitUnknownMember(CVMemberRecord &Record) { 34 return Error::success(); 35 } 36 37 virtual Error visitMemberBegin(CVMemberRecord &Record) { 38 return Error::success(); 39 } 40 41 virtual Error visitMemberEnd(CVMemberRecord &Record) { 42 return Error::success(); 43 } 44 45 #define TYPE_RECORD(EnumName, EnumVal, Name) \ 46 virtual Error visitKnownRecord(CVType &CVR, Name##Record &Record) { \ 47 return Error::success(); \ 48 } 49 #define MEMBER_RECORD(EnumName, EnumVal, Name) \ 50 virtual Error visitKnownMember(CVMemberRecord &CVM, Name##Record &Record) { \ 51 return Error::success(); \ 52 } 53 54 #define TYPE_RECORD_ALIAS(EnumName, EnumVal, Name, AliasName) 55 #define MEMBER_RECORD_ALIAS(EnumName, EnumVal, Name, AliasName) 56 #include "TypeRecords.def" 57 }; 58 59 } // end namespace codeview 60 } // end namespace llvm 61 62 #endif // LLVM_DEBUGINFO_CODEVIEW_TYPEVISITORCALLBACKS_H 63