yaml2obj.h 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  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_TOOLS_YAML2OBJ_YAML2OBJ_H
  17. #define LLVM_TOOLS_YAML2OBJ_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 WasmYAML {
  38. struct Object;
  39. }
  40. namespace ArchYAML {
  41. struct Archive;
  42. }
  43. namespace yaml {
  44. class Input;
  45. struct YamlObjectFile;
  46. using ErrorHandler = llvm::function_ref<void(const Twine &Msg)>;
  47. bool yaml2archive(ArchYAML::Archive &Doc, raw_ostream &Out, ErrorHandler EH);
  48. bool yaml2coff(COFFYAML::Object &Doc, raw_ostream &Out, ErrorHandler EH);
  49. bool yaml2elf(ELFYAML::Object &Doc, raw_ostream &Out, ErrorHandler EH,
  50. uint64_t MaxSize);
  51. bool yaml2macho(YamlObjectFile &Doc, raw_ostream &Out, ErrorHandler EH);
  52. bool yaml2minidump(MinidumpYAML::Object &Doc, raw_ostream &Out,
  53. ErrorHandler EH);
  54. bool yaml2wasm(WasmYAML::Object &Doc, raw_ostream &Out, ErrorHandler EH);
  55. bool convertYAML(Input &YIn, raw_ostream &Out, ErrorHandler ErrHandler,
  56. unsigned DocNum = 1, uint64_t MaxSize = UINT64_MAX);
  57. /// Convenience function for tests.
  58. std::unique_ptr<object::ObjectFile>
  59. yaml2ObjectFile(SmallVectorImpl<char> &Storage, StringRef Yaml,
  60. ErrorHandler ErrHandler);
  61. } // namespace yaml
  62. } // namespace llvm
  63. #endif
  64. #ifdef __GNUC__
  65. #pragma GCC diagnostic pop
  66. #endif