1 //===- SimpleTypeSerializer.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_SIMPLETYPESERIALIZER_H 11 #define LLVM_DEBUGINFO_CODEVIEW_SIMPLETYPESERIALIZER_H 12 13 #include "llvm/ADT/ArrayRef.h" 14 #include "llvm/ADT/Optional.h" 15 #include "llvm/ADT/SmallVector.h" 16 #include "llvm/DebugInfo/CodeView/CodeView.h" 17 #include "llvm/DebugInfo/CodeView/RecordSerialization.h" 18 #include "llvm/DebugInfo/CodeView/TypeIndex.h" 19 #include "llvm/DebugInfo/CodeView/TypeRecord.h" 20 #include "llvm/DebugInfo/CodeView/TypeRecordMapping.h" 21 #include "llvm/DebugInfo/CodeView/TypeVisitorCallbacks.h" 22 #include "llvm/Support/Allocator.h" 23 #include "llvm/Support/BinaryByteStream.h" 24 #include "llvm/Support/BinaryStreamWriter.h" 25 #include "llvm/Support/Error.h" 26 #include <cassert> 27 #include <cstdint> 28 #include <memory> 29 #include <vector> 30 31 namespace llvm { 32 namespace codeview { 33 34 class SimpleTypeSerializer { 35 std::vector<uint8_t> ScratchBuffer; 36 37 public: 38 SimpleTypeSerializer(); 39 ~SimpleTypeSerializer(); 40 41 // This template is explicitly instantiated in the implementation file for all 42 // supported types. The method itself is ugly, so inlining it into the header 43 // file clutters an otherwise straightforward interface. 44 template <typename T> ArrayRef<uint8_t> serialize(T &Record); 45 46 // Don't allow serialization of field list records using this interface. 47 ArrayRef<uint8_t> serialize(const FieldListRecord &Record) = delete; 48 }; 49 50 } // end namespace codeview 51 } // end namespace llvm 52 53 #endif // LLVM_DEBUGINFO_CODEVIEW_SIMPLETYPESERIALIZER_H 54