clang-tools 8.0.0

Generators.cpp
Go to the documentation of this file.
1 //===---- Generator.cpp - Generator Registry ---------------------*- C++-*-===//
2 //
3 // The LLVM Compiler Infrastructure
4 //
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9
10 #include "Generators.h"
11
12 LLVM_INSTANTIATE_REGISTRY(clang::doc::GeneratorRegistry)
13
14 namespace clang {
15 namespace doc {
16
17 llvm::Expected<std::unique_ptr<Generator>>
18 findGeneratorByName(llvm::StringRef Format) {
19 for (auto I = GeneratorRegistry::begin(), E = GeneratorRegistry::end();
20 I != E; ++I) {
21 if (I->getName() != Format)
22 continue;
23 return I->instantiate();
24 }
25 return llvm::make_error<llvm::StringError>("Can't find generator: " + Format,
26 llvm::inconvertibleErrorCode());
27 }
28
29 // This anchor is used to force the linker to link in the generated object file
30 // and thus register the generators.
31 extern volatile int YAMLGeneratorAnchorSource;
32 extern volatile int MDGeneratorAnchorSource;
33 static int LLVM_ATTRIBUTE_UNUSED YAMLGeneratorAnchorDest =
34 YAMLGeneratorAnchorSource;
35 static int LLVM_ATTRIBUTE_UNUSED MDGeneratorAnchorDest =
36 MDGeneratorAnchorSource;
37
38 } // namespace doc
39 } // namespace clang
Generators.h
clang::doc::findGeneratorByName
llvm::Expected< std::unique_ptr< Generator > > findGeneratorByName(llvm::StringRef Format)
Definition: Generators.cpp:18
clang::doc::MDGeneratorAnchorDest
static int LLVM_ATTRIBUTE_UNUSED MDGeneratorAnchorDest
Definition: Generators.cpp:35
clang::doc::YAMLGeneratorAnchorSource
volatile int YAMLGeneratorAnchorSource
Definition: YAMLGenerator.cpp:277
clang::doc::MDGeneratorAnchorSource
volatile int MDGeneratorAnchorSource
Definition: MDGenerator.cpp:316
clang
===– Representation.cpp - ClangDoc Representation --------—*- C++ -*-===//
Definition: ChangeNamespace.cpp:18
clang::doc::GeneratorRegistry
llvm::Registry< Generator > GeneratorRegistry
Definition: Generators.h:33
clang::doc::YAMLGeneratorAnchorDest
static int LLVM_ATTRIBUTE_UNUSED YAMLGeneratorAnchorDest
Definition: Generators.cpp:33