blob: 1719500fb86eca2aa16506ac75ca978fcb958961 [file] [log] [blame]
Gabor Horvath829e75a2017-07-14 12:15:55 +00001//===--- 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"
Gabor Horvathd984e332017-11-17 12:23:30 +000013#include "CopyConstructorInitCheck.h"
Gabor Horvath0b16c102017-08-10 13:30:30 +000014#include "IntegerDivisionCheck.h"
Adam Balogh2079def2017-11-23 12:26:28 +000015#include "MisplacedOperatorInStrlenInAllocCheck.h"
Alexander Kornienkoa3251bf2017-11-23 13:49:14 +000016#include "StringConstructorCheck.h"
Gabor Horvath829e75a2017-07-14 12:15:55 +000017#include "SuspiciousMemsetUsageCheck.h"
Gabor Horvath46a9db42017-07-14 12:20:19 +000018#include "UndefinedMemoryManipulationCheck.h"
Gabor Horvath829e75a2017-07-14 12:15:55 +000019
20namespace clang {
21namespace tidy {
22namespace bugprone {
23
24class BugproneModule : public ClangTidyModule {
25public:
26 void addCheckFactories(ClangTidyCheckFactories &CheckFactories) override {
Gabor Horvathd984e332017-11-17 12:23:30 +000027 CheckFactories.registerCheck<CopyConstructorInitCheck>(
Gabor Horvath024d0b32017-11-17 12:28:58 +000028 "bugprone-copy-constructor-init");
Gabor Horvath0b16c102017-08-10 13:30:30 +000029 CheckFactories.registerCheck<IntegerDivisionCheck>(
30 "bugprone-integer-division");
Adam Balogh2079def2017-11-23 12:26:28 +000031 CheckFactories.registerCheck<MisplacedOperatorInStrlenInAllocCheck>(
32 "bugprone-misplaced-operator-in-strlen-in-alloc");
Alexander Kornienkoa3251bf2017-11-23 13:49:14 +000033 CheckFactories.registerCheck<StringConstructorCheck>(
34 "bugprone-string-constructor");
Gabor Horvath829e75a2017-07-14 12:15:55 +000035 CheckFactories.registerCheck<SuspiciousMemsetUsageCheck>(
36 "bugprone-suspicious-memset-usage");
Gabor Horvath46a9db42017-07-14 12:20:19 +000037 CheckFactories.registerCheck<UndefinedMemoryManipulationCheck>(
38 "bugprone-undefined-memory-manipulation");
Gabor Horvath829e75a2017-07-14 12:15:55 +000039 }
40};
41
42} // namespace bugprone
43
44// Register the BugproneTidyModule using this statically initialized variable.
45static ClangTidyModuleRegistry::Add<bugprone::BugproneModule>
46 X("bugprone-module", "Adds checks for bugprone code constructs.");
47
48// This anchor is used to force the linker to link in the generated object file
49// and thus register the BugproneModule.
50volatile int BugproneModuleAnchorSource = 0;
51
52} // namespace tidy
53} // namespace clang