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