1 //===- TypeRecordMapping.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_TYPERECORDMAPPING_H 11 #define LLVM_DEBUGINFO_CODEVIEW_TYPERECORDMAPPING_H 12 13 #include "llvm/ADT/Optional.h" 14 #include "llvm/DebugInfo/CodeView/CodeViewRecordIO.h" 15 #include "llvm/DebugInfo/CodeView/TypeVisitorCallbacks.h" 16 #include "llvm/Support/Error.h" 17 18 namespace llvm { 19 class BinaryStreamReader; 20 class BinaryStreamWriter; 21 22 namespace codeview { 23 class TypeRecordMapping : public TypeVisitorCallbacks { 24 public: TypeRecordMapping(BinaryStreamReader & Reader)25 explicit TypeRecordMapping(BinaryStreamReader &Reader) : IO(Reader) {} TypeRecordMapping(BinaryStreamWriter & Writer)26 explicit TypeRecordMapping(BinaryStreamWriter &Writer) : IO(Writer) {} 27 28 using TypeVisitorCallbacks::visitTypeBegin; 29 Error visitTypeBegin(CVType &Record) override; 30 Error visitTypeEnd(CVType &Record) override; 31 32 Error visitMemberBegin(CVMemberRecord &Record) override; 33 Error visitMemberEnd(CVMemberRecord &Record) override; 34 35 #define TYPE_RECORD(EnumName, EnumVal, Name) \ 36 Error visitKnownRecord(CVType &CVR, Name##Record &Record) override; 37 #define MEMBER_RECORD(EnumName, EnumVal, Name) \ 38 Error visitKnownMember(CVMemberRecord &CVR, Name##Record &Record) override; 39 #define TYPE_RECORD_ALIAS(EnumName, EnumVal, Name, AliasName) 40 #define MEMBER_RECORD_ALIAS(EnumName, EnumVal, Name, AliasName) 41 #include "llvm/DebugInfo/CodeView/CodeViewTypes.def" 42 43 private: 44 Optional<TypeLeafKind> TypeKind; 45 Optional<TypeLeafKind> MemberKind; 46 47 CodeViewRecordIO IO; 48 }; 49 } 50 } 51 52 #endif 53