llvm/clang-tools-extra/clang-doc/Representation.h

///===-- Representation.h - ClangDoc Representation -------------*- 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
//
//===----------------------------------------------------------------------===//
//
// This file defines the internal representations of different declaration
// types for the clang-doc tool.
//
//===----------------------------------------------------------------------===//

#ifndef LLVM_CLANG_TOOLS_EXTRA_CLANG_DOC_REPRESENTATION_H
#define LLVM_CLANG_TOOLS_EXTRA_CLANG_DOC_REPRESENTATION_H

#include "clang/AST/Type.h"
#include "clang/Basic/Specifiers.h"
#include "clang/Tooling/StandaloneExecution.h"
#include "llvm/ADT/APSInt.h"
#include "llvm/ADT/SmallVector.h"
#include "llvm/ADT/StringExtras.h"
#include <array>
#include <optional>
#include <string>

namespace clang {
namespace doc {

// SHA1'd hash of a USR.
SymbolID;

struct BaseRecordInfo;
struct EnumInfo;
struct FunctionInfo;
struct Info;
struct TypedefInfo;

enum class InfoType {};

// A representation of a parsed comment.
struct CommentInfo {};

struct Reference {};

// Holds the children of a record or namespace.
struct ScopeChildren {};

// A base struct for TypeInfos
struct TypeInfo {};

// Represents one template parameter.
//
// This is a very simple serialization of the text of the source code of the
// template parameter. It is saved in a struct so there is a place to add the
// name and default values in the future if needed.
struct TemplateParamInfo {};

struct TemplateSpecializationInfo {};

// Records the template information for a struct or function that is a template
// or an explicit template specialization.
struct TemplateInfo {};

// Info for field types.
struct FieldTypeInfo : public TypeInfo {};

// Info for member types.
struct MemberTypeInfo : public FieldTypeInfo {};

struct Location {};

/// A base struct for Infos.
struct Info {};

// Info for namespaces.
struct NamespaceInfo : public Info {};

// Info for symbols.
struct SymbolInfo : public Info {};

// TODO: Expand to allow for documenting templating and default args.
// Info for functions.
struct FunctionInfo : public SymbolInfo {};

// TODO: Expand to allow for documenting templating, inheritance access,
// friend classes
// Info for types.
struct RecordInfo : public SymbolInfo {};

// Info for typedef and using statements.
struct TypedefInfo : public SymbolInfo {};

struct BaseRecordInfo : public RecordInfo {};

// Information for a single possible value of an enumeration.
struct EnumValueInfo {};

// TODO: Expand to allow for documenting templating.
// Info for types.
struct EnumInfo : public SymbolInfo {};

struct Index : public Reference {};

// TODO: Add functionality to include separate markdown pages.

// A standalone function to call to merge a vector of infos into one.
// This assumes that all infos in the vector are of the same type, and will fail
// if they are different.
llvm::Expected<std::unique_ptr<Info>>
mergeInfos(std::vector<std::unique_ptr<Info>> &Values);

struct ClangDocContext {};

} // namespace doc
} // namespace clang

#endif // LLVM_CLANG_TOOLS_EXTRA_CLANG_DOC_REPRESENTATION_H