clang-tools 3.8.0

- Main Page
- Namespaces
- Classes
- Files

- File List
- File Members

ReadabilityTidyModule.cpp
Go to the documentation of this file.
1 //===--- ReadabilityTidyModule.cpp - clang-tidy ---------------------------===//
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 "../ClangTidy.h"
11 #include "../ClangTidyModule.h"
12 #include "../ClangTidyModuleRegistry.h"
13 #include "BracesAroundStatementsCheck.h"
14 #include "ContainerSizeEmptyCheck.h"
15 #include "ElseAfterReturnCheck.h"
16 #include "FunctionSizeCheck.h"
17 #include "IdentifierNamingCheck.h"
18 #include "ImplicitBoolCastCheck.h"
19 #include "InconsistentDeclarationParameterNameCheck.h"
20 #include "NamedParameterCheck.h"
21 #include "RedundantSmartptrGetCheck.h"
22 #include "RedundantStringCStrCheck.h"
23 #include "SimplifyBooleanExprCheck.h"
24 #include "UniqueptrDeleteReleaseCheck.h"
25
26 namespace clang {
27 namespace tidy {
28 namespace readability {
29
30 class ReadabilityModule : public ClangTidyModule {
31 public:
32 void addCheckFactories(ClangTidyCheckFactories &CheckFactories) override {
33 CheckFactories.registerCheck<BracesAroundStatementsCheck>(
34 "readability-braces-around-statements");
35 CheckFactories.registerCheck<ContainerSizeEmptyCheck>(
36 "readability-container-size-empty");
37 CheckFactories.registerCheck<ElseAfterReturnCheck>(
38 "readability-else-after-return");
39 CheckFactories.registerCheck<FunctionSizeCheck>(
40 "readability-function-size");
41 CheckFactories.registerCheck<IdentifierNamingCheck>(
42 "readability-identifier-naming");
43 CheckFactories.registerCheck<ImplicitBoolCastCheck>(
44 "readability-implicit-bool-cast");
45 CheckFactories.registerCheck<InconsistentDeclarationParameterNameCheck>(
46 "readability-inconsistent-declaration-parameter-name");
47 CheckFactories.registerCheck<UniqueptrDeleteReleaseCheck>(
48 "readability-uniqueptr-delete-release");
49 CheckFactories.registerCheck<readability::NamedParameterCheck>(
50 "readability-named-parameter");
51 CheckFactories.registerCheck<RedundantSmartptrGetCheck>(
52 "readability-redundant-smartptr-get");
53 CheckFactories.registerCheck<RedundantStringCStrCheck>(
54 "readability-redundant-string-cstr");
55 CheckFactories.registerCheck<SimplifyBooleanExprCheck>(
56 "readability-simplify-boolean-expr");
57 }
58 };
59
60 // Register the ReadabilityModule using this statically initialized variable.
61 static ClangTidyModuleRegistry::Add<ReadabilityModule>
62 X("readability-module", "Adds readability-related checks.");
63
64 } // namespace readability
65
66 // This anchor is used to force the linker to link in the generated object file
67 // and thus register the ReadabilityModule.
68 volatile int ReadabilityModuleAnchorSource = 0;
69
70 } // namespace tidy
71 } // namespace clang
clang::tidy::readability::X
static ClangTidyModuleRegistry::Add< ReadabilityModule > X("readability-module","Adds readability-related checks.")
ImplicitBoolCastCheck.h
clang::tidy::UniqueptrDeleteReleaseCheck
Flag statements of the form: delete <unique_ptr expr>="">.release() and replace them with: <unique_pt...
Definition: UniqueptrDeleteReleaseCheck.h:23
clang::tidy::ReadabilityModuleAnchorSource
volatile int ReadabilityModuleAnchorSource
Definition: ReadabilityTidyModule.cpp:68
clang::tidy::ClangTidyCheckFactories::registerCheck
void registerCheck(StringRef CheckName)
Registers the CheckType with the name Name.
Definition: ClangTidyModule.h:58
InconsistentDeclarationParameterNameCheck.h
SimplifyBooleanExprCheck.h
clang::tidy::readability::SimplifyBooleanExprCheck
Looks for boolean expressions involving boolean constants and simplifies them to use the appropriate ...
Definition: SimplifyBooleanExprCheck.h:91
clang::tidy::readability::ContainerSizeEmptyCheck
Checks whether a call to the size() method can be replaced with a call to empty().
Definition: ContainerSizeEmptyCheck.h:29
clang::tidy::ClangTidyCheckFactories
A collection of ClangTidyCheckFactory instances.
Definition: ClangTidyModule.h:27
clang::tidy::readability::ReadabilityModule
Definition: ReadabilityTidyModule.cpp:30
UniqueptrDeleteReleaseCheck.h
clang::tidy::readability::ElseAfterReturnCheck
Flags the usages of else after return.
Definition: ElseAfterReturnCheck.h:22
RedundantStringCStrCheck.h
clang::tidy::readability::FunctionSizeCheck
Checks for large functions based on various metrics.
Definition: FunctionSizeCheck.h:30
clang::tidy::ClangTidyModule
A clang-tidy module groups a number of ClangTidyChecks and gives them a prefixed name.
Definition: ClangTidyModule.h:83
clang::tidy::readability::RedundantSmartptrGetCheck
Find and remove redundant calls to smart pointer's .get() method.
Definition: RedundantSmartptrGetCheck.h:28
ElseAfterReturnCheck.h
clang::tidy::ImplicitBoolCastCheck
Checks for use of implicit bool casts in expressions.
Definition: ImplicitBoolCastCheck.h:22
NamedParameterCheck.h
BracesAroundStatementsCheck.h
RedundantSmartptrGetCheck.h
IdentifierNamingCheck.h
clang::tidy::readability::InconsistentDeclarationParameterNameCheck
Checks for declarations of functions which differ in parameter names.
Definition: InconsistentDeclarationParameterNameCheck.h:26
clang::tidy::readability::NamedParameterCheck
Find functions with unnamed arguments.
Definition: NamedParameterCheck.h:30
clang::tidy::readability::RedundantStringCStrCheck
Finds unnecessary calls to std::string::c_str().
Definition: RedundantStringCStrCheck.h:20
FunctionSizeCheck.h
clang::tidy::readability::ReadabilityModule::addCheckFactories
void addCheckFactories(ClangTidyCheckFactories &CheckFactories) override
Implement this function in order to register all CheckFactories belonging to this module...
Definition: ReadabilityTidyModule.cpp:32
clang::tidy::readability::BracesAroundStatementsCheck
Checks that bodies of if statements and loops (for, range-for, do-while, and while) are inside braces...
Definition: BracesAroundStatementsCheck.h:44
clang::tidy::readability::IdentifierNamingCheck
Checks for identifiers naming style mismatch.
Definition: IdentifierNamingCheck.h:32
ContainerSizeEmptyCheck.h