LLVM 22.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
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
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 &);
62};
63
64template <> struct ScalarEnumerationTraits<MachO::ObjCConstraintType> {
66};
67
68template <> struct ScalarTraits<MachO::PlatformSet> {
69 static void output(const MachO::PlatformSet &, void *, raw_ostream &);
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 &);
82};
83
84template <> struct ScalarTraits<MachO::PackedVersion> {
85 static void output(const MachO::PackedVersion &, void *, raw_ostream &);
88};
89
90template <> struct ScalarTraits<SwiftVersion> {
91 static void output(const SwiftVersion &, void *, raw_ostream &);
92 static StringRef input(StringRef, void *, SwiftVersion &);
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 &);
102};
103
104} // end namespace yaml.
105} // end namespace llvm.
106
107#endif // LLVM_TEXTAPI_TEXT_STUB_COMMON_H
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)
Utility for declaring that a std::vector of a particular type should be considered a YAML flow sequen...
#define LLVM_YAML_STRONG_TYPEDEF(_base, _type)
YAML I/O does conversion based on types. But often native data types are just a typedef of built in i...
Defines the interface file.
StringRef - Represent a constant reference to a string, i.e.
Definition StringRef.h:55
This class implements an extremely fast bulk output stream that can only output to a stream.
Definition raw_ostream.h:53
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)
SmallSet< PlatformType, 3 > PlatformSet
Definition Platform.h:23
ObjCConstraintType
Defines a list of Objective-C constraints.
Architecture
Defines the architecture slices that are supported by Text-based Stub files.
Expected< std::unique_ptr< InterfaceFile > > getInterfaceFileFromJSON(StringRef JSON)
QuotingType
Describe which type of quotes should be used when quoting is necessary.
Definition YAMLTraits.h:131
This is an optimization pass for GlobalISel generic memory operations.
static void bitset(IO &, MachO::ArchitectureSet &)
This class should be specialized by any integer type that is a union of bit values and the YAML repre...
Definition YAMLTraits.h:123
static void enumeration(IO &, MachO::ObjCConstraintType &)
This class should be specialized by any integral type that converts to/from a YAML scalar where there...
Definition YAMLTraits.h:107
static QuotingType mustQuote(StringRef)
static void output(const FlowStringRef &, void *, raw_ostream &)
static StringRef input(StringRef, void *, FlowStringRef &)
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 &)
static void output(const SwiftVersion &, void *, raw_ostream &)
static QuotingType mustQuote(StringRef)
static StringRef input(StringRef, void *, SwiftVersion &)
static QuotingType mustQuote(StringRef)
static StringRef input(StringRef, void *, UUID &)
static void output(const UUID &, void *, raw_ostream &)
This class should be specialized by type that requires custom conversion to/from a yaml scalar.
Definition YAMLTraits.h:149