xref: /freebsd/contrib/llvm-project/llvm/lib/TextAPI/TextStubCommon.h (revision e32fecd0c2c3ee37c47ee100f169e7eb0282a873)
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/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"
22 
23 using UUID = std::pair<llvm::MachO::Target, std::string>;
24 
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)
29 
30 namespace llvm {
31 
32 namespace MachO {
33     class ArchitectureSet;
34     class PackedVersion;
35 }
36 namespace yaml {
37 
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);
42 };
43 
44 template <> struct ScalarEnumerationTraits<MachO::ObjCConstraintType> {
45   static void enumeration(IO &, MachO::ObjCConstraintType &);
46 };
47 
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);
52 };
53 
54 template <> struct ScalarBitSetTraits<MachO::ArchitectureSet> {
55   static void bitset(IO &, MachO::ArchitectureSet &);
56 };
57 
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);
62 };
63 
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);
68 };
69 
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);
74 };
75 
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);
80 };
81 
82 } // end namespace yaml.
83 } // end namespace llvm.
84 
85 #endif // LLVM_TEXTAPI_TEXT_STUB_COMMON_H
86