1 //===- TextStubCommon.h ---------------------------------------------------===//
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
7 //===----------------------------------------------------------------------===//
9 // Defines common Text Stub YAML mappings.
11 //===----------------------------------------------------------------------===//
13 #ifndef LLVM_TEXTAPI_TEXT_STUB_COMMON_H
14 #define LLVM_TEXTAPI_TEXT_STUB_COMMON_H
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"
24 using UUID
= std::pair
<llvm::MachO::Target
, std::string
>;
26 LLVM_YAML_STRONG_TYPEDEF(llvm::StringRef
, FlowStringRef
)
27 LLVM_YAML_STRONG_TYPEDEF(uint8_t, SwiftVersion
)
28 LLVM_YAML_IS_FLOW_SEQUENCE_VECTOR(UUID
)
29 LLVM_YAML_IS_FLOW_SEQUENCE_VECTOR(FlowStringRef
)
34 template <> struct ScalarTraits
<FlowStringRef
> {
35 static void output(const FlowStringRef
&, void *, raw_ostream
&);
36 static StringRef
input(StringRef
, void *, FlowStringRef
&);
37 static QuotingType
mustQuote(StringRef
);
40 template <> struct ScalarEnumerationTraits
<MachO::ObjCConstraintType
> {
41 static void enumeration(IO
&, MachO::ObjCConstraintType
&);
44 template <> 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
);
50 template <> struct ScalarBitSetTraits
<MachO::ArchitectureSet
> {
51 static void bitset(IO
&, MachO::ArchitectureSet
&);
54 template <> 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
);
60 template <> 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
);
66 template <> struct ScalarTraits
<SwiftVersion
> {
67 static void output(const SwiftVersion
&, void *, raw_ostream
&);
68 static StringRef
input(StringRef
, void *, SwiftVersion
&);
69 static QuotingType
mustQuote(StringRef
);
72 template <> struct ScalarTraits
<UUID
> {
73 static void output(const UUID
&, void *, raw_ostream
&);
74 static StringRef
input(StringRef
, void *, UUID
&);
75 static QuotingType
mustQuote(StringRef
);
78 } // end namespace yaml.
79 } // end namespace llvm.
81 #endif // LLVM_TEXTAPI_TEXT_STUB_COMMON_H