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