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