xref: /freebsd/contrib/llvm-project/llvm/lib/ObjectYAML/GOFFYAML.cpp (revision 5b56413d04e608379c9a306373554a8e4d321bc0)
1 //===-- GOFFYAML.cpp - 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 defines classes for handling the YAML representation of GOFF.
10 //
11 //===----------------------------------------------------------------------===//
12 
13 #include "llvm/ObjectYAML/GOFFYAML.h"
14 #include "llvm/BinaryFormat/GOFF.h"
15 #include <string.h>
16 
17 namespace llvm {
18 namespace GOFFYAML {
19 
20 Object::Object() {}
21 
22 } // namespace GOFFYAML
23 
24 namespace yaml {
25 
26 void MappingTraits<GOFFYAML::FileHeader>::mapping(
27     IO &IO, GOFFYAML::FileHeader &FileHdr) {
28   IO.mapOptional("TargetEnvironment", FileHdr.TargetEnvironment, 0);
29   IO.mapOptional("TargetOperatingSystem", FileHdr.TargetOperatingSystem, 0);
30   IO.mapOptional("CCSID", FileHdr.CCSID, 0);
31   IO.mapOptional("CharacterSetName", FileHdr.CharacterSetName, "");
32   IO.mapOptional("LanguageProductIdentifier", FileHdr.LanguageProductIdentifier,
33                  "");
34   IO.mapOptional("ArchitectureLevel", FileHdr.ArchitectureLevel, 1);
35   IO.mapOptional("InternalCCSID", FileHdr.InternalCCSID);
36   IO.mapOptional("TargetSoftwareEnvironment",
37                  FileHdr.TargetSoftwareEnvironment);
38 }
39 
40 void MappingTraits<GOFFYAML::Object>::mapping(IO &IO, GOFFYAML::Object &Obj) {
41   IO.mapTag("!GOFF", true);
42   IO.mapRequired("FileHeader", Obj.Header);
43 }
44 
45 } // namespace yaml
46 } // namespace llvm
47