1 //===- GOFFYAML.h - GOFF YAMLIO 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 declares classes for handling the YAML representation of GOFF. 10 // 11 //===----------------------------------------------------------------------===// 12 13 #ifndef LLVM_OBJECTYAML_GOFFYAML_H 14 #define LLVM_OBJECTYAML_GOFFYAML_H 15 16 #include "llvm/ADT/StringRef.h" 17 #include "llvm/BinaryFormat/GOFF.h" 18 #include "llvm/ObjectYAML/YAML.h" 19 #include <cstdint> 20 #include <vector> 21 22 namespace llvm { 23 24 // The structure of the yaml files is not an exact 1:1 match to GOFF. In order 25 // to use yaml::IO, we use these structures which are closer to the source. 26 namespace GOFFYAML { 27 28 struct FileHeader { 29 uint32_t TargetEnvironment = 0; 30 uint32_t TargetOperatingSystem = 0; 31 uint16_t CCSID = 0; 32 StringRef CharacterSetName; 33 StringRef LanguageProductIdentifier; 34 uint32_t ArchitectureLevel = 0; 35 std::optional<uint16_t> InternalCCSID; 36 std::optional<uint8_t> TargetSoftwareEnvironment; 37 }; 38 39 struct Object { 40 FileHeader Header; 41 Object(); 42 }; 43 } // end namespace GOFFYAML 44 } // end namespace llvm 45 46 LLVM_YAML_DECLARE_MAPPING_TRAITS(GOFFYAML::FileHeader) 47 LLVM_YAML_DECLARE_MAPPING_TRAITS(GOFFYAML::Object) 48 49 #endif // LLVM_OBJECTYAML_GOFFYAML_H 50