1 //===--- BugproneTidyModule.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 "IntegerDivisionCheck.h"
14 #include "SuspiciousMemsetUsageCheck.h"
15 #include "UndefinedMemoryManipulationCheck.h"
16 
17 namespace clang {
18 namespace tidy {
19 namespace bugprone {
20 
21 class BugproneModule : public ClangTidyModule {
22 public:
23   void addCheckFactories(ClangTidyCheckFactories &CheckFactories) override {
24     CheckFactories.registerCheck<IntegerDivisionCheck>(
25         "bugprone-integer-division");
26     CheckFactories.registerCheck<SuspiciousMemsetUsageCheck>(
27         "bugprone-suspicious-memset-usage");
28     CheckFactories.registerCheck<UndefinedMemoryManipulationCheck>(
29         "bugprone-undefined-memory-manipulation");
30   }
31 };
32 
33 } // namespace bugprone
34 
35 // Register the BugproneTidyModule using this statically initialized variable.
36 static ClangTidyModuleRegistry::Add<bugprone::BugproneModule>
37     X("bugprone-module", "Adds checks for bugprone code constructs.");
38 
39 // This anchor is used to force the linker to link in the generated object file
40 // and thus register the BugproneModule.
41 volatile int BugproneModuleAnchorSource = 0;
42 
43 } // namespace tidy
44 } // namespace clang
45