LLVM 18.0.0git
TextStubCommon.h
Go to the documentation of this file.
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"
21#include "llvm/TextAPI/Target.h"
22
23using UUID = std::pair<llvm::MachO::Target, std::string>;
24
25// clang-format off
26enum TBDFlags : unsigned {
27 None = 0U,
28 FlatNamespace = 1U << 0,
30 InstallAPI = 1U << 2,
34};
35// clang-format on
36
38LLVM_YAML_STRONG_TYPEDEF(uint8_t, SwiftVersion)
41
42namespace llvm {
43
44namespace MachO {
45class ArchitectureSet;
46class PackedVersion;
47
48Expected<std::unique_ptr<InterfaceFile>>
49getInterfaceFileFromJSON(StringRef JSON);
50
51Error serializeInterfaceFileToJSON(raw_ostream &OS, const InterfaceFile &File,
52 const FileType FileKind, bool Compact);
53} // namespace MachO
54
55namespace yaml {
56
57template <> struct ScalarTraits<FlowStringRef> {
58 static void output(const FlowStringRef &, void *, raw_ostream &);
59 static StringRef input(StringRef, void *, FlowStringRef &);
60 static QuotingType mustQuote(StringRef);
61};
62
63template <> struct ScalarEnumerationTraits<MachO::ObjCConstraintType> {
65};
66
67template <> struct ScalarTraits<MachO::PlatformSet> {
68 static void output(const MachO::PlatformSet &, void *, raw_ostream &);
70 static QuotingType mustQuote(StringRef);
71};
72
73template <> struct ScalarBitSetTraits<MachO::ArchitectureSet> {
74 static void bitset(IO &, MachO::ArchitectureSet &);
75};
76
77template <> struct ScalarTraits<MachO::Architecture> {
78 static void output(const MachO::Architecture &, void *, raw_ostream &);
80 static QuotingType mustQuote(StringRef);
81};
82
83template <> struct ScalarTraits<MachO::PackedVersion> {
84 static void output(const MachO::PackedVersion &, void *, raw_ostream &);
86 static QuotingType mustQuote(StringRef);
87};
88
89template <> struct ScalarTraits<SwiftVersion> {
90 static void output(const SwiftVersion &, void *, raw_ostream &);
91 static StringRef input(StringRef, void *, SwiftVersion &);
92 static QuotingType mustQuote(StringRef);
93};
94
95// UUIDs are no longer respected but kept in the YAML parser
96// to keep reading in older TBDs.
97template <> struct ScalarTraits<UUID> {
98 static void output(const UUID &, void *, raw_ostream &);
99 static StringRef input(StringRef, void *, UUID &);
100 static QuotingType mustQuote(StringRef);
101};
102
103} // end namespace yaml.
104} // end namespace llvm.
105
106#endif // LLVM_TEXTAPI_TEXT_STUB_COMMON_H
raw_pwrite_stream & OS
std::pair< llvm::MachO::Target, std::string > UUID
TBDFlags
@ LLVM_MARK_AS_BITMASK_ENUM
@ NotApplicationExtensionSafe
@ SimulatorSupport
@ InstallAPI
@ FlatNamespace
@ None
@ OSLibNotForSharedCache
#define LLVM_YAML_IS_FLOW_SEQUENCE_VECTOR(type)
#define LLVM_YAML_STRONG_TYPEDEF(_base, _type)
SmallSet - This maintains a set of unique values, optimizing for the case when the set is small (less...
Definition: SmallSet.h:135
StringRef - Represent a constant reference to a string, i.e.
Definition: StringRef.h:50
This class implements an extremely fast bulk output stream that can only output to a stream.
Definition: raw_ostream.h:52
FileType
Defines the file type this file represents.
Definition: InterfaceFile.h:53
Error serializeInterfaceFileToJSON(raw_ostream &OS, const InterfaceFile &File, const FileType FileKind, bool Compact)
ObjCConstraintType
Defines a list of Objective-C constraints.
Definition: InterfaceFile.h:33
Architecture
Defines the architecture slices that are supported by Text-based Stub files.
Definition: Architecture.h:27
Expected< std::unique_ptr< InterfaceFile > > getInterfaceFileFromJSON(StringRef JSON)
Definition: TextStubV5.cpp:708
This is an optimization pass for GlobalISel generic memory operations.
Definition: AddressRanges.h:18
static void bitset(IO &, MachO::ArchitectureSet &)
static void enumeration(IO &, MachO::ObjCConstraintType &)
static QuotingType mustQuote(StringRef)
static void output(const MachO::Architecture &, void *, raw_ostream &)
static StringRef input(StringRef, void *, MachO::Architecture &)
static void output(const MachO::PackedVersion &, void *, raw_ostream &)
static StringRef input(StringRef, void *, MachO::PackedVersion &)
static QuotingType mustQuote(StringRef)
static StringRef input(StringRef, void *, MachO::PlatformSet &)
static void output(const MachO::PlatformSet &, void *, raw_ostream &)