[SampleProfileLoader] Fix integer overflow in generateMDProfMetadata (#90217)
[llvm-project.git] / llvm / lib / ObjectYAML / GOFFYAML.cpp
blobae857980a521b00aee2a15b619d1399cfbac2f4d
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.
11 //===----------------------------------------------------------------------===//
13 #include "llvm/ObjectYAML/GOFFYAML.h"
14 #include "llvm/BinaryFormat/GOFF.h"
15 #include <string.h>
17 namespace llvm {
18 namespace GOFFYAML {
20 Object::Object() {}
22 } // namespace GOFFYAML
24 namespace yaml {
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);
40 void MappingTraits<GOFFYAML::Object>::mapping(IO &IO, GOFFYAML::Object &Obj) {
41 IO.mapTag("!GOFF", true);
42 IO.mapRequired("FileHeader", Obj.Header);
45 } // namespace yaml
46 } // namespace llvm