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