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