#include "Generators.h"
#include "Representation.h"
#include "clang/Basic/Version.h"
#include "llvm/ADT/StringExtras.h"
#include "llvm/ADT/StringRef.h"
#include "llvm/ADT/StringSet.h"
#include "llvm/Support/FileSystem.h"
#include "llvm/Support/JSON.h"
#include "llvm/Support/Path.h"
#include "llvm/Support/raw_ostream.h"
#include <algorithm>
#include <optional>
#include <string>
usingnamespacellvm;
namespace clang {
namespace doc {
namespace {
class HTMLTag { … };
enum NodeType { … };
struct HTMLNode { … };
struct TextNode : public HTMLNode { … };
struct TagNode : public HTMLNode { … };
constexpr const char *kDoctypeDecl = …;
struct HTMLFile { … };
}
bool HTMLTag::isSelfClosing() const { … }
StringRef HTMLTag::toString() const { … }
void TextNode::render(llvm::raw_ostream &OS, int IndentationLevel) { … }
void TagNode::render(llvm::raw_ostream &OS, int IndentationLevel) { … }
template <typename Derived, typename Base,
typename = std::enable_if<std::is_base_of<Derived, Base>::value>>
static void appendVector(std::vector<Derived> &&New,
std::vector<Base> &Original) { … }
static SmallString<128> computeRelativePath(StringRef Destination,
StringRef Origin) { … }
static std::vector<std::unique_ptr<TagNode>>
genStylesheetsHTML(StringRef InfoPath, const ClangDocContext &CDCtx) { … }
static std::vector<std::unique_ptr<TagNode>>
genJsScriptsHTML(StringRef InfoPath, const ClangDocContext &CDCtx) { … }
static std::unique_ptr<TagNode> genLink(const Twine &Text, const Twine &Link) { … }
static std::unique_ptr<HTMLNode>
genReference(const Reference &Type, StringRef CurrentDirectory,
std::optional<StringRef> JumpToSection = std::nullopt) { … }
static std::vector<std::unique_ptr<HTMLNode>>
genReferenceList(const llvm::SmallVectorImpl<Reference> &Refs,
const StringRef &CurrentDirectory) { … }
static std::vector<std::unique_ptr<TagNode>>
genHTML(const EnumInfo &I, const ClangDocContext &CDCtx);
static std::vector<std::unique_ptr<TagNode>>
genHTML(const FunctionInfo &I, const ClangDocContext &CDCtx,
StringRef ParentInfoDir);
static std::unique_ptr<TagNode> genHTML(const std::vector<CommentInfo> &C);
static std::vector<std::unique_ptr<TagNode>>
genEnumsBlock(const std::vector<EnumInfo> &Enums,
const ClangDocContext &CDCtx) { … }
static std::unique_ptr<TagNode>
genEnumMembersBlock(const llvm::SmallVector<EnumValueInfo, 4> &Members) { … }
static std::vector<std::unique_ptr<TagNode>>
genFunctionsBlock(const std::vector<FunctionInfo> &Functions,
const ClangDocContext &CDCtx, StringRef ParentInfoDir) { … }
static std::vector<std::unique_ptr<TagNode>>
genRecordMembersBlock(const llvm::SmallVector<MemberTypeInfo, 4> &Members,
StringRef ParentInfoDir) { … }
static std::vector<std::unique_ptr<TagNode>>
genReferencesBlock(const std::vector<Reference> &References,
llvm::StringRef Title, StringRef ParentPath) { … }
static std::unique_ptr<TagNode>
writeFileDefinition(const Location &L,
std::optional<StringRef> RepositoryUrl = std::nullopt) { … }
static std::vector<std::unique_ptr<TagNode>>
genHTML(const Index &Index, StringRef InfoPath, bool IsOutermostList);
static std::vector<std::unique_ptr<TagNode>>
genFileHeadNodes(StringRef Title, StringRef InfoPath,
const ClangDocContext &CDCtx) { … }
static std::unique_ptr<TagNode> genFileHeaderNode(StringRef ProjectName) { … }
static std::unique_ptr<TagNode> genInfoFileMainNode(
StringRef InfoPath,
std::vector<std::unique_ptr<TagNode>> &MainContentInnerNodes,
const Index &InfoIndex) { … }
static std::unique_ptr<TagNode> genFileFooterNode() { … }
static HTMLFile
genInfoFile(StringRef Title, StringRef InfoPath,
std::vector<std::unique_ptr<TagNode>> &MainContentNodes,
const Index &InfoIndex, const ClangDocContext &CDCtx) { … }
template <typename T,
typename = std::enable_if<std::is_base_of<T, Info>::value>>
static Index genInfoIndexItem(const std::vector<T> &Infos, StringRef Title) { … }
static std::vector<std::unique_ptr<TagNode>>
genHTML(const Index &Index, StringRef InfoPath, bool IsOutermostList) { … }
static std::unique_ptr<HTMLNode> genHTML(const CommentInfo &I) { … }
static std::unique_ptr<TagNode> genHTML(const std::vector<CommentInfo> &C) { … }
static std::vector<std::unique_ptr<TagNode>>
genHTML(const EnumInfo &I, const ClangDocContext &CDCtx) { … }
static std::vector<std::unique_ptr<TagNode>>
genHTML(const FunctionInfo &I, const ClangDocContext &CDCtx,
StringRef ParentInfoDir) { … }
static std::vector<std::unique_ptr<TagNode>>
genHTML(const NamespaceInfo &I, Index &InfoIndex, const ClangDocContext &CDCtx,
std::string &InfoTitle) { … }
static std::vector<std::unique_ptr<TagNode>>
genHTML(const RecordInfo &I, Index &InfoIndex, const ClangDocContext &CDCtx,
std::string &InfoTitle) { … }
static std::vector<std::unique_ptr<TagNode>>
genHTML(const TypedefInfo &I, const ClangDocContext &CDCtx,
std::string &InfoTitle) { … }
class HTMLGenerator : public Generator { … };
const char *HTMLGenerator::Format = …;
llvm::Error
HTMLGenerator::generateDocs(StringRef RootDir,
llvm::StringMap<std::unique_ptr<doc::Info>> Infos,
const ClangDocContext &CDCtx) { … }
llvm::Error HTMLGenerator::generateDocForInfo(Info *I, llvm::raw_ostream &OS,
const ClangDocContext &CDCtx) { … }
static std::string getRefType(InfoType IT) { … }
static llvm::Error serializeIndex(ClangDocContext &CDCtx) { … }
static std::unique_ptr<TagNode> genIndexFileMainNode() { … }
static llvm::Error genIndex(const ClangDocContext &CDCtx) { … }
static llvm::Error copyFile(StringRef FilePath, StringRef OutDirectory) { … }
llvm::Error HTMLGenerator::createResources(ClangDocContext &CDCtx) { … }
static GeneratorRegistry::Add<HTMLGenerator> HTML(HTMLGenerator::Format,
"Generator for HTML output.");
volatile int HTMLGeneratorAnchorSource = …;
}
}