yaml2obj.h 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  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. #include "llvm/ADT/STLExtras.h"
  14. #include <memory>
  15. namespace llvm {
  16. class raw_ostream;
  17. template <typename T> class SmallVectorImpl;
  18. class StringRef;
  19. class Twine;
  20. namespace object {
  21. class ObjectFile;
  22. }
  23. namespace COFFYAML {
  24. struct Object;
  25. }
  26. namespace ELFYAML {
  27. struct Object;
  28. }
  29. namespace MinidumpYAML {
  30. struct Object;
  31. }
  32. namespace WasmYAML {
  33. struct Object;
  34. }
  35. namespace ArchYAML {
  36. struct Archive;
  37. }
  38. namespace yaml {
  39. class Input;
  40. struct YamlObjectFile;
  41. using ErrorHandler = llvm::function_ref<void(const Twine &Msg)>;
  42. bool yaml2archive(ArchYAML::Archive &Doc, raw_ostream &Out, ErrorHandler EH);
  43. bool yaml2coff(COFFYAML::Object &Doc, raw_ostream &Out, ErrorHandler EH);
  44. bool yaml2elf(ELFYAML::Object &Doc, raw_ostream &Out, ErrorHandler EH,
  45. uint64_t MaxSize);
  46. bool yaml2macho(YamlObjectFile &Doc, raw_ostream &Out, ErrorHandler EH);
  47. bool yaml2minidump(MinidumpYAML::Object &Doc, raw_ostream &Out,
  48. ErrorHandler EH);
  49. bool yaml2wasm(WasmYAML::Object &Doc, raw_ostream &Out, ErrorHandler EH);
  50. bool convertYAML(Input &YIn, raw_ostream &Out, ErrorHandler ErrHandler,
  51. unsigned DocNum = 1, uint64_t MaxSize = UINT64_MAX);
  52. /// Convenience function for tests.
  53. std::unique_ptr<object::ObjectFile>
  54. yaml2ObjectFile(SmallVectorImpl<char> &Storage, StringRef Yaml,
  55. ErrorHandler ErrHandler);
  56. } // namespace yaml
  57. } // namespace llvm
  58. #endif