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/Support/YAMLTraits.h"
18 #include "llvm/TextAPI/Architecture.h"
19 #include "llvm/TextAPI/InterfaceFile.h"
20 #include "llvm/TextAPI/Platform.h"
21 #include "llvm/TextAPI/Target.h"
23 using UUID
= std::pair
<llvm::MachO::Target
, std::string
>;
25 LLVM_YAML_STRONG_TYPEDEF(llvm::StringRef
, FlowStringRef
)
26 LLVM_YAML_STRONG_TYPEDEF(uint8_t, SwiftVersion
)
27 LLVM_YAML_IS_FLOW_SEQUENCE_VECTOR(UUID
)
28 LLVM_YAML_IS_FLOW_SEQUENCE_VECTOR(FlowStringRef
)
33 class ArchitectureSet
;
38 template <> struct ScalarTraits
<FlowStringRef
> {
39 static void output(const FlowStringRef
&, void *, raw_ostream
&);
40 static StringRef
input(StringRef
, void *, FlowStringRef
&);
41 static QuotingType
mustQuote(StringRef
);
44 template <> struct ScalarEnumerationTraits
<MachO::ObjCConstraintType
> {
45 static void enumeration(IO
&, MachO::ObjCConstraintType
&);
48 template <> struct ScalarTraits
<MachO::PlatformSet
> {
49 static void output(const MachO::PlatformSet
&, void *, raw_ostream
&);
50 static StringRef
input(StringRef
, void *, MachO::PlatformSet
&);
51 static QuotingType
mustQuote(StringRef
);
54 template <> struct ScalarBitSetTraits
<MachO::ArchitectureSet
> {
55 static void bitset(IO
&, MachO::ArchitectureSet
&);
58 template <> struct ScalarTraits
<MachO::Architecture
> {
59 static void output(const MachO::Architecture
&, void *, raw_ostream
&);
60 static StringRef
input(StringRef
, void *, MachO::Architecture
&);
61 static QuotingType
mustQuote(StringRef
);
64 template <> struct ScalarTraits
<MachO::PackedVersion
> {
65 static void output(const MachO::PackedVersion
&, void *, raw_ostream
&);
66 static StringRef
input(StringRef
, void *, MachO::PackedVersion
&);
67 static QuotingType
mustQuote(StringRef
);
70 template <> struct ScalarTraits
<SwiftVersion
> {
71 static void output(const SwiftVersion
&, void *, raw_ostream
&);
72 static StringRef
input(StringRef
, void *, SwiftVersion
&);
73 static QuotingType
mustQuote(StringRef
);
76 template <> struct ScalarTraits
<UUID
> {
77 static void output(const UUID
&, void *, raw_ostream
&);
78 static StringRef
input(StringRef
, void *, UUID
&);
79 static QuotingType
mustQuote(StringRef
);
82 } // end namespace yaml.
83 } // end namespace llvm.
85 #endif // LLVM_TEXTAPI_TEXT_STUB_COMMON_H