blob: f2cda50e297d07841d6a028f2fbab2f4f23751e6 [file] [log] [blame]
Juergen Ributzka32cb5942019-03-22 22:46:52 +00001//===- 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"
Juergen Ributzka32cb5942019-03-22 22:46:52 +000017#include "llvm/Support/YAMLTraits.h"
18#include "llvm/TextAPI/MachO/Architecture.h"
19#include "llvm/TextAPI/MachO/ArchitectureSet.h"
20#include "llvm/TextAPI/MachO/InterfaceFile.h"
21#include "llvm/TextAPI/MachO/PackedVersion.h"
22
Cyndy Ishida81669d52019-09-20 14:32:34 +000023using UUID = std::pair<llvm::MachO::Target, std::string>;
Juergen Ributzka32cb5942019-03-22 22:46:52 +000024
25LLVM_YAML_STRONG_TYPEDEF(llvm::StringRef, FlowStringRef)
26LLVM_YAML_STRONG_TYPEDEF(uint8_t, SwiftVersion)
27LLVM_YAML_IS_FLOW_SEQUENCE_VECTOR(UUID)
28LLVM_YAML_IS_FLOW_SEQUENCE_VECTOR(FlowStringRef)
29
30namespace llvm {
31namespace yaml {
32
33template <> struct ScalarTraits<FlowStringRef> {
34 static void output(const FlowStringRef &, void *, raw_ostream &);
35 static StringRef input(StringRef, void *, FlowStringRef &);
36 static QuotingType mustQuote(StringRef);
37};
38
39template <> struct ScalarEnumerationTraits<MachO::ObjCConstraintType> {
40 static void enumeration(IO &, MachO::ObjCConstraintType &);
41};
42
Cyndy Ishida81669d52019-09-20 14:32:34 +000043template <> struct ScalarTraits<MachO::PlatformSet> {
44 static void output(const MachO::PlatformSet &, void *, raw_ostream &);
45 static StringRef input(StringRef, void *, MachO::PlatformSet &);
Juergen Ributzka32cb5942019-03-22 22:46:52 +000046 static QuotingType mustQuote(StringRef);
47};
48
49template <> struct ScalarBitSetTraits<MachO::ArchitectureSet> {
50 static void bitset(IO &, MachO::ArchitectureSet &);
51};
52
53template <> struct ScalarTraits<MachO::Architecture> {
54 static void output(const MachO::Architecture &, void *, raw_ostream &);
55 static StringRef input(StringRef, void *, MachO::Architecture &);
56 static QuotingType mustQuote(StringRef);
57};
58
59template <> struct ScalarTraits<MachO::PackedVersion> {
60 static void output(const MachO::PackedVersion &, void *, raw_ostream &);
61 static StringRef input(StringRef, void *, MachO::PackedVersion &);
62 static QuotingType mustQuote(StringRef);
63};
64
65template <> struct ScalarTraits<SwiftVersion> {
66 static void output(const SwiftVersion &, void *, raw_ostream &);
67 static StringRef input(StringRef, void *, SwiftVersion &);
68 static QuotingType mustQuote(StringRef);
69};
70
71template <> struct ScalarTraits<UUID> {
72 static void output(const UUID &, void *, raw_ostream &);
73 static StringRef input(StringRef, void *, UUID &);
74 static QuotingType mustQuote(StringRef);
75};
76
77} // end namespace yaml.
78} // end namespace llvm.
79
80#endif // LLVM_TEXTAPI_TEXT_STUB_COMMON_H