Path: blob/main/contrib/llvm-project/llvm/lib/TextAPI/TextStubCommon.h
35262 views
//===- TextStubCommon.h ---------------------------------------------------===//1//2// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.3// See https://llvm.org/LICENSE.txt for license information.4// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception5//6//===----------------------------------------------------------------------===//7//8// Defines common Text Stub YAML mappings.9//10//===----------------------------------------------------------------------===//1112#ifndef LLVM_TEXTAPI_TEXT_STUB_COMMON_H13#define LLVM_TEXTAPI_TEXT_STUB_COMMON_H1415#include "llvm/ADT/BitmaskEnum.h"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"2223using UUID = std::pair<llvm::MachO::Target, std::string>;2425// clang-format off26enum TBDFlags : unsigned {27None = 0U,28FlatNamespace = 1U << 0,29NotApplicationExtensionSafe = 1U << 1,30InstallAPI = 1U << 2,31SimulatorSupport = 1U << 3,32OSLibNotForSharedCache = 1U << 4,33LLVM_MARK_AS_BITMASK_ENUM(/*LargestValue=*/OSLibNotForSharedCache),34};35// clang-format on3637LLVM_YAML_STRONG_TYPEDEF(llvm::StringRef, FlowStringRef)38LLVM_YAML_STRONG_TYPEDEF(uint8_t, SwiftVersion)39LLVM_YAML_IS_FLOW_SEQUENCE_VECTOR(UUID)40LLVM_YAML_IS_FLOW_SEQUENCE_VECTOR(FlowStringRef)4142namespace llvm {4344namespace MachO {45class ArchitectureSet;46class PackedVersion;4748Expected<std::unique_ptr<InterfaceFile>>49getInterfaceFileFromJSON(StringRef JSON);5051Error serializeInterfaceFileToJSON(raw_ostream &OS, const InterfaceFile &File,52const FileType FileKind, bool Compact);53} // namespace MachO5455namespace yaml {5657template <> struct ScalarTraits<FlowStringRef> {58static void output(const FlowStringRef &, void *, raw_ostream &);59static StringRef input(StringRef, void *, FlowStringRef &);60static QuotingType mustQuote(StringRef);61};6263template <> struct ScalarEnumerationTraits<MachO::ObjCConstraintType> {64static void enumeration(IO &, MachO::ObjCConstraintType &);65};6667template <> struct ScalarTraits<MachO::PlatformSet> {68static void output(const MachO::PlatformSet &, void *, raw_ostream &);69static StringRef input(StringRef, void *, MachO::PlatformSet &);70static QuotingType mustQuote(StringRef);71};7273template <> struct ScalarBitSetTraits<MachO::ArchitectureSet> {74static void bitset(IO &, MachO::ArchitectureSet &);75};7677template <> struct ScalarTraits<MachO::Architecture> {78static void output(const MachO::Architecture &, void *, raw_ostream &);79static StringRef input(StringRef, void *, MachO::Architecture &);80static QuotingType mustQuote(StringRef);81};8283template <> struct ScalarTraits<MachO::PackedVersion> {84static void output(const MachO::PackedVersion &, void *, raw_ostream &);85static StringRef input(StringRef, void *, MachO::PackedVersion &);86static QuotingType mustQuote(StringRef);87};8889template <> struct ScalarTraits<SwiftVersion> {90static void output(const SwiftVersion &, void *, raw_ostream &);91static StringRef input(StringRef, void *, SwiftVersion &);92static QuotingType mustQuote(StringRef);93};9495// UUIDs are no longer respected but kept in the YAML parser96// to keep reading in older TBDs.97template <> struct ScalarTraits<UUID> {98static void output(const UUID &, void *, raw_ostream &);99static StringRef input(StringRef, void *, UUID &);100static QuotingType mustQuote(StringRef);101};102103} // end namespace yaml.104} // end namespace llvm.105106#endif // LLVM_TEXTAPI_TEXT_STUB_COMMON_H107108109