yaml2obj.h 2.2 KB

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