clang-tools  9.0.0
Generators.h
Go to the documentation of this file.
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 //===----------------------------------------------------------------------===//
11 
12 #ifndef LLVM_CLANG_TOOLS_EXTRA_CLANG_DOC_GENERATOR_H
13 #define LLVM_CLANG_TOOLS_EXTRA_CLANG_DOC_GENERATOR_H
14 
15 #include "Representation.h"
16 #include "llvm/Support/Error.h"
17 #include "llvm/Support/Registry.h"
18 
19 namespace clang {
20 namespace doc {
21 
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;
27 
28  // Write out the decl info in the specified format.
29  virtual llvm::Error generateDocForInfo(Info *I, llvm::raw_ostream &OS) = 0;
30 };
31 
32 typedef llvm::Registry<Generator> GeneratorRegistry;
33 
34 llvm::Expected<std::unique_ptr<Generator>>
35 findGeneratorByName(llvm::StringRef Format);
36 
37 std::string getAccess(AccessSpecifier AS);
38 
39 std::string getTagType(TagTypeKind AS);
40 
41 } // namespace doc
42 } // namespace clang
43 
44 #endif // LLVM_CLANG_TOOLS_EXTRA_CLANG_DOC_GENERATOR_H
virtual ~Generator()=default
std::string getAccess(AccessSpecifier AS)
Definition: Generators.cpp:30
llvm::Expected< std::unique_ptr< Generator > > findGeneratorByName(llvm::StringRef Format)
Definition: Generators.cpp:17
std::string getTagType(TagTypeKind AS)
Definition: Generators.cpp:44
A base struct for Infos.
===– Representation.cpp - ClangDoc Representation --------—*- C++ -*-===//
virtual llvm::Error generateDocForInfo(Info *I, llvm::raw_ostream &OS)=0
llvm::Registry< Generator > GeneratorRegistry
Definition: Generators.h:32