Disable clang-tidy readability checkers when not compiling in C++ mode. None of the checkers require additional testing as the tests will not compile for other languages or modes, or the checkers would never match a valid construct.

llvm-svn: 246661
This commit is contained in:
Aaron Ballman 2015-09-02 16:05:21 +00:00
parent 01cee3a7bd
commit 1f1b067036
4 changed files with 19 additions and 1 deletions

View File

@ -54,6 +54,11 @@ ContainerSizeEmptyCheck::ContainerSizeEmptyCheck(StringRef Name,
: ClangTidyCheck(Name, Context) {}
void ContainerSizeEmptyCheck::registerMatchers(MatchFinder *Finder) {
// Only register the matchers for C++; the functionality currently does not
// provide any benefit to other languages, despite being benign.
if (!getLangOpts().CPlusPlus)
return;
const auto WrongUse = anyOf(
hasParent(
binaryOperator(

View File

@ -34,7 +34,10 @@ void NamespaceCommentCheck::storeOptions(ClangTidyOptions::OptionMap &Opts) {
}
void NamespaceCommentCheck::registerMatchers(MatchFinder *Finder) {
Finder->addMatcher(namespaceDecl().bind("namespace"), this);
// Only register the matchers for C++; the functionality currently does not
// provide any benefit to other languages, despite being benign.
if (getLangOpts().CPlusPlus)
Finder->addMatcher(namespaceDecl().bind("namespace"), this);
}
static bool locationsInSameFile(const SourceManager &Sources,

View File

@ -74,6 +74,11 @@ void registerMatchersForGetEquals(MatchFinder *Finder,
} // namespace
void RedundantSmartptrGetCheck::registerMatchers(MatchFinder *Finder) {
// Only register the matchers for C++; the functionality currently does not
// provide any benefit to other languages, despite being benign.
if (!getLangOpts().CPlusPlus)
return;
registerMatchersForGetArrowStart(Finder, this);
registerMatchersForGetEquals(Finder, this);
}

View File

@ -80,6 +80,11 @@ namespace readability {
void RedundantStringCStrCheck::registerMatchers(
ast_matchers::MatchFinder *Finder) {
// Only register the matchers for C++; the functionality currently does not
// provide any benefit to other languages, despite being benign.
if (!getLangOpts().CPlusPlus)
return;
Finder->addMatcher(
constructExpr(
hasDeclaration(methodDecl(hasName(StringConstructor))),