aboutsummaryrefslogtreecommitdiff
path: root/clang-tidy/ClangTidyModule.cpp
diff options
context:
space:
mode:
authorAlexander Kornienko <alexfh@google.com>2013-12-19 19:57:05 +0000
committerAlexander Kornienko <alexfh@google.com>2013-12-19 19:57:05 +0000
commitf0c740b38285ace936401dc735e7e4e511aad8aa (patch)
tree95c7bee795af8d78ef02a2a2944feb3f06c20408 /clang-tidy/ClangTidyModule.cpp
parent6d817272e2e36ec76588f6089fe5d096a82cfb97 (diff)
Clang-tidy: added --disable-checks, --list-checks options.
Summary: Allow disabling checks by regex. By default, disable alpha.* checks, that are not particularly good tested (e.g. IdempotentOperationChecker, see http://llvm-reviews.chandlerc.com/D2427). Fixed a bug, that would disable all analyzer checks, when using a regex more strict, than 'clang-analyzer-', for example --checks='clang-analyzer-deadcode-'. Added --list-checks to list all enabled checks. This is useful to test specific values in --checks/--disable-checks. Reviewers: djasper, klimek Reviewed By: klimek CC: cfe-commits, klimek Differential Revision: http://llvm-reviews.chandlerc.com/D2444 git-svn-id: https://llvm.org/svn/llvm-project/clang-tools-extra/trunk@197717 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'clang-tidy/ClangTidyModule.cpp')
-rw-r--r--clang-tidy/ClangTidyModule.cpp20
1 files changed, 6 insertions, 14 deletions
diff --git a/clang-tidy/ClangTidyModule.cpp b/clang-tidy/ClangTidyModule.cpp
index a81213ce..dc3a11d0 100644
--- a/clang-tidy/ClangTidyModule.cpp
+++ b/clang-tidy/ClangTidyModule.cpp
@@ -12,18 +12,13 @@
//===----------------------------------------------------------------------===//
#include "ClangTidyModule.h"
-#include "llvm/Support/Regex.h"
namespace clang {
namespace tidy {
-CheckFactoryBase::~CheckFactoryBase() {}
-
ClangTidyCheckFactories::~ClangTidyCheckFactories() {
- for (std::map<std::string, CheckFactoryBase *>::iterator
- I = Factories.begin(),
- E = Factories.end();
- I != E; ++I) {
+ for (FactoryMap::iterator I = Factories.begin(), E = Factories.end(); I != E;
+ ++I) {
delete I->second;
}
}
@@ -34,13 +29,10 @@ void ClangTidyCheckFactories::addCheckFactory(StringRef Name,
}
void ClangTidyCheckFactories::createChecks(
- StringRef CheckRegexString, SmallVectorImpl<ClangTidyCheck *> &Checks) {
- llvm::Regex CheckRegex(CheckRegexString);
- for (std::map<std::string, CheckFactoryBase *>::iterator
- I = Factories.begin(),
- E = Factories.end();
- I != E; ++I) {
- if (CheckRegex.match(I->first))
+ ChecksFilter &Filter, SmallVectorImpl<ClangTidyCheck *> &Checks) {
+ for (FactoryMap::iterator I = Factories.begin(), E = Factories.end(); I != E;
+ ++I) {
+ if (Filter.IsCheckEnabled(I->first))
Checks.push_back(I->second->createCheck());
}
}