clang-tools  3.8.0
CERTTidyModule.cpp
Go to the documentation of this file.
1 //===--- CERTTidyModule.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 "../google/UnnamedNamespaceInHeaderCheck.h"
14 #include "../misc/MoveConstructorInitCheck.h"
15 #include "../misc/NewDeleteOverloadsCheck.h"
16 #include "../misc/NonCopyableObjects.h"
17 #include "../misc/StaticAssertCheck.h"
18 #include "../misc/ThrowByValueCatchByReferenceCheck.h"
19 #include "SetLongJmpCheck.h"
23 
24 namespace clang {
25 namespace tidy {
26 namespace cert {
27 
28 class CERTModule : public ClangTidyModule {
29 public:
30  void addCheckFactories(ClangTidyCheckFactories &CheckFactories) override {
31  // C++ checkers
32  // DCL
34  "cert-dcl50-cpp");
36  "cert-dcl54-cpp");
38  "cert-dcl59-cpp");
39  // OOP
41  "cert-oop11-cpp");
42  // ERR
43  CheckFactories.registerCheck<SetLongJmpCheck>(
44  "cert-err52-cpp");
46  "cert-err58-cpp");
48  "cert-err60-cpp");
50  "cert-err61-cpp");
51 
52  // C checkers
53  // DCL
54  CheckFactories.registerCheck<StaticAssertCheck>(
55  "cert-dcl03-c");
56 
57  // FIO
58  CheckFactories.registerCheck<NonCopyableObjectsCheck>(
59  "cert-fio38-c");
60  }
61 };
62 
63 } // namespace cert
64 
65 // Register the MiscTidyModule using this statically initialized variable.
66 static ClangTidyModuleRegistry::Add<cert::CERTModule>
67 X("cert-module",
68  "Adds lint checks corresponding to CERT secure coding guidelines.");
69 
70 // This anchor is used to force the linker to link in the generated object file
71 // and thus register the CERTModule.
72 volatile int CERTModuleAnchorSource = 0;
73 
74 } // namespace tidy
75 } // namespace clang
The check flags user-defined move constructors that have a ctor-initializer initializing a member or ...
static ClangTidyModuleRegistry::Add< cert::CERTModule > X("cert-module","Adds lint checks corresponding to CERT secure coding guidelines.")
checks for locations that do not throw by value
void registerCheck(StringRef CheckName)
Registers the CheckType with the name Name.
The check flags dereferences and non-pointer declarations of objects that are not meant to be passed ...
A collection of ClangTidyCheckFactory instances.
Checks whether the constructor for a static or thread_local object will throw.
A clang-tidy module groups a number of ClangTidyChecks and gives them a prefixed name.
Checks whether a thrown object is nothrow copy constructible.
Guards against use of setjmp/longjmp in C++ code.
volatile int CERTModuleAnchorSource
Replaces assert() with static_assert() if the condition is evaluatable at compile time...
void addCheckFactories(ClangTidyCheckFactories &CheckFactories) override
Implement this function in order to register all CheckFactories belonging to this module...
Guards against any C-style variadic function definitions (not declarations).