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,
33};
34// clang-format on
35
37LLVM_YAML_STRONG_TYPEDEF(uint8_t, SwiftVersion)
40
41namespace llvm {
42
43namespace MachO {
44class ArchitectureSet;
45class PackedVersion;
46
47Expected<std::unique_ptr<InterfaceFile>>
48getInterfaceFileFromJSON(StringRef JSON);
49
50Error serializeInterfaceFileToJSON(raw_ostream &OS, const InterfaceFile &File,
51 const FileType FileKind, bool Compact);
52} // namespace MachO
53
54namespace yaml {
55
56template <> struct ScalarTraits<FlowStringRef> {
57 static void output(const FlowStringRef &, void *, raw_ostream &);
58 static StringRef input(StringRef, void *, FlowStringRef &);
59 static QuotingType mustQuote(StringRef);
60};
61
62template <> struct ScalarEnumerationTraits<MachO::ObjCConstraintType> {
64};
65
66template <> struct ScalarTraits<MachO::PlatformSet> {
67 static void output(const MachO::PlatformSet &, void *, raw_ostream &);
69 static QuotingType mustQuote(StringRef);
70};
71
72template <> struct ScalarBitSetTraits<MachO::ArchitectureSet> {
73 static void bitset(IO &, MachO::ArchitectureSet &);
74};
75
76template <> struct ScalarTraits<MachO::Architecture> {
77 static void output(const MachO::Architecture &, void *, raw_ostream &);
79 static QuotingType mustQuote(StringRef);
80};
81
82template <> struct ScalarTraits<MachO::PackedVersion> {
83 static void output(const MachO::PackedVersion &, void *, raw_ostream &);
85 static QuotingType mustQuote(StringRef);
86};
87
88template <> struct ScalarTraits<SwiftVersion> {
89 static void output(const SwiftVersion &, void *, raw_ostream &);
90 static StringRef input(StringRef, void *, SwiftVersion &);
91 static QuotingType mustQuote(StringRef);
92};
93
94// UUIDs are no longer respected but kept in the YAML parser
95// to keep reading in older TBDs.
96template <> struct ScalarTraits<UUID> {
97 static void output(const UUID &, void *, raw_ostream &);
98 static StringRef input(StringRef, void *, UUID &);
99 static QuotingType mustQuote(StringRef);
100};
101
102} // end namespace yaml.
103} // end namespace llvm.
104
105#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
#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:54
Error serializeInterfaceFileToJSON(raw_ostream &OS, const InterfaceFile &File, const FileType FileKind, bool Compact)
ObjCConstraintType
Defines a list of Objective-C constraints.
Definition: InterfaceFile.h:34
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:705
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 &)