clang-tools  3.9.0
CppCoreGuidelinesTidyModule.cpp
Go to the documentation of this file.
1 //===--- CppCoreGuidelinesModule.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 "../misc/UnconventionalAssignOperatorCheck.h"
18 #include "ProTypeConstCastCheck.h"
19 #include "ProTypeCstyleCastCheck.h"
20 #include "ProTypeMemberInitCheck.h"
24 #include "ProTypeVarargCheck.h"
25 
26 namespace clang {
27 namespace tidy {
28 namespace cppcoreguidelines {
29 
30 /// A module containing checks of the C++ Core Guidelines
32 public:
33  void addCheckFactories(ClangTidyCheckFactories &CheckFactories) override {
35  "cppcoreguidelines-interfaces-global-init");
37  "cppcoreguidelines-pro-bounds-array-to-pointer-decay");
39  "cppcoreguidelines-pro-bounds-constant-array-index");
41  "cppcoreguidelines-pro-bounds-pointer-arithmetic");
42  CheckFactories.registerCheck<ProTypeConstCastCheck>(
43  "cppcoreguidelines-pro-type-const-cast");
44  CheckFactories.registerCheck<ProTypeCstyleCastCheck>(
45  "cppcoreguidelines-pro-type-cstyle-cast");
46  CheckFactories.registerCheck<ProTypeMemberInitCheck>(
47  "cppcoreguidelines-pro-type-member-init");
49  "cppcoreguidelines-pro-type-reinterpret-cast");
51  "cppcoreguidelines-pro-type-static-cast-downcast");
52  CheckFactories.registerCheck<ProTypeUnionAccessCheck>(
53  "cppcoreguidelines-pro-type-union-access");
54  CheckFactories.registerCheck<ProTypeVarargCheck>(
55  "cppcoreguidelines-pro-type-vararg");
57  "cppcoreguidelines-c-copy-assignment-signature");
58  }
59 };
60 
61 // Register the LLVMTidyModule using this statically initialized variable.
62 static ClangTidyModuleRegistry::Add<CppCoreGuidelinesModule>
63  X("cppcoreguidelines-module", "Adds checks for the C++ Core Guidelines.");
64 
65 } // namespace cppcoreguidelines
66 
67 // This anchor is used to force the linker to link in the generated object file
68 // and thus register the CppCoreGuidelinesModule.
70 
71 } // namespace tidy
72 } // namespace clang
Flags possible initialization order issues of static variables.
This check flags all access to members of unions.
void registerCheck(StringRef CheckName)
Registers the CheckType with the name Name.
A module containing checks of the C++ Core Guidelines.
static ClangTidyModuleRegistry::Add< CppCoreGuidelinesModule > X("cppcoreguidelines-module","Adds checks for the C++ Core Guidelines.")
A collection of ClangTidyCheckFactory instances.
This check flags all instances of const_cast.
volatile int CppCoreGuidelinesModuleAnchorSource
This check flags all use of C-style casts that perform a static_cast downcast, const_cast, or reinterpret_cast.
A clang-tidy module groups a number of ClangTidyChecks and gives them a prefixed name.
Finds declarations of assignment operators with the wrong return and/or argument types and definition...
void addCheckFactories(ClangTidyCheckFactories &CheckFactories) override
Implement this function in order to register all CheckFactories belonging to this module...
Checks for usages of static_cast, where a base class is downcasted to a derived class.
This check flags all calls to c-style variadic functions and all use of va_arg.
This checks that all array subscriptions on static arrays and std::arrays have a constant index and a...
Flags all kinds of pointer arithmetic that have result of pointer type, i.e.