clang-tools
23.0.0git
llvm-project
clang-tools-extra
clang-doc
ClangDoc.cpp
Go to the documentation of this file.
1
//===-- ClangDoc.cpp - ClangDoc ---------------------------------*- 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
//
9
// This file implements the main entry point for the clang-doc tool. It runs
10
// the clang-doc mapper on a given set of source code files using a
11
// FrontendActionFactory.
12
//
13
//===----------------------------------------------------------------------===//
14
15
#include "
ClangDoc.h
"
16
#include "
Mapper.h
"
17
#include "
Representation.h
"
18
#include "clang/AST/ASTConsumer.h"
19
#include "clang/Frontend/ASTConsumers.h"
20
#include "clang/Frontend/CompilerInstance.h"
21
22
namespace
clang
{
23
namespace
doc
{
24
25
class
MapperActionFactory
:
public
tooling::FrontendActionFactory {
26
public
:
27
MapperActionFactory
(
ClangDocContext
CDCtx) : CDCtx(CDCtx) {}
28
OwnedPtr<FrontendAction>
create
()
override
;
29
30
private
:
31
ClangDocContext
CDCtx;
32
};
33
34
OwnedPtr<FrontendAction>
MapperActionFactory::create
() {
35
class
ClangDocAction :
public
clang::ASTFrontendAction {
36
public
:
37
ClangDocAction(
ClangDocContext
CDCtx) : CDCtx(CDCtx) {}
38
39
OwnedPtr<clang::ASTConsumer>
40
CreateASTConsumer(clang::CompilerInstance &Compiler,
41
llvm::StringRef InFile)
override
{
42
return
std::make_unique<MapASTVisitor>(&Compiler.getASTContext(), CDCtx);
43
}
44
45
private
:
46
ClangDocContext
CDCtx;
47
};
48
return
std::make_unique<ClangDocAction>(CDCtx);
49
}
50
51
OwnedPtr<tooling::FrontendActionFactory>
52
newMapperActionFactory
(
ClangDocContext
CDCtx) {
53
return
std::make_unique<MapperActionFactory>(CDCtx);
54
}
55
56
}
// namespace doc
57
}
// namespace clang
ClangDoc.h
Mapper.h
Representation.h
clang::doc::MapperActionFactory::create
OwnedPtr< FrontendAction > create() override
Definition
ClangDoc.cpp:34
clang::doc::MapperActionFactory::MapperActionFactory
MapperActionFactory(ClangDocContext CDCtx)
Definition
ClangDoc.cpp:27
clang::doc
Definition
ClangDocBenchmark.cpp:31
clang::doc::newMapperActionFactory
OwnedPtr< tooling::FrontendActionFactory > newMapperActionFactory(ClangDocContext CDCtx)
Definition
ClangDoc.cpp:52
clang::doc::OwnedPtr
std::unique_ptr< T > OwnedPtr
Definition
Representation.h:33
clang
===– Representation.cpp - ClangDoc Representation --------—*- C++ -*-===//
Definition
ApplyReplacements.h:27
clang::doc::ClangDocContext
Definition
Representation.h:661
Generated on
for clang-tools by
1.14.0