blob: a943edf93b51af5c4274eed57af0e9bdcc2830fb [file] [log] [blame]
Aaron Ballmanea2f90c2015-10-02 13:27:19 +00001//===--- 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"
Aaron Ballmana742b842015-10-13 20:42:41 +000018#include "../misc/ThrowByValueCatchByReferenceCheck.h"
Aaron Ballmane4b17652015-10-08 19:54:43 +000019#include "SetLongJmpCheck.h"
Aaron Ballman46bc3042015-10-05 20:08:59 +000020#include "VariadicFunctionDefCheck.h"
Aaron Ballmanea2f90c2015-10-02 13:27:19 +000021
22namespace clang {
23namespace tidy {
24namespace CERT {
25
26class CERTModule : public ClangTidyModule {
27public:
28 void addCheckFactories(ClangTidyCheckFactories &CheckFactories) override {
29 // C++ checkers
30 // DCL
Aaron Ballman46bc3042015-10-05 20:08:59 +000031 CheckFactories.registerCheck<VariadicFunctionDefCheck>(
32 "cert-dcl50-cpp");
Aaron Ballmanea2f90c2015-10-02 13:27:19 +000033 CheckFactories.registerCheck<misc::NewDeleteOverloadsCheck>(
34 "cert-dcl54-cpp");
35 CheckFactories.registerCheck<google::build::UnnamedNamespaceInHeaderCheck>(
36 "cert-dcl59-cpp");
37 // OOP
38 CheckFactories.registerCheck<MoveConstructorInitCheck>(
39 "cert-oop11-cpp");
Aaron Ballmane4b17652015-10-08 19:54:43 +000040 // ERR
41 CheckFactories.registerCheck<SetLongJmpCheck>(
42 "cert-err52-cpp");
Aaron Ballmana742b842015-10-13 20:42:41 +000043 CheckFactories.registerCheck<ThrowByValueCatchByReferenceCheck>(
44 "cert-err61-cpp");
Aaron Ballmanea2f90c2015-10-02 13:27:19 +000045
46 // C checkers
47 // DCL
48 CheckFactories.registerCheck<StaticAssertCheck>(
49 "cert-dcl03-c");
50
51 // FIO
52 CheckFactories.registerCheck<NonCopyableObjectsCheck>(
53 "cert-fio38-c");
54 }
55};
56
57} // namespace misc
58
59// Register the MiscTidyModule using this statically initialized variable.
60static ClangTidyModuleRegistry::Add<CERT::CERTModule>
61X("cert-module",
62 "Adds lint checks corresponding to CERT secure coding guidelines.");
63
64// This anchor is used to force the linker to link in the generated object file
65// and thus register the CERTModule.
66volatile int CERTModuleAnchorSource = 0;
67
68} // namespace tidy
69} // namespace clang