llvm/llvm/lib/Remarks/YAMLRemarkSerializer.cpp

//===- YAMLRemarkSerializer.cpp -------------------------------------------===//
//
// 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
//
//===----------------------------------------------------------------------===//
//
// This file provides the implementation of the YAML remark serializer using
// LLVM's YAMLTraits.
//
//===----------------------------------------------------------------------===//

#include "llvm/Remarks/YAMLRemarkSerializer.h"
#include "llvm/Remarks/Remark.h"
#include "llvm/Support/FileSystem.h"
#include <optional>

usingnamespacellvm;
usingnamespacellvm::remarks;

// Use the same keys whether we use a string table or not (respectively, T is an
// unsigned or a StringRef).
template <typename T>
static void mapRemarkHeader(yaml::IO &io, T PassName, T RemarkName,
                            std::optional<RemarkLocation> RL, T FunctionName,
                            std::optional<uint64_t> Hotness,
                            ArrayRef<Argument> Args) {}

namespace llvm {
namespace yaml {

template <> struct MappingTraits<remarks::Remark *> {};

template <> struct MappingTraits<RemarkLocation> {};

/// Helper struct for multiline string block literals. Use this type to preserve
/// newlines in strings.
struct StringBlockVal {};

template <> struct BlockScalarTraits<StringBlockVal> {};

/// ArrayRef is not really compatible with the YAMLTraits. Everything should be
/// immutable in an ArrayRef, while the SequenceTraits expect a mutable version
/// for inputting, but we're only using the outputting capabilities here.
/// This is a hack, but still nicer than having to manually call the YAMLIO
/// internal methods.
/// Keep this in this file so that it doesn't get misused from YAMLTraits.h.
SequenceTraits<ArrayRef<T>>;

/// Implement this as a mapping for now to get proper quotation for the value.
template <> struct MappingTraits<Argument> {};

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

LLVM_YAML_IS_SEQUENCE_VECTOR(Argument)

YAMLRemarkSerializer::YAMLRemarkSerializer(raw_ostream &OS, SerializerMode Mode,
                                           std::optional<StringTable> StrTabIn)
    :{}

YAMLRemarkSerializer::YAMLRemarkSerializer(Format SerializerFormat,
                                           raw_ostream &OS, SerializerMode Mode,
                                           std::optional<StringTable> StrTabIn)
    :{}

void YAMLRemarkSerializer::emit(const Remark &Remark) {}

std::unique_ptr<MetaSerializer> YAMLRemarkSerializer::metaSerializer(
    raw_ostream &OS, std::optional<StringRef> ExternalFilename) {}

void YAMLStrTabRemarkSerializer::emit(const Remark &Remark) {}

std::unique_ptr<MetaSerializer> YAMLStrTabRemarkSerializer::metaSerializer(
    raw_ostream &OS, std::optional<StringRef> ExternalFilename) {}

static void emitMagic(raw_ostream &OS) {}

static void emitVersion(raw_ostream &OS) {}

static void emitStrTab(raw_ostream &OS,
                       std::optional<const StringTable *> StrTab) {}

static void emitExternalFile(raw_ostream &OS, StringRef Filename) {}

void YAMLMetaSerializer::emit() {}

void YAMLStrTabMetaSerializer::emit() {}