clang-tools  5.0.0
HICPPTidyModule.cpp
Go to the documentation of this file.
1 //===------- HICPPTidyModule.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 "../cppcoreguidelines/ProTypeMemberInitCheck.h"
14 #include "../cppcoreguidelines/SpecialMemberFunctionsCheck.h"
15 #include "../google/DefaultArgumentsCheck.h"
16 #include "../google/ExplicitConstructorCheck.h"
17 #include "../misc/NewDeleteOverloadsCheck.h"
18 #include "../misc/NoexceptMoveConstructorCheck.h"
19 #include "../misc/UndelegatedConstructor.h"
20 #include "../misc/UseAfterMoveCheck.h"
21 #include "../modernize/UseEqualsDefaultCheck.h"
22 #include "../modernize/UseEqualsDeleteCheck.h"
23 #include "../modernize/UseOverrideCheck.h"
24 #include "../readability/FunctionSizeCheck.h"
25 #include "../readability/IdentifierNamingCheck.h"
26 #include "NoAssemblerCheck.h"
27 
28 namespace clang {
29 namespace tidy {
30 namespace hicpp {
31 
32 class HICPPModule : public ClangTidyModule {
33 public:
34  void addCheckFactories(ClangTidyCheckFactories &CheckFactories) override {
36  "hicpp-explicit-conversions");
38  "hicpp-function-size");
40  "hicpp-named-parameter");
41  CheckFactories.registerCheck<misc::UseAfterMoveCheck>(
42  "hicpp-invalid-access-moved");
44  "hicpp-member-init");
46  "hicpp-new-delete-operators");
48  "hicpp-noexcept-move");
49  CheckFactories.registerCheck<NoAssemblerCheck>("hicpp-no-assembler");
50  CheckFactories
52  "hicpp-special-member-functions");
54  "hicpp-undelegated-constructor");
56  "hicpp-use-equals-default");
58  "hicpp-use-equals-delete");
60  "hicpp-use-override");
61  }
62 };
63 
64 // Register the HICPPModule using this statically initialized variable.
65 static ClangTidyModuleRegistry::Add<HICPPModule>
66  X("hicpp-module", "Adds High-Integrity C++ checks.");
67 
68 } // namespace hicpp
69 
70 // This anchor is used to force the linker to link in the generated object file
71 // and thus register the HICPPModule.
72 volatile int HICPPModuleAnchorSource = 0;
73 
74 } // namespace tidy
75 } // namespace clang
Checks for classes where some, but not all, of the special member functions are defined.
void addCheckFactories(ClangTidyCheckFactories &CheckFactories) override
Implement this function in order to register all CheckFactories belonging to this module...
Find assembler statements.
Use C++11's override and remove virtual where applicable.
Finds creation of temporary objects in constructors that look like a function call to another constru...
void registerCheck(StringRef CheckName)
Registers the CheckType with the name Name.
static ClangTidyModuleRegistry::Add< HICPPModule > X("hicpp-module","Adds High-Integrity C++ checks.")
Replace default bodies of special member functions with '= default;'.
A collection of ClangTidyCheckFactory instances.
Checks for large functions based on various metrics.
A clang-tidy module groups a number of ClangTidyChecks and gives them a prefixed name.
volatile int HICPPModuleAnchorSource
The check flags user-defined move constructors and assignment operators not marked with noexcept or m...
Mark unimplemented private special member functions with '= delete'.
Checks that all single-argument constructors are explicit.
Checks for identifiers naming style mismatch.
The check warns if an object is used after it has been moved, without an intervening reinitialization...