1//===--- yaml2obj.h - -------------------------------------------*- 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/// \file
9/// Common declarations for yaml2obj
10//===----------------------------------------------------------------------===//
11#ifndef LLVM_OBJECTYAML_YAML2OBJ_H
12#define LLVM_OBJECTYAML_YAML2OBJ_H
13
14#include "llvm/ADT/STLExtras.h"
15#include <memory>
16
17namespace llvm {
18class raw_ostream;
19template <typename T> class SmallVectorImpl;
20class StringRef;
21class Twine;
22
23namespace object {
24class ObjectFile;
25}
26
27namespace COFFYAML {
28struct Object;
29}
30
31namespace ELFYAML {
32struct Object;
33}
34
35namespace GOFFYAML {
36struct Object;
37}
38
39namespace MinidumpYAML {
40struct Object;
41}
42
43namespace OffloadYAML {
44struct Binary;
45}
46
47namespace WasmYAML {
48struct Object;
49}
50
51namespace XCOFFYAML {
52struct Object;
53}
54
55namespace ArchYAML {
56struct Archive;
57}
58
59namespace DXContainerYAML {
60struct Object;
61} // namespace DXContainerYAML
62
63namespace yaml {
64class Input;
65struct YamlObjectFile;
66
67using ErrorHandler = llvm::function_ref<void(const Twine &Msg)>;
68
69bool yaml2archive(ArchYAML::Archive &Doc, raw_ostream &Out, ErrorHandler EH);
70bool yaml2coff(COFFYAML::Object &Doc, raw_ostream &Out, ErrorHandler EH);
71bool yaml2goff(GOFFYAML::Object &Doc, raw_ostream &Out, ErrorHandler EH);
72bool yaml2elf(ELFYAML::Object &Doc, raw_ostream &Out, ErrorHandler EH,
73 uint64_t MaxSize);
74bool yaml2macho(YamlObjectFile &Doc, raw_ostream &Out, ErrorHandler EH);
75bool yaml2minidump(MinidumpYAML::Object &Doc, raw_ostream &Out,
76 ErrorHandler EH);
77bool yaml2offload(OffloadYAML::Binary &Doc, raw_ostream &Out, ErrorHandler EH);
78bool yaml2wasm(WasmYAML::Object &Doc, raw_ostream &Out, ErrorHandler EH);
79bool yaml2xcoff(XCOFFYAML::Object &Doc, raw_ostream &Out, ErrorHandler EH);
80bool yaml2dxcontainer(DXContainerYAML::Object &Doc, raw_ostream &Out,
81 ErrorHandler EH);
82
83bool convertYAML(Input &YIn, raw_ostream &Out, ErrorHandler ErrHandler,
84 unsigned DocNum = 1, uint64_t MaxSize = UINT64_MAX);
85
86/// Convenience function for tests.
87std::unique_ptr<object::ObjectFile>
88yaml2ObjectFile(SmallVectorImpl<char> &Storage, StringRef Yaml,
89 ErrorHandler ErrHandler);
90
91} // namespace yaml
92} // namespace llvm
93
94#endif
95

source code of llvm/include/llvm/ObjectYAML/yaml2obj.h