llvm/clang-tools-extra/clang-doc/YAMLGenerator.cpp

//===-- YAMLGenerator.cpp - ClangDoc YAML -----------------------*- C++ -*-===//
//
// 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
//
//===----------------------------------------------------------------------===//
// Implementation of the YAML generator, converting decl info into YAML output.
//===----------------------------------------------------------------------===//

#include "Generators.h"
#include "Representation.h"
#include "llvm/Support/YAMLTraits.h"
#include "llvm/Support/raw_ostream.h"
#include <optional>

usingnamespaceclang::doc;

// These define YAML traits for decoding the listed values within a vector.
LLVM_YAML_IS_SEQUENCE_VECTOR(FieldTypeInfo)
LLVM_YAML_IS_SEQUENCE_VECTOR(MemberTypeInfo)
LLVM_YAML_IS_SEQUENCE_VECTOR(Reference)
LLVM_YAML_IS_SEQUENCE_VECTOR(Location)
LLVM_YAML_IS_SEQUENCE_VECTOR(CommentInfo)
LLVM_YAML_IS_SEQUENCE_VECTOR(FunctionInfo)
LLVM_YAML_IS_SEQUENCE_VECTOR(EnumInfo)
LLVM_YAML_IS_SEQUENCE_VECTOR(EnumValueInfo)
LLVM_YAML_IS_SEQUENCE_VECTOR(TemplateParamInfo)
LLVM_YAML_IS_SEQUENCE_VECTOR(TypedefInfo)
LLVM_YAML_IS_SEQUENCE_VECTOR(BaseRecordInfo)
LLVM_YAML_IS_SEQUENCE_VECTOR(std::unique_ptr<CommentInfo>)
LLVM_YAML_IS_SEQUENCE_VECTOR(llvm::SmallString<16>)

namespace llvm {
namespace yaml {

// Enumerations to YAML output.

template <> struct ScalarEnumerationTraits<clang::AccessSpecifier> {};

template <> struct ScalarEnumerationTraits<clang::TagTypeKind> {};

template <> struct ScalarEnumerationTraits<InfoType> {};

// Scalars to YAML output.
ScalarTraits<SmallString<U>>;

template <> struct ScalarTraits<std::array<unsigned char, 20>> {};

// Helper functions to map infos to YAML.

static void TypeInfoMapping(IO &IO, TypeInfo &I) {}

static void FieldTypeInfoMapping(IO &IO, FieldTypeInfo &I) {}

static void InfoMapping(IO &IO, Info &I) {}

static void SymbolInfoMapping(IO &IO, SymbolInfo &I) {}

static void RecordInfoMapping(IO &IO, RecordInfo &I) {}

static void CommentInfoMapping(IO &IO, CommentInfo &I) {}

// Template specialization to YAML traits for Infos.

template <> struct MappingTraits<Location> {};

template <> struct MappingTraits<Reference> {};

template <> struct MappingTraits<TypeInfo> {};

template <> struct MappingTraits<FieldTypeInfo> {};

template <> struct MappingTraits<MemberTypeInfo> {};

template <> struct MappingTraits<NamespaceInfo> {};

template <> struct MappingTraits<RecordInfo> {};

template <> struct MappingTraits<BaseRecordInfo> {};

template <> struct MappingTraits<EnumValueInfo> {};

template <> struct MappingTraits<EnumInfo> {};

template <> struct MappingTraits<TypedefInfo> {};

template <> struct MappingTraits<FunctionInfo> {};

template <> struct MappingTraits<TemplateParamInfo> {};

template <> struct MappingTraits<TemplateSpecializationInfo> {};

template <> struct MappingTraits<TemplateInfo> {};

template <> struct MappingTraits<CommentInfo> {};

template <> struct MappingTraits<std::unique_ptr<CommentInfo>> {};

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

namespace clang {
namespace doc {

/// Generator for YAML documentation.
class YAMLGenerator : public Generator {};

const char *YAMLGenerator::Format =;

llvm::Error
YAMLGenerator::generateDocs(StringRef RootDir,
                            llvm::StringMap<std::unique_ptr<doc::Info>> Infos,
                            const ClangDocContext &CDCtx) {}

llvm::Error YAMLGenerator::generateDocForInfo(Info *I, llvm::raw_ostream &OS,
                                              const ClangDocContext &CDCtx) {}

static GeneratorRegistry::Add<YAMLGenerator> YAML(YAMLGenerator::Format,
                                                  "Generator for YAML output.");

// This anchor is used to force the linker to link in the generated object file
// and thus register the generator.
volatile int YAMLGeneratorAnchorSource =;

} // namespace doc
} // namespace clang