forked from OSchip/llvm-project
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:
parent
01cee3a7bd
commit
1f1b067036
|
@ -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(
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
|
|
@ -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))),
|
||||
|
|
Loading…
Reference in New Issue