clang-tools
3.9.0
Main Page
Namespaces
Classes
Files
File List
File Members
llvm.src
tools
clang
tools
extra
clang-tidy
ClangTidyModule.cpp
Go to the documentation of this file.
1
//===--- tools/extra/clang-tidy/ClangTidyModule.cpp - Clang tidy tool -----===//
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
/// \file Implements classes required to build clang-tidy modules.
11
///
12
//===----------------------------------------------------------------------===//
13
14
#include "
ClangTidyModule.h
"
15
16
namespace
clang {
17
namespace
tidy {
18
19
void
ClangTidyCheckFactories::registerCheckFactory
(StringRef
Name
,
20
CheckFactory
Factory) {
21
Factories[
Name
] = std::move(Factory);
22
}
23
24
void
ClangTidyCheckFactories::createChecks
(
25
ClangTidyContext
*
Context
,
26
std::vector<std::unique_ptr<ClangTidyCheck>> &
Checks
) {
27
GlobList
&Filter = Context->
getChecksFilter
();
28
for
(
const
auto
&Factory : Factories) {
29
if
(Filter.
contains
(Factory.first))
30
Checks
.emplace_back(Factory.second(Factory.first, Context));
31
}
32
}
33
34
ClangTidyOptions
ClangTidyModule::getModuleOptions
() {
35
return
ClangTidyOptions
();
36
}
37
38
}
// namespace tidy
39
}
// namespace clang
Name
const std::string Name
Definition:
USRFinder.cpp:140
clang::tidy::GlobList
Read-only set of strings represented as a list of positive and negative globs.
Definition:
ClangTidyDiagnosticConsumer.h:84
Checks
std::vector< std::unique_ptr< ClangTidyCheck > > Checks
Definition:
ClangTidy.cpp:211
clang::tidy::ClangTidyCheckFactories::registerCheckFactory
void registerCheckFactory(StringRef Name, CheckFactory Factory)
Registers check Factory with name Name.
Definition:
ClangTidyModule.cpp:19
clang::tidy::GlobList::contains
bool contains(StringRef S)
Returns true if the pattern matches S.
Definition:
ClangTidyDiagnosticConsumer.h:92
ClangTidyModule.h
clang::tidy::ClangTidyOptions
Contains options for clang-tidy.
Definition:
ClangTidyOptions.h:49
clang::tidy::ClangTidyModule::getModuleOptions
virtual ClangTidyOptions getModuleOptions()
Gets default options for checks defined in this module.
Definition:
ClangTidyModule.cpp:34
clang::tidy::ClangTidyCheckFactories::createChecks
void createChecks(ClangTidyContext *Context, std::vector< std::unique_ptr< ClangTidyCheck >> &Checks)
Create instances of all checks matching CheckRegexString and store them in Checks.
Definition:
ClangTidyModule.cpp:24
Context
ClangTidyContext & Context
Definition:
ClangTidy.cpp:93
clang::tidy::ClangTidyContext
Every ClangTidyCheck reports errors through a DiagnosticsEngine provided by this context.
Definition:
ClangTidyDiagnosticConsumer.h:135
clang::tidy::ClangTidyCheckFactories::CheckFactory
std::function< ClangTidyCheck *(StringRef Name, ClangTidyContext *Context)> CheckFactory
Definition:
ClangTidyModule.h:30
clang::tidy::ClangTidyContext::getChecksFilter
GlobList & getChecksFilter()
Returns check filter for the CurrentFile.
Definition:
ClangTidyDiagnosticConsumer.cpp:221
Generated on Wed Aug 31 2016 16:57:10 for clang-tools by
1.8.6