LLVM 20.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
17#include "llvm/ADT/StringRef.h"
22#include "llvm/TextAPI/Target.h"
23
24using UUID = std::pair<llvm::MachO::Target, std::string>;
25
26// clang-format off
27enum TBDFlags : unsigned {
28 None = 0U,
29 FlatNamespace = 1U << 0,
31 InstallAPI = 1U << 2,
35};
36// clang-format on
37
42
43namespace llvm {
44
45namespace MachO {
46class ArchitectureSet;
47class PackedVersion;
48
49Expected<std::unique_ptr<InterfaceFile>>
50getInterfaceFileFromJSON(StringRef JSON);
51
52Error serializeInterfaceFileToJSON(raw_ostream &OS, const InterfaceFile &File,
53 const FileType FileKind, bool Compact);
54} // namespace MachO
55
56namespace yaml {
57
58template <> struct ScalarTraits<FlowStringRef> {
59 static void output(const FlowStringRef &, void *, raw_ostream &);
60 static StringRef input(StringRef, void *, FlowStringRef &);
61 static QuotingType mustQuote(StringRef);
62};
63
64template <> struct ScalarEnumerationTraits<MachO::ObjCConstraintType> {
66};
67
68template <> struct ScalarTraits<MachO::PlatformSet> {
69 static void output(const MachO::PlatformSet &, void *, raw_ostream &);
71 static QuotingType mustQuote(StringRef);
72};
73
74template <> struct ScalarBitSetTraits<MachO::ArchitectureSet> {
75 static void bitset(IO &, MachO::ArchitectureSet &);
76};
77
78template <> struct ScalarTraits<MachO::Architecture> {
79 static void output(const MachO::Architecture &, void *, raw_ostream &);
81 static QuotingType mustQuote(StringRef);
82};
83
84template <> struct ScalarTraits<MachO::PackedVersion> {
85 static void output(const MachO::PackedVersion &, void *, raw_ostream &);
87 static QuotingType mustQuote(StringRef);
88};
89
90template <> struct ScalarTraits<SwiftVersion> {
91 static void output(const SwiftVersion &, void *, raw_ostream &);
92 static StringRef input(StringRef, void *, SwiftVersion &);
93 static QuotingType mustQuote(StringRef);
94};
95
96// UUIDs are no longer respected but kept in the YAML parser
97// to keep reading in older TBDs.
98template <> struct ScalarTraits<UUID> {
99 static void output(const UUID &, void *, raw_ostream &);
100 static StringRef input(StringRef, void *, UUID &);
101 static QuotingType mustQuote(StringRef);
102};
103
104} // end namespace yaml.
105} // end namespace llvm.
106
107#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:132
StringRef - Represent a constant reference to a string, i.e.
Definition: StringRef.h:51
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 TextAPI files can represent.
Definition: FileTypes.h:15
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:709
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 &)