1 //==- CodeViewYAMLTypes.h - CodeView YAMLIO Type implementation --*- C++ -*-==// 2 // 3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. 4 // See https://llvm.org/LICENSE.txt for license information. 5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception 6 // 7 //===----------------------------------------------------------------------===// 8 // 9 // This file defines classes for handling the YAML representation of CodeView 10 // Debug Info. 11 // 12 //===----------------------------------------------------------------------===// 13 14 #ifndef LLVM_OBJECTYAML_CODEVIEWYAMLTYPES_H 15 #define LLVM_OBJECTYAML_CODEVIEWYAMLTYPES_H 16 17 #include "llvm/ADT/ArrayRef.h" 18 #include "llvm/DebugInfo/CodeView/TypeRecord.h" 19 #include "llvm/Support/Allocator.h" 20 #include "llvm/Support/Compiler.h" 21 #include "llvm/Support/Error.h" 22 #include "llvm/Support/YAMLTraits.h" 23 #include <cstdint> 24 #include <memory> 25 #include <vector> 26 27 namespace llvm { 28 29 namespace codeview { 30 class AppendingTypeTableBuilder; 31 } 32 33 namespace CodeViewYAML { 34 35 namespace detail { 36 37 struct LeafRecordBase; 38 struct MemberRecordBase; 39 40 } // end namespace detail 41 42 struct MemberRecord { 43 std::shared_ptr<detail::MemberRecordBase> Member; 44 }; 45 46 struct LeafRecord { 47 std::shared_ptr<detail::LeafRecordBase> Leaf; 48 49 LLVM_ABI codeview::CVType 50 toCodeViewRecord(codeview::AppendingTypeTableBuilder &Serializer) const; 51 LLVM_ABI static Expected<LeafRecord> 52 fromCodeViewRecord(codeview::CVType Type); 53 }; 54 55 LLVM_ABI std::vector<LeafRecord> fromDebugT(ArrayRef<uint8_t> DebugTorP, 56 StringRef SectionName); 57 LLVM_ABI ArrayRef<uint8_t> 58 toDebugT(ArrayRef<LeafRecord>, BumpPtrAllocator &Alloc, StringRef SectionName); 59 60 } // end namespace CodeViewYAML 61 62 } // end namespace llvm 63 64 LLVM_YAML_DECLARE_SCALAR_TRAITS(codeview::GUID, QuotingType::Single) 65 66 LLVM_YAML_DECLARE_MAPPING_TRAITS(CodeViewYAML::LeafRecord) 67 LLVM_YAML_DECLARE_MAPPING_TRAITS(CodeViewYAML::MemberRecord) 68 69 LLVM_YAML_IS_SEQUENCE_VECTOR(CodeViewYAML::LeafRecord) 70 LLVM_YAML_IS_SEQUENCE_VECTOR(CodeViewYAML::MemberRecord) 71 72 #endif // LLVM_OBJECTYAML_CODEVIEWYAMLTYPES_H 73