[LoongArch] Use getLoc() directly to construct error message
[llvm-project.git] / clang-tools-extra / clang-doc / Generators.h
blob89c6b34c43844fba44a24c14cbdd024597ef7814
1 //===-- Generators.h - ClangDoc Generator ----------------------*- C++ -*-===//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
8 // Generator classes for converting declaration information into documentation
9 // in a specified format.
10 //===----------------------------------------------------------------------===//
12 #ifndef LLVM_CLANG_TOOLS_EXTRA_CLANG_DOC_GENERATOR_H
13 #define LLVM_CLANG_TOOLS_EXTRA_CLANG_DOC_GENERATOR_H
15 #include "Representation.h"
16 #include "llvm/Support/Error.h"
17 #include "llvm/Support/Registry.h"
19 namespace clang {
20 namespace doc {
22 // Abstract base class for generators.
23 // This is expected to be implemented and exposed via the GeneratorRegistry.
24 class Generator {
25 public:
26 virtual ~Generator() = default;
28 // Write out the decl info in the specified format.
29 virtual llvm::Error generateDocForInfo(Info *I, llvm::raw_ostream &OS,
30 const ClangDocContext &CDCtx) = 0;
31 // This function writes a file with the index previously constructed.
32 // It can be overwritten by any of the inherited generators.
33 // If the override method wants to run this it should call
34 // Generator::createResources(CDCtx);
35 virtual llvm::Error createResources(ClangDocContext &CDCtx);
37 static void addInfoToIndex(Index &Idx, const doc::Info *Info);
40 typedef llvm::Registry<Generator> GeneratorRegistry;
42 llvm::Expected<std::unique_ptr<Generator>>
43 findGeneratorByName(llvm::StringRef Format);
45 std::string getTagType(TagTypeKind AS);
47 } // namespace doc
48 } // namespace clang
50 #endif // LLVM_CLANG_TOOLS_EXTRA_CLANG_DOC_GENERATOR_H