llvm/llvm/lib/TextAPI/TextStubCommon.h

//===- TextStubCommon.h ---------------------------------------------------===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
//
// Defines common Text Stub YAML mappings.
//
//===----------------------------------------------------------------------===//

#ifndef LLVM_TEXTAPI_TEXT_STUB_COMMON_H
#define LLVM_TEXTAPI_TEXT_STUB_COMMON_H

#include "llvm/ADT/BitmaskEnum.h"
#include "llvm/ADT/StringRef.h"
#include "llvm/Support/YAMLTraits.h"
#include "llvm/TextAPI/Architecture.h"
#include "llvm/TextAPI/InterfaceFile.h"
#include "llvm/TextAPI/Platform.h"
#include "llvm/TextAPI/Target.h"

UUID;

// clang-format off
enum TBDFlags : unsigned {};
// clang-format on

LLVM_YAML_STRONG_TYPEDEF(llvm::StringRef, FlowStringRef)
LLVM_YAML_STRONG_TYPEDEF()
LLVM_YAML_IS_FLOW_SEQUENCE_VECTOR(UUID)
LLVM_YAML_IS_FLOW_SEQUENCE_VECTOR(FlowStringRef)

namespace llvm {

namespace MachO {
class ArchitectureSet;
class PackedVersion;

Expected<std::unique_ptr<InterfaceFile>>
getInterfaceFileFromJSON(StringRef JSON);

Error serializeInterfaceFileToJSON(raw_ostream &OS, const InterfaceFile &File,
                                   const FileType FileKind, bool Compact);
} // namespace MachO

namespace yaml {

template <> struct ScalarTraits<FlowStringRef> {};

template <> struct ScalarEnumerationTraits<MachO::ObjCConstraintType> {};

template <> struct ScalarTraits<MachO::PlatformSet> {};

template <> struct ScalarBitSetTraits<MachO::ArchitectureSet> {};

template <> struct ScalarTraits<MachO::Architecture> {};

template <> struct ScalarTraits<MachO::PackedVersion> {};

template <> struct ScalarTraits<SwiftVersion> {};

// UUIDs are no longer respected but kept in the YAML parser
// to keep reading in older TBDs.
template <> struct ScalarTraits<UUID> {};

} // end namespace yaml.
} // end namespace llvm.

#endif // LLVM_TEXTAPI_TEXT_STUB_COMMON_H