yaml2obj.h 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100
  1. #pragma once
  2. #ifdef __GNUC__
  3. #pragma GCC diagnostic push
  4. #pragma GCC diagnostic ignored "-Wunused-parameter"
  5. #endif
  6. //===--- yaml2obj.h - -------------------------------------------*- C++ -*-===//
  7. //
  8. // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
  9. // See https://llvm.org/LICENSE.txt for license information.
  10. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
  11. //
  12. //===----------------------------------------------------------------------===//
  13. /// \file
  14. /// Common declarations for yaml2obj
  15. //===----------------------------------------------------------------------===//
  16. #ifndef LLVM_OBJECTYAML_YAML2OBJ_H
  17. #define LLVM_OBJECTYAML_YAML2OBJ_H
  18. #include "llvm/ADT/STLExtras.h"
  19. #include <memory>
  20. namespace llvm {
  21. class raw_ostream;
  22. template <typename T> class SmallVectorImpl;
  23. class StringRef;
  24. class Twine;
  25. namespace object {
  26. class ObjectFile;
  27. }
  28. namespace COFFYAML {
  29. struct Object;
  30. }
  31. namespace ELFYAML {
  32. struct Object;
  33. }
  34. namespace MinidumpYAML {
  35. struct Object;
  36. }
  37. namespace OffloadYAML {
  38. struct Binary;
  39. }
  40. namespace WasmYAML {
  41. struct Object;
  42. }
  43. namespace XCOFFYAML {
  44. struct Object;
  45. }
  46. namespace ArchYAML {
  47. struct Archive;
  48. }
  49. namespace DXContainerYAML {
  50. struct Object;
  51. } // namespace DXContainerYAML
  52. namespace yaml {
  53. class Input;
  54. struct YamlObjectFile;
  55. using ErrorHandler = llvm::function_ref<void(const Twine &Msg)>;
  56. bool yaml2archive(ArchYAML::Archive &Doc, raw_ostream &Out, ErrorHandler EH);
  57. bool yaml2coff(COFFYAML::Object &Doc, raw_ostream &Out, ErrorHandler EH);
  58. bool yaml2elf(ELFYAML::Object &Doc, raw_ostream &Out, ErrorHandler EH,
  59. uint64_t MaxSize);
  60. bool yaml2macho(YamlObjectFile &Doc, raw_ostream &Out, ErrorHandler EH);
  61. bool yaml2minidump(MinidumpYAML::Object &Doc, raw_ostream &Out,
  62. ErrorHandler EH);
  63. bool yaml2offload(OffloadYAML::Binary &Doc, raw_ostream &Out, ErrorHandler EH);
  64. bool yaml2wasm(WasmYAML::Object &Doc, raw_ostream &Out, ErrorHandler EH);
  65. bool yaml2xcoff(XCOFFYAML::Object &Doc, raw_ostream &Out, ErrorHandler EH);
  66. bool yaml2dxcontainer(DXContainerYAML::Object &Doc, raw_ostream &Out,
  67. ErrorHandler EH);
  68. bool convertYAML(Input &YIn, raw_ostream &Out, ErrorHandler ErrHandler,
  69. unsigned DocNum = 1, uint64_t MaxSize = UINT64_MAX);
  70. /// Convenience function for tests.
  71. std::unique_ptr<object::ObjectFile>
  72. yaml2ObjectFile(SmallVectorImpl<char> &Storage, StringRef Yaml,
  73. ErrorHandler ErrHandler);
  74. } // namespace yaml
  75. } // namespace llvm
  76. #endif
  77. #ifdef __GNUC__
  78. #pragma GCC diagnostic pop
  79. #endif