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
>;
26 enum TBDFlags
: unsigned {
28 FlatNamespace
= 1U << 0,
29 NotApplicationExtensionSafe
= 1U << 1,
31 LLVM_MARK_AS_BITMASK_ENUM(/*LargestValue=*/InstallAPI
),
35 LLVM_YAML_STRONG_TYPEDEF(llvm::StringRef
, FlowStringRef
)
36 LLVM_YAML_STRONG_TYPEDEF(uint8_t, SwiftVersion
)
37 LLVM_YAML_IS_FLOW_SEQUENCE_VECTOR(UUID
)
38 LLVM_YAML_IS_FLOW_SEQUENCE_VECTOR(FlowStringRef
)
43 class ArchitectureSet
;
46 Expected
<std::unique_ptr
<InterfaceFile
>>
47 getInterfaceFileFromJSON(StringRef JSON
);
49 Error
serializeInterfaceFileToJSON(raw_ostream
&OS
, const InterfaceFile
&File
,
55 template <> struct ScalarTraits
<FlowStringRef
> {
56 static void output(const FlowStringRef
&, void *, raw_ostream
&);
57 static StringRef
input(StringRef
, void *, FlowStringRef
&);
58 static QuotingType
mustQuote(StringRef
);
61 template <> struct ScalarEnumerationTraits
<MachO::ObjCConstraintType
> {
62 static void enumeration(IO
&, MachO::ObjCConstraintType
&);
65 template <> struct ScalarTraits
<MachO::PlatformSet
> {
66 static void output(const MachO::PlatformSet
&, void *, raw_ostream
&);
67 static StringRef
input(StringRef
, void *, MachO::PlatformSet
&);
68 static QuotingType
mustQuote(StringRef
);
71 template <> struct ScalarBitSetTraits
<MachO::ArchitectureSet
> {
72 static void bitset(IO
&, MachO::ArchitectureSet
&);
75 template <> struct ScalarTraits
<MachO::Architecture
> {
76 static void output(const MachO::Architecture
&, void *, raw_ostream
&);
77 static StringRef
input(StringRef
, void *, MachO::Architecture
&);
78 static QuotingType
mustQuote(StringRef
);
81 template <> struct ScalarTraits
<MachO::PackedVersion
> {
82 static void output(const MachO::PackedVersion
&, void *, raw_ostream
&);
83 static StringRef
input(StringRef
, void *, MachO::PackedVersion
&);
84 static QuotingType
mustQuote(StringRef
);
87 template <> struct ScalarTraits
<SwiftVersion
> {
88 static void output(const SwiftVersion
&, void *, raw_ostream
&);
89 static StringRef
input(StringRef
, void *, SwiftVersion
&);
90 static QuotingType
mustQuote(StringRef
);
93 template <> struct ScalarTraits
<UUID
> {
94 static void output(const UUID
&, void *, raw_ostream
&);
95 static StringRef
input(StringRef
, void *, UUID
&);
96 static QuotingType
mustQuote(StringRef
);
99 } // end namespace yaml.
100 } // end namespace llvm.
102 #endif // LLVM_TEXTAPI_TEXT_STUB_COMMON_H