TextStubCommon.h 2.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. //===- TextStubCommon.h ---------------------------------------------------===//
  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. //
  9. // Defines common Text Stub YAML mappings.
  10. //
  11. //===----------------------------------------------------------------------===//
  12. #ifndef LLVM_TEXTAPI_TEXT_STUB_COMMON_H
  13. #define LLVM_TEXTAPI_TEXT_STUB_COMMON_H
  14. #include "llvm/ADT/StringRef.h"
  15. #include "llvm/Support/YAMLTraits.h"
  16. #include "llvm/TextAPI/Architecture.h"
  17. #include "llvm/TextAPI/InterfaceFile.h"
  18. #include "llvm/TextAPI/Platform.h"
  19. #include "llvm/TextAPI/Target.h"
  20. using UUID = std::pair<llvm::MachO::Target, std::string>;
  21. LLVM_YAML_STRONG_TYPEDEF(llvm::StringRef, FlowStringRef)
  22. LLVM_YAML_STRONG_TYPEDEF(uint8_t, SwiftVersion)
  23. LLVM_YAML_IS_FLOW_SEQUENCE_VECTOR(UUID)
  24. LLVM_YAML_IS_FLOW_SEQUENCE_VECTOR(FlowStringRef)
  25. namespace llvm {
  26. namespace MachO {
  27. class ArchitectureSet;
  28. class PackedVersion;
  29. }
  30. namespace yaml {
  31. template <> struct ScalarTraits<FlowStringRef> {
  32. static void output(const FlowStringRef &, void *, raw_ostream &);
  33. static StringRef input(StringRef, void *, FlowStringRef &);
  34. static QuotingType mustQuote(StringRef);
  35. };
  36. template <> struct ScalarEnumerationTraits<MachO::ObjCConstraintType> {
  37. static void enumeration(IO &, MachO::ObjCConstraintType &);
  38. };
  39. template <> struct ScalarTraits<MachO::PlatformSet> {
  40. static void output(const MachO::PlatformSet &, void *, raw_ostream &);
  41. static StringRef input(StringRef, void *, MachO::PlatformSet &);
  42. static QuotingType mustQuote(StringRef);
  43. };
  44. template <> struct ScalarBitSetTraits<MachO::ArchitectureSet> {
  45. static void bitset(IO &, MachO::ArchitectureSet &);
  46. };
  47. template <> struct ScalarTraits<MachO::Architecture> {
  48. static void output(const MachO::Architecture &, void *, raw_ostream &);
  49. static StringRef input(StringRef, void *, MachO::Architecture &);
  50. static QuotingType mustQuote(StringRef);
  51. };
  52. template <> struct ScalarTraits<MachO::PackedVersion> {
  53. static void output(const MachO::PackedVersion &, void *, raw_ostream &);
  54. static StringRef input(StringRef, void *, MachO::PackedVersion &);
  55. static QuotingType mustQuote(StringRef);
  56. };
  57. template <> struct ScalarTraits<SwiftVersion> {
  58. static void output(const SwiftVersion &, void *, raw_ostream &);
  59. static StringRef input(StringRef, void *, SwiftVersion &);
  60. static QuotingType mustQuote(StringRef);
  61. };
  62. template <> struct ScalarTraits<UUID> {
  63. static void output(const UUID &, void *, raw_ostream &);
  64. static StringRef input(StringRef, void *, UUID &);
  65. static QuotingType mustQuote(StringRef);
  66. };
  67. } // end namespace yaml.
  68. } // end namespace llvm.
  69. #endif // LLVM_TEXTAPI_TEXT_STUB_COMMON_H