clang-tools 3.8.0

- Main Page
- Namespaces
- Classes
- Files

- File List
- File Members

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"
20 #include "StaticObjectExceptionCheck.h"
21 #include "ThrownExceptionTypeCheck.h"
22 #include "VariadicFunctionDefCheck.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
33 CheckFactories.registerCheck<VariadicFunctionDefCheck>(
34 "cert-dcl50-cpp");
35 CheckFactories.registerCheck<misc::NewDeleteOverloadsCheck>(
36 "cert-dcl54-cpp");
37 CheckFactories.registerCheck<google::build::UnnamedNamespaceInHeaderCheck>(
38 "cert-dcl59-cpp");
39 // OOP
40 CheckFactories.registerCheck<MoveConstructorInitCheck>(
41 "cert-oop11-cpp");
42 // ERR
43 CheckFactories.registerCheck<SetLongJmpCheck>(
44 "cert-err52-cpp");
45 CheckFactories.registerCheck<StaticObjectExceptionCheck>(
46 "cert-err58-cpp");
47 CheckFactories.registerCheck<ThrownExceptionTypeCheck>(
48 "cert-err60-cpp");
49 CheckFactories.registerCheck<ThrowByValueCatchByReferenceCheck>(
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
clang::tidy::MoveConstructorInitCheck
The check flags user-defined move constructors that have a ctor-initializer initializing a member or ...
Definition: MoveConstructorInitCheck.h:26
clang::tidy::X
static ClangTidyModuleRegistry::Add< cert::CERTModule > X("cert-module","Adds lint checks corresponding to CERT secure coding guidelines.")
clang::tidy::ThrowByValueCatchByReferenceCheck
checks for locations that do not throw by value
Definition: ThrowByValueCatchByReferenceCheck.h:29
clang::tidy::ClangTidyCheckFactories::registerCheck
void registerCheck(StringRef CheckName)
Registers the CheckType with the name Name.
Definition: ClangTidyModule.h:58
SetLongJmpCheck.h
clang::tidy::NonCopyableObjectsCheck
The check flags dereferences and non-pointer declarations of objects that are not meant to be passed ...
Definition: NonCopyableObjects.h:20
clang::tidy::ClangTidyCheckFactories
A collection of ClangTidyCheckFactory instances.
Definition: ClangTidyModule.h:27
clang::tidy::cert::CERTModule
Definition: CERTTidyModule.cpp:28
ThrownExceptionTypeCheck.h
StaticObjectExceptionCheck.h
clang::tidy::cert::StaticObjectExceptionCheck
Checks whether the constructor for a static or thread_local object will throw.
Definition: StaticObjectExceptionCheck.h:24
clang::tidy::ClangTidyModule
A clang-tidy module groups a number of ClangTidyChecks and gives them a prefixed name.
Definition: ClangTidyModule.h:83
clang::tidy::misc::NewDeleteOverloadsCheck
Definition: NewDeleteOverloadsCheck.h:21
clang::tidy::google::build::UnnamedNamespaceInHeaderCheck
Finds anonymous namespaces in headers.
Definition: UnnamedNamespaceInHeaderCheck.h:25
VariadicFunctionDefCheck.h
clang::tidy::cert::ThrownExceptionTypeCheck
Checks whether a thrown object is nothrow copy constructible.
Definition: ThrownExceptionTypeCheck.h:23
clang::tidy::cert::SetLongJmpCheck
Guards against use of setjmp/longjmp in C++ code.
Definition: SetLongJmpCheck.h:23
clang::tidy::CERTModuleAnchorSource
volatile int CERTModuleAnchorSource
Definition: CERTTidyModule.cpp:72
clang::tidy::StaticAssertCheck
Replaces assert() with static_assert() if the condition is evaluatable at compile time...
Definition: StaticAssertCheck.h:25
clang::tidy::cert::CERTModule::addCheckFactories
void addCheckFactories(ClangTidyCheckFactories &CheckFactories) override
Implement this function in order to register all CheckFactories belonging to this module...
Definition: CERTTidyModule.cpp:30
clang::tidy::cert::VariadicFunctionDefCheck
Guards against any C-style variadic function definitions (not declarations).
Definition: VariadicFunctionDefCheck.h:23