2017-07-14 20:15:55 +08:00
|
|
|
//===--- BugproneTidyModule.cpp - clang-tidy ------------------------------===//
|
|
|
|
//
|
|
|
|
// The LLVM Compiler Infrastructure
|
|
|
|
//
|
|
|
|
// This file is distributed under the University of Illinois Open Source
|
|
|
|
// License. See LICENSE.TXT for details.
|
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
|
|
|
#include "../ClangTidy.h"
|
|
|
|
#include "../ClangTidyModule.h"
|
|
|
|
#include "../ClangTidyModuleRegistry.h"
|
2017-11-17 20:23:30 +08:00
|
|
|
#include "CopyConstructorInitCheck.h"
|
2017-08-10 21:30:30 +08:00
|
|
|
#include "IntegerDivisionCheck.h"
|
2017-11-23 20:26:28 +08:00
|
|
|
#include "MisplacedOperatorInStrlenInAllocCheck.h"
|
2017-11-23 21:49:14 +08:00
|
|
|
#include "StringConstructorCheck.h"
|
2017-07-14 20:15:55 +08:00
|
|
|
#include "SuspiciousMemsetUsageCheck.h"
|
2017-07-14 20:20:19 +08:00
|
|
|
#include "UndefinedMemoryManipulationCheck.h"
|
2017-07-14 20:15:55 +08:00
|
|
|
|
|
|
|
namespace clang {
|
|
|
|
namespace tidy {
|
|
|
|
namespace bugprone {
|
|
|
|
|
|
|
|
class BugproneModule : public ClangTidyModule {
|
|
|
|
public:
|
|
|
|
void addCheckFactories(ClangTidyCheckFactories &CheckFactories) override {
|
2017-11-17 20:23:30 +08:00
|
|
|
CheckFactories.registerCheck<CopyConstructorInitCheck>(
|
2017-11-17 20:28:58 +08:00
|
|
|
"bugprone-copy-constructor-init");
|
2017-08-10 21:30:30 +08:00
|
|
|
CheckFactories.registerCheck<IntegerDivisionCheck>(
|
|
|
|
"bugprone-integer-division");
|
2017-11-23 20:26:28 +08:00
|
|
|
CheckFactories.registerCheck<MisplacedOperatorInStrlenInAllocCheck>(
|
|
|
|
"bugprone-misplaced-operator-in-strlen-in-alloc");
|
2017-11-23 21:49:14 +08:00
|
|
|
CheckFactories.registerCheck<StringConstructorCheck>(
|
|
|
|
"bugprone-string-constructor");
|
2017-07-14 20:15:55 +08:00
|
|
|
CheckFactories.registerCheck<SuspiciousMemsetUsageCheck>(
|
|
|
|
"bugprone-suspicious-memset-usage");
|
2017-07-14 20:20:19 +08:00
|
|
|
CheckFactories.registerCheck<UndefinedMemoryManipulationCheck>(
|
|
|
|
"bugprone-undefined-memory-manipulation");
|
2017-07-14 20:15:55 +08:00
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
} // namespace bugprone
|
|
|
|
|
|
|
|
// Register the BugproneTidyModule using this statically initialized variable.
|
|
|
|
static ClangTidyModuleRegistry::Add<bugprone::BugproneModule>
|
|
|
|
X("bugprone-module", "Adds checks for bugprone code constructs.");
|
|
|
|
|
|
|
|
// This anchor is used to force the linker to link in the generated object file
|
|
|
|
// and thus register the BugproneModule.
|
|
|
|
volatile int BugproneModuleAnchorSource = 0;
|
|
|
|
|
|
|
|
} // namespace tidy
|
|
|
|
} // namespace clang
|