TextStubCommon.h 2.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  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/MachO/Architecture.h"
  17. #include "llvm/TextAPI/MachO/ArchitectureSet.h"
  18. #include "llvm/TextAPI/MachO/InterfaceFile.h"
  19. #include "llvm/TextAPI/MachO/PackedVersion.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 yaml {
  27. template <> struct ScalarTraits<FlowStringRef> {
  28. static void output(const FlowStringRef &, void *, raw_ostream &);
  29. static StringRef input(StringRef, void *, FlowStringRef &);
  30. static QuotingType mustQuote(StringRef);
  31. };
  32. template <> struct ScalarEnumerationTraits<MachO::ObjCConstraintType> {
  33. static void enumeration(IO &, MachO::ObjCConstraintType &);
  34. };
  35. template <> struct ScalarTraits<MachO::PlatformSet> {
  36. static void output(const MachO::PlatformSet &, void *, raw_ostream &);
  37. static StringRef input(StringRef, void *, MachO::PlatformSet &);
  38. static QuotingType mustQuote(StringRef);
  39. };
  40. template <> struct ScalarBitSetTraits<MachO::ArchitectureSet> {
  41. static void bitset(IO &, MachO::ArchitectureSet &);
  42. };
  43. template <> struct ScalarTraits<MachO::Architecture> {
  44. static void output(const MachO::Architecture &, void *, raw_ostream &);
  45. static StringRef input(StringRef, void *, MachO::Architecture &);
  46. static QuotingType mustQuote(StringRef);
  47. };
  48. template <> struct ScalarTraits<MachO::PackedVersion> {
  49. static void output(const MachO::PackedVersion &, void *, raw_ostream &);
  50. static StringRef input(StringRef, void *, MachO::PackedVersion &);
  51. static QuotingType mustQuote(StringRef);
  52. };
  53. template <> struct ScalarTraits<SwiftVersion> {
  54. static void output(const SwiftVersion &, void *, raw_ostream &);
  55. static StringRef input(StringRef, void *, SwiftVersion &);
  56. static QuotingType mustQuote(StringRef);
  57. };
  58. template <> struct ScalarTraits<UUID> {
  59. static void output(const UUID &, void *, raw_ostream &);
  60. static StringRef input(StringRef, void *, UUID &);
  61. static QuotingType mustQuote(StringRef);
  62. };
  63. } // end namespace yaml.
  64. } // end namespace llvm.
  65. #endif // LLVM_TEXTAPI_TEXT_STUB_COMMON_H