2013-07-29 16:19:24 +08:00
|
|
|
//===--- tools/extra/clang-tidy/ClangTidyModule.cpp - Clang tidy tool -----===//
|
|
|
|
//
|
|
|
|
// The LLVM Compiler Infrastructure
|
|
|
|
//
|
|
|
|
// This file is distributed under the University of Illinois Open Source
|
|
|
|
// License. See LICENSE.TXT for details.
|
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
///
|
|
|
|
/// \file Implements classes required to build clang-tidy modules.
|
|
|
|
///
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
|
|
|
#include "ClangTidyModule.h"
|
|
|
|
|
|
|
|
namespace clang {
|
|
|
|
namespace tidy {
|
|
|
|
|
|
|
|
ClangTidyCheckFactories::~ClangTidyCheckFactories() {
|
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
llvm-svn: 197717
2013-12-20 03:57:05 +08:00
|
|
|
for (FactoryMap::iterator I = Factories.begin(), E = Factories.end(); I != E;
|
|
|
|
++I) {
|
2013-07-29 16:19:24 +08:00
|
|
|
delete I->second;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
void ClangTidyCheckFactories::addCheckFactory(StringRef Name,
|
|
|
|
CheckFactoryBase *Factory) {
|
|
|
|
|
|
|
|
Factories[Name] = Factory;
|
|
|
|
}
|
|
|
|
|
|
|
|
void ClangTidyCheckFactories::createChecks(
|
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
llvm-svn: 197717
2013-12-20 03:57:05 +08:00
|
|
|
ChecksFilter &Filter, SmallVectorImpl<ClangTidyCheck *> &Checks) {
|
|
|
|
for (FactoryMap::iterator I = Factories.begin(), E = Factories.end(); I != E;
|
|
|
|
++I) {
|
|
|
|
if (Filter.IsCheckEnabled(I->first))
|
2013-07-29 16:19:24 +08:00
|
|
|
Checks.push_back(I->second->createCheck());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
} // namespace tidy
|
|
|
|
} // namespace clang
|